build

package
v0.0.0-...-d49a382 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 NewBan

func NewBan() Ban

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

func NewJSONImageData(in []byte) (ImageData, error)

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 NewRole

func NewRole() Role

NewRole

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 NewVoiceRegion

func NewVoiceRegion() VoiceRegion

NewVoiceRegion TODO: Document me

func NewVoiceState

func NewVoiceState(validate bool) VoiceState

func NewWidget

func NewWidget() Widget

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL