Documentation ¶
Index ¶
- Variables
- type ApplicationCommand
- type ApplicationCommandInteractionOption
- type ApplicationCommandOption
- type ApplicationCommandOptionChoice
- type ApplicationCommandOptionType
- type ApplicationCommandPermission
- type ApplicationCommandPermissions
- type ApplicationCommandType
- type Attachment
- type Channel
- type ChannelType
- type CommandPermissionType
- type Embed
- type EmbedAuthor
- type EmbedField
- type EmbedFooter
- type EmbedImage
- type EmbedProvider
- type Emoji
- type Gateway
- type GuildMember
- type Interaction
- type InteractionData
- type InteractionType
- type Message
- type MessageReaction
- type MessageType
- type PermissionOverwrite
- type Reaction
- type ResolvedData
- type Role
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrBadOptType = errors.New("bad option type value")
Functions ¶
This section is empty.
Types ¶
type ApplicationCommand ¶
type ApplicationCommand struct { ID string `json:"id,omitempty"` Type ApplicationCommandType `json:"type"` ApplicationID string `json:"application_id,omitempty"` GuildID string `json:"guild_id,omitempty"` Name string `json:"name"` Description string `json:"description"` Options []ApplicationCommandOption `json:"options"` DefaultPermission bool `json:"default_permission"` Version string `json:"version,omitempty"` IDSnowflake snowflake.Snowflake `json:"-"` ApplicationIDSnowflake snowflake.Snowflake `json:"-"` GuildIDSnowflake snowflake.Snowflake `json:"-"` VersionSnowflake snowflake.Snowflake `json:"-"` }
func (*ApplicationCommand) Snowflakify ¶
func (c *ApplicationCommand) Snowflakify() error
type ApplicationCommandInteractionOption ¶
type ApplicationCommandInteractionOption struct { Name string `json:"name"` Type ApplicationCommandOptionType `json:"type"` Value stdjson.RawMessage `json:"value"` Options []ApplicationCommandInteractionOption `json:"options"` Focused bool `json:"focused,omitempty"` ValueSubCommand string `json:"-"` ValueSubCommandGroup string `json:"-"` ValueString string `json:"-"` ValueInt int `json:"-"` ValueBool bool `json:"-"` ValueUser snowflake.Snowflake `json:"-"` ValueChannel snowflake.Snowflake `json:"-"` ValueRole snowflake.Snowflake `json:"-"` ValueNumber float64 `json:"-"` }
func ApplicationCommandInteractionOptionFromElement ¶
func ApplicationCommandInteractionOptionFromElement(e etfapi.Element) (ApplicationCommandInteractionOption, error)
func (*ApplicationCommandInteractionOption) PackValue ¶
func (i *ApplicationCommandInteractionOption) PackValue() error
func (*ApplicationCommandInteractionOption) ResolveValue ¶
func (i *ApplicationCommandInteractionOption) ResolveValue() error
type ApplicationCommandOption ¶
type ApplicationCommandOption struct { Type ApplicationCommandOptionType `json:"type"` Name string `json:"name"` Description string `json:"description"` Required bool `json:"required"` Choices []ApplicationCommandOptionChoice `json:"choices,omitempty"` Options []ApplicationCommandOption `json:"options,omitempty"` ChannelTypes []ChannelType `json:"channel_types,omitempty"` Autocomplete bool `json:"autocomplete,omitempty"` }
func (*ApplicationCommandOption) Snowflakify ¶
func (o *ApplicationCommandOption) Snowflakify() error
type ApplicationCommandOptionChoice ¶
type ApplicationCommandOptionChoice struct { Name string `json:"name"` Value stdjson.RawMessage `json:"value"` Type ApplicationCommandOptionType `json:"-"` ValueString string `json:"-"` ValueInt int `json:"-"` ValueNumber float64 `json:"-"` }
func (*ApplicationCommandOptionChoice) FillValue ¶
func (c *ApplicationCommandOptionChoice) FillValue() error
func (*ApplicationCommandOptionChoice) MarshalJSON ¶
func (c *ApplicationCommandOptionChoice) MarshalJSON() ([]byte, error)
func (*ApplicationCommandOptionChoice) ResolveValue ¶
func (c *ApplicationCommandOptionChoice) ResolveValue() error
type ApplicationCommandOptionType ¶
type ApplicationCommandOptionType int
const ( OptTypeSubCommand ApplicationCommandOptionType = 1 OptTypeSubCommandGroup ApplicationCommandOptionType = 2 OptTypeString ApplicationCommandOptionType = 3 OptTypeInteger ApplicationCommandOptionType = 4 OptTypeBoolean ApplicationCommandOptionType = 5 OptTypeUser ApplicationCommandOptionType = 6 OptTypeChannel ApplicationCommandOptionType = 7 OptTypeRole ApplicationCommandOptionType = 8 OptTypeMentionable ApplicationCommandOptionType = 9 OptTypeNumber ApplicationCommandOptionType = 10 )
func ApplicationCommandOptionTypeFromElement ¶
func ApplicationCommandOptionTypeFromElement(e etfapi.Element) (ApplicationCommandOptionType, error)
ApplicationCommandOptionTypeFromElement generates a ApplicationCommandOptionType representation from the given application-command-option-type Element
type ApplicationCommandPermission ¶ added in v23.2.0
type ApplicationCommandPermission struct { IDString string `json:"id"` Type CommandPermissionType `json:"type"` Permission bool `json:"permission"` IDSnowflake snowflake.Snowflake `json:"-"` }
func (*ApplicationCommandPermission) Snowflakify ¶ added in v23.2.0
func (p *ApplicationCommandPermission) Snowflakify() error
type ApplicationCommandPermissions ¶ added in v23.2.0
type ApplicationCommandPermissions struct { IDString string `json:"id"` ApplicationIDString string `json:"application_id"` GuildIDString string `json:"guild_id"` Permissions []ApplicationCommandPermission `json:"permissions"` IDSnowflake snowflake.Snowflake `json:"-"` ApplicationIDSnowflake snowflake.Snowflake `json:"-"` GuildIDSnowflake snowflake.Snowflake `json:"-"` }
func (*ApplicationCommandPermissions) Snowflakify ¶ added in v23.2.0
func (p *ApplicationCommandPermissions) Snowflakify() error
type ApplicationCommandType ¶
type ApplicationCommandType int
const ( CmdTypeChatInput ApplicationCommandType = 1 CmdTypeUser ApplicationCommandType = 2 CmdTypeMessage ApplicationCommandType = 3 )
func ApplicationCommandTypeFromElement ¶
func ApplicationCommandTypeFromElement(e etfapi.Element) (ApplicationCommandType, error)
ApplicationCommandTypeFromElement generates a ApplicationCommandType representation from the given application-command-type Element
type Attachment ¶
type Attachment struct { ID string `json:"id"` Filename string `json:"filename"` Size int `json:"size"` URL string `json:"url"` ProxyURL string `json:"proxy_url"` Height int `json:"height"` Width int `json:"width"` IDSnowflake snowflake.Snowflake }
Attachment is the data about an attachment recevied from the json api
func (*Attachment) Snowflakify ¶
func (ar *Attachment) Snowflakify() error
type Channel ¶
type Channel struct { IDString string `json:"id"` GuildIDString string `json:"guild_id"` OwnerIDString string `json:"owner_id"` ApplicationIDString string `json:"application_id"` LastMessageIDString string `json:"last_message_id"` ParentIDString string `json:"parent_id"` Permissions string `json:"permissions"` Type ChannelType `json:"type"` Position int `json:"position"` PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"` Name string `json:"name"` Topic string `json:"topic"` NSFW bool `json:"nsfw"` Bitrate int `json:"bitrate"` UserLimit int `json:"user_limit"` Recipients []User `json:"recipients"` Icon string `json:"icon"` LastPinTimestamp string `json:"last_pin_timestamp"` RTCRegion string `json:"rtc_region"` VideoQualityMode int `json:"video_quality_mode"` MessageCount int `json:"message_count"` MemberCount int `json:"member_count"` IDSnowflake snowflake.Snowflake `json:"-"` GuildIDSnowflake snowflake.Snowflake `json:"-"` LastMessageIDSnowflake snowflake.Snowflake `json:"-"` OwnerIDSnowflake snowflake.Snowflake `json:"-"` ApplicationIDSnowflake snowflake.Snowflake `json:"-"` ParentIDSnowflake snowflake.Snowflake `json:"-"` PermissionsSnowflake snowflake.Snowflake `json:"-"` }
func (*Channel) Snowflakify ¶
type ChannelType ¶
type ChannelType int
const ( ChannelGuildText ChannelType = 0 ChannelDM ChannelType = 1 ChannelGuildVoice ChannelType = 2 ChannelGroupDM ChannelType = 3 ChannelGuildCategory ChannelType = 4 ChannelGuildNews ChannelType = 5 ChannelGuildStore ChannelType = 6 ChannelGuildNewsThread ChannelType = 10 ChannelGuildPublicThread ChannelType = 11 ChannelGuildPrivateThread ChannelType = 12 ChannelGuildStageVoice ChannelType = 13 )
func ChannelTypeFromElement ¶
func ChannelTypeFromElement(e etfapi.Element) (ChannelType, error)
ChannelTypeFromElement generates a ChannelType representation from the given channel-type Element
type CommandPermissionType ¶ added in v23.2.0
type CommandPermissionType int
const ( CommandPermissionRole CommandPermissionType = 1 CommandPermissionUser CommandPermissionType = 2 )
type Embed ¶
type Embed struct { Title string `json:"title"` Type string `json:"type"` Description string `json:"description"` URL string `json:"url"` Timestamp string `json:"timestamp"` // ISO8601 Color int `json:"color"` Image EmbedImage `json:"image"` Thumbnail EmbedImage `json:"thumbnail"` Video EmbedImage `json:"video"` Provider EmbedProvider `json:"provider"` Author EmbedAuthor `json:"author"` Fields []EmbedField `json:"fields"` }
Embed is the data about a message embed received from the json api
type EmbedAuthor ¶
type EmbedAuthor struct { Name string `json:"name"` URL string `json:"url"` IconURL string `json:"icon_url"` ProxyIconURL string `json:"proxy_icon_url"` }
EmbedAuthor is the data about an embed author recevied from the json api
type EmbedField ¶
type EmbedField struct { Name string `json:"name"` Value string `json:"value"` Inline bool `json:"inline"` }
EmbedField is the data about an embed field received from the json api
type EmbedFooter ¶
type EmbedFooter struct {}
EmbedFooter is the data about an embed footer recevied from the json api
type EmbedImage ¶
type EmbedImage struct { URL string `json:"url"` ProxyURL string `json:"proxy_url"` Height int `json:"height"` Width int `json:"width"` }
EmbedImage is the data about an embed thumbnail received from the json api
type EmbedProvider ¶
EmbedProvider is the data about an embed provider recevied from the json api
type Emoji ¶
type Emoji struct { ID string `json:"id"` Name string `json:"name"` Roles []Role `json:"roles"` User User `json:"user"` RequireColons bool `json:"require_colons"` Managed bool `json:"managed"` Animated bool `json:"animated"` Available bool `json:"available"` IDSnowflake snowflake.Snowflake }
Emoji is the data about an emoji recevied from the json api
func (*Emoji) Snowflakify ¶
type Gateway ¶
Gateway is the json object received from the discord api when requesting gateway connection information
type GuildMember ¶
type GuildMember struct { User *User `json:"user"` Nick string `json:"nick"` Roles []string `json:"roles"` JoinedAt string `json:"joined_at"` // ISO8601 PremiumSince string `json:"premium_since"` // ISO8601 Deaf bool `json:"deaf"` Mute bool `json:"mute"` RoleSnowflakes []snowflake.Snowflake `json:"-"` }
GuildMember is the data about a guild member recevied from the json api
func GuildMemberFromElement ¶
func GuildMemberFromElement(e etfapi.Element) (GuildMember, error)
func (*GuildMember) Snowflakify ¶
func (gmr *GuildMember) Snowflakify() error
type Interaction ¶
type Interaction struct { Type InteractionType `json:"type"` Data *InteractionData `json:"data"` Member *GuildMember `json:"member"` User *User `json:"user"` Token string `json:"token"` Version int `json:"version"` Message *Message `json:"message"` IDString string `json:"id"` ApplicationIDString string `json:"application_id"` GuildIDString string `json:"guild_id"` ChannelIDString string `json:"channel_id"` IDSnowflake snowflake.Snowflake `json:"-"` ApplicationIDSnowflake snowflake.Snowflake `json:"-"` GuildIDSnowflake snowflake.Snowflake `json:"-"` ChannelIDSnowflake snowflake.Snowflake `json:"-"` }
func InteractionFromElementMap ¶
func InteractionFromElementMap(eMap map[string]etfapi.Element) (Interaction, error)
InteractionFromElementMap generates a new Interaction object from the given data
type InteractionData ¶
type InteractionData struct { Name string Type ApplicationCommandType Resolved ResolvedData Options []ApplicationCommandInteractionOption IDString string `json:"id"` TargetIDString string `json:"target_id"` IDSnowflake snowflake.Snowflake `json:"-"` TargetIDSnowflake snowflake.Snowflake `json:"-"` }
func InteractionDataFromElement ¶
func InteractionDataFromElement(e etfapi.Element) (InteractionData, error)
InteractionDataFromElement generates a new Interaction object from the given data
type InteractionType ¶
type InteractionType int
const ( InteractionPing InteractionType = 1 InteractionApplicationCommand InteractionType = 2 InteractionMessageComponent InteractionType = 3 InteractionAutocomplete InteractionType = 4 )
func InteractionTypeFromElement ¶
func InteractionTypeFromElement(e etfapi.Element) (InteractionType, error)
InteractionTypeFromElement generates a InteractionType representation from the given interaction-type Element
type Message ¶
type Message struct { IDString string `json:"id"` ChannelIDString string `json:"channel_id"` GuildIDString string `json:"guild_id"` Author User `json:"author"` Member GuildMember `json:"member"` Content string `json:"content"` Timestamp string `json:"timestamp"` // ISO8601 EditedTimestamp string `json:"edited_timestamp"` // ISO8601 TTS bool `json:"tts"` MentionEveryone bool `json:"mention_everyone"` Mentions []User `json:"mentions"` MentionRolesStrings []string `json:"mention_roles"` MentionChannels []Channel `json:"mention_channels"` Attachments []Attachment `json:"attachments"` Embeds []Embed `json:"embeds"` Reactions []MessageReaction `json:"reactions"` Pinned bool `json:"pinned"` WebhookID string `json:"webhook_id"` Type MessageType `json:"type"` Flags int `json:"flags"` IDSnowflake snowflake.Snowflake `json:"-"` ChannelIDSnowflake snowflake.Snowflake `json:"-"` GuildIDSnowflake snowflake.Snowflake `json:"-"` WebhookIDSnowflake snowflake.Snowflake `json:"-"` MentionRoles []snowflake.Snowflake `json:"-"` }
Message is the data that is received back from the discord api
func MessageFromElement ¶
MessageFromElement generates a new Message object from the given Element
func MessageFromElementMap ¶
MessageFromElementMap generates a new Message object from the given data
func (*Message) ContentString ¶
ContentString returns the content of the message
func (*Message) MessageType ¶
func (m *Message) MessageType() MessageType
MessageType returns the MessageType of the message
func (*Message) Snowflakify ¶
type MessageReaction ¶
type MessageReaction struct { Count int `json:"count"` Me bool `json:"me"` Emoji Emoji `json:"emoji"` }
MessageReaction is the data about a reaction received from the json api
func (*MessageReaction) Snowflakify ¶
func (rr *MessageReaction) Snowflakify() error
type MessageType ¶
type MessageType int
MessageType represents the type of message received in a discord channel
const ( DefaultMessage MessageType = 0 RecipientAddMessage MessageType = 1 RecipientRemoveMessage MessageType = 2 CallMessage MessageType = 3 ChannelNameChangeMessage MessageType = 4 ChannelIconChangeMessage MessageType = 5 ChannelPinnedMessageMessage MessageType = 6 GuildMemberJoinMessage MessageType = 7 )
These are the known message types
func MessageTypeFromElement ¶
func MessageTypeFromElement(e etfapi.Element) (MessageType, error)
MessageTypeFromElement generates a MessageType representation from the given message-type Element
func (MessageType) String ¶
func (t MessageType) String() string
type PermissionOverwrite ¶
type PermissionOverwrite struct { IDString string `json:"id"` Type int `json:"type"` AllowString string `json:"allow"` DenyString string `json:"deny"` IDSnowflake snowflake.Snowflake `json:"-"` AllowSnowflake snowflake.Snowflake `json:"-"` DenySnowflake snowflake.Snowflake `json:"-"` }
func PermissionOverwriteFromElement ¶
func PermissionOverwriteFromElement(e etfapi.Element) (PermissionOverwrite, error)
func (*PermissionOverwrite) Snowflakify ¶
func (ow *PermissionOverwrite) Snowflakify() error
type Reaction ¶
type Reaction struct { UserIDString string `json:"user_id"` ChannelIDString string `json:"channel_id"` MessageIDString string `json:"message_id"` GuildIDString string `json:"guild_id"` UserIDSnowflake snowflake.Snowflake `json:"-"` ChannelIDSnowflake snowflake.Snowflake `json:"-"` MessageIDSnowflake snowflake.Snowflake `json:"-"` GuildIDSnowflake snowflake.Snowflake `json:"-"` // member GuildMember EmojiString string `json:"emoji"` }
Reaction represents the data about a message in a discord channel
func ReactionFromElement ¶
ReactionFromElement generates a new Reaction object from the given Element
func ReactionFromElementMap ¶
ReactionFromElementMap generates a new Reaction object from the given data
func (*Reaction) Emoji ¶
Emoji returns the emoji of the reaction ChannelID returns the ID of the channel the reaction was to
type ResolvedData ¶
type ResolvedData struct { Users map[snowflake.Snowflake]User Members map[snowflake.Snowflake]GuildMember Roles map[snowflake.Snowflake]Role Channels map[snowflake.Snowflake]Channel }
func ResolvedDataFromElement ¶
func ResolvedDataFromElement(e etfapi.Element) (ResolvedData, error)
ResolvedDataFromElement generates a new Interaction object from the given data
type Role ¶
type Role struct { IDString string `json:"id"` Name string `json:"name"` Color int `json:"color"` Hoist bool `json:"hoist"` Position int `json:"position"` PermissionsString string `json:"permissions"` Managed bool `json:"managed"` Mentionable bool `json:"mentionable"` IDSnowflake snowflake.Snowflake `json:"-"` PermissionsSnowflake snowflake.Snowflake `json:"-"` }
Role is the data about a role recevied from the json api
func RoleFromElement ¶
RoleFromElement generates a new Role object from the given data
func (*Role) Snowflakify ¶
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` Discriminator string `json:"discriminator"` Avatar string `json:"avatar"` Bot bool `json:"bot"` System bool `json:"system"` MFAEnabled bool `json:"mfa_enabled"` Locale string `json:"locale"` Verified bool `json:"verified"` Email string `json:"email"` Flags int `json:"flags"` PremiumType int `json:"premium_type"` PublicFlags int `json:"public_flags"` Member *GuildMember `json:"member"` IDSnowflake snowflake.Snowflake }
User is the data about a user recevied from the json api
func UserFromElement ¶
UserFromElement generates a new User object from the given Element