Documentation ¶
Index ¶
- func NewActivity() Activity
- func NewActivityAssets() ActivityAssets
- func NewActivityEmoji() ActivityEmoji
- func NewActivityParty() ActivityParty
- func NewActivitySecrets() ActivitySecrets
- func NewActivityTimestamps() ActivityTimestamps
- func NewBan() Ban
- func NewChannel() Channel
- func NewIcon(in io.ReadSeeker) (out GuildIcon, err error)
- func NewImageData(in io.ReadSeeker) (ImageData, error)
- func NewJSONImageData(in []byte) (ImageData, error)
- func NewRole() Role
- func NewSnowflake() Snowflake
- func NewUser() User
- func NewVoiceRegion() VoiceRegion
- func NewVoiceState(validate bool) VoiceState
- func NewWidget() Widget
- func RequireNewIcon(in io.ReadSeeker) GuildIcon
- func RequireNewImageData(in io.ReadSeeker) ImageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewActivity ¶
func NewActivity() Activity
func NewActivityAssets ¶
func NewActivityAssets() ActivityAssets
func NewActivityEmoji ¶
func NewActivityEmoji() ActivityEmoji
func NewActivityParty ¶
func NewActivityParty() ActivityParty
func NewActivitySecrets ¶
func NewActivitySecrets() ActivitySecrets
func NewActivityTimestamps ¶
func NewActivityTimestamps() ActivityTimestamps
func NewChannel ¶
func NewChannel() Channel
func NewIcon ¶
func NewIcon(in io.ReadSeeker) (out GuildIcon, err error)
NewIcon constructs a new Guild Icon from the given input file or stream.
If an IO error occurs while attempting to work with the given stream this function will return `nil, error`.
If the given image stream is not an image that is a gif, png, or jpeg this function will return `nil, ErrBadIconFormat`.
If the given image stream is of an image with a width or height greater than the allowed dimensions as defined by the Discord API docs, then the new Icon instance will be returned alongside an ErrBadIconSize error. This error may be treated as a warning and ignored, however the Discord API may return an error itself if this icon is sent to that API.
func NewImageData ¶
func NewImageData(in io.ReadSeeker) (ImageData, error)
NewImageData constructs a new string/json serializable image container from the given input file or stream.
If an IO error occurs while attempting to work with the given stream this function will return `nil, error`.
If the given image stream is not an image that is a gif, png, or jpeg this function will return `nil, ErrBadIconFormat`.
func NewJSONImageData ¶
NewJSONImageData constructs an ImageData instance from the given JSON byte slice.
This method is intended to allow creating a new ImageData instance without having a local copy of the image data.
func NewSnowflake ¶
func NewSnowflake() Snowflake
NewSnowflake constructs a new empty Snowflake instance.
The `validate` flag enables on-the-fly validation of this type. When enabled the setters on the Snowflake type will panic if provided an invalid input value. Additionally the Marshal/Unmarshal methods will return validation errors if the value being (un)marshalled is invalid.
Note: The Snowflake instance this method creates is empty, and as such is invalid. The snowflake will need to have values set via setters or unmarshaler methods to become valid.
func NewUser ¶
func NewUser() User
Returns a new, empty User instance.
Data Validation ¶
The "validate" flag enables/disables internal input validation. This will check that values being set via the type's setter methods are valid according to the documented Discord restrictions.
Note: internal input validation does not guarantee that Discord will accept the value, there are undocumented internal checks that the Discord API does in addition to the documented checks. This feature is primarily intended to help catch internal bugs and/or avoid making requests with obviously bad data.
func NewVoiceState ¶
func NewVoiceState(validate bool) VoiceState
func RequireNewIcon ¶
func RequireNewIcon(in io.ReadSeeker) GuildIcon
RequireNewIcon constructs a new Guild Icon from the given input file or stream.
If this function encounters any error, including ErrBadIconSize, it will panic.
See NewIcon() for more information.
func RequireNewImageData ¶
func RequireNewImageData(in io.ReadSeeker) ImageData
RequireNewImageData constructs a new string/json serializable image container from the given input file or stream.
If this function encounters any error it will panic.
See NewImageData for more information.
Types ¶
This section is empty.