package interactions import "git.sapphic.engineer/roleypoly/v4/types" type Interaction struct { ID string `json:"id"` Member types.DiscordMember `json:"member"` Data InteractionData `json:"data"` GuildID string `json:"guild_id"` AppPermissions uint64 `json:"app_permissions"` Type uint64 `json:"type"` Token string `json:"token"` } func (ix Interaction) GetName() string { if ix.Member.Nick != "" { return ix.Member.Nick } if ix.Member.User.GlobalName != "" { return ix.Member.User.GlobalName } return ix.Member.User.Username } const ( TypePing uint64 = 1 TypeApplicationCommand uint64 = 2 ) type InteractionData struct { Name string `json:"name"` Options []InteractionOption `json:"options"` } type InteractionOption struct { Name string `json:"name"` Value string `json:"value"` } const ( ResponsePong = 1 ResponseChannelMessage = 4 ResponseDeferredChannelMessage = 5 ) type InteractionResponse struct { Type int `json:"type"` Data InteractionResponseData `json:"data"` } const ( FlagEphemeral = 1 << 6 ) type InteractionResponseData struct { Content string `json:"content,omitempty"` Components []ButtonComponent `json:"components,omitempty"` Embeds []Embed `json:"embeds,omitempty"` Flags int `json:"flags,omitempty"` } type ButtonComponent struct { Type int `json:"type,omitempty"` Style int `json:"style,omitempty"` Label string `json:"label,omitempty"` Emoji types.Emoji `json:"emoji,omitempty"` URL string `json:"url,omitempty"` } type InteractionCommand struct { ID string `json:"id"` Type int `json:"type"` GuildID string `json:"guild_id,omitempty"` Name string `json:"name"` Description string `json:"description"` Options InteractionCommandOption `json:"options"` ChannelTypes []int `json:"channel_types,omitempty"` } type InteractionCommandOption struct { Type int `json:"type"` Name string `json:"name"` Required bool `json:"required,omitempty"` } type Embed struct { Author EmbedAuthor `json:"author"` Color uint32 `json:"color"` Description string `json:"description,omitempty"` Fields []EmbedField `json:"fields"` Footer EmbedFooter `json:"footer"` Timestamp string `json:"timestamp,omitempty"` Title string `json:"title"` } type EmbedField struct { Name string `json:"name"` Value string `json:"value"` Inline bool `json:"inline,omitempty"` } type EmbedFooter struct { Text string `json:"text"` IconURL string `json:"icon_url,omitempty"` ProxyIconURL string `json:"proxy_icon_url,omitempty"` } type EmbedAuthor struct { Name string `json:"name"` IconURL string `json:"icon_url"` }