Documentation
¶
Index ¶
- type ApplicationCommand
- type ApplicationCommandAutoCompleteInteraction
- type ApplicationCommandAutoCompleteInteractionData
- type ApplicationCommandAutoCompleteResultResponse
- type ApplicationCommandCallbackData
- type ApplicationCommandInteraction
- type ApplicationCommandInteractionData
- type ApplicationCommandInteractionDataOption
- type ApplicationCommandOption
- type ApplicationCommandOptionChoice
- type ApplicationCommandOptionType
- type ApplicationCommandPermissionType
- type ApplicationCommandPermissions
- type ApplicationCommandType
- type ButtonInteractionData
- type IMessageComponentInteractionData
- type Interaction
- type InteractionContextType
- type InteractionMetadata
- type InteractionType
- type MessageComponentInteraction
- type MessageComponentInteractionBaseData
- type MessageComponentInteractionData
- type ModalResponse
- type ModalResponseData
- type ModalSubmitInteraction
- type ModalSubmitInteractionActionRowData
- type ModalSubmitInteractionComponentData
- type ModalSubmitInteractionData
- type PingInteraction
- type PremiumRequiredResponse
- type ResolvedData
- type Response
- type ResponseAckWithSource
- type ResponseChannelMessage
- type ResponseDeferredMessageUpdate
- type ResponsePong
- type ResponseType
- type ResponseUpdateMessage
- type ResponseUpdateMessageData
- type SelectMenuInteractionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationCommand ¶
type ApplicationCommand struct {
Id uint64 `json:"id,string,omitempty"`
Type ApplicationCommandType `json:"application_command_type"`
ApplicationId uint64 `json:"application_id,string,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Options []ApplicationCommandOption `json:"options"`
DefaultPermission bool `json:"default_permission,omitempty"`
Contexts []InteractionContextType `json:"contexts,omitempty"`
}
type ApplicationCommandAutoCompleteInteraction ¶
type ApplicationCommandAutoCompleteInteraction struct {
InteractionMetadata
Data ApplicationCommandAutoCompleteInteractionData `json:"data"`
}
type ApplicationCommandAutoCompleteInteractionData ¶
type ApplicationCommandAutoCompleteInteractionData struct {
Id uint64 `json:"id,string"`
Name string `json:"name"`
Options []ApplicationCommandInteractionDataOption `json:"options"`
Type ApplicationCommandType `json:"type"`
}
type ApplicationCommandAutoCompleteResultResponse ¶
type ApplicationCommandAutoCompleteResultResponse struct {
Response
Data struct {
Choices []ApplicationCommandOptionChoice `json:"choices"`
} `json:"data"`
}
======================================================== Auto Complete Result Response ========================================================
func NewApplicationCommandAutoCompleteResultResponse ¶
func NewApplicationCommandAutoCompleteResultResponse(choices []ApplicationCommandOptionChoice) ApplicationCommandAutoCompleteResultResponse
type ApplicationCommandCallbackData ¶
type ApplicationCommandCallbackData struct {
Tts bool `json:"tts"`
Content string `json:"content,omitempty"`
Embeds []*embed.Embed `json:"embeds,omitempty"`
AllowedMentions message.AllowedMention `json:"allowed_mentions,omitempty"`
Flags uint `json:"flags"`
Components []component.Component `json:"components,omitempty"`
}
type ApplicationCommandInteraction ¶
type ApplicationCommandInteraction struct {
InteractionMetadata
Data *ApplicationCommandInteractionData `json:"data"`
}
If GuildId is not null, Member will be present and User will not. If GuildId is null, Member will not be present, and User will.
type ApplicationCommandInteractionData ¶
type ApplicationCommandInteractionData struct {
Id uint64 `json:"id,string"`
Name string `json:"name"`
Type ApplicationCommandType `json:"type"`
Resolved ResolvedData `json:"resolved"`
Options []ApplicationCommandInteractionDataOption `json:"options"`
TargetId uint64 `json:"target_id,string"`
}
type ApplicationCommandInteractionDataOption ¶
type ApplicationCommandInteractionDataOption struct {
Name string `json:"name"`
Value interface{} `json:"value,omitempty"`
Options []ApplicationCommandInteractionDataOption `json:"options,omitempty"`
Focused bool `json:"focused"`
}
type ApplicationCommandOption ¶
type ApplicationCommandOption struct {
Type ApplicationCommandOptionType `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Default bool `json:"default"`
Required bool `json:"required"`
Choices []ApplicationCommandOptionChoice `json:"choices,omitempty"`
Autocomplete bool `json:"autocomplete"`
Options []ApplicationCommandOption `json:"options,omitempty"`
ChannelTypes []channel.ChannelType `json:"channel_types,omitempty"`
}
type ApplicationCommandOptionChoice ¶
type ApplicationCommandOptionChoice struct {
Name string `json:"name"`
Value interface{} `json:"value"` // string, int or double
}
type ApplicationCommandOptionType ¶
type ApplicationCommandOptionType uint8
const ( OptionTypeSubCommand ApplicationCommandOptionType = iota + 1 OptionTypeSubCommandGroup OptionTypeString OptionTypeInteger OptionTypeBoolean OptionTypeUser OptionTypeChannel OptionTypeRole OptionTypeMentionable OptionTypeNumber OptionTypeAttachment )
type ApplicationCommandPermissionType ¶
type ApplicationCommandPermissionType uint8
const ( ApplicationCommandPermissionTypeRole ApplicationCommandPermissionType = iota + 1 ApplicationCommandPermissionTypeUser )
type ApplicationCommandPermissions ¶
type ApplicationCommandPermissions struct {
Id uint64 `json:"id,string"`
Type ApplicationCommandPermissionType `json:"type"`
Permission bool `json:"permission"`
}
type ApplicationCommandType ¶
type ApplicationCommandType uint8
const ( ApplicationCommandTypeChatInput ApplicationCommandType = iota + 1 ApplicationCommandTypeUser ApplicationCommandTypeMessage )
type ButtonInteractionData ¶
type ButtonInteractionData struct {
MessageComponentInteractionBaseData
}
func (ButtonInteractionData) Type ¶
func (d ButtonInteractionData) Type() component.ComponentType
type IMessageComponentInteractionData ¶
type IMessageComponentInteractionData interface {
Type() component.ComponentType
}
type Interaction ¶
type Interaction struct {
Version uint8 `json:"version"`
Type InteractionType `json:"type"`
}
type InteractionContextType ¶
type InteractionContextType int8
const ( InteractionContextGuild InteractionContextType = 0 InteractionContextBotDM InteractionContextType = 1 InteractionContextPrivateChannel InteractionContextType = 2 )
type InteractionMetadata ¶
type InteractionMetadata struct {
Interaction
Id uint64 `json:"id,string"`
ApplicationId uint64 `json:"application_id,string"`
GuildId objects.NullableSnowflake `json:"guild_id"`
ChannelId uint64 `json:"channel_id,string"`
Channel channel.PartialChannel `json:"channel"`
Member *member.Member `json:"member"`
User *user.User `json:"user"`
Token string `json:"token"`
AppPermissions uint64 `json:"app_permissions,string"`
Locale string `json:"locale"`
GuildLocale string `json:"guild_locale"`
Entitlements []entitlement.Entitlement `json:"entitlements"`
}
type InteractionType ¶
type InteractionType uint8
const ( InteractionTypePing InteractionType = iota + 1 InteractionTypeApplicationCommand InteractionTypeMessageComponent InteractionTypeApplicationCommandAutoComplete InteractionTypeModalSubmit )
type MessageComponentInteraction ¶
type MessageComponentInteraction struct {
InteractionMetadata
Data MessageComponentInteractionData `json:"data"`
Message message.Message `json:"message"`
}
type MessageComponentInteractionBaseData ¶
type MessageComponentInteractionBaseData struct {
ComponentType component.ComponentType `json:"component_type"`
CustomId string `json:"custom_id"`
}
type MessageComponentInteractionData ¶
type MessageComponentInteractionData struct {
ComponentType component.ComponentType `json:"component_type"`
IMessageComponentInteractionData
}
func (MessageComponentInteractionData) AsButton ¶
func (d MessageComponentInteractionData) AsButton() ButtonInteractionData
func (MessageComponentInteractionData) AsSelectMenu ¶
func (d MessageComponentInteractionData) AsSelectMenu() SelectMenuInteractionData
func (*MessageComponentInteractionData) UnmarshalJSON ¶
func (d *MessageComponentInteractionData) UnmarshalJSON(data []byte) error
type ModalResponse ¶
type ModalResponse struct {
Response
Data ModalResponseData `json:"data"`
}
======================================================== Modal Response ========================================================
func NewModalResponse ¶
func NewModalResponse(customId, title string, components []component.Component) ModalResponse
type ModalResponseData ¶
type ModalSubmitInteraction ¶
type ModalSubmitInteraction struct {
InteractionMetadata
Data ModalSubmitInteractionData `json:"data"`
}
type ModalSubmitInteractionActionRowData ¶
type ModalSubmitInteractionActionRowData struct {
Type component.ComponentType `json:"type"`
Components []ModalSubmitInteractionComponentData `json:"components"`
Component *ModalSubmitInteractionComponentData `json:"component,omitempty"` // For single component rows
}
type ModalSubmitInteractionComponentData ¶
type ModalSubmitInteractionComponentData struct {
Type component.ComponentType `json:"type"`
CustomId string `json:"custom_id"`
Values []string `json:"values,omitempty"` // For multi-selects
Value string `json:"value"`
}
type ModalSubmitInteractionData ¶
type ModalSubmitInteractionData struct {
CustomId string `json:"custom_id"`
Components []ModalSubmitInteractionActionRowData `json:"components"`
Component *ModalSubmitInteractionComponentData `json:"component,omitempty"` // For single component
}
type PingInteraction ¶
type PingInteraction struct {
Interaction
}
type PremiumRequiredResponse ¶
type PremiumRequiredResponse struct {
Response
Data struct{} `json:"data"`
}
======================================================== Premium Required Response ========================================================
func NewPremiumRequiredResponse ¶
func NewPremiumRequiredResponse() PremiumRequiredResponse
type ResolvedData ¶
type ResolvedData struct {
Users map[objects.Snowflake]user.User `json:"users"`
Members map[objects.Snowflake]member.Member `json:"members"`
Roles map[objects.Snowflake]guild.Role `json:"roles"`
Channels map[objects.Snowflake]channel.Channel `json:"channels"`
Messages map[objects.Snowflake]message.Message `json:"messages"`
Attachments map[objects.Snowflake]channel.Attachment `json:"attachments"`
}
type Response ¶
type Response struct {
Type ResponseType `json:"type"`
}
type ResponseAckWithSource ¶
type ResponseAckWithSource struct {
Response
Data struct {
Flags uint `json:"flags"`
} `json:"data"`
}
======================================================== Ack With Source Response ========================================================
func NewResponseAckWithSource ¶
func NewResponseAckWithSource(flags uint) ResponseAckWithSource
type ResponseChannelMessage ¶
type ResponseChannelMessage struct {
Response
Data ApplicationCommandCallbackData `json:"data"`
}
======================================================== Channel Message Response ========================================================
func NewResponseChannelMessage ¶
func NewResponseChannelMessage(data ApplicationCommandCallbackData) ResponseChannelMessage
type ResponseDeferredMessageUpdate ¶
type ResponseDeferredMessageUpdate struct {
Response
}
======================================================== Deferred Message Update Response ========================================================
func NewResponseDeferredMessageUpdate ¶
func NewResponseDeferredMessageUpdate() ResponseDeferredMessageUpdate
type ResponsePong ¶
type ResponsePong struct {
Response
}
======================================================== Pong Response ========================================================
func NewResponsePong ¶
func NewResponsePong() ResponsePong
type ResponseType ¶
type ResponseType uint8
const ( ResponseTypePong ResponseType = iota + 1 ResponseTypeChannelMessageWithSource ResponseTypeACKWithSource ResponseTypeDeferredMessageUpdate ResponseTypeUpdateMessage ResponseTypeApplicationCommandAutoCompleteResult ResponseTypeModal ResponseTypePremiumRequired )
type ResponseUpdateMessage ¶
type ResponseUpdateMessage struct {
Response
Data ResponseUpdateMessageData `json:"data"`
}
======================================================== Update message Response ========================================================
func NewResponseUpdateMessage ¶
func NewResponseUpdateMessage(data ResponseUpdateMessageData) ResponseUpdateMessage
type ResponseUpdateMessageData ¶
type ResponseUpdateMessageData struct {
Content *string `json:"content"`
Embeds []*embed.Embed `json:"embeds"`
Components []component.Component `json:"components"`
}
TODO: Improve this
type SelectMenuInteractionData ¶
type SelectMenuInteractionData struct {
MessageComponentInteractionBaseData
Values []string `json:"values"`
}
func (SelectMenuInteractionData) Type ¶
func (d SelectMenuInteractionData) Type() component.ComponentType