* Interactions: the Buttons (#933) * Interactions: buttons * Doc fix * Gofmt fix * Fix typo * Remaking interaction data into interface * Godoc fix * Gofmt fix * Godoc fix * InteractionData helper functions and some fixes in slash commands example * Fix components example * Yet another fix of components example * Fix interaction unmarshaling * Gofmt fix * Godoc fix * Gofmt fix * Corrected naming and docs * Rolled back API version * Requested fixes * Added support of components to webhook and regular messages * Fix components unmarshaling * Godoc fix * Requested fixes * Fixed unmarshaling issues * Components example: cleanup * Added components tracking to state * Requested fixes * Renaming fix * Remove more named returns * Minor English fixes Co-authored-by: Carson Hoffman <c@rsonhoffman.com> * Doc fix * Gofmt fix * Fix typo * Remaking interaction data into interface * Godoc fix * Gofmt fix * Godoc fix * InteractionData helper functions and some fixes in slash commands example * Fix components example * Yet another fix of components example * Fix interaction unmarshaling * Godoc fix * Gofmt fix * Corrected naming and docs * Rolled back API version * Requested fixes * Added support of components to webhook and regular messages * Interactions: select menus * Example fix * Merge fix * Some fixes * Added missing documentation * Fix components unmarshaling * Godoc fix * Requested fixes * Fixed unmarshaling issues * Components example: cleanup * Gofmt fix * Godoc fix * URL field renaming fix * Added flags to followups * Updated components example * Fixed typo in components example * Merge fix * Improve handling of invalid interaction situations * support allowing webhook edits with files, and responding to interactions with files (#931) * allow files in webhook message edits * add Files to WebhookEdit struct * move the construction of the multipart body for files into a shared function * allow interaction responses to have files * go fmt * fix err shadowing * document MakeFilesBody * rename MakeFilesBody -> EncodeWithFiles. fix InteractionRespond responding twice * use resp in InteractionRespond files, add basic-command-with-files example command * import strings and go fmt * EncodeWithFiles -> MultiPartBodyWithJSON * go fmt * fix example for slash_commands * move files to responsedata * Merge fixes * Fixed rebase consequences Co-authored-by: Carson Hoffman <c@rsonhoffman.com> Co-authored-by: plally <pierce@vulpes.dev>
49 lines
1.9 KiB
Go
49 lines
1.9 KiB
Go
package discordgo
|
|
|
|
// Webhook stores the data for a webhook.
|
|
type Webhook struct {
|
|
ID string `json:"id"`
|
|
Type WebhookType `json:"type"`
|
|
GuildID string `json:"guild_id"`
|
|
ChannelID string `json:"channel_id"`
|
|
User *User `json:"user"`
|
|
Name string `json:"name"`
|
|
Avatar string `json:"avatar"`
|
|
Token string `json:"token"`
|
|
|
|
// ApplicationID is the bot/OAuth2 application that created this webhook
|
|
ApplicationID string `json:"application_id,omitempty"`
|
|
}
|
|
|
|
// WebhookType is the type of Webhook (see WebhookType* consts) in the Webhook struct
|
|
// https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types
|
|
type WebhookType int
|
|
|
|
// Valid WebhookType values
|
|
const (
|
|
WebhookTypeIncoming WebhookType = 1
|
|
WebhookTypeChannelFollower WebhookType = 2
|
|
)
|
|
|
|
// WebhookParams is a struct for webhook params, used in the WebhookExecute command.
|
|
type WebhookParams struct {
|
|
Content string `json:"content,omitempty"`
|
|
Username string `json:"username,omitempty"`
|
|
AvatarURL string `json:"avatar_url,omitempty"`
|
|
TTS bool `json:"tts,omitempty"`
|
|
Files []*File `json:"-"`
|
|
Components []MessageComponent `json:"components"`
|
|
Embeds []*MessageEmbed `json:"embeds,omitempty"`
|
|
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
|
// NOTE: Works only for followup messages.
|
|
Flags uint64 `json:"flags,omitempty"`
|
|
}
|
|
|
|
// WebhookEdit stores data for editing of a webhook message.
|
|
type WebhookEdit struct {
|
|
Content string `json:"content,omitempty"`
|
|
Components []MessageComponent `json:"components"`
|
|
Embeds []*MessageEmbed `json:"embeds,omitempty"`
|
|
Files []*File `json:"-"`
|
|
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
|
}
|