api

package
v10.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TitleLimit       = 256  // 256 characters
	DescriptionLimit = 4096 // 4096 characters
	FieldCount       = 25   // Up to 25 field objects
	FieldNameLimit   = 256  // 256 characters
	FieldValueLimit  = 1024 // 1024 characters
	FooterTextLimit  = 2048 // 2048 characters
	AuthorNameLimit  = 256  // 256 characters
)

Additionally, the combined sum of characters in all title, description, field.name, field.value, footer.text, and author.name fields across all embeds attached to a message must not exceed 6000 characters.

Violating any of these constraints will result in a Bad Request response.

View Source
const (
	// ImageBaseURL - The root URL for image links
	ImageBaseURL string = "https://cdn.discordapp.com/"
)
View Source
const (
	// UserAgent - header value to be sent with each API request
	UserAgent = "NowLiveCustomLib (https://nowlivebot.com, 10.0.19)"
)

Variables

View Source
var (
	ApplicationID Snowflake // ApplicationID -  The Snowflake of the application
	DefaultColor  int64     = 16711680
	LogLevel      logrus.Level
	Token         string // Token - The application's token
)

Functions

func CanAddReactions

func CanAddReactions(member *GuildMember, channel *Channel) bool

CanAddReactions - Allows for the addition of reactions to messages

func CanAdminister

func CanAdminister(member *GuildMember, channel *Channel) bool

CanAdminister - Allows all permissions and bypasses channel permission overwrites

func CanAttachFiles

func CanAttachFiles(member *GuildMember, channel *Channel) bool

CanAttachFiles - Allows for uploading images and files

func CanBanMembers

func CanBanMembers(member *GuildMember, channel *Channel) bool

CanBanMembers - Allows banning members

func CanChangeNickname

func CanChangeNickname(member *GuildMember, channel *Channel) bool

CanChangeNickname - Allows for modification of own nickname

func CanConnect

func CanConnect(member *GuildMember, channel *Channel) bool

CanConnect - Allows for joining of a voice channel

func CanCreateInstantInvite

func CanCreateInstantInvite(member *GuildMember, channel *Channel) bool

CanCreateInstantInvite - Allows creation of instant invites

func CanCreatePrivateThreads

func CanCreatePrivateThreads(member *GuildMember, channel *Channel) bool

CanCreatePrivateThreads - Allows for creating private threads

func CanCreatePublicThreads

func CanCreatePublicThreads(member *GuildMember, channel *Channel) bool

CanCreatePublicThreads - Allows for creating public and announcement threads

func CanDeafenMembers

func CanDeafenMembers(member *GuildMember, channel *Channel) bool

CanDeafenMembers - Allows for deafening of members in a voice channel

func CanEmbedLinks(member *GuildMember, channel *Channel) bool

CanEmbedLinks - Links sent by users with this permission will be auto-embedded

func CanKickMembers

func CanKickMembers(member *GuildMember, channel *Channel) bool

CanKickMembers - Allows kicking members

func CanManageChannels

func CanManageChannels(member *GuildMember, channel *Channel) bool

CanManageChannels - Allows management and editing of channels

func CanManageEvents

func CanManageEvents(member *GuildMember, channel *Channel) bool

CanManageEvents - Allows for creating, editing, and deleting scheduled events

func CanManageGuild

func CanManageGuild(member *GuildMember, channel *Channel) bool

CanManageGuild - Allows management and editing of the guild

func CanManageGuildExpressions added in v10.2.0

func CanManageGuildExpressions(member *GuildMember, channel *Channel) bool

CanManageGuildExpressions - Allows management and editing of emojis and stickers

func CanManageMessages

func CanManageMessages(member *GuildMember, channel *Channel) bool

CanManageMessages - Allows for deletion of other users messages

func CanManageNicknames

func CanManageNicknames(member *GuildMember, channel *Channel) bool

CanManageNicknames - Allows for modification of other users nicknames

func CanManageRoles

func CanManageRoles(member *GuildMember, channel *Channel) bool

CanManageRoles - Allows management and editing of roles

func CanManageThreads

func CanManageThreads(member *GuildMember, channel *Channel) bool

CanManageThreads - Allows for deleting and archiving threads, and viewing all private threads

func CanManageWebhooks

func CanManageWebhooks(member *GuildMember, channel *Channel) bool

CanManageWebhooks - Allows management and editing of webhooks

func CanMentionEveryone

func CanMentionEveryone(member *GuildMember, channel *Channel) bool

CanMentionEveryone - Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel

func CanModerateMembers

func CanModerateMembers(member *GuildMember, channel *Channel) bool

CanModerateMembers - Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels

func CanMoveMembers

func CanMoveMembers(member *GuildMember, channel *Channel) bool

CanMoveMembers - Allows for moving of members between voice channels

func CanMuteMembers

func CanMuteMembers(member *GuildMember, channel *Channel) bool

CanMuteMembers - Allows for muting members in a voice channel

func CanReadMessageHistory

func CanReadMessageHistory(member *GuildMember, channel *Channel) bool

CanReadMessageHistory - Allows for reading of message history

func CanRequestToSpeak

func CanRequestToSpeak(member *GuildMember, channel *Channel) bool

CanRequestToSpeak - Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)

func CanSendMessages

func CanSendMessages(member *GuildMember, channel *Channel) bool

CanSendMessages - Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads)

func CanSendMessagesInThreads

func CanSendMessagesInThreads(member *GuildMember, channel *Channel) bool

CanSendMessagesInThreads - Allows for sending messages in threads

func CanSendTtsMessages

func CanSendTtsMessages(member *GuildMember, channel *Channel) bool

CanSendTtsMessages - Allows for sending of /tts messages

func CanSpeak

func CanSpeak(member *GuildMember, channel *Channel) bool

CanSpeak - Allows for speaking in a voice channel

func CanStream

func CanStream(member *GuildMember, channel *Channel) bool

CanStream - Allows the user to go live

func CanUseApplicationCommands

func CanUseApplicationCommands(member *GuildMember, channel *Channel) bool

CanUseApplicationCommands - Allows members to use application commands, including slash commands and context menu commands.

func CanUseEmbeddedActivities

func CanUseEmbeddedActivities(member *GuildMember, channel *Channel) bool

CanUseEmbeddedActivities - Allows for using Activities (applications with the Embedded flag) in a voice channel

func CanUseExternalEmojis

func CanUseExternalEmojis(member *GuildMember, channel *Channel) bool

CanUseExternalEmojis - Allows the usage of custom emojis from other servers

func CanUseExternalStickers

func CanUseExternalStickers(member *GuildMember, channel *Channel) bool

CanUseExternalStickers - Allows the usage of custom stickers from other servers

func CanUseVoiceActivity

func CanUseVoiceActivity(member *GuildMember, channel *Channel) bool

CanUseVoiceActivity - Allows for using voice-activity-detection in a voice channel

func CanViewAuditLog

func CanViewAuditLog(member *GuildMember, channel *Channel) bool

CanViewAuditLog - Allows for viewing of audit logs

func CanViewChannel

func CanViewChannel(member *GuildMember, channel *Channel) bool

CanViewChannel - Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels

func CanViewGuildInsights

func CanViewGuildInsights(member *GuildMember, channel *Channel) bool

CanViewGuildInsights - Allows for viewing guild insights

func DeleteAutoModerationRule

func DeleteAutoModerationRule(guildID string, channel *Channel, userID, ruleID *Snowflake, reason *string) error

DeleteAutoModerationRule - Delete a rule. Returns a 204 on success. Fires an AutoModerationRuleDelete Gateway event.

This endpoint requires the ManageGuild permission.

func DeleteGlobalApplicationCommand

func DeleteGlobalApplicationCommand(applicationID *Snowflake, commandID string) error

DeleteGlobalApplicationCommand - Deletes a global command. Returns 204 No Content on success.

func DeleteGuildApplicationCommand

func DeleteGuildApplicationCommand(applicationID *Snowflake,
	guildID *Snowflake,
	commandID string) error

DeleteGuildApplicationCommand - Delete a guild command. Returns 204 No Content on success.

func IsPrioritySpeaker

func IsPrioritySpeaker(member *GuildMember, channel *Channel) bool

IsPrioritySpeaker - Allows for using priority speaker in a voice channel

func PtrStr

func PtrStr(s *string) string

PtrStr converts a string pointer to a string

Types

type AddGuildMemberJSON

type AddGuildMemberJSON struct {
	AccessToken string       `json:"access_token"`    // an oauth2 access token granted with the `guilds.join` to the bots' application for the user you want to add to the guild
	Nick        string       `json:"nick,omitempty"`  // value to set user's nickname to
	Roles       []*Snowflake `json:"roles,omitempty"` // array of role ids the member is assigned
	Mute        bool         `json:"mute,omitempty"`  // whether the user is muted in voice channels
	Deaf        bool         `json:"deaf,omitempty"`  // whether the user is deafened in voice channels
}

AddGuildMemberJSON - JSON payload

type AllowedMentionType

type AllowedMentionType string

AllowedMentionType - the type of mention allowed

const (
	RoleMentions     AllowedMentionType = "roles"    // Controls role mentions
	UserMentions     AllowedMentionType = "users"    // Controls user mentions
	EveryoneMentions AllowedMentionType = "everyone" // Controls @everyone and @here mentions
)

type AllowedMentions

type AllowedMentions struct {
	Parse       []*AllowedMentionType `json:"parse"`                  // An array of AllowedMentionType to parse from the content.
	Roles       []*Snowflake          `json:"roles,omitempty"`        // Array of role_ids to mention (Max size of 100)
	Users       []*Snowflake          `json:"users,omitempty"`        // Array of user_ids to mention (Max size of 100)
	RepliedUser bool                  `json:"replied_user,omitempty"` // For replies, whether to mention the author of the message being replied to (default false)
}

AllowedMentions - The allowed mention field allows for more granular control over mentions without various hacks to the message content.

This will always validate against message content to avoid phantom pings (e.g. to ping everyone, you must still have @everyone in the message content), and check against user/bot permissions.

type Application

type Application struct {
	ID                             Snowflake        `json:"id"`                                          // ID of the app
	Name                           string           `json:"name"`                                        // Name of the app
	Icon                           *string          `json:"icon"`                                        // Icon hash of the app
	Description                    string           `json:"description"`                                 // Description of the app
	RpcOrigins                     []string         `json:"rpc_origins,omitempty"`                       // List of RPC origin URLs, if RPC is enabled
	BotPublic                      bool             `json:"bot_public"`                                  // When false, only the app owner can add the app to guilds
	BotRequireCodeGrant            bool             `json:"bot_require_code_grant"`                      // When true, the app's bot will only join upon completion of the full OAuth2 code grant flow
	Bot                            User             `json:"bot,omitempty"`                               // Partial user object for the bot user associated with the app
	TermsOfServiceURL              string           `json:"terms_of_service_url,omitempty"`              // URL of the app's Terms of Service
	PrivacyPolicyURL               string           `json:"privacy_policy_url,omitempty"`                // URL of the app's Privacy Policy
	Owner                          User             `json:"owner,omitempty"`                             // Partial user object for the owner of the app
	VerifyKey                      string           `json:"verify_key"`                                  // Hex encoded key for verification in interactions and the GameSDK's GetTicket
	Team                           *Team            `json:"team"`                                        // If the app belongs to a team, this will be a list of the members of that team
	GuildID                        Snowflake        `json:"guild_id,omitempty"`                          // Guild associated with the app. For example, a developer support server.
	Guild                          Guild            `json:"guild,omitempty"`                             // Partial object of the associated guild
	PrimarySkuID                   Snowflake        `json:"primary_sku_id,omitempty"`                    // If this app is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
	Slug                           string           `json:"slug,omitempty"`                              // If this app is a game sold on Discord, this field will be the URL slug that links to the store page
	CoverImage                     string           `json:"cover_image,omitempty"`                       // App's default rich presence invite cover image hash
	Flags                          ApplicationFlags `json:"flags,omitempty"`                             // App's public flags
	ApproximateGuildCount          int64            `json:"approximate_guild_count,omitempty"`           // Approximate count of guilds the app has been added to
	RedirectUris                   []string         `json:"redirect_uris,omitempty"`                     // Array of redirect URIs for the app
	InteractionsEndpointUrl        string           `json:"interactions_endpoint_url,omitempty"`         // Interactions endpoint URL for the app
	RoleConnectionsVerificationURL string           `json:"role_connections_verification_url,omitempty"` // Role connection verification URL for the app
	Tags                           []string         `json:"tags,omitempty"`                              // List of tags describing the content and functionality of the app. Max of 5 tags.
	InstallParams                  InstallParams    `json:"install_params,omitempty"`                    // Settings for the app's default in-app authorization link, if enabled
	CustomInstallURL               string           `json:"custom_install_url,omitempty"`                // Default custom authorization URL for the app, if enabled
}

Application - an application which operates on Discord, commonly referred to as bots

func EditCurrentApplication added in v10.2.6

func EditCurrentApplication(customInstallUrl, description, roleConnectionsVerificationUrl, interactionsEndpointUrl *string, flags *int, tags *[]string) (*Application, error)

func GetCurrentApplication added in v10.2.6

func GetCurrentApplication() (*Application, error)

type ApplicationCommand

type ApplicationCommand struct {
	ID                       Snowflake                   `json:"id,omitempty"`                         // unique id of the command
	Type                     ApplicationCommandType      `json:"type,omitempty"`                       // the type of command, defaults 1 if not set
	ApplicationID            Snowflake                   `json:"application_id"`                       // unique id of the parent application
	GuildID                  Snowflake                   `json:"guild_id,omitempty"`                   // guild id of the command, if not global
	Name                     string                      `json:"name"`                                 // max 32 chars, must follow ^[\w-]{1,32}$ regex
	NameLocalizations        *LocalizationDict           `json:"name_localizations,omitempty"`         // Localization dictionary for the name field. Values follow the same restrictions as name
	Description              string                      `json:"description"`                          // 1-100 character description for CHAT_INPUT command, empty string for USER and MESSAGE command
	DescriptionLocalizations *LocalizationDict           `json:"description_localizations,omitempty"`  // Localization dictionary for the description field. Values follow the same restrictions as description
	Options                  []*ApplicationCommandOption `json:"options,omitempty"`                    // the parameters for the command, max 25; CHAT_INPUT
	DefaultMemberPermissions *string                     `json:"default_member_permissions,omitempty"` // Set of permissions represented as a bit set
	DmPermission             *bool                       `json:"dm_permission,omitempty"`              // Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
	Version                  Snowflake                   `json:"version"`                              // autoincrementing version identifier updated during substantial record changes
}

ApplicationCommand - A command, or each individual subcommand, can have a maximum of 25 options

An application command is the base "command" model that belongs to an application. This is what you are creating when you POST a new command.

Required options must be listed before optional options

func BulkOverwriteGlobalApplicationCommands

func BulkOverwriteGlobalApplicationCommands(
	applicationID *Snowflake,
	payload []*ApplicationCommand,
) ([]*ApplicationCommand, error)

BulkOverwriteGlobalApplicationCommands - Takes a list of application commands, overwriting the existing global command list for this application.

Updates will be available in all guilds after 1 hour.

Returns 200 and a list of application command objects.

Commands that do not already exist will count toward daily application command create limits.

func CreateGlobalApplicationCommand

func CreateGlobalApplicationCommand(applicationID Snowflake, payload CreateApplicationCommandJSON) (
	*ApplicationCommand,
	error,
)

CreateGlobalApplicationCommand - Create a new global command.

New global commands will be available in all guilds after 1 hour. Returns 201 and an application command object.

Creating a command with the same name as an existing command for your application will overwrite the old command.

func CreateGuildApplicationCommand

func CreateGuildApplicationCommand(
	applicationID *Snowflake,
	guildID *Snowflake,
	payload *CreateApplicationCommandJSON,
) (*ApplicationCommand, error)

CreateGuildApplicationCommand - Create a new guild command.

New guild commands will be available in the guild immediately.

Returns 201 and an application command object.

If the command did not already exist, it will count toward daily application command create limits.

func GetGlobalApplicationCommands

func GetGlobalApplicationCommands(applicationID Snowflake, withLocalizations bool) ([]*ApplicationCommand,
	error)

GetGlobalApplicationCommands - Fetch all the global commands for your application.

Returns an array of application command objects.

func GetGuildApplicationCommands

func GetGuildApplicationCommands(
	applicationID *Snowflake,
	guildID *Snowflake,
	withLocalizations bool,
) ([]*ApplicationCommand, error)

GetGuildApplicationCommands - Fetch all the guild commands for your application for a specific guild.

Returns an array of application command objects.

type ApplicationCommandData

type ApplicationCommandData struct {
	ID       Snowflake                                  `json:"id,omitempty"`        // the ID of the invoked command
	Name     string                                     `json:"name,omitempty"`      // the name of the invoked command
	Type     ApplicationCommandType                     `json:"type,omitempty"`      // the type of the invoked command
	Resolved ResolvedData                               `json:"resolved,omitempty"`  // converted users + roles + channels
	Options  []*ApplicationCommandInteractionDataOption `json:"options,omitempty"`   // the params + values from the user
	GuildID  Snowflake                                  `json:"guild_id,omitempty"`  // the id of the guild the command is registered to
	TargetID Snowflake                                  `json:"target_id,omitempty"` // id the of user or message targeted by a user or message command
}

ApplicationCommandData

While the data field is guaranteed to be present for all interaction types besides InteractionTypePing, its structure will vary.

type ApplicationCommandInteractionDataOption

type ApplicationCommandInteractionDataOption struct {
	Name    string                                     `json:"name"`              // the name of the parameter
	Type    ApplicationCommandOptionType               `json:"type"`              // value of application command option type
	Value   any                                        `json:"value,omitempty"`   // the value of the pair
	Options []*ApplicationCommandInteractionDataOption `json:"options,omitempty"` // present if this option is a group or subcommand
	Focused bool                                       `json:"focused,omitempty"` // true if this option is the currently focused option for autocomplete
}

ApplicationCommandInteractionDataOption - All options have names, and an option can either be a parameter and input value--in which case value will be set--or it can denote a subcommand or group--in which case it will contain a top-level key and another array of options.

value and options are mutually exclusive.

type ApplicationCommandOption

type ApplicationCommandOption struct {
	Type                     ApplicationCommandOptionType      `json:"type"`                                // the type of option
	Name                     string                            `json:"name"`                                // 1-32 character name
	NameLocalizations        *LocalizationDict                 `json:"name_localizations,omitempty"`        // Localization dictionary for the name field. Values follow the same restrictions as name
	Description              string                            `json:"description"`                         // 1-100 character description
	DescriptionLocalizations *LocalizationDict                 `json:"description_localizations,omitempty"` // Localization dictionary for the description field. Values follow the same restrictions as description
	Required                 bool                              `json:"required,omitempty"`                  // if the parameter is required or optional--default `false`
	Choices                  []*ApplicationCommandOptionChoice `json:"choices,omitempty"`                   // choices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25
	Options                  []*ApplicationCommandOption       `json:"options,omitempty"`                   // if the option is a subcommand or subcommand group type, these nested options will be the parameters
	ChannelTypes             []*ChannelType                    `json:"channel_types,omitempty"`             // if the option is a channel type, the channels shown will be restricted to these types
	MinValue                 any                               `json:"min_value,omitempty"`                 // if the option is an INTEGER or NUMBER type, the minimum value permitted; integer for INTEGER options, double for NUMBER options
	MaxValue                 any                               `json:"max_value,omitempty"`                 // if the option is an INTEGER or NUMBER type, the maximum value permitted; integer for INTEGER options, double for NUMBER options
	MinLength                int                               `json:"min_length,omitempty"`                // For option type STRING, the minimum allowed length (minimum of 0, maximum of 6000)
	MaxLength                int                               `json:"max_length,omitempty"`                // For option type STRING, the maximum allowed length (minimum of 1, maximum of 6000)
	Autocomplete             bool                              `json:"autocomplete,omitempty"`              // If autocomplete interactions are enabled for this STRING, INTEGER, or NUMBER type option
}

ApplicationCommandOption - You can specify a maximum of 25 choices per option

type ApplicationCommandOptionChoice

type ApplicationCommandOptionChoice struct {
	Name              string            `json:"name"`                         // 1-100 character choice name
	NameLocalizations *LocalizationDict `json:"name_localizations,omitempty"` // Localization dictionary for the name field. Values follow the same restrictions as name
	Value             any               `json:"value"`                        // value of the choice, up to 100 characters if string
}

ApplicationCommandOptionChoice - If you specify choices for an option, they are the only valid values for a user to pick

type ApplicationCommandOptionType

type ApplicationCommandOptionType int

ApplicationCommandOptionType - The option type of the command

const (
	OptionTypeSubCommand ApplicationCommandOptionType = iota + 1
	OptionTypeSubCommandGroup
	OptionTypeString
	OptionTypeInteger // Any integer between -2^53 and 2^53
	OptionTypeBoolean
	OptionTypeUser
	OptionTypeChannel // Includes all channel types + categories
	OptionTypeRole
	OptionTypeMentionable // Includes users and roles
	OptionTypeNumber      // Any double between -2^53 and 2^53
	OptionTypeAttachment  // attachment object
)

type ApplicationCommandPermissionType

type ApplicationCommandPermissionType int

ApplicationCommandPermissionType - The permission type for the command

const (
	PermissionTypeRole    ApplicationCommandPermissionType = iota + 1 // ROLE
	PermissionTypeUser                                                // USER
	PermissionTypeChannel                                             // CHANNEL
)

type ApplicationCommandPermissions

type ApplicationCommandPermissions struct {
	ID         Snowflake                        `json:"id"`         // the id of the role or user
	Type       ApplicationCommandPermissionType `json:"type"`       // role or user
	Permission bool                             `json:"permission"` // true to allow, false, to disallow
}

ApplicationCommandPermissions - Application command permissions allow you to enable or disable command for specific users or roles within a guild.

type ApplicationCommandType

type ApplicationCommandType int

ApplicationCommandType - The type of application command

const (
	CommandTypeChatInput ApplicationCommandType = iota + 1
	CommandTypeUser
	CommandTypeMessage
)

type ApplicationFlags

type ApplicationFlags int64

ApplicationFlags - the application's public ApplicationFlags

const (
	ApplicationAutoModerationRuleCreateBadge ApplicationFlags = 1 << 6  // Indicates if an app uses the Auto Moderation API
	GatewayPresence                          ApplicationFlags = 1 << 12 // Intent required for bots in 100 or more servers to receive presence_update events
	GatewayPresenceLimited                   ApplicationFlags = 1 << 13 // Intent required for bots in under 100 servers to receive presence_update events, found in Bot Settings
	GatewayGuildMembers                      ApplicationFlags = 1 << 14 // Intent required for bots in 100 or more servers to receive member-related events like guild_member_add. See list of member-related events under GUILD_MEMBERS
	GatewayGuildMembersLimited               ApplicationFlags = 1 << 15 // Intent required for bots in under 100 servers to receive member-related events like guild_member_add, found in Bot Settings. See list of member-related events under GUILD_MEMBERS
	VerificationPendingGuildLimit            ApplicationFlags = 1 << 16 // Indicates unusual growth of an app that prevents verification
	Embedded                                 ApplicationFlags = 1 << 17 // Indicates if an app is embedded within the Discord client (currently unavailable publicly)
	GatewayMessageContent                    ApplicationFlags = 1 << 18 // Intent required for bots in 100 or more servers to receive message content
	GatewayMessageContentLimited             ApplicationFlags = 1 << 19 // Intent required for bots in under 100 servers to receive message content, found in Bot Settings
	ApplicationCommandBadge                  ApplicationFlags = 1 << 23 // Indicates if an app has registered global application commands
)

type ApplicationRoleConnection

type ApplicationRoleConnection struct {
	PlatformName     *string                           `json:"platform_name"`
	PlatformUsername *string                           `json:"platform_username"`
	Metadata         ApplicationRoleConnectionMetadata `json:"metadata"`
}

func GetUserApplicationRoleConnection

func GetUserApplicationRoleConnection(applicationID *Snowflake) (*ApplicationRoleConnection, error)

GetUserApplicationRoleConnection - Returns the application role connection for the user.

Requires an OAuth2 access token with role_connections.write scope for the application specified in the path.

func UpdateUserApplicationRoleConnection

func UpdateUserApplicationRoleConnection(applicationID *Snowflake,
	payload *ApplicationRoleConnection) (*ApplicationRoleConnection, error)

UpdateUserApplicationRoleConnection - Updates and returns the application role connection for the user.

Requires an OAuth2 access token with role_connections.write scope for the application specified in the path.

type ApplicationRoleConnectionMetadata

type ApplicationRoleConnectionMetadata struct {
	Type                      ApplicationRoleConnectionMetadataType // type of metadata value
	Key                       string                                // dictionary key for the metadata field (must be a-z, 0-9, or _ characters; 1-50 characters)
	Name                      string                                // name of the metadata field (1-100 characters)
	NameLocalizations         LocalizationDict                      // translations of the name
	Description               string                                //	description of the metadata field (1-200 characters)
	DescriptionsLocalizations LocalizationDict                      // translations of the description
}

ApplicationRoleConnectionMetadata

A representation of role connection metadata for an Application.

When a Guild has added a bot and that bot has configured its RoleConnectionsVerificationURL (in the developer portal), the application will render as a potential verification method in the guild's role verification configuration.

If an application has configured role connection metadata, its metadata will appear in the role verification configuration when the application has been added as a verification method to the role.

When a user connects their account using the bots RoleConnectionsVerificationURL, the bot will update a user's role connection with metadata using the OAuth2 scopes.RoleConnectionsWrite scope.

func GetApplicationRoleConnectionMetadataRecords

func GetApplicationRoleConnectionMetadataRecords(appID string) ([]*ApplicationRoleConnectionMetadata, error)

GetApplicationRoleConnectionMetadataRecords - Returns a list of ApplicationRoleConnectionMetadata objects for the given Application.

func UpdateApplicationRoleConnectionMetadataRecords

func UpdateApplicationRoleConnectionMetadataRecords(appID string) ([]*ApplicationRoleConnectionMetadata, error)

UpdateApplicationRoleConnectionMetadataRecords - Updates and returns a list of ApplicationRoleConnectionMetadata objects for the given Application.

type ApplicationRoleConnectionMetadataType

type ApplicationRoleConnectionMetadataType int

ApplicationRoleConnectionMetadataType - type of metadata value

const (
	// IntegerLessThanOrEqual - the metadata value (integer) is less than or equal to the guild's configured value (integer)
	IntegerLessThanOrEqual ApplicationRoleConnectionMetadataType = iota + 1

	// IntegerGreaterThanOrEqual - the metadata value (integer) is greater than or equal to the guild's configured value (integer)
	IntegerGreaterThanOrEqual

	// IntegerEqual - the metadata value (integer) is equal to the guild's configured value (integer)
	IntegerEqual

	// IntegerNotEqual - the metadata value (integer) is not equal to the guild's configured value (integer)
	IntegerNotEqual

	// DateTimeLessThanOrEqual - the metadata value (ISO8601 string) is less than or equal to the guild's configured value (integer; days before current date)
	DateTimeLessThanOrEqual

	// DateTimeGreaterThanOrEqual - the metadata value (ISO8601 string) is greater than or equal to the guild's configured value (integer; days before current date)
	DateTimeGreaterThanOrEqual

	// BooleanEqual - the metadata value (integer) is equal to the guild's configured value (integer; 1)
	BooleanEqual

	// BooleanNotEqual - the metadata value (integer) is not equal to the guild's configured value (integer; 1)
	BooleanNotEqual
)

type Attachment

type Attachment struct {
	ID          Snowflake `json:"id"`                     // attachment id
	Filename    string    `json:"filename"`               // name of file attached
	Description string    `json:"description,omitempty"`  // description for the file
	ContentType string    `json:"content_type,omitempty"` // the attachment's media type
	Size        int       `json:"size"`                   // size of file in bytes
	URL         string    `json:"url"`                    // source url of file
	ProxyURL    string    `json:"proxy_url"`              // a proxied url of file
	Height      *int      `json:"height,omitempty"`       // height of file (if image)
	Width       *int      `json:"width,omitempty"`        // width of file (if image)
	Ephemeral   bool      `json:"ephemeral,omitempty"`    // whether this attachment is ephemeral
}

Attachment - For the attachments array in Message Create/Edit requests, only the id is required.

type AuditLog

type AuditLog struct {
	ApplicationCommands  []*ApplicationCommand  `json:"application_commands"`   // List of ApplicationCommands referenced in the audit log
	AuditLogEntries      []*AuditLogEntry       `json:"audit_log_entries"`      // List of AuditLog entries, sorted from most to least recent
	AutoModerationRules  []AutoModerationRule   `json:"auto_moderation_rules"`  // List of AutoModerationRule referenced in the audit log
	GuildScheduledEvents []*GuildScheduledEvent `json:"guild_scheduled_events"` // List of GuildScheduledEvents referenced in the audit log
	Integrations         []*Integration         `json:"integrations"`           // List of partial Integration objects
	Threads              []*Channel             `json:"threads"`                // List of Threads referenced in the audit log
	Users                []*User                `json:"users"`                  // List of Users referenced in the audit log
	Webhooks             []*Webhook             `json:"webhooks"`               // List of Webhooks referenced in the audit log
}

AuditLog - When an administrative action is performed in a Guild, an entry is added to its AuditLog.

Viewing audit logs requires the ViewAuditLog permission and can be fetched by apps using the GetGuildAuditLog endpoint, or seen by users in the guild's Server Settings.

All audit log entries are stored for 45 days.

When an app is performing an eligible action using the APIs, it can pass an X-Audit-Log-Reason header to indicate why the action was taken.

More information is in the audit log entry section.

type AuditLogChange

type AuditLogChange struct {
	NewValue any    `json:"new_value,omitempty"` // new value of the key
	OldValue any    `json:"old_value,omitempty"` // old value of the key
	Key      string `json:"key"`                 // name of audit log change key
}

AuditLogChange - If new_value is not present in the change object, while old_value is, that means the property that was changed has been reset, or set to null

type AuditLogEntry

type AuditLogEntry struct {
	TargetID   *string            `json:"target_id"`         // id of the affected entity (webhook, user, role, etc.)
	Changes    []*AuditLogChange  `json:"changes,omitempty"` // changes made to the target_id
	UserID     *Snowflake         `json:"user_id"`           // the user who made the changes
	ID         Snowflake          `json:"id"`                // id of the entry
	ActionType AuditLogEvent      `json:"action_type"`       // type of action that occurred
	Options    OptionalAuditEntry `json:"options,omitempty"` // additional info for certain action types
	Reason     string             `json:"reason,omitempty"`  // the reason for the change (0-512 characters)
}

AuditLogEntry - Representation of a single Audit Log

type AuditLogEvent

type AuditLogEvent int

AuditLogEvent - The event type that triggered the log action

const (
	// GuildUpdate - Guild update Events
	GuildUpdate AuditLogEvent = iota + 1

	ChannelCreate AuditLogEvent = iota + 9
	ChannelUpdate
	ChannelDelete

	ChannelOverwriteCreate
	ChannelOverwriteUpdate
	ChannelOverwriteDelete

	MemberKick AuditLogEvent = iota + 13
	MemberPrune
	MemberBanAdd
	MemberBanRemove
	MemberUpdate
	MemberRoleUpdate
	MemberMove
	MemberDisconnect
	BotAdd

	RoleCreate AuditLogEvent = iota + 14
	RoleUpdate
	RoleDelete

	InviteCreate AuditLogEvent = iota + 21
	InviteUpdate
	InviteDelete

	WebhookCreate AuditLogEvent = iota + 28
	WebhookUpdate
	WebhookDelete

	EmojiCreate AuditLogEvent = iota + 35
	EmojiUpdate
	EmojiDelete

	MessageDelete AuditLogEvent = iota + 44
	MessageBulkDelete
	MessagePin
	MessageUnpin

	IntegrationCreate AuditLogEvent = iota + 48
	IntegrationUpdate
	IntegrationDelete
	StageInstanceCreate
	StageInstanceUpdate
	StageInstanceDelete

	StickerCreate AuditLogEvent = iota + 52
	StickerUpdate
	StickerDelete

	GuildScheduledEventCreate AuditLogEvent = iota + 59
	GuildScheduledEventUpdate
	GuildScheduledEventDelete

	ThreadCreate AuditLogEvent = iota + 66
	ThreadUpdate
	ThreadDelete

	ApplicationCommandPermissionUpdate = iota + 74

	AutoModerationRuleCreate = iota + 92
	AutoModerationRuleUpdate
	AutoModerationRuleDelete
	AutoModerationBlockMessage
	AutoModerationFlagToChannel
	AutoModerationUserCommunicationDisabled
)

type Author

type Author struct {
	Name    string  `json:"name,omitempty"`     // name of author
	URL     string  `json:"url,omitempty"`      // url of author
	IconURL *string `json:"icon_url,omitempty"` // url of author icon (only supports http(s) and attachments)
}

Author - author information

func (*Author) SetIconURL

func (a *Author) SetIconURL(u *string) *Author

SetIconURL - set the Author IconURL

func (*Author) SetName

func (a *Author) SetName(name string) *Author

SetName - set the Author Name

func (*Author) SetURL

func (a *Author) SetURL(u string) *Author

SetURL - set the Author URL

type AutoModAction

type AutoModAction struct {
	Type     AutoModerationActionType `json:"type"`     // the type of action
	Metadata AutoModActionMetadata    `json:"metadata"` // additional metadata needed during execution for this specific action type
}

AutoModAction - An action which will execute whenever a rule is triggered.

type AutoModActionMetadata

type AutoModActionMetadata struct {
	ChannelID       Snowflake `json:"channel_id"`
	DurationSeconds int       `json:"duration_seconds"`
}

AutoModActionMetadata - Additional data used when an action is executed. Different fields are relevant based on the value of action type.

type AutoModerationActionType

type AutoModerationActionType int

AutoModerationActionType - the type of action

const (
	BlockMessage AutoModerationActionType = iota + 1
	SendMessage
	Timeout
)

type AutoModerationRule

type AutoModerationRule struct {
	ID              Snowflake       `json:"id"`               // the id of this rule
	GuildID         Snowflake       `json:"guild_id"`         // the id of the guild which this rule belongs to
	Name            string          `json:"name"`             // the rule name
	CreatorID       Snowflake       `json:"creator_id"`       // the user which first created this rule
	EventType       EventType       `json:"event_type"`       // the rule event type
	TriggerType     TriggerType     `json:"trigger_type"`     // the rule trigger type
	TriggerMetadata TriggerMetadata `json:"trigger_metadata"` // the rule trigger metadata
	Actions         []AutoModAction `json:"actions"`          // the actions which will execute when the rule is triggered
	Enabled         bool            `json:"enabled"`          // whether the rule is enabled
	ExemptRoles     []*Snowflake    `json:"exempt_roles"`     // the role ids that should not be affected by the rule (Maximum of 20)
	ExemptChannels  []*Snowflake    `json:"exempt_channels"`  // the channel ids that should not be affected by the rule (Maximum of 50)
}

AutoModerationRule - Auto Moderation is a feature which allows each guild to set up rules that trigger based on some criteria. For example, a rule can trigger whenever a message contains a specific keyword.

Rules can be configured to automatically execute actions whenever they trigger. For example, if a user tries to send a message which contains a certain keyword, a rule can trigger and block the message before it is sent.

func CreateAutoModerationRule

func CreateAutoModerationRule(guildID string,
	channel *Channel,
	userID,
	ruleID *Snowflake,
	payload AutoModerationRuleJSON,
	reason *string) (*AutoModerationRule, error)

CreateAutoModerationRule - Create a new rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Create Gateway event.

This endpoint requires the ManageGuild permission.

func GetAutoModerationRule

func GetAutoModerationRule(guildID string, channel *Channel, userID, ruleID *Snowflake) (*AutoModerationRule,
	error)

GetAutoModerationRule - Get a single rule. Returns an auto moderation rule object.

This endpoint requires the ManageGuild permission.

func ListAutoModerationRulesForGuild

func ListAutoModerationRulesForGuild(guildID string,
	channel *Channel,
	userID *Snowflake) ([]*AutoModerationRule,
	error)

ListAutoModerationRulesForGuild - Get a list of all rules currently configured for the guild. Returns a list of auto moderation rule objects for the given guild.

This endpoint requires the ManageGuild permission.

func ModifyAutoModerationRule

func ModifyAutoModerationRule(guildID string,
	channel *Channel,
	userID, ruleID *Snowflake,
	payload AutoModerationRuleJSON,
	reason *string) (*AutoModerationRule, error)

ModifyAutoModerationRule - Modify an existing rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Update Gateway event.

This endpoint requires the ManageGuild permission.

type AutoModerationRuleJSON

type AutoModerationRuleJSON struct {
	Name            string           `json:"name"`                       // the rule name
	EventType       EventType        `json:"event_type"`                 // the event type
	TriggerType     TriggerType      `json:"trigger_type,omitempty"`     // the trigger metadata; only req for CreateAutoModerationRule
	TriggerMetadata TriggerMetadata  `json:"trigger_metadata,omitempty"` // the actions which will execute when the rule is triggered
	Actions         []*AutoModAction `json:"actions"`                    // whether the rule is enabled
	Enabled         bool             `json:"enabled,omitempty"`
	ExemptRoles     []*Snowflake     `json:"exempt_roles,omitempty"`
	ExemptChannels  []*Snowflake     `json:"exempt_channels,omitempty"`
}

AutoModerationRuleJSON - JSON payload for AutoMod actions

type Ban

type Ban struct {
	Reason *string `json:"reason"` // the reason for the ban
	User   User    `json:"user"`   // the banned user
}

Ban - represents a guild member ban object

type BeginGuildPruneJSON

type BeginGuildPruneJSON struct {
	Days              uint         `json:"days"`                // number of days to prune (1-30)
	ComputePruneCount bool         `json:"compute_prune_count"` // whether `pruned` is returned, discouraged for large guilds
	IncludeRoles      []*Snowflake `json:"include_roles"`       // role(s) to include
}

BeginGuildPruneJSON - JSON payload

type BulkDeleteJSON

type BulkDeleteJSON struct {
	Messages []*Snowflake `json:"messages"`
}

BulkDeleteJSON - JSON payload structure

type Button

type Button struct {
	Type     ComponentType `json:"type"`                // ComponentType for a button
	Style    ButtonStyle   `json:"style"`               // one of ButtonStyle
	Label    string        `json:"label,omitempty"`     // text that appears on the button, max 80 characters
	Emoji    Emoji         `json:"emoji,omitempty"`     // name, id, and animated
	CustomID string        `json:"custom_id,omitempty"` // a developer-defined identifier for the button, max 100 characters
	URL      string        `json:"url,omitempty"`       // a URL for link-style buttons
	Disabled bool          `json:"disabled,omitempty"`  // whether the button is disabled, default false
}

Button - Buttons are interactive components that render on messages.

They can be clicked by users, and send an interaction to your app when clicked.

  • Buttons must be sent inside an ComponentTypeActionRow
  • A ComponentTypeActionRow can contain up to 5 buttons

type ButtonStyle

type ButtonStyle int

ButtonStyle - Buttons come in a variety of styles to convey different types of actions.

These styles also define what fields are valid for a button.

Non-link buttons must have a custom_id, and cannot have a URL
Link buttons must have a URL, and cannot have a custom_id
Link buttons do not send an interaction to your app when clicked
const (
	ButtonPrimary   ButtonStyle = iota + 1 // color: blurple; requires field: custom_id
	ButtonSecondary                        // color: grey; requires field: custom_id
	ButtonSuccess                          // color: green; requires field: custom_id
	ButtonDanger                           // color: red; requires field: custom_id
	ButtonLink                             // color: grey; requires field: url
)

type Channel

type Channel struct {
	ID                            Snowflake        `json:"id"`                                           // the id of this channel
	Type                          ChannelType      `json:"type"`                                         // the ChannelType
	GuildID                       Snowflake        `json:"guild_id,omitempty"`                           // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	Position                      int              `json:"position,omitempty"`                           // sorting position of the channel
	PermissionOverwrites          []*Overwrite     `json:"permission_overwrites,omitempty"`              // explicit permission overwrites for members and roles
	Name                          string           `json:"name,omitempty"`                               // the name of the channel (1-100 characters)
	Topic                         *string          `json:"topic,omitempty"`                              // the channel topic (0-1024 characters)
	Nsfw                          bool             `json:"nsfw,omitempty"`                               // whether the channel is nsfw
	LastMessageID                 *Snowflake       `json:"last_message_id,omitempty"`                    // the id of the last message sent in this channel (may not point to an existing or valid message)
	Bitrate                       int64            `json:"bitrate,omitempty"`                            // the bitrate (in bits) of the voice channel
	UserLimit                     int64            `json:"user_limit,omitempty"`                         // the user limit of the voice channel
	RateLimitPerUser              int64            `json:"rate_limit_per_user,omitempty"`                // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Recipients                    []*User          `json:"recipients,omitempty"`                         // the recipients of the DM
	Icon                          *string          `json:"icon,omitempty"`                               // icon hash of the group DM
	OwnerID                       Snowflake        `json:"owner_id,omitempty"`                           // id of the creator of the group DM or thread
	ApplicationID                 Snowflake        `json:"application_id,omitempty"`                     // application id of the group DM creator if it is bot-created
	Managed                       bool             `json:"managed,omitempty"`                            // for group DM channels: whether the channel is managed by an application via the gdm.join OAuth2 scope
	ParentID                      *Snowflake       `json:"parent_id,omitempty"`                          // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	LastPinTimestamp              *time.Time       `json:"last_pin_timestamp,omitempty"`                 // when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
	RtcRegion                     *string          `json:"rtc_region,omitempty"`                         // voice region id for the voice channel, automatic when set to null
	VideoQualityMode              int64            `json:"video_quality_mode,omitempty"`                 // the camera video quality mode of the voice channel, 1 when not present
	MessageCount                  int64            `json:"message_count,omitempty"`                      // an approximate count of messages in a thread, stops counting at 50
	MemberCount                   int64            `json:"member_count,omitempty"`                       // an approximate count of users in a thread, stops counting at 50
	ThreadMetadata                ThreadMetadata   `json:"thread_metadata,omitempty"`                    // thread-specific fields not needed by other channels
	Member                        ThreadMember     `json:"member,omitempty"`                             // ThreadMember for the current User, if they have joined the thread, only included on certain API endpoints
	DefaultAutoArchiveDuration    int              `json:"default_auto_archive_duration,omitempty"`      // default duration that the clients (not the API) will use for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	Permissions                   string           `json:"permissions"`                                  // computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction
	Flags                         ChannelFlag      `json:"flags,omitempty"`                              // channel flags combined as a bitfield
	TotalMessagesSent             int64            `json:"total_messages_sent,omitempty"`                // number of messages ever sent in a thread, it's similar to MessageCount on message creation, but will not decrement the number when a message is deleted
	AvailableTags                 []*ForumTag      `json:"available_tags,omitempty"`                     // the set of tags that can be used in a GuildForum channel
	AppliedTags                   []*Snowflake     `json:"applied_tags,omitempty"`                       // the IDs of the set of tags that have been applied to a thread in a GuildForum channel
	DefaultReactionEmoji          *DefaultReaction `json:"default_reaction_emoji,omitempty"`             // the emoji to show in the add reaction button on a thread in a GuildForum channel
	DefaultThreadRateLimitPerUser uint             `json:"default_thread_rate_limit_per_user,omitempty"` // the initial RateLimitPerUser to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
	DefaultSortOrder              *SortOrderType   `json:"default_sort_order,omitempty"`                 // the default sort order type used to order posts in GuildForum channels. Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin
	DefaultForumLayout            *ForumLayoutType `json:"default_forum_layout,omitempty"`               // the default forum layout view used to display posts in GuildForum channels. Defaults to NotSet (0), which indicates a layout view has not been set by a channel admin
}

Channel - Represents a guild or DM channel within Discord.

func CreateDM

func CreateDM(payload *CreateDmJSON) (*Channel, error)

CreateDM - Create a new DM Channel with a User. Returns a DM Channel object.

You should not use this endpoint to DM everyone in a server about something.

DMs should generally be initiated by a user action.

If you open a significant amount of DMs too quickly, your bot may be rate limited or blocked from opening new ones.

func CreateGroupDM

func CreateGroupDM(payload *CreateDmJSON) (*Channel, error)

CreateGroupDM - Create a new group DM Channel with multiple users. Returns a DM channel object.

This endpoint was intended to be used with the now-deprecated GameBridge SDK.

DMs created with this endpoint will not be shown in the Discord client

This endpoint is limited to 10 active group DMs.

func GetChannel

func GetChannel(channelID *Snowflake) (*Channel, error)

GetChannel - Get a Channel by ID. Returns a Channel object. If the channel is a thread, a thread member object is included in the returned result.

func (*Channel) AddThreadMember

func (c *Channel) AddThreadMember(userID Snowflake) error

AddThreadMember - Adds another member to a thread.

Requires the ability to send messages in the thread.

Also requires the thread is not archived.

Returns a 204 empty response if the member is successfully added or was already a member of the thread.

Fires a Thread Members Update Gateway event.

func (*Channel) BulkDeleteMessages

func (c *Channel) BulkDeleteMessages(payload BulkDeleteJSON, reason *string) error

BulkDeleteMessages - Delete multiple messages in a single request.

This endpoint can only be used on guild channels and requires the MANAGE_MESSAGES permission.

Returns a 204 empty response on success.

Fires a Message Delete Bulk Gateway event.

Any message IDs given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). This endpoint will not delete messages older than 2 weeks, and will fail with a 400 BAD REQUEST if any message provided is older than that or if any duplicate message IDs are provided.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Channel) CreateChannelInvite

func (c *Channel) CreateChannelInvite(payload CreateChannelInviteJSON, reason *string) (*Invite, error)

CreateChannelInvite - Create a new invite object for the channel.

Only usable for guild channels.

Requires the CreateInstantInvite permission.

All JSON parameters for this route are optional, however the request body is not.

If you are not sending any fields, you still have to send an empty JSON object ({}).

Returns an Invite object. Fires an Invite Create Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Channel) CreateMessage

func (c *Channel) CreateMessage(payload CreateMessageJSON) (*Message, error)

CreateMessage - Post a message to a guild text or DM channel. Returns a message object.

Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and utilizing allowed_mentions to prevent unexpected mentions.

Fires a Message Create Gateway event.

See message formatting for more information on how to properly format messages.

Limitations

  • When operating on a guild channel, the current user must have the SendMessages permission.
  • When sending a message with tts (text-to-speech) set to true, the current user must have the SendTtsMessages permission.
  • When creating a message as a reply to another message, the current user must have the ReadMessageHistory permission.
  • The referenced message must exist and cannot be a system message.
  • The maximum request size when sending a message is 8 MB
  • For the embed object, you can set every field except type (it will be rich regardless of if you try to set it), provider, video, and any height, width, or proxy_url values for images.
  • Files can only be uploaded when using the multipart/form-data content type.

You may create a message as a reply to another message. To do so, include a `message_reference` with a `message_id`. The `channel_id` and `guild_id` in the `message_reference` are optional, but will be validated if provided.

Note that when sending a message, you must provide a value for at least one of content, embeds, or file.

For a file attachment, the Content-Disposition subpart header MUST contain a filename parameter.

This endpoint supports both application/json and multipart/form-data bodies.

When uploading files the multipart/form-data content type must be used.

Note that in multipart form data, the embeds and allowed_mentions fields cannot be used.

You can pass a stringified JSON body as a form value as payload_json instead.

If you supply a payload_json form value, all fields except for file fields will be ignored in the form data.

func (*Channel) CreateReaction

func (c *Channel) CreateReaction(messageID Snowflake, emoji string) error

CreateReaction - Create a reaction for the message.

This endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user.

Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the 'ADD_REACTIONS' permission to be present on the current user.

Returns a 204 empty response on success.

The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.

func (*Channel) CreateWebhook

func (c *Channel) CreateWebhook(name string, avatar *dataurl.DataURL, reason *string) (*Webhook, error)

CreateWebhook - Create a new webhook.

Requires the ManageWebhooks permission.

Returns a Webhook object on success.

Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:

  • Webhook names cannot be: 'clyde'

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Channel) CrosspostMessage

func (c *Channel) CrosspostMessage(messageID string) (*Message, error)

CrosspostMessage - Crosspost a message in an GuildAnnouncement Channel to following channels.

This endpoint requires the 'SEND_MESSAGES' permission, if the current user sent the message, or additionally the 'MANAGE_MESSAGES' permission, for all other messages, to be present for the current user.

Returns a message object.

func (*Channel) DeleteAllReactions

func (c *Channel) DeleteAllReactions(messageID Snowflake) error

DeleteAllReactions - Deletes all reactions on a message.

This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user.

Fires a Message Reaction Remove All Gateway event.

func (*Channel) DeleteAllReactionsForEmoji

func (c *Channel) DeleteAllReactionsForEmoji(messageID Snowflake, emoji string) error

DeleteAllReactionsForEmoji - Deletes all the reactions for a given emoji on a message.

This endpoint requires the MANAGE_MESSAGES permission to be present on the current user.

Fires a Message Reaction Remove Emoji Gateway event.

The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.

func (*Channel) DeleteChannel

func (c *Channel) DeleteChannel(reason *string) error

DeleteChannel - Delete a channel, or close a private message.

Requires the ManageChannels permission for the guild, or ManageThreads if the channel is a thread.

Deleting a category does not delete its child channels; they will have their parent_id removed and a ChannelUpdate Gateway event will fire for each of them.

Returns a channel object on success. Fires a ChannelDelete Gateway event (or ThreadDelete if the channel was a thread).

Deleting a guild channel cannot be undone. Use this with caution, as it is impossible to undo this action when performed on a guild channel. In contrast, when used with a private message, it is possible to undo the action by opening a private message with the recipient again.

For Community guilds, the Rules or Guidelines channel and the Community Updates channel cannot be deleted.

This endpoint supports the `X-Audit-Log-Reason` header.

func (*Channel) DeleteChannelPermission

func (c *Channel) DeleteChannelPermission(overwriteID Snowflake, reason *string) error

DeleteChannelPermission - Delete a channel permission overwrite for a user or role in a channel.

Only usable for guild channels.

Requires the ManageRoles permission.

Returns a 204 empty response on success.

For more information about permissions, see permissions

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Channel) DeleteMessage

func (c *Channel) DeleteMessage(messageID string, reason *string) error

DeleteMessage - Delete a message.

If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the MANAGE_MESSAGES permission.

Returns a 204 empty response on success.

Fires a MessageDelete Gateway event.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Channel) DeleteOwnReaction

func (c *Channel) DeleteOwnReaction(messageID Snowflake, emoji string) error

DeleteOwnReaction - Delete a reaction the current user has made for the message.

Returns a 204 empty response on success.

The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.

func (*Channel) DeleteUserReaction

func (c *Channel) DeleteUserReaction(messageID Snowflake, emoji string, userID Snowflake) error

DeleteUserReaction - Deletes another user's reaction.

This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user.

Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.

func (*Channel) EditChannelPermissions

func (c *Channel) EditChannelPermissions(overwriteID Snowflake,
	payload EditChannelPermissionsJSON,
	reason *string) error

EditChannelPermissions - Edit the channel permission overwrites for a user or role in a channel.

Only usable for guild channels.

Requires the ManageRoles permission.

Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a ManageRoles overwrite in the channel).

Returns a 204 empty response on success.

For more information about permissions, see permissions.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Channel) EditMessage

func (c *Channel) EditMessage(messageID string, payload EditMessageJSON) (*Message, error)

EditMessage - Edit a previously sent message.

The fields content, embeds, and flags can be edited by the original message author. Other users can only edit flags and only if they have the ManageMessages permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only flags documented in the table below may be modified by users (unsupported flag changes are currently ignored without error).

When the content field is edited, the mentions array in the message object will be reconstructed from scratch based on the new content. The allowed_mentions field of the edit request controls how this happens. If there is no explicit allowed_mentions in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an allowed_mentions was present in the request that originally created the message.

Returns a message object.

Fires a Message Update Gateway event.

func (*Channel) FollowAnnouncementChannel

func (c *Channel) FollowAnnouncementChannel(payload FollowAnnouncementChannelJSON) (*FollowedChannel, error)

FollowAnnouncementChannel - Follow an Announcement Channel to send messages to a target channel.

Requires the ManageWebhooks permission in the target channel.

Returns a followed channel object.

func (*Channel) GetChannel

func (c *Channel) GetChannel() (*Channel, error)

GetChannel - Get a channel by ID.

Returns a channel object.

If the channel is a thread, a thread member object is included in the returned result.

func (*Channel) GetChannelInvites

func (c *Channel) GetChannelInvites() ([]*Invite, error)

GetChannelInvites - Returns a list of invite objects (with invite metadata) for the channel.

Only usable for guild channels.

Requires the ManageChannels permission.

func (*Channel) GetChannelMessage

func (c *Channel) GetChannelMessage(messageID string) (*Message, error)

GetChannelMessage - Returns a specific message in the channel.

If operating on a guild channel, this endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user.

Returns a message object on success

func (*Channel) GetChannelMessages

func (c *Channel) GetChannelMessages(around *Snowflake,
	before *Snowflake,
	after *Snowflake,
	limit *int) (
	[]*Message,
	error,
)

GetChannelMessages - Returns the messages for a channel.

If operating on a guild channel, this endpoint requires the ViewChannel permission to be present on the current user.

If the current user is missing the ReadMessageHistory permission in the channel then this will return no messages (since they cannot read the message history).

Returns an array of message objects on success.

SUPPORTS: "around : Snowflake"; "before : Snowflake"; "after : Snowflake"; "limit : int" ; nil

The before, after, and around keys are mutually exclusive, only one may be passed at a time.

TODO: Check permissions; required ViewChannel and ReadMessageHistory

func (*Channel) GetChannelWebhooks

func (c *Channel) GetChannelWebhooks() ([]*Webhook, error)

GetChannelWebhooks - Returns a list of channel webhook objects. Requires the ManageWebhooks permission.

func (*Channel) GetPinnedMessages

func (c *Channel) GetPinnedMessages() ([]*Message, error)

GetPinnedMessages - Returns all pinned messages in the channel as an array of message objects.

func (*Channel) GetReactions

func (c *Channel) GetReactions(messageID Snowflake,
	emoji string,
	after *Snowflake,
	limit *int) ([]*User, error)

GetReactions - Get a list of users that reacted with this emoji.

Returns an array of user objects on success.

The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.

OPTS SUPPORTS: "after : Snowflake"; "limit : int", nil

func (*Channel) GetThreadMember

func (c *Channel) GetThreadMember(userID Snowflake) (*ThreadMember, error)

GetThreadMember - Returns a thread member object for the specified user if they are a member of the thread, returns a 404 response otherwise.

func (*Channel) GroupDmAddRecipient

func (c *Channel) GroupDmAddRecipient(userID Snowflake, payload GroupDmAddRecipientJSON) error

GroupDmAddRecipient - Adds a recipient to a Group DM using their access token.

REQUIRES: gdm.join SCOPE

func (*Channel) GroupDmRemoveRecipient

func (c *Channel) GroupDmRemoveRecipient(userID Snowflake) error

GroupDmRemoveRecipient - Removes a recipient from a Group DM.

func (*Channel) JoinThread

func (c *Channel) JoinThread() error

JoinThread - Adds the current user to a thread.

Also requires the thread is not archived.

Returns a 204 empty response on success.

Fires a ThreadMembersUpdate Gateway event.

func (*Channel) LeaveThread

func (c *Channel) LeaveThread() error

LeaveThread - Removes the current user from a thread.

Also requires the thread is not archived.

Returns a 204 empty response on success.

Fires a ThreadMembersUpdate Gateway event.

func (*Channel) ListJoinedPrivateArchivedThreads

func (c *Channel) ListJoinedPrivateArchivedThreads(before *Snowflake, limit *int) (*ThreadListResponse,
	error)

ListJoinedPrivateArchivedThreads - Returns archived threads in the channel that are of type GuildPrivateThread, and the user has joined.

Threads are ordered by their id, in descending order.

Requires the READ_MESSAGE_HISTORY permission.

func (*Channel) ListPrivateArchivedThreads

func (c *Channel) ListPrivateArchivedThreads(before *time.Time, limit *int) (*ThreadListResponse, error)

ListPrivateArchivedThreads - Returns archived threads in the channel that are of type GuildPrivateThread.

Threads are ordered by archive_timestamp, in descending order.

Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

func (*Channel) ListPublicArchivedThreads

func (c *Channel) ListPublicArchivedThreads(before *time.Time, limit *int) (*ThreadListResponse, error)

ListPublicArchivedThreads - Returns archived threads in the channel that are public.

When called on a GuildText channel, returns threads of type GuildPublicThread.

When called on a GuildAnnouncement channel returns threads of type GuildAnnouncementThread.

Threads are ordered by archive_timestamp, in descending order.

Requires the ReadMessageHistory permission.

func (*Channel) ListThreadMembers

func (c *Channel) ListThreadMembers() ([]*ThreadMember, error)

ListThreadMembers - Returns array of thread members objects that are members of the thread.

This endpoint is restricted according to whether the GuildMembers Privileged Intent is enabled for your application.

func (*Channel) ModifyGroupDm

func (c *Channel) ModifyGroupDm(payload ModifyGroupDmJSON, reason *string) (*Channel, error)

ModifyGroupDm - Fires a ChannelUpdate Gateway event.

func (*Channel) ModifyGuildAnnouncementChannel

func (c *Channel) ModifyGuildAnnouncementChannel(payload ModifyAnnouncementChannelJSON, reason *string) (*Channel,
	error)

func (*Channel) ModifyGuildTextChannel

func (c *Channel) ModifyGuildTextChannel(payload ModifyTextChannelJSON, reason *string) (*Channel, error)

func (*Channel) ModifyGuildVoiceChannel

func (c *Channel) ModifyGuildVoiceChannel(payload ModifyGuildVoiceChannelJSON, reason *string) (*Channel, error)

func (*Channel) ModifyThread

func (c *Channel) ModifyThread(payload ModifyThreadJSON, reason *string) (*Channel, error)

func (*Channel) PinMessage

func (c *Channel) PinMessage(messageID Snowflake, reason *string) error

PinMessage - Pin a message in a channel.

Requires the ManageMessages permission.

Returns a 204 empty response on success.

The max pinned messages is 50.

This endpoint supports the X-Audit-Log-Reason header.

func (*Channel) RemoveThreadMember

func (c *Channel) RemoveThreadMember(userID Snowflake) error

RemoveThreadMember - Removes another member from a thread.

Requires the ManageThreads permission, or the creator of the thread if it is a GuildPrivateThread.

Also requires the thread is not archived.

Returns a 204 empty response on success.

Fires a Thread Members Update Gateway event.

func (*Channel) StartThreadInForumOrMediaChannel added in v10.2.4

func (c *Channel) StartThreadInForumOrMediaChannel(payload StartThreadWithoutMessageJSON, reason *string) (*Channel, error)

StartThreadInForumOrMediaChannel

Creates a new thread in a forum channel, and sends a message within the created thread. Returns a Channel, with a nested Message object, on success, and a 400 BAD REQUEST on invalid parameters. Fires a ThreadCreate and Message Create Gateway event.

The type of the created thread is GuildPublicThread.
See message formatting for more information on how to properly format messages.
The current user must have the SendMessages permission (CreatePublicThreads is ignored).
The maximum request size when sending a message is 8MiB.
For the embed object, you can set every field except type (it will be rich regardless of if you try to set it), provider, video, and any height, width, or proxy_url values for images.
Examples for file uploads are available in Uploading Files.
Files must be attached using a multipart/form-data body as described in Uploading Files.
Note that when sending a message, you must provide a value for at least one of content, embeds, sticker_ids, components, or files[n].

Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and utilizing allowed_mentions to prevent unexpected mentions.

This endpoint supports the X-Audit-Log-Reason header.

func (*Channel) StartThreadWithMessage

func (c *Channel) StartThreadWithMessage(
	messageID Snowflake,
	payload StartThreadWithMessageJSON,
	reason *string,
) (*Channel, error)

StartThreadWithMessage - Creates a new thread from an existing message.

Returns a channel on success, and a 400 BAD REQUEST on invalid parameters.

Fires a ThreadCreate Gateway event.

When called on a GuildText channel, creates a GuildPublicThread. When called on a GuildAnnouncement channel, creates a GuildAnnouncementThread.

Does not work on a GuildForum channel.

The id of the created thread will be the same as the id of the source message, and as such a message can only have a single thread created from it.

This endpoint supports the X-Audit-Log-Reason header.

func (*Channel) StartThreadWithoutMessage

func (c *Channel) StartThreadWithoutMessage(payload StartThreadWithoutMessageJSON, reason *string) (*Channel, error)

StartThreadWithoutMessage - Creates a new thread that is not connected to an existing message.

The created thread defaults to a GuildPrivateThread.

Returns a channel on success, and a 400 BAD REQUEST on invalid parameters.

Fires a ThreadCreate Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

* Creating a GuildPrivateThread requires the server to be boosted. The GuildFeatures will indicate if that is possible for the guild.

func (*Channel) String

func (c *Channel) String() string

String - Converts a Channel into a string for easy output

func (*Channel) TriggerTypingIndicator

func (c *Channel) TriggerTypingIndicator() error

TriggerTypingIndicator - Post a typing indicator for the specified channel.

Generally bots should not implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message.

Returns a 204 empty response on success.

Fires a Typing Start Gateway event.

func (*Channel) UnpinMessage

func (c *Channel) UnpinMessage(messageID Snowflake, reason *string) error

UnpinMessage - Unpin a message in a channel.

Requires the ManageMessages permission.

Returns a 204 empty response on success.

This endpoint supports the X-Audit-Log-Reason header.

type ChannelFlag

type ChannelFlag int

ChannelFlag - channel flags combined as a bitfield

const (
	Pinned     ChannelFlag = 1 << 1 // this thread is pinned to the top of its parent GuildForum channel
	RequireTag ChannelFlag = 1 << 4 // whether a tag is required to be specified when creating a thread in a GuildForum channel. Tags are specified in the AppliedTags field.
)

type ChannelMention

type ChannelMention struct {
	ID      Snowflake   `json:"id"`       // id of the channel
	GuildID Snowflake   `json:"guild_id"` // id of the guild containing the channel
	Type    ChannelType `json:"type"`     // the ChannelType
	Name    string      `json:"name"`     // the name of the channel
}

ChannelMention - representation of a Channel mention

type ChannelType

type ChannelType int

ChannelType - the type of channel

const (
	GuildText               ChannelType = iota     // a text channel within a server
	DM                                             // a direct message between users
	GuildVoice                                     // a voice channel within a server
	GroupDM                                        // a direct message between multiple users
	GuildCategory                                  // an organizational category that contains up to 50 channels
	GuildAnnouncement                              // a channel that users can follow and crosspost into their own server (formerly news channels)
	GuildAnnouncementThread ChannelType = iota + 4 // a temporary sub-channel within a GuildAnnouncement channel
	GuildPublicThread                              // a temporary sub-channel within a GuildText channel
	GuildPrivateThread                             // a temporary sub-channel within a GuildText channel that is only viewable by those invited and those with the ManageThreads permission
	GuildStageVoice                                // a voice channel for hosting events with an audience
	GuildDirectory                                 // the channel in a hub containing the listed servers
	GuildForum                                     // Channel that can only contain threads
	GuildMedia                                     // Channel that can only contain threads, similar to GuildForum channels
)

type Component

type Component struct {
	Type        ComponentType   `json:"type"`                  // ComponentType; valid for all types
	CustomID    string          `json:"custom_id,omitempty"`   // a developer-defined identifier for the button, max 100 characters
	Disabled    bool            `json:"disabled,omitempty"`    // whether the button is disabled, default false
	Style       any             `json:"style,omitempty"`       // one of ButtonStyle
	Label       string          `json:"label,omitempty"`       // text that appears on the button, max 80 characters
	Emoji       *Emoji          `json:"emoji,omitempty"`       // name, id, and animated
	URL         string          `json:"url,omitempty"`         // a URL for link-style buttons
	Options     []*SelectOption `json:"options,omitempty"`     // the choices in the select, max 25
	MinValues   int             `json:"min_values,omitempty"`  // the minimum number of items that must be chosen; default 1, min 0, max 25
	MaxValues   int             `json:"max_values,omitempty"`  // the maximum number of items that can be chosen; default 1, max 25
	Placeholder string          `json:"placeholder,omitempty"` // custom placeholder text if nothing is selected, max 100 characters
	Components  []*Component    `json:"components,omitempty"`  // a list of child components
	MinLength   int             `json:"min_length,omitempty"`  // the minimum input length for a text input
	MaxLength   int             `json:"max_length,omitempty"`  // the maximum input length for a text input
	Required    bool            `json:"required,omitempty"`    // whether this component is required to be filled
	Value       string          `json:"value,omitempty"`       // a pre-filled value for this component
}

Component - Components are a new field on the message object, so you can use them whether you're sending messages or responding to a slash command or other interaction.

The top-level component's field is an array of Action Row components. Deprecated: Use specific component type

func NewComponent

func NewComponent() *Component

NewComponent - Build a new Component

func (*Component) IsDisabled

func (c *Component) IsDisabled() bool

IsDisabled - is the Component disabled

func (*Component) SetButtonStyle

func (c *Component) SetButtonStyle(s ButtonStyle) *Component

SetButtonStyle - sets the style of the Button

func (*Component) SetCustomID

func (c *Component) SetCustomID(t string) *Component

SetCustomID - sets the CustomID of the component

func (*Component) SetDisabled

func (c *Component) SetDisabled(d bool) *Component

SetDisabled - sets the Disabled state of the Component

func (*Component) SetEmoji

func (c *Component) SetEmoji(e *Emoji) *Component

SetEmoji - sets the Emoji for the Button

func (*Component) SetTextInputStyle

func (c *Component) SetTextInputStyle(s TextInputStyle) *Component

SetTextInputStyle - sets the style of the TextInput

func (*Component) SetType

func (c *Component) SetType(t ComponentType) *Component

SetType - sets the Component type

func (*Component) SetURL

func (c *Component) SetURL(u string) *Component

SetURL - sets the URL for the Button

type ComponentType

type ComponentType int

ComponentType - The type of component

const (
	ComponentTypeActionRow         ComponentType = iota + 1 // Container for other components
	ComponentTypeButton                                     // Button object
	ComponentTypeSelectMenu                                 // SelectMenu for picking from defined text options
	ComponentTypeTextInput                                  // TextInput object
	ComponentTypeUserSelect                                 // Select menu for users
	ComponentTypeRoleSelect                                 // Select menu for roles
	ComponentTypeMentionableSelect                          // Select menu for mentionables (users and roles)
	ComponentTypeChannelSelect                              // Select menu for channels
)

type Connection

type Connection struct {
	ID           string                   `json:"id"`                     // id of the connection account
	Name         string                   `json:"name"`                   // the username of the connection account
	Type         Service                  `json:"type"`                   // the service of the connection (Twitch, YouTube)
	Revoked      bool                     `json:"revoked,omitempty"`      // whether the connection is revoked
	Integrations []*Integration           `json:"integrations,omitempty"` // an array of partial server integrations
	Verified     bool                     `json:"verified"`               // whether the connection is verified
	FriendSync   bool                     `json:"friend_sync"`            // whether friend sync is enabled for this connection
	ShowActivity bool                     `json:"show_activity"`          // whether activities related to this connection will be shown in presence updates
	TwoWayLink   bool                     `json:"two_way_link"`           // whether this connection has a corresponding third party OAuth2 token
	Visibility   ConnectionVisibilityType `json:"visibility"`             // visibility of this connection
}

Connection - The connection object that the user has attached.

func GetUserConnections

func GetUserConnections() ([]*Connection, error)

GetUserConnections - Returns a list of Connection objects. Requires the `connections` OAuth2 scope.

type ConnectionVisibilityType

type ConnectionVisibilityType int

ConnectionVisibilityType - visibility of this connection

const (
	ConnectionVisibilityTypeNone     ConnectionVisibilityType = iota // invisible to everyone except the user themselves
	ConnectionVisibilityTypeEveryone                                 // visible to everyone
)

type CreateApplicationCommandJSON

type CreateApplicationCommandJSON struct {
	Name                     string                      `json:"name"`                                 // 1-32 character name
	NameLocalizations        *LocalizationDict           `json:"name_localizations,omitempty"`         // Localization dictionary for the name field. Values follow the same restrictions as name
	Description              string                      `json:"description"`                          // 1-100 character description
	DescriptionLocalizations *LocalizationDict           `json:"description_localizations,omitempty"`  // Localization dictionary for the description field. Values follow the same restrictions as description
	Options                  []*ApplicationCommandOption `json:"options,omitempty"`                    // the parameters for the command
	DefaultMemberPermissions *string                     `json:"default_member_permissions,omitempty"` // Set of permissions represented as a bit set
	DmPermission             *bool                       `json:"dm_permission,omitempty"`              // Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
	DefaultPermission        bool                        `json:"default_permission,omitempty"`         // whether the command is enabled by default when the app is added to a guild; default true
	Type                     ApplicationCommandType      `json:"type,omitempty"`                       // the type of command, defaults 1 if not set
}

CreateApplicationCommandJSON - JSON payload structure

type CreateChannelInviteJSON

type CreateChannelInviteJSON struct {
	MaxAge              uint64           `json:"max_age"`               // duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days)
	MaxUses             int              `json:"max_uses"`              // max number of uses or 0 for unlimited. between 0 and 100
	Temporary           bool             `json:"temporary"`             // whether this invite only grants temporary membership
	Unique              bool             `json:"unique"`                // if true, don't try to reuse a similar invite (useful for creating many unique one time use invites)
	TargetType          InviteTargetType `json:"target_type"`           // the type of target for this voice channel invite
	TargetUserID        Snowflake        `json:"target_user_id"`        // the id of the user whose stream to display for this invite, required if target_type is 1, the user must be streaming in the channel
	TargetApplicationID Snowflake        `json:"target_application_id"` // the id of the embedded application to open for this invite, required if target_type is 2, the application must have the Embedded flag
}

CreateChannelInviteJSON - JSON payload structure

type CreateDmJSON

type CreateDmJSON struct {
	RecipientID Snowflake `json:"recipient_id"` // the recipient to open a DM channel with
}

CreateDmJSON - JSON payload

type CreateEmojiJSON

type CreateEmojiJSON struct {
	Name  string          `json:"name"`  // Name - name of the emoji
	Image base64.Encoding `json:"image"` // Image - the 128x128 emoji image
	Roles []*Snowflake    `json:"roles"` // Roles - roles allowed to use this emoji
}

CreateEmojiJSON - Parameters to pass in the JSON payload

TODO: Validate the base64.Encoding

type CreateGroupDmJSON

type CreateGroupDmJSON struct {
	AccessTokens []string             `json:"access_tokens"` // access tokens of users that have granted your app the `gdm.join` scope
	Nicks        map[Snowflake]string `json:"nicks"`         // a dictionary of user ids to their respective nicknames
}

CreateGroupDmJSON - JSON payload

type CreateGuildChannelJSON

type CreateGuildChannelJSON struct {
	Name                       *string          `json:"name"`                                    // the name of the channel (1-100 characters)
	Type                       *ChannelType     `json:"type,omitempty"`                          // the ChannelType
	Topic                      *string          `json:"topic,omitempty"`                         // the channel topic (0-1024 characters)
	Bitrate                    *int64           `json:"bitrate,omitempty"`                       // the bitrate (in bits) of the voice channel
	UserLimit                  *int64           `json:"user_limit,omitempty"`                    // the user limit of the voice channel
	RateLimitPerUser           *int64           `json:"rate_limit_per_user,omitempty"`           // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Position                   *int             `json:"position,omitempty"`                      // sorting position of the channel
	PermissionOverwrites       []*Overwrite     `json:"permission_overwrites,omitempty"`         // explicit permission overwrites for members and roles
	ParentID                   *Snowflake       `json:"parent_id,omitempty"`                     // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	Nsfw                       *bool            `json:"nsfw,omitempty"`                          // whether the channel is nsfw
	RtcRegion                  *string          `json:"rtc_region,omitempty"`                    // channel voice region id of the voice or stage channel, automatic when set to null
	VideoQualityMode           VideoQualityMode `json:"video_quality_mode,omitempty"`            // the camera video quality mode of the voice channel
	DefaultAutoArchiveDuration *int             `json:"default_auto_archive_duration,omitempty"` // default duration that the clients (not the API) will use for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	DefaultReactionEmoji       DefaultReaction  `json:"default_reaction_emoji,omitempty"`        // Emoji to show in the add Reaction button on a thread in a GuildForum channel
	AvailableTags              []*ForumTag      `json:"available_tags,omitempty"`                // set of tags that can be used in a GuildForum channel
	DefaultSortOrder           SortOrderType    `json:"default_sort_order,omitempty"`            // the default SortOrderType used to order posts in GuildForum channels
}

type CreateGuildFromGuildTemplateJSON

type CreateGuildFromGuildTemplateJSON struct {
	Name string `json:"name"`
	Icon string `json:"icon,omitempty"`
}

CreateGuildFromGuildTemplateJSON - JSON payload

type CreateGuildJSON

type CreateGuildJSON struct {
	Name                        string                          `json:"name"`                          // guild name (2-100 characters, excluding trailing and leading whitespace)
	Icon                        *string                         `json:"icon"`                          // icon hash
	VerificationLevel           VerificationLevel               `json:"verification_level"`            // verification level required for the guild
	DefaultMessageNotifications DefaultMessageNotificationLevel `json:"default_message_notifications"` // default message notifications level
	ExplicitContentFilter       ExplicitContentFilterLevel      `json:"explicit_content_filter"`       // explicit content filter level
	Roles                       []*Role                         `json:"roles"`                         // roles in the guild
	Channels                    []*Channel                      `json:"channels,omitempty"`            // channels in the guild
	AfkChannelID                Snowflake                       `json:"afk_channel_id,omitempty"`      // id of afk channel
	AfkTimeout                  int64                           `json:"afk_timeout"`                   // afk timeout in seconds
	SystemChannelID             *Snowflake                      `json:"system_channel_id"`             // the id of the channel where guild notices such as welcome messages and boost events are posted
	SystemChannelFlags          SystemChannelFlags              `json:"system_channel_flags"`          // system channel flags
}

type CreateGuildRoleJSON

type CreateGuildRoleJSON struct {
	Name         string  `json:"name"`
	Permissions  string  `json:"permissions"`
	Color        uint64  `json:"color"`
	Hoist        bool    `json:"hoist"`
	Icon         *string `json:"icon"`
	UnicodeEmoji *string `json:"unicode_emoji"`
	Mentionable  bool    `json:"mentionable"`
}

CreateGuildRoleJSON - JSON payload

type CreateGuildScheduledEventJSON

type CreateGuildScheduledEventJSON struct {
	ChannelID          Snowflake                         `json:"channel_id,omitempty"`
	EntityMetadata     GuildScheduledEventEntityMetadata `json:"entity_metadata,omitempty"`
	Name               string                            `json:"name"`
	PrivacyLevel       GuildScheduledEventPrivacyLevel   `json:"privacy_level"`
	ScheduledStartTime time.Time                         `json:"scheduled_start_time"`
	ScheduledEndTime   time.Time                         `json:"scheduled_end_time,omitempty"`
	Description        string                            `json:"description,omitempty"`
	EntityType         GuildScheduledEventType           `json:"entity_type"`
	Image              string                            `json:"image,omitempty"`
}

CreateGuildScheduledEventJSON - JSON payload

type CreateGuildTemplateJSON

type CreateGuildTemplateJSON struct {
	Name        string  `json:"name,omitempty"`        // name of the template (1-100 characters)
	Description *string `json:"description,omitempty"` // description for the template (0-120 characters)
}

CreateGuildTemplateJSON - JSON payload

type CreateMessageJSON

type CreateMessageJSON struct {
	Content          string            `json:"content,omitempty"`           // the message contents (up to 2000 characters)
	TTS              bool              `json:"tts,omitempty"`               // true if this is a TTS message
	Embeds           []*Embed          `json:"embeds,omitempty"`            // embedded rich content (up to 6000 characters)
	AllowedMentions  AllowedMentions   `json:"allowed_mentions,omitempty"`  // allowed mentions for the message
	MessageReference *MessageReference `json:"message_reference,omitempty"` // include to make your message a reply
	Components       []*Component      `json:"components,omitempty"`        // the components to include with the message
	StickerIDs       []*Snowflake      `json:"sticker_ids,omitempty"`       // IDs of up to 3 stickers in the server to send in the message
	PayloadJson      string            `json:"payload_json,omitempty"`      // JSON encoded body of non-file params
	Attachments      []*Attachment     `json:"attachments,omitempty"`       // attachment objects with filename and description
	Flags            MessageFlags      `json:"flags,omitempty"`             // message flags combined as a bitfield (only SUPPRESS_EMBEDS can be set)
}

CreateMessageJSON - JSON payload structure TODO: files[n]

type CreateStageInstanceJSON

type CreateStageInstanceJSON struct {
	ChannelID             Snowflake    `json:"channel_id"`                        // The id of the StageChannel
	Topic                 string       `json:"topic"`                             // The topic of the Stage instance (1-120 characters)
	PrivacyLevel          PrivacyLevel `json:"privacy_level"`                     // The privacy level of the Stage instance (default GuildOnly)
	SendStartNotification bool         `json:"send_start_notification,omitempty"` // Notify @everyone that a Stage instance has started
}

CreateStageInstanceJSON - data to send in the CreateStageInstance payload

type DefaultMessageNotificationLevel

type DefaultMessageNotificationLevel int

DefaultMessageNotificationLevel - default message notifications level

const (
	AllMessages  DefaultMessageNotificationLevel = iota // members will receive notifications for all messages by default
	OnlyMentions                                        // members will receive notifications only for messages that @mention them by default
)

type DefaultReaction

type DefaultReaction struct {
	EmojiID   *Snowflake `json:"emoji_id"`   // the id of a guild's custom emoji
	EmojiName *string    `json:"emoji_name"` // the unicode character of the emoji
}

DefaultReaction - An object that specifies the emoji to use as the default way to react to a forum post. Exactly one of emoji_id and emoji_name must be set.

type EditApplicationCommandJSON

type EditApplicationCommandJSON struct {
	Name                     string                      `json:"name"`                                 // 1-32 character name
	NameLocalizations        *LocalizationDict           `json:"name_localizations,omitempty"`         // Localization dictionary for the name field. Values follow the same restrictions as name
	Description              string                      `json:"description"`                          // 1-100 character description
	DescriptionLocalizations *LocalizationDict           `json:"description_localizations,omitempty"`  // Localization dictionary for the description field. Values follow the same restrictions as description
	Options                  []*ApplicationCommandOption `json:"options,omitempty"`                    // the parameters for the command
	DefaultMemberPermissions *string                     `json:"default_member_permissions,omitempty"` // Set of permissions represented as a bit set
	DmPermission             *bool                       `json:"dm_permission,omitempty"`              // Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
	DefaultPermission        bool                        `json:"default_permission,omitempty"`         // whether the command is enabled by default when the app is added to a guild; default true
}

EditApplicationCommandJSON - JSON payload structure

type EditApplicationCommandPermissionsJSON

type EditApplicationCommandPermissionsJSON struct {
	Permissions []*ApplicationCommandPermissions `json:"permissions"` // the permissions for the command in the guild
}

EditApplicationCommandPermissionsJSON - JSON payload structure

type EditChannelPermissionsJSON

type EditChannelPermissionsJSON struct {
	Allow *string       `json:"allow,omitempty"` // the bitwise value of all allowed permissions (default "0")
	Deny  *string       `json:"deny,omitempty"`  // the bitwise value of all disallowed permissions (default "0")
	Type  OverwriteType `json:"type"`            // 0 for a role or 1 for a member
}

EditChannelPermissionsJSON - JSON payload structure

type EditMessageJSON

type EditMessageJSON struct {
	Content         *string          `json:"content,omitempty"`
	Embeds          []*Embed         `json:"embeds,omitempty"`
	Flags           *int             `json:"flags,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []*Component     `json:"components,omitempty"`
	PayloadJson     *string          `json:"payload_json,omitempty"`
	Attachments     []*Attachment    `json:"attachments,omitempty"`
}

EditMessageJSON - JSON payload structure

All parameters are optional and nullable.

TODO: files[n]

type EditWebhookMessageJSON

type EditWebhookMessageJSON struct {
	Content         *string          `json:"content,omitempty"`          // the message contents (up to 2000 characters)
	Embeds          []*Embed         `json:"embeds,omitempty"`           // embedded rich content
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // allowed mentions for the message
	Components      []*Component     `json:"components,omitempty"`       // the components to include with the message
	PayloadJson     *string          `json:"payload_json,omitempty"`     // JSON encoded body of non-file params (multipart/form-data only)
	Attachments     []*Attachment    `json:"attachments,omitempty"`      // attached files to keep and possible descriptions for new files
}

EditWebhookMessageJSON - All parameters to this endpoint are optional and nullable.

type Embed

type Embed struct {
	Title       string     `json:"title,omitempty"`       // title of embed
	Type        EmbedType  `json:"type,omitempty"`        // EmbedType (always RichEmbed for webhook embeds)
	Description string     `json:"description,omitempty"` // description of embed
	URL         string     `json:"url,omitempty"`         // url of embed
	Timestamp   string     `json:"timestamp,omitempty"`   // timestamp of embed content
	Color       int64      `json:"color,omitempty"`       // color code of the embed
	Footer      *Footer    `json:"footer,omitempty"`      // footer information
	Image       *Image     `json:"image,omitempty"`       // image information
	Thumbnail   *Thumbnail `json:"thumbnail,omitempty"`   // thumbnail information
	Video       *video     `json:"video,omitempty"`       // video information; cannot set this when sending an Embed
	Provider    *provider  `json:"provider,omitempty"`    // provider information; cannot set this when sending an Embed
	Author      *Author    `json:"author,omitempty"`      // author information
	Fields      []*Field   `json:"fields,omitempty"`      // fields information
}

Embed - contains rich content

func NewEmbed

func NewEmbed() *Embed

NewEmbed - Instantiates a new Embed object with the color defaulted to red and the timestamp defaulted to time.Now()

func (*Embed) AddField

func (e *Embed) AddField(name, value string, inline bool) *Embed

AddField - Add a singular Field

func (*Embed) AddFields

func (e *Embed) AddFields(fields ...*Field) *Embed

AddFields - Add multiple fields; must create the Field objects first

func (*Embed) IsValidLength

func (e *Embed) IsValidLength() bool

IsValidLength - Checks that the total size of an Embed is valid for sending

func (*Embed) SetAuthor

func (e *Embed) SetAuthor(name, url string, iconURL *string) *Embed

SetAuthor - Set the Author

func (*Embed) SetColor

func (e *Embed) SetColor(c int64) *Embed

SetColor - Set the Embed color

func (*Embed) SetDescription

func (e *Embed) SetDescription(description string) *Embed

SetDescription - Set the Embed description

func (*Embed) SetFooter

func (e *Embed) SetFooter(text string, iconURL string) *Embed

SetFooter - Set the Footer

func (*Embed) SetImage

func (e *Embed) SetImage(imageURL string) *Embed

SetImage - Set the Image

func (*Embed) SetThumbnail

func (e *Embed) SetThumbnail(thumbnailURL string) *Embed

SetThumbnail - Set the Thumbnail

func (*Embed) SetTimestamp

func (e *Embed) SetTimestamp(ts time.Time) *Embed

SetTimestamp - Set the Embed timestamp

func (*Embed) SetTitle

func (e *Embed) SetTitle(title string) *Embed

SetTitle - Set the Embed title

func (*Embed) SetURL

func (e *Embed) SetURL(u string) *Embed

SetURL - Set the Embed URL

type EmbedType

type EmbedType string

EmbedType - Embed types are "loosely defined" and, for the most part, are not used by our clients for rendering.

Embed attributes power what is rendered.

Embed types should be considered deprecated and might be removed in a future API version.

const (
	RichEmbed EmbedType = "rich" // generic embed rendered from embed attributes

)

type Emoji

type Emoji struct {
	ID            *Snowflake `json:"id"`                       // ID - emoji id
	Name          string     `json:"name"`                     // Name - emoji name
	Roles         []*Role    `json:"roles,omitempty"`          // Roles - roles allowed to use this emoji
	User          *User      `json:"user,omitempty"`           // User - user that created this emoji
	RequireColons bool       `json:"require_colons,omitempty"` // RequireColons - whether this emoji must be wrapped in colons
	Managed       bool       `json:"managed,omitempty"`        // Managed - whether this emoji is managed
	Animated      bool       `json:"animated,omitempty"`       // Animated - whether this emoji is animated
	Available     bool       `json:"available,omitempty"`      // Available - whether this emoji can be used, may be false due to loss of Server Boosts
}

Emoji - Routes for controlling emojis do not follow the normal rate limit conventions.

These routes are specifically limited on a per-guild basis to prevent abuse.

This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s.

type EventType

type EventType int

EventType - Indicates in what event context a rule should be checked.

const (
	MessageSend EventType = iota + 1 // when a member sends or edits a message in the guild
)

type ExecuteWebhookJSON

type ExecuteWebhookJSON struct {
	Content         string           `json:"content"`                    // the message contents (up to 2000 characters); Required - one of content, file, embeds
	Username        string           `json:"username,omitempty"`         // override the default username of the webhook; Required - false
	AvatarURL       string           `json:"avatar_url,omitempty"`       // override the default avatar of the webhook; Required - false
	Tts             bool             `json:"tts,omitempty"`              // true if this is a TTS message; Required - false
	Embeds          []*Embed         `json:"embeds"`                     // embedded rich content; Required - one of content, file, embeds
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // allowed mentions for the message; Required - false
	Components      []*Component     `json:"components,omitempty"`       // the components to include with the message - Required - false
	PayloadJson     string           `json:"payload_json"`               // JSON encoded body of non-file params; Required - "multipart/form-data" only
	Attachments     []*Attachment    `json:"attachments,omitempty"`      // Attachment objects with filename and description; Required - false
	Flags           MessageFlags     `json:"flags,omitempty"`            // MessageFlags combined as a bitfield (only SuppressEmbeds can be set)
	ThreadName      string           `json:"thread_name"`                // name of thread to create (requires the webhook channel to be a forum channel)
	AppliedTags     []Snowflake      `json:"applied_tags"`               // array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel)
}

ExecuteWebhookJSON - JSON payload structure

type ExplicitContentFilterLevel

type ExplicitContentFilterLevel int

ExplicitContentFilterLevel - explicit content filter level

const (
	Disabled            ExplicitContentFilterLevel = iota // media content will not be scanned
	MembersWithoutRoles                                   // media content sent by members without roles will be scanned
	AllMembers                                            // media content sent by all members will be scanned
)

type Field

type Field struct {
	Name   string `json:"name"`   // name of the field
	Value  string `json:"value"`  // value of the field
	Inline bool   `json:"inline"` // whether this field should display inline
}

Field - fields information

func NewField

func NewField() *Field

NewField - Create a new base Field to chain against

func (*Field) IsInline

func (f *Field) IsInline() bool

IsInline - Helper function for testing is inline

func (*Field) SetInline

func (f *Field) SetInline(inline bool) *Field

SetInline - set the Field Inline

func (*Field) SetName

func (f *Field) SetName(name string) *Field

SetName - set the Field Name

func (*Field) SetValue

func (f *Field) SetValue(value string) *Field

SetValue - set the Field Value

type FollowAnnouncementChannelJSON

type FollowAnnouncementChannelJSON struct {
	WebhookChannelID Snowflake `json:"webhook_channel_id"`
}

FollowAnnouncementChannelJSON - JSON payload structure

type FollowedChannel

type FollowedChannel struct {
	ChannelID Snowflake `json:"channel_id"` // source Channel id
	WebhookID Snowflake `json:"webhook_id"` // created target Webhook id
}

FollowedChannel - representation of a followed News Channel

type Footer struct {
	Text    string `json:"text"`               // footer text
	IconURL string `json:"icon_url,omitempty"` // url of footer icon (only supports http(s) and attachments)
}

Footer - footer information

func (*Footer) SetIconURL

func (f *Footer) SetIconURL(iconURL string) *Footer

SetIconURL - set the Footer IconURL

func (*Footer) SetText

func (f *Footer) SetText(text string) *Footer

SetText - set the Footer text

type Format

type Format string

Format - Discord utilizes a subset of markdown for rendering message content on its clients, while also adding some custom functionality to enable things like mentioning users and channels.

const (
	ChannelFormat Format = "<#%s>" // ChannelFormat - <#CHANNEL_ID>

)

type FormattedSnowflake

type FormattedSnowflake struct {
	Timestamp         int64
	InternalWorkerID  int64
	InternalProcessID int64
	Increment         int64
}

FormattedSnowflake - A breakdown of the data contained in a Snowflake

type ForumLayoutType

type ForumLayoutType int

ForumLayoutType - the default forum layout view used to display posts in GuildForum channels.

const (
	NotSet      ForumLayoutType = iota // No default has been set for forum channel
	ListView                           // Display posts as a list
	GalleryView                        // Display posts as a collection of tiles
)

type ForumOrMediaThreadMessageParams added in v10.2.4

type ForumOrMediaThreadMessageParams struct {
	Content         string          `json:"content"`          // Message contents (up to 2000 characters)
	Embeds          []*Embed        `json:"embeds"`           // Up to 10 rich embeds (up to 6000 characters)
	AllowedMentions AllowedMentions `json:"allowed_mentions"` // Allowed mentions for the message
	Components      []*Component    `json:"components"`       // Components to include with the message
	StickerIDs      []*Snowflake    `json:"sticker_ids"`      // IDs of up to 3 stickers in the server to send in the message
	Attachments     []*Attachment   `json:"attachments"`      // attachment objects with filename and description
	Flags           MessageFlags    `json:"flags"`            // Message flags combined as a bitfield (only SuppressEmbeds and SuppressNotifications can be set)
}

ForumOrMediaThreadMessageParams - JSON for starting a new forum thread

TODO: files[n]

type ForumTag

type ForumTag struct {
	ID        Snowflake `json:"id"`         // the id of the tag
	Name      string    `json:"name"`       // the name of the tag (0-20 characters)
	Moderated bool      `json:"moderated"`  // whether this tag can only be added to or removed from threads by a member with the ManageThreads permission
	EmojiID   Snowflake `json:"emoji_id"`   // the id of a guild's custom emoji
	EmojiName *string   `json:"emoji_name"` // the unicode character of the emoji
}

ForumTag - An object that represents a tag that is able to be applied to a thread in a GuildForum channel.

When updating a GuildForum channel, tag objects in available_tags only require the Name field.

At most one of EmojiID and EmojiName may be set.

type GetGatewayBotResponse added in v10.1.1

type GetGatewayBotResponse struct {
	Url               string `json:"url"`
	Shards            int    `json:"shards"`
	SessionStartLimit struct {
		Total          int `json:"total"`
		Remaining      int `json:"remaining"`
		ResetAfter     int `json:"reset_after"`
		MaxConcurrency int `json:"max_concurrency"`
	} `json:"session_start_limit"`
}

func GetGatewayBot added in v10.1.1

func GetGatewayBot() (*GetGatewayBotResponse, error)

type GetGatewayResponse added in v10.1.1

type GetGatewayResponse struct {
	Url string `json:"url"`
}

func GetGateway added in v10.1.1

func GetGateway() (*GetGatewayResponse, error)

type GetGuildPruneCountResponse

type GetGuildPruneCountResponse struct {
	Pruned *uint64 `json:"pruned"`
}

type GetGuildWidget

type GetGuildWidget struct {
	ID            Snowflake      `json:"id"`             // guild id
	Name          string         `json:"name"`           // guild name (2-100 characters)
	InstantInvite *string        `json:"instant_invite"` // instant invite for the guilds specified widget invite channel
	Channels      []*Channel     `json:"channels"`       // voice and stage channels which are accessible by @everyone
	Members       []*GuildMember `json:"members"`        // special widget user objects that includes users presence (Limit 100)
	PresenceCount int            `json:"presence_count"` // number of online members in this guild
}

GetGuildWidget - the guild widget

The fields `id`, `discriminator` and `avatar` are anonymized to prevent abuse.

type GroupDmAddRecipientJSON

type GroupDmAddRecipientJSON struct {
	AccessToken string `json:"access_token"` // access token of a user that has granted your app the gdm.join scope
	Nick        string `json:"nick"`         // nickname of the user being added
}

GroupDmAddRecipientJSON - JSON payload structure

IMPORTANT: requires a Bearer token for the user

type Guild

type Guild struct {
	ID                          Snowflake                       `json:"id"`                                      // guild id
	Name                        string                          `json:"name"`                                    // guild name (2-100 characters, excluding trailing and leading whitespace)
	Icon                        *string                         `json:"icon"`                                    // icon hash
	IconHash                    *string                         `json:"icon_hash,omitempty"`                     // icon hash, returned when in the template object
	Splash                      *string                         `json:"splash,omitempty"`                        // splash hash
	DiscoverySplash             *string                         `json:"discovery_splash"`                        // discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
	OwnerID                     Snowflake                       `json:"owner_id"`                                // id of owner
	AfkChannelID                Snowflake                       `json:"afk_channel_id,omitempty"`                // id of afk channel
	AfkTimeout                  int                             `json:"afk_timeout"`                             // afk timeout in seconds
	WidgetEnabled               bool                            `json:"widget_enabled,omitempty"`                // true if the server widget is enabled
	WidgetChannelID             *Snowflake                      `json:"widget_channel_id,omitempty"`             // the channel id that the widget will generate an "invite" to, or null if set to no invite
	VerificationLevel           VerificationLevel               `json:"verification_level"`                      // verification level required for the guild
	DefaultMessageNotifications DefaultMessageNotificationLevel `json:"default_message_notifications"`           // default message notifications level
	ExplicitContentFilter       ExplicitContentFilterLevel      `json:"explicit_content_filter"`                 // explicit content filter level
	Roles                       []*Role                         `json:"roles"`                                   // roles in the guild
	Emojis                      []*Emoji                        `json:"emojis"`                                  // custom guild emojis
	Features                    []*GuildFeatures                `json:"features"`                                // enabled guild features
	MfaLevel                    MfaLevel                        `json:"mfa_level"`                               // required MFA level for the guild
	ApplicationID               *Snowflake                      `json:"application_id"`                          // application id of the guild creator if it is bot-created
	SystemChannelID             *Snowflake                      `json:"system_channel_id"`                       // the id of the channel where guild notices such as welcome messages and boost events are posted
	SystemChannelFlags          SystemChannelFlags              `json:"system_channel_flags"`                    // system channel flags
	RulesChannelID              *Snowflake                      `json:"rules_channel_id"`                        // the id of the channel where Community guilds can display rules and/or guidelines
	MaxPresences                *int64                          `json:"max_presences,omitempty"`                 // the maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
	MaxMembers                  int64                           `json:"max_members,omitempty"`                   // the maximum number of members for the guild
	VanityUrlCode               *string                         `json:"vanity_url_code"`                         // the vanity url code for the guild
	Description                 *string                         `json:"description"`                             // the description of a Community guild
	Banner                      *string                         `json:"banner"`                                  // banner hash
	PremiumTier                 PremiumTier                     `json:"premium_tier"`                            // premium tier (Server Boost level)
	PremiumSubscriptionCount    uint64                          `json:"premium_subscription_count,omitempty"`    // the number of boosts this guild currently has
	PreferredLocale             string                          `json:"preferred_locale"`                        // the preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
	PublicUpdatesChannelID      *Snowflake                      `json:"public_updates_channel_id"`               // the id of the channel where admins and moderators of Community guilds receive notices from Discord
	MaxVideoChannelUsers        uint64                          `json:"max_video_channel_users,omitempty"`       // the maximum amount of users in a video channel
	MaxStageVideoChannelUsers   uint64                          `json:"max_stage_video_channel_users,omitempty"` // the maximum amount of users in a stage video channel
	ApproximateMemberCount      uint64                          `json:"approximate_member_count,omitempty"`      // approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
	ApproximatePresenceCount    uint64                          `json:"approximate_presence_count,omitempty"`    // approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
	WelcomeScreen               WelcomeScreen                   `json:"welcome_screen,omitempty"`                // the welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
	NsfwLevel                   GuildNsfwLevel                  `json:"nsfw_level"`                              // guild NSFW level
	Stickers                    []*Sticker                      `json:"stickers,omitempty"`                      // custom guild stickers
	PremiumProgressBarEnabled   bool                            `json:"premium_progress_bar_enabled"`            // whether the guild has the boost progress bar enabled

	Owner       bool   `json:"owner,omitempty"`       // true if the user is the owner of the guild
	Permissions string `json:"permissions,omitempty"` // total permissions for the user in the guild (excludes overwrites)
}

Guild - Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI.

func CreateGuild

func CreateGuild(payload *CreateGuildJSON) (*Guild, error)

CreateGuild

Create a new guild. Returns a guild object on success. Fires a GuildCreate Gateway event.

This endpoint can be used only by bots in less than 10 guilds.

When using the roles parameter, the first member of the array is used to change properties of the guild's @everyone role. If you are trying to bootstrap a guild with additional roles, keep this in mind.

When using the roles parameter, the required id field within each role object is an integer placeholder, and will be replaced by the API upon consumption. Its purpose is to allow you to overwrite a role's permissions in a channel when also passing in channels with the channels array.

When using the channels parameter, the position field is ignored, and none of the default channels are created.

When using the channels parameter, the id field within each channel object may be set to an integer placeholder, and will be replaced by the API upon consumption. Its purpose is to allow you to create GUILD_CATEGORY channels by setting the parent_id field on any children to the category's id field. Category channels must be listed before any children.

func CreateGuildFromGuildTemplate

func CreateGuildFromGuildTemplate(templateCode string, payload *CreateGuildFromGuildTemplateJSON) (*Guild, error)

CreateGuildFromGuildTemplate - Create a new guild based on a template. Returns a guild object on success. Fires a GuildCreate Gateway event.

This endpoint can be used only by bots in less than 10 guilds.

func GetCurrentUserGuilds

func GetCurrentUserGuilds(before *Snowflake, after *Snowflake, limit *uint64) ([]*Guild, error)

GetCurrentUserGuilds - Returns a list of partial Guild objects the current user is a member of. Requires the `guilds` OAuth2 scope.

func (*Guild) AddGuildMember

func (g *Guild) AddGuildMember(userID *Snowflake, payload *AddGuildMemberJSON) (*GuildMember, error)

AddGuildMember - Adds a user to the guild, provided you have a valid oauth2 access token for the user with the `guilds.join` scope.

Returns a 201 Created with the guild member as the body, or 204 No Content if the user is already a member of the guild.

Fires a GuildMemberAdd Gateway event.

For guilds with MembershipScreening enabled, this endpoint will default to adding new members as pending in the guild member object.

Members that are pending will have to complete membership screening before they become full members that can talk.

All parameters to this endpoint except for access_token are optional.

The Authorization header must be a Bot token (belonging to the same application used for authorization), and the bot must be a member of the guild with CreateInstantInvite permission.

For guilds with Membership Screening enabled, assigning a role using the `roles` parameter will add the user to the guild as a full member (pending is false in the member object).

A member with a role will bypass membership screening and the guild's verification level, and get immediate access to chat.

Therefore, instead of assigning a role when the member joins, it is recommended to grant roles only after the user completes screening.

func (*Guild) AddGuildMemberRole

func (g *Guild) AddGuildMemberRole(user *User, roleID *Snowflake, reason *string) error

AddGuildMemberRole - Adds a role to a guild member.

Requires the ManageRoles permission.

Returns a 204 empty response on success.

Fires a Guild Member Update Gateway event.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Guild) BeginGuildPrune

func (g *Guild) BeginGuildPrune(payload *BeginGuildPruneJSON, reason *string) (*GetGuildPruneCountResponse, error)

BeginGuildPrune - Begin a prune operation.

Requires the KickMembers permission.

Returns an object with one pruned key indicating the number of members that were removed in the prune operation.

For large guilds it's recommended to set the `compute_prune_count` option to false, forcing pruned to null.

Fires multiple GuildMemberRemove Gateway events.

By default, prune will not remove users with roles.

You can optionally include specific roles in your prune by providing the include_roles parameter.

Any inactive user that has a subset of the provided role(s) will be included in the prune and users with additional roles will not.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) CreateGuildBan

func (g *Guild) CreateGuildBan(userID *Snowflake, deleteMessageSeconds *uint64, reason *string) error

CreateGuildBan - Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BanMembers permission. Returns a 204 empty response on success. Fires a GuildBanAdd Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) CreateGuildChannel

func (g *Guild) CreateGuildChannel(payload CreateGuildChannelJSON, reason *string) (*Channel, error)

CreateGuildChannel - Create a new channel object for the guild.

Requires the ManageChannels permission.

If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied.

Setting ManageRoles permission in channels is only possible for guild administrators.

Returns the new channel object on success. Fires a ChannelCreate Gateway event.

All parameters to this endpoint are optional excluding name

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) CreateGuildEmoji

func (g *Guild) CreateGuildEmoji(payload *CreateEmojiJSON, reason *string) (*Emoji, error)

CreateGuildEmoji - Create a new emoji for the guild.

Requires the CreateGuildExpressions permission.

Returns the new Emoji object on success.

Fires a GuildEmojisUpdate Gateway event.

Emojis and animated emojis have a maximum file size of 256kb.

Attempting to upload an emoji larger than this limit will fail and return "400 Bad Request" and an error message, but not a JSON status code.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Guild) CreateGuildRole

func (g *Guild) CreateGuildRole(payload *CreateGuildRoleJSON, reason *string) ([]*Role, error)

func (*Guild) CreateGuildScheduledEvent

func (g *Guild) CreateGuildScheduledEvent(payload *CreateGuildScheduledEventJSON, reason *string) (
	*GuildScheduledEvent,
	error,
)

CreateGuildScheduledEvent - Create a GuildScheduledEvent in the Guild. Returns a guild scheduled event object on success.

A guild can have a maximum of 100 events with Scheduled or Active status at any time.

This endpoint supports the `X-Audit-Log-Reason` header.

func (*Guild) CreateGuildSticker

func (g *Guild) CreateGuildSticker() (*Sticker, error)

CreateGuildSticker - Create a new sticker for the guild.

Send a multipart/form-data body.

Requires the CreateGuildExpressions permission.

Returns the new sticker object on success.

Fires a GuildStickersUpdateGateway event.

This endpoint supports the "X-Audit-Log-Reason" header.

Lottie stickers can only be uploaded on guilds that have either the Verified and/or the Partnered guild feature.

Uploaded stickers are constrained to 5 seconds in length for animated stickers, and 320 x 320 pixels. TODO: FormData fields

func (*Guild) CreateGuildTemplate

func (g *Guild) CreateGuildTemplate(payload *CreateGuildTemplateJSON) (*GuildTemplate, error)

func (*Guild) DeleteGuild

func (g *Guild) DeleteGuild() error

DeleteGuild - Delete a guild permanently. User must be Owner. Returns `204 No Content` on success. Fires a GuildDelete Gateway event.

func (*Guild) DeleteGuildEmoji

func (g *Guild) DeleteGuildEmoji(emoji *Emoji, reason *string) error

DeleteGuildEmoji - Delete the given emoji.

For emojis created by the current user, requires either the CreateGuildExpressions or ManageGuildExpressions permission.

For other emojis, requires the ManageGuildExpressions permission.

Returns "204 No Content" on success.

Fires a GuildEmojisUpdate Gateway event.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Guild) DeleteGuildIntegration

func (g *Guild) DeleteGuildIntegration(integrationID *Snowflake, reason *string) error

DeleteGuildIntegration - Delete the attached integration object for the guild.

Deletes any associated webhooks and kicks the associated bot if there is one.

Requires the ManageGuild permission.

Returns a 204 empty response on success.

Fires a GuildIntegrationsUpdate Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) DeleteGuildRole

func (g *Guild) DeleteGuildRole(roleID *Snowflake, reason *string) error

DeleteGuildRole - Delete a guild role.

Requires the ManageRoles permission.

Returns a 204 empty response on success.

Fires a GuildRoleDelete Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) DeleteGuildScheduledEvent

func (g *Guild) DeleteGuildScheduledEvent(guildScheduledEventID *Snowflake) error

DeleteGuildScheduledEvent - Delete a guild scheduled event. Returns a 204 on success.

func (*Guild) DeleteGuildSticker

func (g *Guild) DeleteGuildSticker(stickerID Snowflake, reason *string) error

DeleteGuildSticker - Delete the given sticker.

For stickers created by the current user, requires either the CreateGuildExpressions or ManageGuildExpressions permission.

For other stickers, requires the ManageGuildExpressions permission.

Returns "204 No Content" on success.

This endpoint supports the `X-Audit-Log-Reason` header.

func (*Guild) DeleteGuildTemplate

func (g *Guild) DeleteGuildTemplate(templateCode string) error

DeleteGuildTemplate - Deletes the template.

Requires the ManageGuild permission. Returns the deleted GuildTemplate object on success. TODO: This DELETE endpoint returns a payload; update the delete request and all other methods that use it accordingly

func (*Guild) GetCurrentUserGuildMember

func (g *Guild) GetCurrentUserGuildMember() (*GuildMember, error)

GetCurrentUserGuildMember - Returns a GuildMember object for the current user. Requires the `guilds.members.read` OAuth2 scope.

func (*Guild) GetGuild

func (g *Guild) GetGuild(withCounts *bool) (*Guild, error)

GetGuild - Returns the guild object for the given id.

If with_counts is set to true, this endpoint will also return approximate_member_count and approximate_presence_count for the guild.

func (*Guild) GetGuildAuditLog

func (g *Guild) GetGuildAuditLog(userID *Snowflake,
	actionType *uint64,
	before, after *Snowflake,
	limit *uint64) (*AuditLog,
	error)

GetGuildAuditLog - Returns an audit log object for the Guild. Requires the ViewAuditLog permission.

The returned list of AuditLogEntry is ordered based on whether you use before or after.

When using before, the list is ordered by the audit log entry ID descending (newer entries first).

If after is used, the list is reversed and appears in ascending order (older entries first).

Omitting both before and after defaults to before the current timestamp and will show the most recent entries in descending order by ID, the opposite can be achieved using after=0 (showing oldest entries).

func (*Guild) GetGuildBan

func (g *Guild) GetGuildBan(userID Snowflake) (*Ban, error)

GetGuildBan - Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BanMembers permission.

func (*Guild) GetGuildBans

func (g *Guild) GetGuildBans(limit *uint64, before *Snowflake, after *Snowflake) ([]*Ban, error)

GetGuildBans - Returns a list of Ban objects for the users banned from this guild. Requires the BanMembers permission.

func (*Guild) GetGuildChannels

func (g *Guild) GetGuildChannels() ([]*Channel, error)

GetGuildChannels - Returns a list of guild Channel objects. Does not include threads.

func (*Guild) GetGuildEmoji

func (g *Guild) GetGuildEmoji(emoji *Emoji) (*Emoji, error)

GetGuildEmoji - Returns an emoji object for the given guild and emoji IDs. Includes the user field if the bot has the ManageGuildExpressions permission, or if the bot created the emoji and has the CreateGuildExpressions permission.

func (*Guild) GetGuildIntegrations

func (g *Guild) GetGuildIntegrations() ([]*Integration, error)

GetGuildIntegrations - Returns a list of integration objects for the guild.

Requires the ManageGuild permission.

func (*Guild) GetGuildInvites

func (g *Guild) GetGuildInvites() ([]*Invite, error)

GetGuildInvites - Returns a list of invite objects (with invite metadata) for the guild.

Requires the ManageGuild permission.

func (*Guild) GetGuildMember

func (g *Guild) GetGuildMember(userID *Snowflake) (*GuildMember, error)

GetGuildMember - Returns a GuildMember object for the specified User.

func (*Guild) GetGuildOnboarding added in v10.2.0

func (g *Guild) GetGuildOnboarding() (*GuildOnboarding, error)

func (*Guild) GetGuildPreview

func (g *Guild) GetGuildPreview() (*GuildPreview, error)

GetGuildPreview - Returns the guild preview object for the given id. If the user is not in the guild, then the guild must be lurkable.

func (*Guild) GetGuildPruneCount

func (g *Guild) GetGuildPruneCount(days uint, includeRoles *string) (*GetGuildPruneCountResponse, error)

GetGuildPruneCount - Returns an object with one pruned key indicating the number of members that would be removed in a prune operation.

Requires the KickMembers permission.

By default, prune will not remove users with roles.

You can optionally include specific roles in your prune by providing the `include_roles` parameter.

Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

func (*Guild) GetGuildRoles

func (g *Guild) GetGuildRoles() ([]*Role, error)

GetGuildRoles - Returns a list of role objects for the guild.

func (*Guild) GetGuildScheduledEvent

func (g *Guild) GetGuildScheduledEvent(guildScheduledEventID *Snowflake, withUserCount *bool) (
	*GuildScheduledEvent,
	error,
)

GetGuildScheduledEvent - Get a guild scheduled event. Returns a guild scheduled event object on success.

func (*Guild) GetGuildScheduledEventUsers

func (g *Guild) GetGuildScheduledEventUsers(
	guildScheduledEventID *Snowflake,
	limit *uint64,
	withMember *bool,
	before *Snowflake,
	after *Snowflake,
) (*GuildScheduledEventUser, error)

GetGuildScheduledEventUsers - Get a list of guild scheduled event users subscribed to a guild scheduled event.

Returns a list of guild scheduled event user objects on success.

GuildMember data, if it exists, is included if the `with_member` query parameter is set.

func (*Guild) GetGuildSticker

func (g *Guild) GetGuildSticker(stickerID Snowflake) (*Sticker, error)

GetGuildSticker - Returns a sticker object for the given guild and sticker IDs.

Includes the user field if the bot has the CreateGuildExpressions or CreateGuildExpressions permission.

func (*Guild) GetGuildTemplates

func (g *Guild) GetGuildTemplates() ([]*GuildTemplate, error)

GetGuildTemplates - Returns an array of GuildTemplate objects. Requires the ManageGuild permission.

func (*Guild) GetGuildVanityURL

func (g *Guild) GetGuildVanityURL() (*Invite, error)

GetGuildVanityURL - Returns a partial invite object for guilds with that feature enabled.

Requires the ManageGuild permission.

`code` will be null if a vanity url for the Guild is not set.

func (*Guild) GetGuildVoiceRegions

func (g *Guild) GetGuildVoiceRegions() ([]*VoiceRegion, error)

GetGuildVoiceRegions - Returns a list of voice region objects for the guild.

Unlike the similar `/voice` route, this returns VIP servers when the guild is VIP-enabled.

func (*Guild) GetGuildWebhooks

func (g *Guild) GetGuildWebhooks(c *Channel) ([]*Webhook, error)

GetGuildWebhooks - Returns a list of guild webhook objects. Requires the ManageWebhooks permission.

func (*Guild) GetGuildWelcomeScreen

func (g *Guild) GetGuildWelcomeScreen() (*WelcomeScreen, error)

GetGuildWelcomeScreen - Returns the WelcomeScreen object for the guild.

If the welcome screen is not enabled, the ManageGuild permission is required.

func (*Guild) GetGuildWidget

func (g *Guild) GetGuildWidget() (*GetGuildWidget, error)

GetGuildWidget - Returns the widget for the guild.

func (*Guild) GetGuildWidgetImage

func (g *Guild) GetGuildWidgetImage() ([]byte, error)

func (*Guild) GetGuildWidgetSettings

func (g *Guild) GetGuildWidgetSettings() (*GuildWidgetSettings, error)

GetGuildWidgetSettings - Returns a guild widget settings object.

Requires the ManageGuild permission.

func (*Guild) LeaveGuild

func (g *Guild) LeaveGuild() error

LeaveGuild - Leave a guild. Returns a 204 empty response on success.

func (*Guild) ListActiveThreads

func (g *Guild) ListActiveThreads() (*ThreadListResponse, error)

ListActiveThreads - Returns all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.

func (*Guild) ListGuildEmojis

func (g *Guild) ListGuildEmojis() ([]*Emoji, error)

ListGuildEmojis - Returns a list of emoji objects for the given guild. Includes User fields if the bot has the CreateGuildExpressions or ManageGuildExpressions permission.

func (*Guild) ListGuildMembers

func (g *Guild) ListGuildMembers(limit *uint64, after *Snowflake) ([]*GuildMember, error)

ListGuildMembers - Returns a list of guild member objects that are members of the guild.

This endpoint is restricted according to whether the GuildMembers Privileged Intent is enabled for your application.

func (*Guild) ListGuildScheduledEvents

func (g *Guild) ListGuildScheduledEvents(withUserCount *bool) ([]*GuildScheduledEvent, error)

ListGuildScheduledEvents - Returns a list of guild scheduled event objects for the given guild.

func (*Guild) ListGuildStickers

func (g *Guild) ListGuildStickers() ([]*Sticker, error)

ListGuildStickers - Returns an array of sticker objects for the given guild.

Includes user fields if the bot has the CreateGuildExpressions or CreateGuildExpressions permission.

func (*Guild) ModifyCurrentMember

func (g *Guild) ModifyCurrentMember(nick *string, reason *string) (*GuildMember, error)

ModifyCurrentMember - Modifies the current member in a guild. Returns a 200 with the updated member object on success. Fires a Guild Member Update Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) ModifyCurrentUserVoiceState

func (g *Guild) ModifyCurrentUserVoiceState(payload *ModifyCurrentUserVoiceStateJSON) error

ModifyCurrentUserVoiceState - Updates the current user's voice state. Returns 204 No Content on success.

There are currently several caveats for this endpoint:

  • `channel_id` must currently point to a stage channel.
  • current user must already have joined `channel_id`.
  • You must have the MuteMembers permission to unsuppress yourself. You can always suppress yourself.
  • You must have the RequestToSpeak permission to request to speak. You can always clear your own request to speak.
  • You are able to set `request_to_speak_timestamp` to any present or future time.

func (*Guild) ModifyGuild

func (g *Guild) ModifyGuild(payload ModifyGuildJSON, reason *string) (*Guild, error)

ModifyGuild - Modify a guild's settings.

Requires the ManageGuild permission.

Returns the updated guild object on success.

Fires a GuildUpdate Gateway event.

All parameters to this endpoint are optional

This endpoint supports the X-Audit-Log-Reason header.

Attempting to add or remove the Community guild feature requires the Administrator permission.

func (*Guild) ModifyGuildChannelPositions

func (g *Guild) ModifyGuildChannelPositions(payload *ModifyGuildChannelPositionsJSON, reason *string) error

ModifyGuildChannelPositions - Modify the positions of a set of channel objects for the guild.

Requires ManageChannels permission. Returns a 204 empty response on success. Fires multiple ChannelUpdate Gateway events.

Only channels to be modified are required.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) ModifyGuildEmoji

func (g *Guild) ModifyGuildEmoji(emoji *Emoji, payload *ModifyGuildEmojiJSON, reason *string) (*Emoji, error)

ModifyGuildEmoji - Modify the given emoji.

Requires the ManageEmojisAndStickers permission.

For Emoji created by the current user, requires either the CreateGuildExpressions or ManageGuildExpressions permission.

For other emojis, requires the ManageGuildExpressions permission.

Returns the updated Emoji object on success.

Fires a GuildEmojisUpdateGateway event.

All parameters to this endpoint are optional.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Guild) ModifyGuildMember

func (g *Guild) ModifyGuildMember(userID *Snowflake, payload *ModifyGuildMemberJSON, reason *string) (
	*GuildMember,
	error,
)

ModifyGuildMember - Modify attributes of a guild member.

Returns a 200 OK with the guild member as the body. Fires a GuildMember Update Gateway event.

If the channel_id is set to null, this will force the target user to be disconnected from voice.

All parameters to this endpoint are optional and nullable. When moving members to channels, the API user must have permissions to both connect to the channel and have the MoveMembers permission.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) ModifyGuildMfaLevel

func (g *Guild) ModifyGuildMfaLevel(level MfaLevel, reason *string) (*MfaLevel, error)

ModifyGuildMfaLevel - Modify a guild's MFA level.

Requires guild ownership.

Returns the updated level on success.

Fires a GuildUpdate Gateway event.

func (*Guild) ModifyGuildRole

func (g *Guild) ModifyGuildRole(roleID *Snowflake, payload *ModifyGuildRoleJSON, reason *string) (*Role,
	error)

ModifyGuildRole - Modify a Guild Role.

Requires the ManageRoles permission.

Returns the updated role on success.

Fires a GuildRoleUpdate Gateway event.

All parameters to this endpoint are optional and nullable.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) ModifyGuildRolePositions

func (g *Guild) ModifyGuildRolePositions(payload []*ModifyGuildRolePositionsJSON, reason *string) ([]*Role, error)

ModifyGuildRolePositions - Modify the positions of a set of role objects for the guild.

Requires the ManageRoles permission.

Returns a list of all the guild's role objects on success.

Fires multiple Guild Role Update Gateway events.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) ModifyGuildScheduledEvent

func (g *Guild) ModifyGuildScheduledEvent(
	guildScheduledEventID Snowflake,
	payload *ModifyGuildScheduledEventJSON,
	reason *string,
) (*GuildScheduledEvent, error)

ModifyGuildScheduledEvent - Modify a guild scheduled event. Returns the modified guild scheduled event object on success.

To start or end an event, use this endpoint to modify the event's status field.

This endpoint supports the `X-Audit-Log-Reason` header.

This endpoint silently discards `entity_metadata` for non-EXTERNAL events.

If updating entity_type to EXTERNAL:

`channel_id` is required and must be set to null
`entity_metadata` with a location field must be provided
`scheduled_end_time` must be provided

func (*Guild) ModifyGuildSticker

func (g *Guild) ModifyGuildSticker(stickerID Snowflake,
	payload ModifyGuildStickerJSON,
	reason *string) (*Sticker,
	error)

ModifyGuildSticker - Modify the given sticker.

For stickers created by the current user, requires either the CreateGuildExpressions or ManageGuildExpressions permission.

For other stickers, requires the ManageGuildExpressions permission.

Returns the updated Sticker object on success.

Fires a Guild Stickers Update Gateway event.

All parameters to this endpoint are optional.

This endpoint supports the `X-Audit-Log-Reason` header.

func (*Guild) ModifyGuildTemplate

func (g *Guild) ModifyGuildTemplate(templateCode string, payload *ModifyGuildTemplateJSON) (*GuildTemplate, error)

ModifyGuildTemplate - Modifies the template's metadata.

Requires the ManageGuild permission.

Returns the GuildTemplate object on success.

func (*Guild) ModifyGuildWelcomeScreen

func (g *Guild) ModifyGuildWelcomeScreen(payload *ModifyGuildWelcomeScreenJSON, reason *string) (
	*WelcomeScreen,
	error,
)

ModifyGuildWelcomeScreen - Modify the guild's Welcome Screen. Requires the ManageGuild permission. Returns the updated WelcomeScreen object.

All parameters to this endpoint are optional and nullable

This endpoint supports the `X-Audit-Log-Reason` header.

func (*Guild) ModifyGuildWidget

func (g *Guild) ModifyGuildWidget(payload *GuildWidgetSettings, reason *string) (*GuildWidgetSettings, error)

ModifyGuildWidget - Modify a guild widget settings object for the guild.

All attributes may be passed in with JSON and modified.

Requires the ManageGuild permission.

Returns the updated GuildWidgetSettings object.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) ModifyUserVoiceState

func (g *Guild) ModifyUserVoiceState(userID *Snowflake, payload *ModifyUserVoiceStateJSON) error

ModifyUserVoiceState - Updates another user's voice state.

There are currently several caveats for this endpoint:

`channel_id` must currently point to a stage channel.
User must already have joined `channel_id`.
You must have the MuteMembers permission. (Since suppression is the only thing that is available currently.)
When unsuppressed, non-bot users will have their `request_to_speak_timestamp` set to the current time. Bot users will not.
When suppressed, the user will have their `request_to_speak_timestamp` removed.

func (*Guild) RemoveGuildBan

func (g *Guild) RemoveGuildBan(userID *Snowflake, reason *string) error

RemoveGuildBan - Remove the ban for a user. Requires the BanMembers permissions. Returns a 204 empty response on success. Fires a GuildBanRemove Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) RemoveGuildMember

func (g *Guild) RemoveGuildMember(user *User, reason *string) error

RemoveGuildMember - Remove a member from a guild.

Requires KickMembers permission.

Returns a 204 empty response on success.

Fires a GuildMemberRemove Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) RemoveGuildMemberRole

func (g *Guild) RemoveGuildMemberRole(user *User, role *Snowflake, reason *string) error

RemoveGuildMemberRole - Removes a role from a guild member.

Requires the ManageRoles permission.

Returns a 204 empty response on success.

Fires a GuildMember Update Gateway event.

This endpoint supports the X-Audit-Log-Reason header.

func (*Guild) SearchGuildMembers

func (g *Guild) SearchGuildMembers(query string, limit *uint64) ([]*GuildMember, error)

SearchGuildMembers - Returns a list of GuildMember objects whose username or nickname starts with a provided string.

All parameters to this endpoint except for `query` are optional

func (*Guild) String

func (g *Guild) String() string

String - Helper function to convert basic Guild data into string form

func (*Guild) SyncGuildTemplate

func (g *Guild) SyncGuildTemplate(templateCode string) (*GuildTemplate, error)

SyncGuildTemplate - Syncs the template to the guild's current state.

Requires the ManageGuild permission. Returns the GuildTemplate object on success.

type GuildAnnouncementChannel

type GuildAnnouncementChannel struct {
	*Channel

	LastMessageID        *Snowflake   `json:"last_message_id,omitempty"`       // the id of the last message sent in this channel (may not point to an existing or valid message)
	Position             int          `json:"position,omitempty"`              // sorting position of the channel
	Flags                ChannelFlag  `json:"flags,omitempty"`                 // channel flags combined as a bitfield
	ParentID             *Snowflake   `json:"parent_id,omitempty"`             // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	Topic                *string      `json:"topic,omitempty"`                 // the channel topic (0-1024 characters)
	GuildID              Snowflake    `json:"guild_id,omitempty"`              // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	PermissionOverwrites []*Overwrite `json:"permission_overwrites,omitempty"` // explicit permission overwrites for members and roles
	LastPinTimestamp     *time.Time   `json:"last_pin_timestamp,omitempty"`    // when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
	RateLimitPerUser     int64        `json:"rate_limit_per_user,omitempty"`   // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Nsfw                 bool         `json:"nsfw,omitempty"`                  // whether the channel is nsfw
}

type GuildAnnouncementThreadChannel

type GuildAnnouncementThreadChannel struct {
	*Channel

	GuildID           Snowflake      `json:"guild_id,omitempty"`            // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	ParentID          *Snowflake     `json:"parent_id,omitempty"`           // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	OwnerID           Snowflake      `json:"owner_id,omitempty"`            // id of the creator of the group DM or thread
	LastMessageID     *Snowflake     `json:"last_message_id,omitempty"`     // the id of the last message sent in this channel (may not point to an existing or valid message)
	ThreadMetadata    ThreadMetadata `json:"thread_metadata,omitempty"`     // thread-specific fields not needed by other channels
	MessageCount      int64          `json:"message_count,omitempty"`       // an approximate count of messages in a thread, stops counting at 50
	MemberCount       int64          `json:"member_count,omitempty"`        // an approximate count of users in a thread, stops counting at 50
	RateLimitPerUser  int64          `json:"rate_limit_per_user,omitempty"` // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Flags             ChannelFlag    `json:"flags,omitempty"`               // channel flags combined as a bitfield
	TotalMessagesSent int64          `json:"total_messages_sent,omitempty"` // number of messages ever sent in a thread, it's similar to MessageCount on message creation, but will not decrement the number when a message is deleted
}

type GuildApplicationCommandPermissions

type GuildApplicationCommandPermissions struct {
	ID            Snowflake                        `json:"id"`             // the id of the command
	ApplicationID Snowflake                        `json:"application_id"` // the id of the application the command belongs to
	GuildID       Snowflake                        `json:"guild_id"`       // the id of the guild
	Permissions   []*ApplicationCommandPermissions `json:"permissions"`    // the permissions for the command in the guild
}

GuildApplicationCommandPermissions - Returned when fetching the permissions for a command in a guild.

type GuildCategoryChannel

type GuildCategoryChannel struct {
	*Channel

	Position             int          `json:"position,omitempty"`              // sorting position of the channel
	Flags                ChannelFlag  `json:"flags,omitempty"`                 // channel flags combined as a bitfield
	ParentID             *Snowflake   `json:"parent_id,omitempty"`             // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	GuildID              Snowflake    `json:"guild_id,omitempty"`              // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	PermissionOverwrites []*Overwrite `json:"permission_overwrites,omitempty"` // explicit permission overwrites for members and roles
}

type GuildFeatures

type GuildFeatures string

GuildFeatures - enabled guild features

const (
	AnimatedBanner                        GuildFeatures = "ANIMATED_BANNER"                           // guild has access to set an animated guild banner image
	AnimatedIcon                          GuildFeatures = "ANIMATED_ICON"                             // guild has access to set an animated guild icon
	ApplicationCommandPermissionsV2       GuildFeatures = "APPLICATION_COMMAND_PERMISSIONS_V2"        // guild is using the old permissions configuration behavior
	AutoModeration                        GuildFeatures = "AUTO_MODERATION"                           // guild has set up auto moderation rules
	Community                             GuildFeatures = "COMMUNITY"                                 // Mutable; guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates
	CreatorMonetizableProvisional         GuildFeatures = "CREATOR_MONETIZABLE_PROVISIONAL"           // guild has enabled monetization
	CreatorStorePage                      GuildFeatures = "CREATOR_STORE_PAGE"                        // guild has enabled the role subscription promo page
	DeveloperSupportServer                GuildFeatures = "DEVELOPER_SUPPORT_SERVER"                  // guild has been set as a support server on the App Directory
	Discoverable                          GuildFeatures = "DISCOVERABLE"                              // Mutable; guild is able to be discovered in the directory
	Featurable                            GuildFeatures = "FEATURABLE"                                // guild is able to be featured in the directory
	InvitesDisabled                       GuildFeatures = "INVITES_DISABLED"                          // Mutable; Pauses all invites/access to the server
	InviteSplash                          GuildFeatures = "INVITE_SPLASH"                             // guild has access to set an invite splash background
	MemberVerificationGateEnabled         GuildFeatures = "MEMBER_VERIFICATION_GATE_ENABLED"          // guild has enabled Membership Screening
	MoreStickers                          GuildFeatures = "MORE_STICKERS"                             // guild has increased custom sticker slots
	News                                  GuildFeatures = "NEWS"                                      // guild has access to create news channels
	Partnered                             GuildFeatures = "PARTNERED"                                 // guild is partnered
	PreviewEnabled                        GuildFeatures = "PREVIEW_ENABLED"                           // guild can be previewed before joining via Membership Screening or the directory
	RoleIcons                             GuildFeatures = "ROLE_ICONS"                                // guild is able to set role icons
	RoleSubscriptionsAvailableForPurchase GuildFeatures = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" // guild has role subscriptions that can be purchased
	RoleSubscriptionsEnabled              GuildFeatures = "ROLE_SUBSCRIPTIONS_ENABLED"                // guild has enabled role subscriptions
	TicketedEventsEnabled                 GuildFeatures = "TICKETED_EVENTS_ENABLED"                   // guild has enabled ticketed events
	VanityURL                             GuildFeatures = "VANITY_URL"                                // guild has access to set a vanity URL
	Verified                              GuildFeatures = "VERIFIED"                                  // guild is verified
	VipRegions                            GuildFeatures = "VIP_REGIONS"                               // guild has access to set 384kbps bitrate in voice (previously VIP voice servers)
	WelcomeScreenEnabled                  GuildFeatures = "WELCOME_SCREEN_ENABLED"                    // guild has enabled the welcome screen
)

type GuildForumChannel

type GuildForumChannel struct {
	*Channel

	LastMessageID                 *Snowflake       `json:"last_message_id,omitempty"`                    // the id of the last message sent in this channel (may not point to an existing or valid message)
	DefaultAutoArchiveDuration    int              `json:"default_auto_archive_duration,omitempty"`      // default duration that the clients (not the API) will use for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	DefaultThreadRateLimitPerUser uint             `json:"default_thread_rate_limit_per_user,omitempty"` // the initial RateLimitPerUser to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
	Position                      int              `json:"position,omitempty"`                           // sorting position of the channel
	Flags                         ChannelFlag      `json:"flags,omitempty"`                              // channel flags combined as a bitfield
	ParentID                      *Snowflake       `json:"parent_id,omitempty"`                          // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	Topic                         *string          `json:"topic,omitempty"`                              // the channel topic (0-1024 characters)
	GuildID                       Snowflake        `json:"guild_id,omitempty"`                           // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	PermissionOverwrites          []*Overwrite     `json:"permission_overwrites,omitempty"`              // explicit permission overwrites for members and roles
	RateLimitPerUser              int64            `json:"rate_limit_per_user,omitempty"`                // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Nsfw                          bool             `json:"nsfw,omitempty"`                               // whether the channel is nsfw
	AvailableTags                 []*ForumTag      `json:"available_tags,omitempty"`                     // the set of tags that can be used in a GuildForum channel
	Template                      string           `json:"template,omitempty"`                           // Undocumented as of 3/15/2023
	DefaultReactionEmoji          *DefaultReaction `json:"default_reaction_emoji,omitempty"`             // the emoji to show in the add reaction button on a thread in a GuildForum channel
	DefaultSortOrder              *SortOrderType   `json:"default_sort_order,omitempty"`                 // the default sort order type used to order posts in GuildForum channels. Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin
	DefaultForumLayout            *ForumLayoutType `json:"default_forum_layout,omitempty"`               // the default forum layout view used to display posts in GuildForum channels. Defaults to NotSet (0), which indicates a layout view has not been set by a channel admin
}

type GuildMember

type GuildMember struct {
	User                       User            `json:"user,omitempty"`                         // User - the user this guild member represents
	Nick                       *string         `json:"nick,omitempty"`                         // Nick - the users' guild nickname
	Avatar                     *string         `json:"avatar,omitempty"`                       // Avatar - guild specific avatar
	Roles                      []*Snowflake    `json:"roles"`                                  // Roles - array of GuildRole id's
	JoinedAt                   time.Time       `json:"joined_at"`                              // JoinedAt - when the user joined the guild
	PremiumSince               *time.Time      `json:"premium_since,omitempty"`                // PremiumSince - when the user started boosting the guild
	Deaf                       bool            `json:"deaf"`                                   // Deaf - whether the user is deafened in voice channels
	Mute                       bool            `json:"mute"`                                   // Mute - whether the user is muted in voice channels
	Flags                      GuildMemberFlag `json:"flags,omitempty"`                        // Flags - guild member flags represented as a bit set, defaults to 0
	Pending                    bool            `json:"pending,omitempty"`                      // Pending - whether the user has not yet passed the guild's Membership Screening requirements
	Permissions                *string         `json:"permissions"`                            // Permissions - total permissions of the member in the channel, including overwrites, returned when in the interaction object
	CommunicationDisabledUntil *time.Time      `json:"communication_disabled_until,omitempty"` // CommunicationDisabledUntil - when the user's timeout will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out

	// Undocumented as of 12/3/2022
	IsPending bool `json:"is_pending,omitempty"`
}

GuildMember - Represents a member of a Guild

The field `user` won't be included in the member object attached to MessageCreate and MessageUpdate gateway events.

In GUILD_ events, pending will always be included as true or false.
In non GUILD_ events which can only be triggered by non-pending users, pending will not be included.

type GuildMemberFlag

type GuildMemberFlag int

GuildMemberFlag - guild member flags represented as a bit set, defaults to 0

const (
	DidRejoin            GuildMemberFlag = 1 << 0 // DidRejoin - Member has left and rejoined the guild
	CompletedOnboarding  GuildMemberFlag = 1 << 1 // CompletedOnboarding - Member has completed onboarding
	BypassesVerification GuildMemberFlag = 1 << 2 // BypassesVerification - Member is exempt from guild verification requirements
	StartedOnboarding    GuildMemberFlag = 1 << 3 // StartedOnboarding - Member has started onboarding
)

type GuildNsfwLevel

type GuildNsfwLevel int

GuildNsfwLevel - guild NSFW level

const (
	NsfwDefault GuildNsfwLevel = iota
	NsfwExplicit
	NsfwSafe
	NsfwAgeRestricted
)

type GuildOnboarding added in v10.2.0

type GuildOnboarding struct {
	GuildID          Snowflake          `json:"guild_id"`           // ID of the guild this onboarding is part of
	Prompts          []OnboardingPrompt `json:"prompts"`            // Prompts shown during onboarding and in customize community
	DefaultChanelIds []Snowflake        `json:"default_chanel_ids"` // Channel IDs that members get opted into automatically
	Enabled          bool               `json:"enabled"`            // Whether onboarding is enabled in the guild
}

GuildOnboarding - Represents the onboarding flow for a guild.

type GuildPreview

type GuildPreview struct {
	ID                       Snowflake        `json:"id"`                         // guild id
	Name                     string           `json:"name"`                       // guild name (2-100 characters)
	Icon                     *string          `json:"icon"`                       // icon hash
	Splash                   *string          `json:"splash"`                     // splash hash
	DiscoverySplash          *string          `json:"discovery_splash"`           // discovery splash hash
	Emojis                   []*Emoji         `json:"emojis"`                     // custom guild emojis
	Features                 []*GuildFeatures `json:"features"`                   // enabled guild features
	ApproximateMemberCount   int              `json:"approximate_member_count"`   // approximate number of members in this guild
	ApproximatePresenceCount int              `json:"approximate_presence_count"` // approximate number of online members in this guild
	Description              *string          `json:"description"`                // the description for the guild, if the guild is discoverable
	Stickers                 []*Sticker       `json:"stickers"`                   // custom guild stickers
}

GuildPreview - preview object

type GuildPrivateThreadChannel

type GuildPrivateThreadChannel struct {
	*Channel

	GuildID           Snowflake      `json:"guild_id,omitempty"`            // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	ParentID          *Snowflake     `json:"parent_id,omitempty"`           // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	OwnerID           Snowflake      `json:"owner_id,omitempty"`            // id of the creator of the group DM or thread
	LastMessageID     *Snowflake     `json:"last_message_id,omitempty"`     // the id of the last message sent in this channel (may not point to an existing or valid message)
	ThreadMetadata    ThreadMetadata `json:"thread_metadata,omitempty"`     // thread-specific fields not needed by other channels
	MessageCount      int64          `json:"message_count,omitempty"`       // an approximate count of messages in a thread, stops counting at 50
	MemberCount       int64          `json:"member_count,omitempty"`        // an approximate count of users in a thread, stops counting at 50
	RateLimitPerUser  int64          `json:"rate_limit_per_user,omitempty"` // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Flags             ChannelFlag    `json:"flags,omitempty"`               // channel flags combined as a bitfield
	TotalMessagesSent int64          `json:"total_messages_sent,omitempty"` // number of messages ever sent in a thread, it's similar to MessageCount on message creation, but will not decrement the number when a message is deleted
}

type GuildPublicThreadChannel

type GuildPublicThreadChannel struct {
	*Channel

	GuildID           Snowflake      `json:"guild_id,omitempty"`            // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	ParentID          *Snowflake     `json:"parent_id,omitempty"`           // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	OwnerID           Snowflake      `json:"owner_id,omitempty"`            // id of the creator of the group DM or thread
	LastMessageID     *Snowflake     `json:"last_message_id,omitempty"`     // the id of the last message sent in this channel (may not point to an existing or valid message)
	ThreadMetadata    ThreadMetadata `json:"thread_metadata,omitempty"`     // thread-specific fields not needed by other channels
	MessageCount      int64          `json:"message_count,omitempty"`       // an approximate count of messages in a thread, stops counting at 50
	MemberCount       int64          `json:"member_count,omitempty"`        // an approximate count of users in a thread, stops counting at 50
	RateLimitPerUser  int64          `json:"rate_limit_per_user,omitempty"` // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Flags             ChannelFlag    `json:"flags,omitempty"`               // channel flags combined as a bitfield
	TotalMessagesSent int64          `json:"total_messages_sent,omitempty"` // number of messages ever sent in a thread, it's similar to MessageCount on message creation, but will not decrement the number when a message is deleted
	AppliedTags       []*Snowflake   `json:"applied_tags,omitempty"`        // GuildForum only : the IDs of the set of tags that have been applied to a thread in a GuildForum channel
}

type GuildScheduledEvent

type GuildScheduledEvent struct {
	ID                 Snowflake                          `json:"id"`                    // the id of the scheduled event
	GuildID            Snowflake                          `json:"guild_id"`              // the guild id which the scheduled event belongs to
	ChannelID          *Snowflake                         `json:"channel_id"`            // the channel id in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL
	CreatorID          *Snowflake                         `json:"creator_id"`            // the id of the user that created the scheduled event
	Name               string                             `json:"name"`                  // the name of the scheduled event (1-100 characters)
	Description        *string                            `json:"description,omitempty"` // the description of the scheduled event (1-1000 characters)
	ScheduledStartTime time.Time                          `json:"scheduled_start_time"`  // the time the scheduled event will start
	ScheduledEndTime   *time.Time                         `json:"scheduled_end_time"`    // the time the scheduled event will end, required if entity_type is EXTERNAL
	PrivacyLevel       GuildScheduledEventPrivacyLevel    `json:"privacy_level"`         // the privacy level of the scheduled event
	Status             GuildScheduledEventStatus          `json:"status"`                // the status of the scheduled event
	EntityType         GuildScheduledEventType            `json:"entity_type"`           // the type of the scheduled event
	EntityID           *Snowflake                         `json:"entity_id"`             // the id of an entity associated with a guild scheduled event
	EntityMetadata     *GuildScheduledEventEntityMetadata `json:"entity_metadata"`       // additional metadata for the guild scheduled event
	Creator            User                               `json:"creator,omitempty"`     // the user that created the scheduled event
	UserCount          int64                              `json:"user_count,omitempty"`  // the number of users subscribed to the scheduled event
	Image              *string                            `json:"image,omitempty"`       // the cover image hash of the scheduled event
}

GuildScheduledEvent - A representation of a scheduled event in a guild.

creator_id will be null and creator will not be included for events created before October 25th, 2021, when the concept of creator_id was introduced and tracked.

type GuildScheduledEventEntityMetadata

type GuildScheduledEventEntityMetadata struct {
	Location string `json:"location,omitempty"` // location of the event (1-100 characters)
}

GuildScheduledEventEntityMetadata - required for events with 'entity_type': EXTERNAL

type GuildScheduledEventPrivacyLevel

type GuildScheduledEventPrivacyLevel int

GuildScheduledEventPrivacyLevel - the privacy level of the scheduled event

const (
	GuildScheduledEventPrivacyLevelGuildOnly GuildScheduledEventPrivacyLevel = iota + 2 // the scheduled event is only accessible to guild members
)

GuildScheduledEventPrivacyLevelGuildOnly - the scheduled event is only accessible to guild members

type GuildScheduledEventStatus

type GuildScheduledEventStatus int

GuildScheduledEventStatus - Once status is set to Completed or Cancelled, the status can no longer be updated

const (
	Scheduled GuildScheduledEventStatus = iota + 1
	Active
	Completed
	Cancelled
)

type GuildScheduledEventType

type GuildScheduledEventType int

GuildScheduledEventType - the type of the scheduled event

const (
	GuildScheduledEventTypeStageInstance GuildScheduledEventType = iota + 1
	GuildScheduledEventTypeVoice
	GuildScheduledEventTypeExternal
)

type GuildScheduledEventUser

type GuildScheduledEventUser struct {
	GuildScheduledEventID Snowflake   `json:"guild_scheduled_event_id"` // the scheduled event id which the user subscribed to
	User                  User        `json:"user"`                     // user which subscribed to an event
	Member                GuildMember `json:"member"`                   // guild member data for this user for the guild which this event belongs to, if any
}

GuildScheduledEventUser - Representation of a user interested in attending an event

type GuildStageVoiceChannel

type GuildStageVoiceChannel struct {
	*Channel

	LastMessageID        *Snowflake   `json:"last_message_id,omitempty"`       // the id of the last message sent in this channel (may not point to an existing or valid message)
	Position             int          `json:"position,omitempty"`              // sorting position of the channel
	Flags                ChannelFlag  `json:"flags,omitempty"`                 // channel flags combined as a bitfield
	ParentID             *Snowflake   `json:"parent_id,omitempty"`             // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	Topic                *string      `json:"topic,omitempty"`                 // the channel topic (0-1024 characters)
	Bitrate              int64        `json:"bitrate,omitempty"`               // the bitrate (in bits) of the voice channel
	UserLimit            int64        `json:"user_limit,omitempty"`            // the user limit of the voice channel
	RtcRegion            *string      `json:"rtc_region,omitempty"`            // voice region id for the voice channel, automatic when set to null
	GuildID              Snowflake    `json:"guild_id,omitempty"`              // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	PermissionOverwrites []*Overwrite `json:"permission_overwrites,omitempty"` // explicit permission overwrites for members and roles
	RateLimitPerUser     int64        `json:"rate_limit_per_user,omitempty"`   // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Nsfw                 bool         `json:"nsfw,omitempty"`                  // whether the channel is nsfw
}

type GuildTemplate

type GuildTemplate struct {
	Code                  string    `json:"code"`
	Name                  string    `json:"name"`
	Description           *string   `json:"description"`
	UsageCount            int       `json:"usage_count"`
	CreatorID             Snowflake `json:"creator_id"`
	Creator               User      `json:"creator"`
	CreatedAt             time.Time `json:"created_at"`
	UpdatedAt             time.Time `json:"updated_at"`
	SourceGuildID         Snowflake `json:"source_guild_id"`
	SerializedSourceGuild Guild     `json:"serialized_source_guild"`
	IsDirty               *bool     `json:"is_dirty"`
}

GuildTemplate - Represents a code that when used, creates a guild based on a snapshot of an existing guild.

func GetGuildTemplate

func GetGuildTemplate(templateCode string) (*GuildTemplate, error)

GetGuildTemplate - Returns a GuildTemplate object for the given code.

type GuildTextChannel

type GuildTextChannel struct {
	*Channel

	LastMessageID        *Snowflake   `json:"last_message_id,omitempty"`       // the id of the last message sent in this channel (may not point to an existing or valid message)
	Position             int          `json:"position,omitempty"`              // sorting position of the channel
	Flags                ChannelFlag  `json:"flags,omitempty"`                 // channel flags combined as a bitfield
	ParentID             *Snowflake   `json:"parent_id,omitempty"`             // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	Topic                *string      `json:"topic,omitempty"`                 // the channel topic (0-1024 characters)
	GuildID              Snowflake    `json:"guild_id,omitempty"`              // the id of the guild (maybe missing for some channel objects received over gateway guild dispatches)
	PermissionOverwrites []*Overwrite `json:"permission_overwrites,omitempty"` // explicit permission overwrites for members and roles
	LastPinTimestamp     *time.Time   `json:"last_pin_timestamp,omitempty"`    // when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
	RateLimitPerUser     int64        `json:"rate_limit_per_user,omitempty"`   // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Nsfw                 bool         `json:"nsfw,omitempty"`                  // whether the channel is nsfw
}

type GuildVoiceChannel

type GuildVoiceChannel struct {
	*Channel

	LastMessageID        *Snowflake   `json:"last_message_id,omitempty"`       // the id of the last message sent in this channel (may not point to an existing or valid message)
	Position             int          `json:"position,omitempty"`              // sorting position of the channel
	Flags                ChannelFlag  `json:"flags,omitempty"`                 // channel flags combined as a bitfield
	ParentID             *Snowflake   `json:"parent_id,omitempty"`             // for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	Bitrate              int64        `json:"bitrate,omitempty"`               // the bitrate (in bits) of the voice channel
	UserLimit            int64        `json:"user_limit,omitempty"`            // the user limit of the voice channel
	RtcRegion            *string      `json:"rtc_region,omitempty"`            // voice region id for the voice channel, automatic when set to null
	GuildID              Snowflake    `json:"guild_id,omitempty"`              // the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	PermissionOverwrites []*Overwrite `json:"permission_overwrites,omitempty"` // explicit permission overwrites for members and roles
	RateLimitPerUser     int64        `json:"rate_limit_per_user,omitempty"`   // amount of seconds a user has to wait before sending another Message (0-21600); bots, as well as users with the permission ManageMessages or ManageChannels, are unaffected
	Nsfw                 bool         `json:"nsfw,omitempty"`                  // whether the channel is nsfw
}

type GuildWidgetSettings

type GuildWidgetSettings struct {
	Enabled   bool       `json:"enabled"`    // whether the widget is enabled
	ChannelID *Snowflake `json:"channel_id"` // the widget channel id
}

GuildWidgetSettings - the guild widget status

type Image

type Image struct {
	URL    string `json:"url,omitempty"`    // source url of image (only supports http(s) and attachments)
	Height int    `json:"height,omitempty"` // height of image
	Width  int    `json:"width,omitempty"`  // width of image
}

Image - image information

func (*Image) SetURL

func (i *Image) SetURL(u string) *Image

SetURL - set the Image URL

type InstallParams

type InstallParams struct {
	Scopes      []*oauth2.Scopes `json:"scopes"`      // Scopes to add the application to the server with
	Permissions string           `json:"permissions"` // Permissions to request for the bot role
}

InstallParams - settings for the application's default in-app authorization link, if enabled

type Integration

type Integration struct {
	ID                Snowflake                 `json:"id"`                            // integration id
	Name              string                    `json:"name"`                          // integration name
	Type              string                    `json:"type"`                          // integration type (twitch, YouTube, or discord)
	Enabled           bool                      `json:"enabled"`                       // is this integration enabled
	Syncing           bool                      `json:"syncing,omitempty"`             // is this integration syncing
	RoleID            Snowflake                 `json:"role_id,omitempty"`             // id that this integration uses for "subscribers"
	EnableEmoticons   bool                      `json:"enable_emoticons,omitempty"`    // whether emoticons should be synced for this integration (twitch only currently)
	ExpireBehavior    IntegrationExpireBehavior `json:"expire_behavior,omitempty"`     // the behavior of expiring subscribers
	ExpireGracePeriod int                       `json:"expire_grace_period,omitempty"` // the grace period (in days) before expiring subscribers
	User              User                      `json:"user,omitempty"`                // user for this integration
	Account           IntegrationAccount        `json:"account"`                       // integration account information
	SyncedAt          time.Time                 `json:"synced_at,omitempty"`           // when this integration was last synced
	SubscriberCount   int                       `json:"subscriber_count,omitempty"`    // how many subscribers this integration has
	Revoked           bool                      `json:"revoked,omitempty"`             // has this integration been revoked
	Application       IntegrationApplication    `json:"application,omitempty"`         // The bot/OAuth2 application for discord integrations
	Scopes            []string                  `json:"scopes,omitempty"`              // the scopes the application has been authorized for
}

Integration - a guild integration

type IntegrationAccount

type IntegrationAccount struct {
	ID   string `json:"id"`   // id of the account
	Name string `json:"name"` // name of the account
}

IntegrationAccount - integration account information

type IntegrationApplication

type IntegrationApplication struct {
	ID          Snowflake `json:"id"`            // the id of the app
	Name        string    `json:"name"`          // the name of the app
	Icon        *string   `json:"icon"`          // the icon hash of the app
	Description string    `json:"description"`   // the description of the app
	Summary     string    `json:"summary"`       // the summary of the app
	Bot         User      `json:"bot,omitempty"` // the bot associated with this application
}

IntegrationApplication - The bot/OAuth2 application for discord integrations

type IntegrationExpireBehavior

type IntegrationExpireBehavior int

IntegrationExpireBehavior - the behavior of expiring subscribers

const (
	RemoveRole IntegrationExpireBehavior = iota // Remove role
	Kick                                        // Kick
)

type Interaction

type Interaction struct {
	ID             Snowflake              `json:"id"`                        // ID of the interaction
	ApplicationID  Snowflake              `json:"application_id"`            // ID of the application this interaction is for
	Type           InteractionType        `json:"type"`                      // Type of interaction
	Data           ApplicationCommandData `json:"data,omitempty"`            // Interaction data payload
	GuildID        Snowflake              `json:"guild_id,omitempty"`        // Guild that the interaction was sent from
	Channel        Channel                `json:"channel,omitempty"`         // Channel that the interaction was sent from
	ChannelID      Snowflake              `json:"channel_id,omitempty"`      // Channel that the interaction was sent from
	Member         GuildMember            `json:"member,omitempty"`          // GuildMember data for the invoking user, including permissions
	User           *User                  `json:"user,omitempty"`            // User object for the invoking user, if invoked in a DM
	Token          string                 `json:"token"`                     // Continuation token for responding to the interaction
	Version        int                    `json:"version"`                   // Read-only property, always `1`
	Message        *Message               `json:"message,omitempty"`         // For components, the message they were attached to
	AppPermissions string                 `json:"app_permissions,omitempty"` // Bitwise set of permissions the app or bot has within the channel the interaction was sent from
	Locale         string                 `json:"locale,omitempty"`          // Selected language of the invoking user
	GuildLocale    string                 `json:"guild_locale,omitempty"`    // Guild's preferred locale, if invoked in a Guild
}

An Interaction is the message that your application receives when a user uses an ApplicationCommand or a Message Component.

For Slash Commands, it includes the values that the user submitted.

For User Commands and Message Commands, it includes the resolved User or Message on which the action was taken.

For Message Components it includes identifying information about the component that was used.

It will also include some metadata about how the interaction was triggered: the `guild_id`, `channel_id`, `member` and other fields.

func (*Interaction) BuildResponse

func (i *Interaction) BuildResponse(embeds []*Embed) *InteractionResponseMessages

BuildResponse Deprecated: helper method for building a basic message response

func (*Interaction) BulkOverwriteGuildApplicationCommands

func (i *Interaction) BulkOverwriteGuildApplicationCommands(payload []*ApplicationCommand) (
	[]*ApplicationCommand,
	error,
)

BulkOverwriteGuildApplicationCommands - Takes a list of application commands, overwriting the existing command list for this application for the targeted guild.

Returns 200 and a list of application command objects.

func (*Interaction) CreateFollowupMessage

func (i *Interaction) CreateFollowupMessage() (method string, route string)

CreateFollowupMessage - Create a followup message for an Interaction.

Functions the same as Execute Webhook, but wait is always true, and flags can be set to 64 in the body to send an ephemeral message.

The thread_id, avatar_url, and username parameters are not supported when using this endpoint for interaction followups.

func (*Interaction) CreateInteractionResponse

func (i *Interaction) CreateInteractionResponse(payload any) error

CreateInteractionResponse

Create a response to an Interaction from the gateway. Body is an InteractionResponse. Returns 204 No Content.

This endpoint also supports file attachments similar to the webhook endpoints. Refer to Uploading Files for details on uploading files and `multipart/form-data` requests.

func (*Interaction) DeleteFollowupMessage

func (i *Interaction) DeleteFollowupMessage() (method string, route string)

DeleteFollowupMessage - Deletes a followup message for an Interaction.

Returns 204 No Content on success.

Does not support ephemeral followups.

func (*Interaction) DeleteOriginalInteractionResponse

func (i *Interaction) DeleteOriginalInteractionResponse() (method string, route string)

DeleteOriginalInteractionResponse Deletes the initial Interaction response. Returns 204 on success.

func (*Interaction) EditApplicationCommandPermissions

func (i *Interaction) EditApplicationCommandPermissions(payload *EditApplicationCommandPermissionsJSON) (
	*GuildApplicationCommandPermissions,
	error,
)

EditApplicationCommandPermissions

This endpoint will overwrite existing permissions for the command in that guild

Edits command permissions for a specific command for your application in a guild and returns a GuildApplicationCommandPermissions object.

You can add up to 100 permission overwrites for a command.

This endpoint requires authentication with a `Bearer` token that has permission to manage the guild and its roles. For more information, read above about application command permissions.

Deleting or renaming a command will permanently delete all permissions for the command

TODO: Find the best way to handle the requirement for needing a Bearer Token to use this endpoint

func (*Interaction) EditFollowupMessage

func (i *Interaction) EditFollowupMessage() (method string, route string)

EditFollowupMessage - Edits a followup message for an Interaction.

Functions the same as Edit Webhook Message.

Does not support ephemeral followups.

func (*Interaction) EditGlobalApplicationCommand

func (i *Interaction) EditGlobalApplicationCommand(payload EditApplicationCommandJSON) (*ApplicationCommand, error)

EditGlobalApplicationCommand - Edit a global command. Updates will be available in all guilds after 1 hour.

Returns 200 and an application command object.

All JSON parameters for this endpoint are optional.

func (*Interaction) EditGuildApplicationCommand

func (i *Interaction) EditGuildApplicationCommand(payload *EditApplicationCommandJSON) (*ApplicationCommand, error)

EditGuildApplicationCommand - Edit a guild command. Updates for guild commands will be available immediately.

Returns 200 and an application command object.

All parameters for this endpoint are optional.

func (*Interaction) EditOriginalInteractionResponse

func (i *Interaction) EditOriginalInteractionResponse() (method string, route string)

EditOriginalInteractionResponse Edits the initial Interaction response.

func (*Interaction) GetApplicationCommandPermissions

func (i *Interaction) GetApplicationCommandPermissions() (*GuildApplicationCommandPermissions, error)

GetApplicationCommandPermissions - Fetches command permissions for a specific command for your application in a guild.

Returns a guild application command permissions object.

func (*Interaction) GetFollowupMessage

func (i *Interaction) GetFollowupMessage() (method string, route string)

GetFollowupMessage - Returns a followup message for an Interaction.

Functions the same as Get Webhook Message.

Does not support ephemeral followups.

func (*Interaction) GetGlobalApplicationCommand

func (i *Interaction) GetGlobalApplicationCommand() (*ApplicationCommand, error)

GetGlobalApplicationCommand - Fetch a global command for your application.

Returns an application command object.

Includes localizations by default

func (*Interaction) GetGuildApplicationCommand

func (i *Interaction) GetGuildApplicationCommand() (*ApplicationCommand, error)

GetGuildApplicationCommand - Fetch a guild command for your application. Returns an application command object.

func (*Interaction) GetGuildApplicationCommandPermissions

func (i *Interaction) GetGuildApplicationCommandPermissions() ([]*GuildApplicationCommandPermissions, error)

GetGuildApplicationCommandPermissions - Fetches command permissions for all commands for your application in a guild.

Returns an array of guild application command permissions objects.

func (*Interaction) GetGuildApplicationCommands

func (i *Interaction) GetGuildApplicationCommands(withLocalizations bool) ([]*ApplicationCommand, error)

GetGuildApplicationCommands - Fetch all the guild commands for your application for a specific guild.

Returns an array of application command objects.

func (*Interaction) GetOriginalInteractionResponse

func (i *Interaction) GetOriginalInteractionResponse() (method string, route string)

GetOriginalInteractionResponse Returns the initial Interaction response.

type InteractionCallbackDataAutocomplete

type InteractionCallbackDataAutocomplete struct {
	Choices []*ApplicationCommandOptionChoice `json:"choices"` // autocomplete choices (max of 25 choices)
}

InteractionCallbackDataAutocomplete - Data payload for InteractionResponseAutocomplete

type InteractionCallbackDataMessages

type InteractionCallbackDataMessages struct {
	TTS             bool             `json:"tts,omitempty"`         // is the response TTS
	Content         string           `json:"content,omitempty"`     // message content
	Embeds          []*Embed         `json:"embeds,omitempty"`      // supports up to 10 embeds
	AllowedMentions *AllowedMentions `json:"allowed_mentions"`      // AllowedMentionType object
	Flags           MessageFlags     `json:"flags,omitempty"`       // set to 64 to make your response Ephemeral
	Components      []*Component     `json:"components,omitempty"`  // message components
	Attachments     []*Attachment    `json:"attachments,omitempty"` // attachment objects with filename and description
}

InteractionCallbackDataMessages - Not all message fields are currently supported by Discord

Data payload for InteractionResponseMessages

type InteractionCallbackDataModal

type InteractionCallbackDataModal struct {
	CustomID   string       `json:"custom_id"`  // a developer-defined identifier for the component, max 100 characters
	Title      string       `json:"title"`      // the title of the popup modal, max 45 characters
	Components []*Component `json:"components"` // between 1 and 5 (inclusive) components that make up the modal
}

InteractionCallbackDataModal - Data payload for InteractionResponseModal

type InteractionCallbackType

type InteractionCallbackType int

InteractionCallbackType - The type of callback to an interaction with respond

const (
	Pong                             InteractionCallbackType = iota + 1 // ACK a Ping
	ChannelMessageWithSource         InteractionCallbackType = iota + 3 // respond to an interaction with a message
	DeferredChannelMessageWithSource                                    // ACK an interaction and edit a response later, the user sees a loading state
	DeferredUpdateMessage                                               // for components, ACK an interaction and edit the original message later; the user does not see a loading state; edit the message using EditOriginalInteractionResponse
	UpdateMessage                                                       // for components, edit the message the component was attached to
	AutocompleteResult                                                  // respond to an autocomplete interaction with suggested choices
	Modal                                                               // respond to an interaction with a popup modal ** Not available for MODAL_SUBMIT and PING interactions.
)

type InteractionResponseAutocomplete

type InteractionResponseAutocomplete struct {
	Type InteractionCallbackType              `json:"type"`           // the type of response
	Data *InteractionCallbackDataAutocomplete `json:"data,omitempty"` // options for the autocomplete result
}

InteractionResponseAutocomplete - After receiving an interaction, you must respond to acknowledge it.

You can choose to respond with a message immediately using type 4, or you can choose to send a deferred response with type 5.

If choosing a deferred response, the user will see a loading state for the interaction, and you'll have up to 15 minutes to edit the original deferred response using Edit Original Interaction Response.

Interaction responses can also be public—everyone can see it—or "ephemeral"—only the invoking user can see it.

That is determined by setting flags to 64 on the InteractionCallbackDataMessages.

func NewAutocompleteResponse

func NewAutocompleteResponse() *InteractionResponseAutocomplete

NewAutocompleteResponse - Build a new response containing a modal

func (*InteractionResponseAutocomplete) AddChoice

AddChoice - adds a single choice to the autocomplete response

func (*InteractionResponseAutocomplete) AddChoices

AddChoices - adds multiple choices to the autocomplete response

type InteractionResponseMessages

type InteractionResponseMessages struct {
	Type InteractionCallbackType          `json:"type"`           // the type of response
	Data *InteractionCallbackDataMessages `json:"data,omitempty"` // an optional response message
}

InteractionResponseMessages - After receiving an interaction, you must respond to acknowledge it.

You can choose to respond with a message immediately using type 4, or you can choose to send a deferred response with type 5.

If choosing a deferred response, the user will see a loading state for the interaction, and you'll have up to 15 minutes to edit the original deferred response using Edit Original Interaction Response.

Interaction responses can also be public—everyone can see it—or "ephemeral"—only the invoking user can see it.

That is determined by setting flags to 64 on the InteractionCallbackDataMessages.

func NewMessageResponse

func NewMessageResponse() *InteractionResponseMessages

NewMessageResponse - Build a new response containing a message

func (*InteractionResponseMessages) AddAttachment

AddAttachment - adds a single attachment to the response message

func (*InteractionResponseMessages) AddComponent

AddComponent - adds a single Component to the response message

func (*InteractionResponseMessages) AddEmbed

AddEmbed - adds a single Embed to the response

func (*InteractionResponseMessages) AddEmbeds

AddEmbeds - add multiple Embed objects (max 10) to the response

func (*InteractionResponseMessages) AddFlag

AddFlag - bit shifts a new flag into the flags of the response message

func (*InteractionResponseMessages) SetContent

SetContent - sets the content of the response message

func (*InteractionResponseMessages) SetEphemeral

SetEphemeral - sets the Ephemeral flag to the response message

func (*InteractionResponseMessages) SetTts

SetTts - sets the TTS flag

func (*InteractionResponseMessages) SetType

SetType - sets the Type of the InteractionResponseMessages object

type InteractionResponseModal

type InteractionResponseModal struct {
	CallbackType InteractionCallbackType       `json:"type"`           // the type of response
	Data         *InteractionCallbackDataModal `json:"data,omitempty"` // the information submitted through the modal
}

InteractionResponseModal - After receiving an interaction, you must respond to acknowledge it.

You can choose to respond with a message immediately using type 4, or you can choose to send a deferred response with type 5.

If choosing a deferred response, the user will see a loading state for the interaction, and you'll have up to 15 minutes to edit the original deferred response using Edit Original Interaction Response.

Interaction responses can also be public—everyone can see it—or "ephemeral"—only the invoking user can see it.

That is determined by setting flags to 64 on the InteractionCallbackDataMessages.

func NewModalResponse

func NewModalResponse() *InteractionResponseModal

NewModalResponse - Build a new response containing a modal

func (*InteractionResponseModal) AddComponent

AddComponent - adds a single Component to the InteractionResponseModal

func (*InteractionResponseModal) SetCustomID

SetCustomID - sets the CustomID of the InteractionResponseModal

func (*InteractionResponseModal) SetTitle

SetTitle - sets the Title of the InteractionResponseModal

type InteractionType

type InteractionType int

InteractionType - The type of Interaction

const (
	InteractionTypePing                           InteractionType = iota + 1 // PING
	InteractionTypeApplicationCommand                                        // APPLICATION_COMMAND
	InteractionTypeMessageComponent                                          // MESSAGE_COMPONENT
	InteractionTypeApplicationCommandAutocomplete                            // APPLICATION_COMMAND_AUTOCOMPLETE
	InteractionTypeModalSubmit                                               // MODAL_SUBMIT
)

type Invite

type Invite struct {
	Code                     *string             `json:"code"`                                 // the invite code (unique ID)
	Guild                    Guild               `json:"guild,omitempty"`                      // the guild this invite is for
	Channel                  *Channel            `json:"channel"`                              // the channel this invite is for
	Inviter                  User                `json:"inviter,omitempty"`                    // the user who created the invite
	TargetType               InviteTargetType    `json:"target_type,omitempty"`                // the type of target for this voice channel invite
	TargetUser               User                `json:"target_user,omitempty"`                // the user whose stream to display for this voice channel stream invite
	TargetApplication        Application         `json:"target_application,omitempty"`         // the embedded application to open for this voice channel embedded application invite
	ApproximatePresenceCount uint64              `json:"approximate_presence_count,omitempty"` // approximate count of online members, returned from the GET /invites/<code> endpoint when with_counts is true
	ApproximateMemberCount   uint64              `json:"approximate_member_count,omitempty"`   // approximate count of total members, returned from the GET /invites/<code> endpoint when with_counts is true
	ExpiresAt                *time.Time          `json:"expires_at,omitempty"`                 // the expiration date of this invite, returned from the GET /invites/<code> endpoint when with_expiration is true
	GuildScheduledEvent      GuildScheduledEvent `json:"guild_scheduled_event,omitempty"`      // guild scheduled event data, only included if guild_scheduled_event_id contains a valid guild scheduled event id
}

Invite - Represents a code that when used, adds a user to a guild or group DM channel.

func (*Invite) DeleteInvite

func (i *Invite) DeleteInvite(reason *string) error

DeleteInvite - Delete an Invite.

Requires the ManageChannels permission on the channel this invite belongs to, or ManageGuild to remove any invite across the guild.

Returns an Invite object on success.

Fires an InviteDelete Gateway event.

This endpoint supports the `X-Audit-Log-Reason` header.

func (*Invite) GetInvite

func (i *Invite) GetInvite(withCounts *bool, withExpiration *bool, guildScheduledEventID *Snowflake) (*Invite,
	error)

GetInvite - Returns an Invite object for the given code.

type InviteMetadata

type InviteMetadata struct {
	Uses      uint64    `json:"uses"`       // number of times this invite has been used
	MaxUses   uint64    `json:"max_uses"`   // max number of times this invite can be used
	MaxAge    uint64    `json:"max_age"`    // duration (in seconds) after which the invite expires
	Temporary bool      `json:"temporary"`  // whether this invite only grants temporary membership
	CreatedAt time.Time `json:"created_at"` // when this invite was created
}

InviteMetadata - Extra information about an invite, will extend the invite object.

type InviteTargetType

type InviteTargetType int

InviteTargetType - the type of target for this voice channel invite

const (
	TargetTypeStream              InviteTargetType = iota + 1 // STREAM
	TargetTypeEmbeddedApplication                             // EMBEDDED_APPLICATION
)

type KeyWordPresetType

type KeyWordPresetType int

KeyWordPresetType - the internally pre-defined wordsets which will be searched for in content

const (
	Profanity     KeyWordPresetType = iota + 1 // Words that may be considered forms of swearing or cursing
	SexualContent                              // Words that refer to sexually explicit behavior or activity
	Slurs                                      // Personal insults or words that may be considered hate speech
)

type ListStickerPacksResponse added in v10.2.4

type ListStickerPacksResponse struct {
	StickerPacks []*StickerPack `json:"sticker_packs"`
}

ListStickerPacksResponse - JSON response

func ListStickerPacks added in v10.2.4

func ListStickerPacks() (*ListStickerPacksResponse, error)

ListStickerPacks - Returns the list of sticker packs available to Nitro subscribers.

type LocalizationDict

type LocalizationDict struct {
	Danish              string `json:"da,omitempty"`
	German              string `json:"de,omitempty"`
	EnglishUK           string `json:"en-GB,omitempty"`
	EnglishUS           string `json:"en-US,omitempty"`
	Spanish             string `json:"es-ES,omitempty"`
	French              string `json:"fr,omitempty"`
	Croatian            string `json:"hr,omitempty"`
	Italian             string `json:"it,omitempty"`
	Lithuanian          string `json:"lt,omitempty"`
	Hungarian           string `json:"hu,omitempty"`
	Dutch               string `json:"nl,omitempty"`
	Norwegian           string `json:"no,omitempty"`
	Polish              string `json:"pl,omitempty"`
	PortugueseBrazilian string `json:"pt-BR,omitempty"`
	Romanian            string `json:"ro,omitempty"`
	Finnish             string `json:"fi,omitempty"`
	Swedish             string `json:"sv-SE,omitempty"`
	Vietnamese          string `json:"vi,omitempty"`
	Turkish             string `json:"tr,omitempty"`
	Czech               string `json:"cs,omitempty"`
	Greek               string `json:"el,omitempty"`
	Bulgarian           string `json:"bg,omitempty"`
	Russian             string `json:"ru,omitempty"`
	Ukrainian           string `json:"uk,omitempty"`
	Hindi               string `json:"hi,omitempty"`
	Thai                string `json:"th,omitempty"`
	ChineseChina        string `json:"zh-CN,omitempty"`
	Japanese            string `json:"ja,omitempty"`
	ChineseTaiwan       string `json:"zh-TW,omitempty"`
	Korean              string `json:"ko,omitempty"`
}

LocalizationDict - officially supported languages by Discord

type MembershipState

type MembershipState int

MembershipState - Current state of a team member

const (
	Invited  MembershipState = iota + 1 // INVITED
	Accepted                            // ACCEPTED
)

type Message

type Message struct {
	ID                   Snowflake          `json:"id,omitempty"`                     // id of the message
	ChannelID            Snowflake          `json:"channel_id,omitempty"`             // id of the Channel the message was sent in
	Author               User               `json:"author,omitempty"`                 // the author of this message (not guaranteed to be a valid user)
	Content              string             `json:"content,omitempty"`                // contents of the message
	Timestamp            time.Time          `json:"timestamp,omitempty"`              // when this message was sent
	EditedTimestamp      *time.Time         `json:"edited_timestamp,omitempty"`       // when this message was edited (or null if never)
	TTS                  bool               `json:"tts,omitempty"`                    // whether this was a TTS message
	MentionEveryone      bool               `json:"mention_everyone,omitempty"`       // whether this message mentions everyone
	Mentions             []*User            `json:"mentions,omitempty"`               // users specifically mentioned in the message
	MentionRoles         []*Snowflake       `json:"mention_roles,omitempty"`          // roles specifically mentioned in this message
	MentionChannels      []*Channel         `json:"mention_channels,omitempty"`       // channels specifically mentioned in this message
	Attachments          []*Attachment      `json:"attachments,omitempty"`            // any attached files
	Embeds               []*Embed           `json:"embeds,omitempty"`                 // any embedded content
	Reactions            []*Reaction        `json:"reactions,omitempty"`              // reactions to the message
	Nonce                any                `json:"nonce,omitempty"`                  // used for validating a message was sent
	Pinned               bool               `json:"pinned,omitempty"`                 // whether this message is pinned
	WebhookID            Snowflake          `json:"webhook_id,omitempty"`             // if the message is generated by a Webhook, this is the webhook's id
	Type                 MessageType        `json:"type,omitempty"`                   // the MessageType
	Activity             MessageActivity    `json:"activity,omitempty"`               // sent with Rich Presence-related chat embeds
	Application          Application        `json:"application,omitempty"`            // sent with Rich Presence-related chat embeds
	ApplicationID        Snowflake          `json:"application_id,omitempty"`         // if the message is an Interaction or application-owned webhook, this is the id of the application
	MessageReference     MessageReference   `json:"message_reference,omitempty"`      // data showing the source of a crosspost, channel follow add, pin, or reply message
	Flags                MessageFlags       `json:"flags,omitempty"`                  // MessageFlags combined as a bitfield
	ReferencedMessage    *Message           `json:"referenced_message,omitempty"`     // the message associated with the MessageReference
	Interaction          MessageInteraction `json:"interaction,omitempty"`            // sent if the message is a response to an Interaction
	Thread               Channel            `json:"thread,omitempty"`                 // the thread that was started from this message, includes ThreadMember object
	Components           []*Component       `json:"components,omitempty"`             // sent if the message contains components like buttons, action rows, or other interactive components
	StickerItems         []string           `json:"sticker_items,omitempty"`          // sent if the message contains stickers
	Stickers             []string           `json:"stickers,omitempty"`               // Deprecated: the stickers sent with the message
	Position             int                `json:"position,omitempty"`               // A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread
	RoleSubscriptionData any                `json:"role_subscription_data,omitempty"` // data of the role subscription purchase or renewal that prompted this RoleSubscriptionPurchase message
}

Message - Represents a message sent in a channel within Discord.

type MessageActivity

type MessageActivity struct {
	Type    MessageActivityType `json:"type"`               // type of message activity
	PartyID string              `json:"party_id,omitempty"` // party_id from a Rich Presence event
}

MessageActivity - sent with Rich Presence-related chat embeds

type MessageActivityType

type MessageActivityType int

MessageActivityType - type of message activity

const (
	MessageActivityTypeJoin        MessageActivityType = iota + 1 // JOIN
	MessageActivityTypeSpectate                                   // SPECTATE
	MessageActivityTypeListen                                     // LISTEN
	MessageActivityTypeJoinRequest MessageActivityType = iota + 2 // JOIN_REQUEST
)

type MessageComponentData

type MessageComponentData struct {
	CustomID      string        `json:"custom_id"`      // the custom_id of the component
	ComponentType ComponentType `json:"component_type"` // the type of the component
	Values        []string      `json:"values"`         // values the user selected in a select menu component
}

type MessageFlags

type MessageFlags int

MessageFlags - MessageFlags combined as a bitfield

const (
	CrossPosted                      MessageFlags = 1 << 0  // this message has been published to subscribed channels (via Channel Following)
	IsCrossPost                      MessageFlags = 1 << 1  // this message originated from a message in another channel (via Channel Following)
	SuppressEmbeds                   MessageFlags = 1 << 2  // do not include any embeds when serializing this message
	SourceMessageDeleted             MessageFlags = 1 << 3  // the source message for this crosspost has been deleted (via Channel Following)
	Urgent                           MessageFlags = 1 << 4  // this message came from the urgent message system
	HasThread                        MessageFlags = 1 << 5  // this message has an associated thread, with the same id as the message
	Ephemeral                        MessageFlags = 1 << 6  // this message is only visible to the user who invoked the Interaction
	Loading                          MessageFlags = 1 << 7  // this message is an Interaction Response and the bot is "thinking"
	FailedToMentionSomeRolesInThread MessageFlags = 1 << 8  // this message failed to mention some roles and add their members to the thread
	SuppressNotifications            MessageFlags = 1 << 12 // this message will not trigger push and desktop notifications
)

type MessageInteraction

type MessageInteraction struct {
	ID     Snowflake       `json:"id"`               // id of the Interaction
	Type   InteractionType `json:"type"`             // the type of Interaction
	Name   string          `json:"name"`             // the name of the ApplicationCommand
	User   User            `json:"user"`             // the user who invoked the interaction
	Member GuildMember     `json:"member,omitempty"` // the Member who invoked the interaction in the Guild
}

MessageInteraction - This is sent on the message object when the message is a response to an Interaction.

This means responses to Message Components do not include this property, instead including a MessageReference object as components always exist on preexisting messages.

type MessageReference

type MessageReference struct {
	MessageID       Snowflake `json:"message_id,omitempty"`         // id of the originating message
	ChannelID       Snowflake `json:"channel_id,omitempty"`         // id of the originating message's channel
	GuildID         Snowflake `json:"guild_id,omitempty"`           // id of the originating message's guild
	FailIfNotExists bool      `json:"fail_if_not_exists,omitempty"` // when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true
}

MessageReference - ChannelID is optional when creating a reply, but will always be present when receiving an event/response that includes this data model.

type MessageType

type MessageType int

MessageType - type of message

const (
	Default                                 MessageType = iota     // DEFAULT
	RecipientAdd                                                   // RECIPIENT_ADD
	RecipientRemove                                                // RECIPIENT_REMOVE
	Call                                                           // CALL
	ChannelNameChange                                              // CHANNEL_NAME_CHANGE
	ChannelIconChange                                              // CHANNEL_ICON_CHANGE
	ChannelPinnedMessage                                           // CHANNEL_PINNED_MESSAGE
	UserJoin                                                       // USER_JOIN
	GuildBoost                                                     // GUILD_BOOST
	GuildBoostTier1                                                // GUILD_BOOST_TIER_1
	GuildBoostTier2                                                // GUILD_BOOST_TIER_2
	GuildBoostTier3                                                // GUILD_BOOST_TIER_3
	ChannelFollowAdd                                               // CHANNEL_FOLLOW_ADD
	GuildDiscoveryDisqualified              MessageType = iota + 1 // GUILD_DISCOVERY_DISQUALIFIED
	GuildDiscoveryRequalified                                      // GUILD_DISCOVERY_REQUALIFIED
	GuildDiscoveryGracePeriodInitialWarning                        // GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING
	GuildDiscoveryGracePeriodFinalWarning                          // GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING
	ThreadCreated                                                  // THREAD_CREATED
	Reply                                                          // REPLY
	ChatInputCommand                                               // CHAT_INPUT_COMMAND
	ThreadStarterMessage                                           // THREAD_STARTER_MESSAGE
	GuildInviteReminder                                            // GUILD_INVITE_REMINDER
	ContextMenuCommand                                             // CONTEXT_MENU_COMMAND
	AutoModerationAction                                           // AUTO_MODERATION_ACTION
	RoleSubscriptionPurchase                                       // ROLE_SUBSCRIPTION_PURCHASE
	InteractionPremiumUpsell                                       // INTERACTION_PREMIUM_UPSELL
	StageStart                                                     // STAGE_START
	StageEnd                                                       // STAGE_END
	StageSpeaker                                                   // STAGE_SPEAKER
	StageTopic                              MessageType = iota + 2 // STAGE_TOPIC
	GuildApplicationPremiumSubscription                            // GUILD_APPLICATION_PREMIUM_SUBSCRIPTION
)

type MfaLevel

type MfaLevel int

MfaLevel - required MFA level for the guild

const (
	MfaNone     MfaLevel = iota // guild has no MFA/2FA requirement for moderation actions
	MfaElevated                 // guild has a 2FA requirement for moderation actions
)

type ModalSubmitData

type ModalSubmitData struct {
	CustomID   string       `json:"custom_id"`  // the custom_id of the modal
	Components []*Component `json:"components"` // the values submitted by the user
}

type ModifyAllChannelJSON

type ModifyAllChannelJSON struct {
	Name                 string       `json:"name"`                  // 1-100 character channel name
	Position             *int         `json:"position"`              // the position of the channel in the left-hand listing
	PermissionOverwrites []*Overwrite `json:"permission_overwrites"` // channel or category-specific permissions
}

type ModifyAnnouncementChannelJSON

type ModifyAnnouncementChannelJSON struct {
	ModifyAllChannelJSON

	Type                       ChannelType `json:"type"`                          // the type of channel; only conversion between text and announcement is supported and only in guilds with the "NEWS" feature
	Topic                      *string     `json:"topic"`                         // 0-1024 character channel topic
	Nsfw                       *bool       `json:"nsfw"`                          // whether the channel is nsfw
	ParentID                   *Snowflake  `json:"parent_id"`                     // id of the new parent category for a channel
	DefaultAutoArchiveDuration *uint64     `json:"default_auto_archive_duration"` // the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity
}

type ModifyCurrentUserJSON

type ModifyCurrentUserJSON struct {
	Username string  `json:"username,omitempty"`
	Avatar   *string `json:"avatar,omitempty"`
}

ModifyCurrentUserJSON - JSON payload

type ModifyCurrentUserVoiceStateJSON

type ModifyCurrentUserVoiceStateJSON struct {
	ChannelID               Snowflake  `json:"channel_id,omitempty"`                 // the id of the channel the user is currently in
	Suppress                bool       `json:"suppress,omitempty"`                   // toggles the user's suppress state
	RequestToSpeakTimestamp *time.Time `json:"request_to_speak_timestamp,omitempty"` // sets the user's request to speak
}

ModifyCurrentUserVoiceStateJSON - JSON payload

type ModifyGroupDmJSON

type ModifyGroupDmJSON struct {
	Name string `json:"name"` // 1-100 character channel name
	Icon string `json:"icon"` // base64 encoded icon
}

type ModifyGuildChannelPositionsJSON

type ModifyGuildChannelPositionsJSON struct {
	ID              Snowflake  `json:"id"`               // channel id
	Position        *uint64    `json:"position"`         // sorting position of the channel
	LockPermissions *bool      `json:"lock_permissions"` // syncs the permission overwrites with the new parent, if moving to a new category
	ParentID        *Snowflake `json:"parent_id"`        // the new parent ID for the channel that is moved
}

ModifyGuildChannelPositionsJSON - JSON payload

type ModifyGuildEmojiJSON

type ModifyGuildEmojiJSON struct {
	Name  string       `json:"name,omitempty"`  // Name - name of the emoji
	Roles []*Snowflake `json:"roles,omitempty"` // Roles - roles allowed to use this emoji
}

ModifyGuildEmojiJSON - Parameters to pass in the JSON payload

type ModifyGuildJSON

type ModifyGuildJSON struct {
	Name                        string                           `json:"name,omitempty"`                          // guild name (2-100 characters, excluding trailing and leading whitespace)
	VerificationLevel           *VerificationLevel               `json:"verification_level,omitempty"`            // verification level required for the guild
	DefaultMessageNotifications *DefaultMessageNotificationLevel `json:"default_message_notifications,omitempty"` // default message notifications level
	ExplicitContentFilter       *ExplicitContentFilterLevel      `json:"explicit_content_filter,omitempty"`       // explicit content filter level
	AfkChannelID                *Snowflake                       `json:"afk_channel_id,omitempty,omitempty"`      // id of afk channel
	AfkTimeout                  int64                            `json:"afk_timeout,omitempty"`                   // afk timeout in seconds
	Icon                        *string                          `json:"icon,omitempty"`                          // icon hash
	OwnerID                     Snowflake                        `json:"owner_id,omitempty"`                      // id of owner
	Splash                      *string                          `json:"splash,omitempty,omitempty"`              // splash hash
	DiscoverySplash             *string                          `json:"discovery_splash,omitempty"`              // discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
	Banner                      *string                          `json:"banner,omitempty"`                        // banner hash
	SystemChannelID             *Snowflake                       `json:"system_channel_id,omitempty"`             // the id of the channel where guild notices such as welcome messages and boost events are posted
	SystemChannelFlags          SystemChannelFlags               `json:"system_channel_flags,omitempty"`          // system channel flags
	RulesChannelID              *Snowflake                       `json:"rules_channel_id,omitempty"`              // the id of the channel where Community guilds can display rules and/or guidelines
	PublicUpdatesChannelID      *Snowflake                       `json:"public_updates_channel_id,omitempty"`     // the id of the channel where admins and moderators of Community guilds receive notices from Discord
	PreferredLocale             string                           `json:"preferred_locale,omitempty"`              // the preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
	Features                    []*GuildFeatures                 `json:"features,omitempty"`                      // enabled guild features
	Description                 *string                          `json:"description,omitempty"`                   // the description of a Community guild
	PremiumProgressBarEnabled   bool                             `json:"premium_progress_bar_enabled,omitempty"`  // whether the guild has the boost progress bar enabled
}

ModifyGuildJSON All parameters to this endpoint are optional

This endpoint supports the `X-Audit-Log-Reason` header.

Attempting to add or remove the COMMUNITY guild feature requires the Administrator permission.

type ModifyGuildMemberJSON

type ModifyGuildMemberJSON struct {
	Nick                       *string         `json:"nick,omitempty"`                         // value to set user's nickname to
	Roles                      []*Snowflake    `json:"roles,omitempty"`                        // array of role ids the member is assigned
	Mute                       *bool           `json:"mute,omitempty"`                         // whether the user is muted in voice channels. Will throw a 400 error if the user is not in a voice channel
	Deaf                       *bool           `json:"deaf,omitempty"`                         // whether the user is deafened in voice channels. Will throw a 400 error if the user is not in a voice channel
	ChannelID                  *Snowflake      `json:"channel_id,omitempty"`                   // id of channel to move user to (if they are connected to voice)
	CommunicationDisabledUntil *time.Time      `json:"communication_disabled_until,omitempty"` // when the user's timeout will expire and the User will be able to communicate in the guild again (up to 28 days in the future), set to null to remove timeout. Will throw a 403 error if the user has the Administrator permission or is the owner of the guild
	Flags                      GuildMemberFlag `json:"flags"`                                  // guild member flags
}

ModifyGuildMemberJSON - JSON payload

type ModifyGuildRoleJSON

type ModifyGuildRoleJSON struct {
	Name         *string `json:"name,omitempty"`
	Permissions  *string `json:"permissions,omitempty"`
	Color        *uint64 `json:"color,omitempty"`
	Hoist        *bool   `json:"hoist,omitempty"`
	Icon         *string `json:"icon,omitempty"`
	UnicodeEmoji *string `json:"unicode_emoji,omitempty"`
	Mentionable  *bool   `json:"mentionable,omitempty"`
}

ModifyGuildRoleJSON - JSON payload

type ModifyGuildRolePositionsJSON

type ModifyGuildRolePositionsJSON struct {
	ID       Snowflake `json:"id"`                 // role
	Position *uint64   `json:"position,omitempty"` // sorting position of the role
}

ModifyGuildRolePositionsJSON - JSON payload

type ModifyGuildScheduledEventJSON

type ModifyGuildScheduledEventJSON struct {
	ChannelID          *Snowflake                         `json:"channel_id,omitempty"`
	EntityMetadata     *GuildScheduledEventEntityMetadata `json:"entity_metadata,omitempty"`
	Name               string                             `json:"name"`
	PrivacyLevel       GuildScheduledEventPrivacyLevel    `json:"privacy_level"`
	ScheduledStartTime time.Time                          `json:"scheduled_start_time"`
	ScheduledEndTime   time.Time                          `json:"scheduled_end_time,omitempty"`
	Description        *string                            `json:"description,omitempty"`
	EntityType         GuildScheduledEventType            `json:"entity_type"`
	Status             GuildScheduledEventStatus          `json:"status,omitempty"`
	Image              string                             `json:"image,omitempty"`
}

ModifyGuildScheduledEventJSON - JSON payload

type ModifyGuildStickerJSON

type ModifyGuildStickerJSON struct {
	Name        string  `json:"name"`        // name of the sticker (2-30 characters)
	Description *string `json:"description"` // description of the sticker (2-100 characters)
	Tags        string  `json:"tags"`        // autocomplete/suggestion tags for the sticker (max 200 characters)
}

ModifyGuildStickerJSON - JSON payload

type ModifyGuildTemplateJSON

type ModifyGuildTemplateJSON struct {
	CreateGuildTemplateJSON
}

type ModifyGuildVoiceChannelJSON

type ModifyGuildVoiceChannelJSON struct {
	ModifyAllChannelJSON

	Bitrate          *uint64          `json:"bitrate"`            // the bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers)
	UserLimit        *uint            `json:"user_limit"`         // the user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit
	ParentID         *Snowflake       `json:"parent_id"`          // id of the new parent category for a channel
	RtcRegion        *string          `json:"rtc_region"`         // channel voice region id, automatic when set to null
	VideoQualityMode VideoQualityMode `json:"video_quality_mode"` // the camera video quality mode of the voice channel
}

type ModifyGuildWelcomeScreenJSON

type ModifyGuildWelcomeScreenJSON struct {
	Enabled         *bool                   `json:"enabled,omitempty"`          // whether the welcome screen is enabled
	WelcomeChannels []*WelcomeScreenChannel `json:"welcome_channels,omitempty"` // channels linked in the welcome screen and their display options
	Description     *string                 `json:"description,omitempty"`      // the server description to show in the welcome screen
}

ModifyGuildWelcomeScreenJSON - JSON payload

type ModifyStageInstanceJSON

type ModifyStageInstanceJSON struct {
	Topic        string       `json:"topic,omitempty"`         // The topic of the Stage instance (1-120 characters)
	PrivacyLevel PrivacyLevel `json:"privacy_level,omitempty"` // The PrivacyLevel of the Stage instance
}

ModifyStageInstanceJSON - data to send in the ModifyStageInstance payload

type ModifyTextChannelJSON

type ModifyTextChannelJSON struct {
	ModifyAnnouncementChannelJSON

	RateLimitPerUser *uint64 `json:"rate_limit_per_user"` // amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission ManageMessages, or ManageChannels, are unaffected
}

type ModifyThreadJSON

type ModifyThreadJSON struct {
	Name                string `json:"name"`                  // 1-100 character channel name
	Archived            bool   `json:"archived"`              // whether the thread is archived
	AutoArchiveDuration int    `json:"auto_archive_duration"` // duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	Locked              bool   `json:"locked"`                // whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
	Invitable           bool   `json:"invitable"`             // whether non-moderators can add other non-moderators to a thread; only available on private threads
	RateLimitPerUser    *int   `json:"rate_limit_per_user"`   // amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages, manage_thread, or manage_channel, are unaffected
}

ModifyThreadJSON - When setting archived to false, when locked is also false, only the SEND_MESSAGES permission is required.

Otherwise, requires the MANAGE_THREADS permission. Fires a Thread Update Gateway event. Requires the thread to have archived set to false or be set to false in the request.

type ModifyUserVoiceStateJSON

type ModifyUserVoiceStateJSON struct {
	ChannelID Snowflake `json:"channel_id"`         // the id of the channel the user is currently in
	Suppress  bool      `json:"suppress,omitempty"` // toggles the user's suppress state
}

ModifyUserVoiceStateJSON - JSON payload

type OnboardingPrompt added in v10.2.0

type OnboardingPrompt struct {
	ID           Snowflake      `json:"id"`            // ID of the prompt
	Type         PromptType     `json:"type"`          // Type of prompt
	Options      []PromptOption `json:"options"`       // Options available within the prompt
	Title        string         `json:"title"`         // Title of the prompt
	SingleSelect bool           `json:"single_select"` // Indicates whether users are limited to selecting one option for the prompt
	Required     bool           `json:"required"`      // Indicates whether the prompt is required before a user completes the onboarding flow
	InOnboarding bool           `json:"in_onboarding"` // Indicates whether the prompt is present in the onboarding flow. If false, the prompt will only appear in the Channels & Roles tab
}

OnboardingPrompt - Prompts shown during onboarding and in customize community

type OptionalAuditEntry

type OptionalAuditEntry struct {
	ApplicationID                 Snowflake ` json:"application_id"`                   // ID of the app whose permissions were targeted
	AutoModerationRuleName        string    `json:"auto_moderation_rule_name"`         // Name of the Auto Moderation rule that was triggered
	AutoModerationRuleTriggerType string    `json:"auto_moderation_rule_trigger_type"` // Trigger type of the Auto Moderation rule that was triggered
	ChannelID                     Snowflake `json:"channel_id"`                        // channel in which the entities were targeted
	Count                         string    `json:"count"`                             // number of entities that were targeted
	DeleteMemberDays              string    `json:"delete_member_days"`                // number of days after which inactive members were kicked
	ID                            Snowflake `json:"id"`                                // id of the overwritten entity
	MembersRemoved                string    `json:"members_removed"`                   // number of members removed by the prune
	MessageID                     Snowflake `json:"message_id"`                        // id of the message that was targeted
	RoleName                      string    `json:"role_name"`                         // name of the role if type is "0" (not present if type is "1")
	Type                          string    `json:"type"`                              // type of overwritten entity - "0" for "role" or "1" for "member"
}

OptionalAuditEntry - Information that is specific to certain events

type Overwrite

type Overwrite struct {
	ID    Snowflake     `json:"id"`    // Role or User id
	Type  OverwriteType `json:"type"`  // either PermissionRole or PermissionMember
	Allow string        `json:"allow"` // permission bit set
	Deny  string        `json:"deny"`  // permission bit set
}

Overwrite - representation of a permissions overwrite

type OverwriteType

type OverwriteType int

OverwriteType - either PermissionRole or PermissionMember

const (
	PermissionRole   OverwriteType = iota // 0 (role)
	PermissionMember                      // 1 (member)
)

type Permission

type Permission uint64

Permission - Permissions in Discord are a way to limit and grant certain abilities to users. A set of base permissions can be configured at the guild level for different roles. When these roles are attached to users, they grant or revoke specific privileges within the guild. Along with the guild-level permissions, Discord also supports permission overwrites that can be assigned to individual guild roles or guild members on a per-channel basis.

Permissions are stored within a variable-length integer serialized into a string, and are calculated using bitwise operations. For example, the permission value 123 will be serialized as "123". For long-term stability, we recommend deserializing the permissions using your languages' Big Integer libraries. The total permissions integer can be determined by ORing together each individual value, and flags can be checked using AND operations.

const (
	NoPermissions                    Permission = 0 << 0  // For Vanity Roles that have no other permissions attached to them
	CreateInstantInvite              Permission = 1 << 0  // Allows creation of instant invites
	KickMembers                      Permission = 1 << 1  // Allows kicking members
	BanMembers                       Permission = 1 << 2  // Allows banning members
	Administrator                    Permission = 1 << 3  // Allows all permissions and bypasses channel permission overwrites
	ManageChannels                   Permission = 1 << 4  // Allows management and editing of channels
	ManageGuild                      Permission = 1 << 5  // Allows management and editing of the guild
	AddReactions                     Permission = 1 << 6  // Allows for the addition of reactions to messages
	ViewAuditLog                     Permission = 1 << 7  // Allows for viewing of audit logs
	PrioritySpeaker                  Permission = 1 << 8  // Allows for using priority speaker in a voice channel
	Stream                           Permission = 1 << 9  // Allows the user to go live
	ViewChannel                      Permission = 1 << 10 // Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels
	SendMessages                     Permission = 1 << 11 // Allows for sending messages in a channel (does not allow sending messages in threads)
	SendTtsMessages                  Permission = 1 << 12 // Allows for sending of /tts messages
	ManageMessages                   Permission = 1 << 13 // Allows for deletion of other users messages
	EmbedLinks                       Permission = 1 << 14 // Links sent by users with this permission will be auto-embedded
	AttachFiles                      Permission = 1 << 15 // Allows for uploading images and files
	ReadMessageHistory               Permission = 1 << 16 // Allows for reading of message history
	MentionEveryone                  Permission = 1 << 17 // Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel
	UseExternalEmojis                Permission = 1 << 18 // Allows the usage of custom emojis from other servers
	ViewGuildInsights                Permission = 1 << 19 // Allows for viewing guild insights
	Connect                          Permission = 1 << 20 // Allows for joining of a voice channel
	Speak                            Permission = 1 << 21 // Allows for speaking in a voice channel
	MuteMembers                      Permission = 1 << 22 // Allows for muting members in a voice channel
	DeafenMembers                    Permission = 1 << 23 // Allows for deafening of members in a voice channel
	MoveMembers                      Permission = 1 << 24 // Allows for moving of members between voice channels
	UseVoiceActivity                 Permission = 1 << 25 // Allows for using voice-activity-detection in a voice channel
	ChangeNickname                   Permission = 1 << 26 // Allows for modification of own nickname
	ManageNicknames                  Permission = 1 << 27 // Allows for modification of other users nicknames
	ManageRoles                      Permission = 1 << 28 // Allows management and editing of roles
	ManageWebhooks                   Permission = 1 << 29 // Allows management and editing of webhooks
	ManageGuildExpressions           Permission = 1 << 30 // Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users
	UseApplicationCommands           Permission = 1 << 31 // Allows members to use application commands, including slash commands and context menu commands.
	RequestToSpeak                   Permission = 1 << 32 // Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)
	ManageEvents                     Permission = 1 << 33 // Allows for editing and deleting scheduled events created by all users
	ManageThreads                    Permission = 1 << 34 // Allows for deleting and archiving threads, and viewing all private threads
	CreatePublicThreads              Permission = 1 << 35 // Allows for creating public and announcement threads
	CreatePrivateThreads             Permission = 1 << 36 // Allows for creating private threads
	UseExternalStickers              Permission = 1 << 37 // Allows the usage of custom stickers from other servers
	SendMessagesInThreads            Permission = 1 << 38 // Allows for sending messages in threads
	UseEmbeddedActivities            Permission = 1 << 39 // Allows for launching activities (applications with the EMBEDDED flag) in a voice channel
	ModerateMembers                  Permission = 1 << 40 // Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels
	ViewCreatorMonetizationAnalytics Permission = 1 << 41 // Allows for viewing role subscription insights
	UseSoundboard                    Permission = 1 << 42 // Allows for using soundboard in a voice channel
	CreateGuildExpressions           Permission = 1 << 43 // Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user
	CreateEvents                     Permission = 1 << 44 // Allows for creating scheduled events, and editing and deleting those created by the current user
	UseExternalSounds                Permission = 1 << 45 // Allows the usage of custom soundboard sounds from other servers
	SendVoiceMessages                Permission = 1 << 46 // Allows sending voice messages
)

type PremiumTier

type PremiumTier int

PremiumTier - premium tier (Server Boost level)

const (
	PremiumNone  PremiumTier = iota // guild has not unlocked any Server Boost perks
	PremiumTier1                    // guild has unlocked Server Boost level 1 perks
	PremiumTier2                    // guild has unlocked Server Boost level 2 perks
	PremiumTier3                    // guild has unlocked Server Boost level 3 perks
)

type PremiumType

type PremiumType int

PremiumType - Premium types denote the level of premium a user has. Visit the Nitro page to learn more about the premium plans we currently offer.

const (
	MultipleChoice PremiumType = iota
	Dropdown
)
const (
	None         PremiumType = iota // None
	NitroClassic                    // Nitro Classic
	Nitro                           // Nitro
	NitroBasic                      // Nitro Basic
)

type PrivacyLevel

type PrivacyLevel int

PrivacyLevel - The privacy level of the Stage instance

const (
	GuildOnly PrivacyLevel = iota + 2 // The Stage instance is visible to only guild members.
)

type PromptOption added in v10.2.0

type PromptOption struct {
	ID            Snowflake   `json:"id"`                       // ID of the prompt option
	ChannelIds    []Snowflake `json:"channel_ids"`              // IDs for channels a member is added to when the option is selected
	RoleIds       []Snowflake `json:"role_ids"`                 // IDs for roles assigned to a member when the option is selected
	Emoji         Emoji       `json:"emoji,omitempty"`          // Emoji of the option
	EmojiID       Snowflake   `json:"emoji_id,omitempty"`       // EmojiID of the option
	EmojiName     string      `json:"emoji_name,omitempty"`     // EmojiName of the option
	EmojiAnimated bool        `json:"emoji_animated,omitempty"` // Whether the emoji is animated
	Title         string      `json:"title"`                    // Title of the option
	Description   *string     `json:"description"`              // Description of the option
}

PromptOption - Options available within the prompt When creating or updating a prompt option, the emoji_id, emoji_name, and emoji_animated fields must be used instead of the emoji object.

type PromptType added in v10.2.0

type PromptType int

PromptType - Type of prompt

type RateLimiter

type RateLimiter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RateLimiter holds all ratelimit buckets

var (
	// Rest - Holds the rate limit buckets
	Rest *RateLimiter
)

func NewRatelimiter

func NewRatelimiter() *RateLimiter

NewRatelimiter returns a new RateLimiter

func (*RateLimiter) Request

func (r *RateLimiter) Request(method, route string, data any, reason *string) (*http.Response, error)

Request - send an HTTP request with rate limiting

type Reaction

type Reaction struct {
	Count int   `json:"count"` // times this Emoji has been used to react
	Me    bool  `json:"me"`    // whether the current User reacted using this Emoji
	Emoji Emoji `json:"emoji"` // Emoji information
}

Reaction - representation of a message reaction

type ResolvedData

type ResolvedData struct {
	Users       map[Snowflake]User        `json:"users,omitempty"`       // the IDs and DiscordUser objects
	Members     map[Snowflake]GuildMember `json:"members,omitempty"`     // the IDs and partial GuildMember objects
	Roles       map[Snowflake]Role        `json:"roles,omitempty"`       // the IDs and GuildRole objects
	Channels    map[Snowflake]Channel     `json:"channels,omitempty"`    // the IDs and partial GuildChannel objects
	Messages    map[Snowflake]Message     `json:"messages,omitempty"`    // the ids and partial Message objects
	Attachments map[Snowflake]Attachment  `json:"attachments,omitempty"` // the ids and attachment objects
}

ResolvedData - Descriptive data about the Interaction

If data for a GuildMember is included, data for its corresponding User will also be included.

type Role

type Role struct {
	ID           Snowflake  `json:"id"`                      // role id
	Name         string     `json:"name"`                    // role name
	Color        int        `json:"color"`                   // integer representation of hexadecimal color code
	Hoist        bool       `json:"hoist"`                   // if this role is pinned in the user listing
	Icon         *string    `json:"icon,omitempty"`          // role icon hash
	UnicodeEmoji *string    `json:"unicode_emoji,omitempty"` // role unicode emoji
	Position     int        `json:"position"`                // position of this role
	Permissions  Permission `json:"permissions,string"`      // permission bit set
	Managed      bool       `json:"managed"`                 // whether this role is managed by an integration
	Mentionable  bool       `json:"mentionable"`             // whether this role is mentionable
	Tags         RoleTags   `json:"tags,omitempty"`          // the tags this role has
}

Role - Roles represent a set of permissions attached to a group of users.

Roles have unique names, colors, and can be "pinned" to the sidebar, causing their members to be listed separately.

Roles are unique per guild, and can have separate permission profiles for the global context (guild) and channel context.

The @everyone role has the same ID as the guild it belongs to.

type RoleSubscriptionData

type RoleSubscriptionData struct {
	RoleSubscriptionListingID Snowflake `json:"role_subscription_listing_id"` // the id of the sku and listing that the user is subscribed to
	TierName                  string    `json:"tier_name"`                    // the name of the tier that the user is subscribed to
	TotalMonthsSubscribed     uint      `json:"total_months_subscribed"`      // the cumulative number of months that the user has been subscribed for
	IsRenewal                 bool      `json:"is_renewal"`                   // whether this notification is for a renewal rather than a new purchase
}

RoleSubscriptionData - data of the role subscription purchase or renewal that prompted this RoleSubscriptionData message

type RoleTags

type RoleTags struct {
	BotID             Snowflake `json:"bot_id,omitempty"`             // the id of the bot this role belongs to
	IntegrationID     Snowflake `json:"integration_id,omitempty"`     // the id of the integration this role belongs to
	PremiumSubscriber *string   `json:"premium_subscriber,omitempty"` // whether this is the guild's premium subscriber role
}

RoleTags - the tags this Role has

type SelectMenu

type SelectMenu struct {
	Type         ComponentType   `json:"type"`                  // ComponentTypeSelectMenu for a select menu
	CustomID     string          `json:"custom_id"`             // a developer-defined identifier for the button, max 100 characters
	Options      []*SelectOption `json:"options"`               // the choices in the select, max 25
	ChannelTypes []*ChannelType  `json:"channel_types"`         // List of channel types to include in the channel select component (type 8)
	Placeholder  string          `json:"placeholder,omitempty"` // custom placeholder text if nothing is selected, max 150 characters
	MinValues    int64           `json:"min_values,omitempty"`  // the minimum number of items that must be chosen; default 1, min 0, max 25
	MaxValues    int64           `json:"max_values,omitempty"`  // the maximum number of items that can be chosen; default 1, max 25
	Disabled     bool            `json:"disabled,omitempty"`    // disable the select, default false
}

SelectMenu - Select menus support single-select and multi-select behavior, meaning you can prompt a user to choose just one item from a list, or multiple.

When a user finishes making their choice by clicking out of the dropdown or closing the half-sheet, your app will receive an interaction.

Select menus must be sent inside an Action Row
An Action Row can contain only one select menu
An Action Row containing a select menu cannot also contain buttons

type SelectOption

type SelectOption struct {
	Label       string `json:"label"`                 // the user-facing name of the option, max 25 characters
	Value       string `json:"value"`                 // the dev-define value of the option, max 100 characters
	Description string `json:"description,omitempty"` // an additional description of the option, max 50 characters
	Emoji       *Emoji `json:"emoji,omitempty"`       // id, name, and animated
	Default     bool   `json:"default,omitempty"`     // will render this option as selected by default
}

SelectOption - Represents a single select menu option

type Service

type Service string

Service - the service of the connection

const (
	BattleNet       Service = "battlenet"
	CrunchyRoll     Service = "crunchyroll" // Undocumented as of 03/17/2023
	Ebay            Service = "ebay"
	EpicGames       Service = "epicgames"
	Facebook        Service = "facebook"
	GitHub          Service = "github"
	Instagram       Service = "instagram"
	LeagueOfLegends Service = "leagueoflegends"
	PayPal          Service = "paypal"
	PlayStation     Service = "playstation"
	Reddit          Service = "reddit"
	RiotGames       Service = "riotgames"
	Spotify         Service = "spotify"
	Skype           Service = "skype" // No longer to be added by users
	Steam           Service = "steam"
	TikTok          Service = "tiktok"
	Twitch          Service = "twitch"
	Twitter         Service = "twitter"
	Xbox            Service = "xbox"
	YouTube         Service = "youtube"
)

type Snowflake

type Snowflake string

Snowflake - Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs).

These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their parent's ID.

Because Snowflake IDs are up to 64 bits in size (e.g. a uint64), they are always returned as strings in the HTTP API to prevent integer overflows in some languages.

See Gateway ETF/JSON for more information regarding Gateway encoding.

func PermissionConstantsEveryone

func PermissionConstantsEveryone(guildID Snowflake) *Snowflake

PermissionConstantsEveryone All members in a guild

func PermissionsConstantsAllChannels

func PermissionsConstantsAllChannels(guildID Snowflake) *Snowflake

PermissionsConstantsAllChannels All channels in a guild

func StringToSnowflake

func StringToSnowflake(s string) *Snowflake

StringToSnowflake - Type converts a string into a Snowflake

func (Snowflake) ParseSnowflake

func (s Snowflake) ParseSnowflake() FormattedSnowflake

ParseSnowflake - Breaks down a Snowflake and assigns each value to the FormattedSnowflake struct

func (Snowflake) String

func (s Snowflake) String() string

String - Type converts a Snowflake into a string

func (Snowflake) Timestamp

func (s Snowflake) Timestamp() time.Time

Timestamp - Extracts only the timestamp from a Snowflake

Useful for determining when the object belonging to the Snowflake was created

func (Snowflake) ToBinary

func (s Snowflake) ToBinary() string

ToBinary - Type converts a Snowflake into its binary representation

type SortOrderType

type SortOrderType int

SortOrderType - the default sort order type used to order posts in GuildForum channels.

const (
	LatestActivity SortOrderType = iota // Sort forum posts by activity
	CreationDate                        // Sort forum posts by creation time (from most recent to oldest)
)

type StageInstance

type StageInstance struct {
	ID                    Snowflake    `json:"id"`                       // The id of this Stage instance
	GuildID               Snowflake    `json:"guild_id"`                 // The guild id of the associated Stage channel
	ChannelID             Snowflake    `json:"channel_id"`               // The id of the associated Stage channel
	Topic                 string       `json:"topic"`                    // The topic of the Stage instance (1-120 characters)
	PrivacyLevel          PrivacyLevel `json:"privacy_level"`            // The privacy level of the Stage instance
	GuildScheduledEventID *Snowflake   `json:"guild_scheduled_event_id"` // The id of the scheduled event for this Stage instance
}

StageInstance - A StageInstance holds information about a live stage.

func CreateStageInstance

func CreateStageInstance(payload CreateStageInstanceJSON, reason *string) (*StageInstance, error)

CreateStageInstance - Creates a new Stage instance associated to a Stage channel.

Requires the user to be a moderator of the Stage channel.

This endpoint supports the X-Audit-Log-Reason header.

func (*StageInstance) DeleteStageInstance

func (s *StageInstance) DeleteStageInstance(reason *string) error

DeleteStageInstance - Deletes the Stage instance. Returns `204 No Content`.

Requires the user to be a moderator of the Stage channel.

This endpoint supports the `X-Audit-Log-Reason` header.

func (*StageInstance) GetStageInstance

func (s *StageInstance) GetStageInstance() (*StageInstance, error)

GetStageInstance - Gets the stage instance associated with the Stage channel, if it exists.

func (*StageInstance) ModifyStageInstance

func (s *StageInstance) ModifyStageInstance(payload ModifyStageInstanceJSON, reason *string) (*StageInstance, error)

ModifyStageInstance - Updates fields of an existing Stage instance.

Requires the user to be a moderator of the Stage channel.

  This endpoint supports the `X-Audit-Log-Reason` header.

type StartThreadInForumJSON

type StartThreadInForumJSON struct {
	Name                string                          `json:"name"`                          // 1-100 character channel name
	AutoArchiveDuration uint64                          `json:"auto_archive_duration"`         // duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	RateLimitPerUser    *uint64                         `json:"rate_limit_per_user,omitempty"` // amount of seconds a user has to wait before sending another message (0-21600)
	Message             ForumOrMediaThreadMessageParams `json:"message"`                       // contents of the first message in the forum thread
	AppliedTags         []Snowflake                     `json:"applied_tags"`                  // the IDs of the set of tags that have been applied to a thread in a GuildForum or a GuildMedia channel
	Files               []string                        `json:"files"`                         // Contents of the file being sent. See Uploading Files
	PayloadJson         string                          `json:"payload_json"`                  // JSON-encoded body of non-file params, only for multipart/form-data requests. See Uploading Files
}

StartThreadInForumJSON - JSON payload structure

type StartThreadWithMessageJSON

type StartThreadWithMessageJSON struct {
	Name                string  `json:"name"`                            // 1-100 character channel name
	AutoArchiveDuration uint64  `json:"auto_archive_duration,omitempty"` // duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	RateLimitPerUser    *uint64 `json:"rate_limit_per_user,omitempty"`   // amount of seconds a user has to wait before sending another message (0-21600)
}

StartThreadWithMessageJSON - JSON payload structure

type StartThreadWithoutMessageJSON

type StartThreadWithoutMessageJSON struct {
	Name                string      `json:"name"`                          // 1-100 character channel name
	AutoArchiveDuration uint64      `json:"auto_archive_duration"`         // duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	Type                ChannelType `json:"type"`                          // the type of thread to create
	Invitable           bool        `json:"invitable"`                     // whether non-moderators can add other non-moderators to a thread; only available when creating a private thread
	RateLimitPerUser    *uint64     `json:"rate_limit_per_user,omitempty"` // amount of seconds a user has to wait before sending another message (0-21600)
}

StartThreadWithoutMessageJSON - JSON payload structure

type Sticker

type Sticker struct {
	ID          Snowflake   `json:"id"`                   // id of the sticker
	PackID      Snowflake   `json:"pack_id,omitempty"`    // for standard stickers, id of the pack the sticker is from
	Name        string      `json:"name"`                 // name of the sticker
	Description *string     `json:"description"`          // description of the sticker
	Tags        string      `json:"tags,omitempty"`       // autocomplete/suggestion tags for the sticker (max 200 characters)
	Type        StickerType `json:"type"`                 // type of sticker
	FormatType  int         `json:"format_type"`          // type of sticker format
	Available   bool        `json:"available,omitempty"`  // whether this guild sticker can be used, may be false due to loss of Server Boosts
	GuildID     Snowflake   `json:"guild_id,omitempty"`   // id of the guild that owns this sticker
	User        User        `json:"user,omitempty"`       // the user that uploaded the guild sticker
	SortValue   int         `json:"sort_value,omitempty"` // the standard sticker's sort order within its pack
}

Sticker - Represents a sticker that can be sent in messages.

func (*Sticker) GetSticker

func (s *Sticker) GetSticker() (*Sticker, error)

GetSticker - Returns a sticker object for the given sticker ID.

type StickerFormatType

type StickerFormatType int

StickerFormatType - The format of the Sticker

const (
	StickerFormatTypePng         StickerFormatType = iota + 1 // PNG
	StickerFormatTypeAnimatedPng                              // APNG
	StickerFormatTypeLottie                                   // LOTTIE
	StickerFormatTypeGif                                      // GIF
)

type StickerItem

type StickerItem struct {
	ID         Snowflake         `json:"id"`          // id of the sticker
	Name       string            `json:"name"`        // name of the sticker
	FormatType StickerFormatType `json:"format_type"` // type of sticker format
}

StickerItem - The smallest amount of data required to render a sticker. A partial sticker object.

type StickerPack

type StickerPack struct {
	ID             Snowflake  `json:"id"`                         // id of the sticker pack
	Stickers       []*Sticker `json:"stickers"`                   // the stickers in the pack
	Name           string     `json:"name"`                       // name of the sticker pack
	SkuID          Snowflake  `json:"sku_id"`                     // id of the pack's SKU
	CoverStickerID Snowflake  `json:"cover_sticker_id,omitempty"` // id of a sticker in the pack which is shown as the pack's icon
	Description    string     `json:"description"`                // description of the sticker pack
	BannerAssetID  Snowflake  `json:"banner_asset_id,omitempty"`  // id of the sticker pack's banner image
}

StickerPack - Represents a pack of standard stickers.

type StickerType

type StickerType int

StickerType - type of sticker

const (
	StickerTypeStandard StickerType = iota + 1 // an official sticker in a pack, part of Nitro or in a removed purchasable pack
	StickerTypeGuild                           // a sticker uploaded to a Boosted guild for the guild's members
)

type SystemChannelFlags

type SystemChannelFlags int

SystemChannelFlags - system channel flags

const (
	SuppressJoinNotifications                           SystemChannelFlags = 1 << 0 // Suppress member join notifications
	SuppressPremiumSubscriptions                        SystemChannelFlags = 1 << 1 // Suppress server boost notifications
	SuppressGuildReminderNotifications                  SystemChannelFlags = 1 << 2 // Suppress server setup tips
	SuppressJoinNotificationReplies                     SystemChannelFlags = 1 << 3 // Hide member join sticker reply buttons
	SuppressRoleSubscriptionPurchaseNotifications       SystemChannelFlags = 1 << 4 // Suppress role subscription purchase and renewal notifications
	SuppressRoleSubscriptionPurchaseNotificationReplies SystemChannelFlags = 1 << 5 // Hide role subscription sticker reply buttons
)

type Team

type Team struct {
	Icon        *string       `json:"icon"`          // a hash of the image of the team's icon
	ID          Snowflake     `json:"id"`            // the unique id of the team
	Members     []*TeamMember `json:"members"`       // the members of the team
	Name        string        `json:"name"`          // the name of the team
	OwnerUserID Snowflake     `json:"owner_user_id"` // the user id of the current team owner
}

Team - Teams are groups of developers on Discord who want to collaborate on apps.

On other platforms, these may be referred to as "organizations", "companies", or "teams".

type TeamMember

type TeamMember struct {
	MembershipState MembershipState `json:"membership_state"` // the user's membership state on the team
	Permissions     []string        `json:"permissions"`      // will always be ["*"]
	TeamID          Snowflake       `json:"team_id"`          // the id of the parent team of which they are a member
	User            User            `json:"user"`             // the avatar, discriminator, id, and username of the user
}

TeamMember - representation of a team member

type TextInput

type TextInput struct {
	Type        ComponentType  `json:"type"`                  // ComponentTypeTextInput for a text input
	CustomID    string         `json:"custom_id"`             // a developer-defined identifier for the input, max 100 characters
	Style       TextInputStyle `json:"style"`                 // the TextInputStyle
	Label       string         `json:"label"`                 // the label for this component
	MinLength   uint           `json:"min_length,omitempty"`  // the minimum input length for a text input, min 0, max 4000
	MaxLength   uint           `json:"max_length,omitempty"`  // the maximum input length for a text input, min 1, max 4000
	Required    bool           `json:"required,omitempty"`    // whether this component is required to be filled, default true
	Value       string         `json:"value,omitempty"`       // a pre-filled value for this component, max 4000 characters
	Placeholder string         `json:"placeholder,omitempty"` // custom placeholder text if the input is empty, max 100 characters
}

TextInput - Text inputs are an interactive component that render on modals. They can be used to collect short-form or long-form text.

type TextInputStyle

type TextInputStyle int

TextInputStyle - Denotes if a text input is short form or paragraph form

const (
	TextInputShort     TextInputStyle = iota + 1 // A single-line input
	TextInputParagraph                           // A multi-line input
)

type ThreadListResponse

type ThreadListResponse struct {
	Threads []*Channel      `json:"threads"`            // the archived threads
	Members []*ThreadMember `json:"members"`            // a thread member object for each returned thread the current user has joined
	HasMore bool            `json:"has_more,omitempty"` // whether there are potentially additional threads that could be returned on a subsequent call
}

type ThreadMember

type ThreadMember struct {
	ID            Snowflake   `json:"id,omitempty"`      // ID of the thread
	UserID        Snowflake   `json:"user_id,omitempty"` // ID of the user
	JoinTimestamp time.Time   `json:"join_timestamp"`    // Time the user last joined the thread
	Flags         int64       `json:"flags"`             // Any user-thread settings, currently only used for notifications
	Member        GuildMember `json:"member,omitempty"`  // Additional information about the user
}

ThreadMember - A thread member is used to indicate whether a user has joined a thread or not.

type ThreadMetadata

type ThreadMetadata struct {
	Archived            bool       `json:"archived"`                   // whether the thread is archived
	AutoArchiveDuration int        `json:"auto_archive_duration"`      // duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	ArchiveTimestamp    time.Time  `json:"archive_timestamp"`          // timestamp when the thread's archive status was last changed, used for calculating recent activity
	Locked              bool       `json:"locked"`                     // whether the thread is locked; when a thread is locked, only users with ManageThreads can unarchive it
	Invitable           bool       `json:"invitable,omitempty"`        // whether non-moderators can add other non-moderators to a thread; only available on private threads
	CreateTimestamp     *time.Time `json:"create_timestamp,omitempty"` // timestamp when the thread was created; only populated for threads created after 2022-01-09
}

ThreadMetadata - The thread metadata object contains a number of thread-specific channel fields that are not needed by other channel types.

type Thumbnail

type Thumbnail struct {
	URL    string `json:"url,omitempty"`    // source url of thumbnail (only supports http(s) and attachments)
	Height int    `json:"height,omitempty"` // height of thumbnail
	Width  int    `json:"width,omitempty"`  // width of thumbnail
}

Thumbnail - thumbnail information

func (*Thumbnail) SetURL

func (t *Thumbnail) SetURL(u string) *Thumbnail

SetURL - set the Thumbnail URL

type TimestampStyle

type TimestampStyle string

TimestampStyle - Timestamps will display the given timestamp in the user's timezone and locale.

const (
	ShortTime     TimestampStyle = "t" // ShortTime - 16:20
	LongTime      TimestampStyle = "T" // LongTime - 16:20:30
	ShortDate     TimestampStyle = "d" // ShortDate - 20/04/2021
	LongDate      TimestampStyle = "D" // LongDate - 20 April 2021
	ShortDateTime TimestampStyle = "f" // ShortDateTime - 20 April 2021 16:20; default
	LongDateTime  TimestampStyle = "F" // LongDateTime - Tuesday, 20 April 2021 16:20
	RelativeTime  TimestampStyle = "R" // RelativeTime - 2 months ago
)

type TriggerMetadata

type TriggerMetadata struct {
	KeywordFilter     []string             `json:"keyword_filter"`      // substrings which will be searched for in content (Maximum of 1000)
	RegexPatterns     []string             `json:"regex_patterns"`      // regular expression patterns which will be matched against content (Maximum of 10)
	Presets           []*KeyWordPresetType `json:"presets"`             // the internally pre-defined wordsets which will be searched for in content
	AllowList         []string             `json:"allow_list"`          // substrings which will be exempt from triggering the preset trigger type (Maximum of 1000)
	MentionTotalLimit int                  `json:"mention_total_limit"` // total number of unique role and user mentions allowed per message (Maximum of 50)
}

TriggerMetadata - Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the value of trigger_type.

type TriggerType

type TriggerType int

TriggerType - Characterizes the type of content which can trigger the rule.

const (
	Keyword       TriggerType = iota + 1 // check if content contains words from a user defined list of keywords
	Spam          TriggerType = iota + 2 // check if content represents generic spam
	KeywordPreset                        // check if content contains words from internal pre-defined wordsets
	MentionSpam                          // check if content contains more unique mentions than allowed
)

type UnavailableGuild

type UnavailableGuild struct {
	ID          Snowflake `json:"id"`
	Unavailable bool      `json:"unavailable"`
}

UnavailableGuild - A partial guild object.

Represents an Offline Guild, or a Guild whose information has not been provided through Guild Create events during the Gateway connect.

type User

type User struct {
	ID               Snowflake   `json:"id,omitempty"`                // the user's id
	Username         string      `json:"username,omitempty"`          // the user's username, not unique across the platform
	Discriminator    string      `json:"discriminator,omitempty"`     // the user's 4-digit discord-tag
	Avatar           *string     `json:"avatar"`                      // the user's avatar hash
	Bot              bool        `json:"bot,omitempty"`               // whether the user belongs to an OAuth2 application
	System           bool        `json:"system,omitempty"`            // whether the user is an Official Discord System user (part of the urgent message system)
	MfaEnabled       bool        `json:"mfa_enabled,omitempty"`       // whether the user has two factor enabled on their account
	Banner           *string     `json:"banner,omitempty"`            // the user's banner hash
	BannerColor      string      `json:"banner_color,omitempty"`      // Undocumented as of 10/31/21
	AccentColor      *uint       `json:"accent_color,omitempty"`      // the user's banner color encoded as an integer representation of hexadecimal color code
	Locale           string      `json:"locale,omitempty"`            // the user's chosen language option
	Flags            UserFlags   `json:"flags,omitempty"`             // the flags on a user's account
	PremiumType      PremiumType `json:"premium_type,omitempty"`      // the type of Nitro subscription on a user's account
	PublicFlags      UserFlags   `json:"public_flags,omitempty"`      // the public flags on a user's account
	GlobalName       *string     `json:"global_name,omitempty"`       // UNDOCUMENTED AS OF 3/23/2023
	DisplayName      *string     `json:"display_name,omitempty"`      // UNDOCUMENTED AS OF 3/23/2023
	AvatarDecoration *string     `json:"avatar_decoration,omitempty"` // UNDOCUMENTED AS OF 3/23/2023

	// Below require `email` OAuth2 scope
	Verified bool    `json:"verified,omitempty"` // whether the email on this account has been verified
	Email    *string `json:"email,omitempty"`    // the user's email
}

User - Discord enforces the following restrictions for usernames and nicknames:

Names can contain most valid unicode characters. We limit some zero-width and non-rendering characters.
Usernames must be between 2 and 32 characters long.
Nicknames must be between 1 and 32 characters long.
Names are sanitized and trimmed of leading, trailing, and excessive internal whitespace.

The following restrictions are additionally enforced for usernames:

Names cannot contain the following substrings: '@', '#', ':', '```', 'discord'.
Names cannot be: 'everyone', 'here'.

There are other rules and restrictions not shared here for the sake of spam and abuse mitigation, but the majority of users won't encounter them.

It's important to properly handle all error messages returned by Discord when editing or updating names.

func GetCurrentUser

func GetCurrentUser() (*User, error)

GetCurrentUser - Returns the user object of the requesters account.

For OAuth2, this requires the `identify` scope, which will return the object without an email, and optionally the `email` scope, which returns the object with an email.

func ModifyCurrentUser

func ModifyCurrentUser(payload *ModifyCurrentUserJSON) (*User, error)

ModifyCurrentUser - Modify the requesters user account settings. Returns a User object on success.

All parameters to this endpoint are optional.

func (*User) GetAvatarUrl

func (u *User) GetAvatarUrl() string

GetAvatarUrl - returns a properly formatted avatar url

func (*User) GetDefaultUserAvatarUrl

func (u *User) GetDefaultUserAvatarUrl() string

GetDefaultUserAvatarUrl - returns the default Discord avatar

func (*User) GetUser

func (u *User) GetUser() (*User, error)

GetUser - Returns a User object for a given user ID.

type UserFlags

type UserFlags uint64

UserFlags - public flags on a User account, many display badges on a User profile

const (
	FlagsNone             UserFlags = iota    // None
	Staff                 UserFlags = 1 << 0  // Discord Employee
	Partner               UserFlags = 1 << 1  // Partnered Server Owner
	HypeSquad             UserFlags = 1 << 2  // HypeSquad Events Coordinator
	BugHunterLevel1       UserFlags = 1 << 3  // Bug Hunter Level 1
	HouseBravery          UserFlags = 1 << 6  // House Bravery Member
	HouseBrilliance       UserFlags = 1 << 7  // House Brilliance Member
	HouseBalance          UserFlags = 1 << 8  // House Balance Member
	PremiumEarlySupporter UserFlags = 1 << 9  // Early Nitro Supporter
	TeamPsuedoUser        UserFlags = 1 << 10 // User is a team
	BugHunterLevel2       UserFlags = 1 << 14 // Bug Hunter Level 2
	VerifiedBot           UserFlags = 1 << 16 // Verified Bot
	VerifiedDeveloper     UserFlags = 1 << 17 // Early Verified Bot Developer
	CertifiedModerator    UserFlags = 1 << 18 // Discord Certified Moderator
	BotHttpInteractions   UserFlags = 1 << 19 // Bot uses only HTTP interactions and is shown in the online member list
	ActiveDeveloper       UserFlags = 1 << 22 // User is an Active Developer
)

type VerificationLevel

type VerificationLevel int

VerificationLevel - verification level required for the guild

const (
	VerificationLevelNone     VerificationLevel = iota // unrestricted
	VerificationLevelLow                               // must have verified email on account
	VerificationLevelMedium                            // must be registered on Discord for longer than 5 minutes
	VerificationLevelHigh                              // must be a member of the server for longer than 10 minutes
	VerificationLevelVeryHigh                          // must have a verified phone number
)

type VideoQualityMode

type VideoQualityMode int

VideoQualityMode - the camera video quality mode of the voice channel, 1 when not present

const (
	Auto VideoQualityMode = iota + 1 // Discord chooses the quality for optimal performance
	Full                             // 720p
)

type VoiceRegion

type VoiceRegion struct {
	ID         string `json:"id"`         // unique ID for the region
	Name       string `json:"name"`       // name of the region
	Optimal    bool   `json:"optimal"`    // true for a single server that is closest to the current user's client
	Deprecated bool   `json:"deprecated"` // whether this is a deprecated voice region (avoid switching to these)
	Custom     bool   `json:"custom"`     // whether this is a custom voice region (used for events/etc)
}

VoiceRegion - representation of a geographic voice server

func ListVoiceRegions

func ListVoiceRegions() ([]*VoiceRegion, error)

ListVoiceRegions - Returns an array of voice region objects that can be used when setting a voice or stage channel's `rtc_region`.

type VoiceState

type VoiceState struct {
	GuildID                 Snowflake   `json:"guild_id,omitempty"`                   // the guild id this voice state is for
	ChannelID               *Snowflake  `json:"channel_id,omitempty"`                 // the channel id this user is connected to
	UserID                  Snowflake   `json:"user_id"`                              // the user id this voice state is for
	Member                  GuildMember `json:"member,omitempty"`                     // the guild member this voice state is for
	SessionID               string      `json:"session_id"`                           // the session id for this voice state
	Deaf                    bool        `json:"deaf"`                                 // whether this user is deafened by the server
	Mute                    bool        `json:"mute"`                                 // whether this user is muted by the server
	SelfDeaf                bool        `json:"self_deaf"`                            // whether this user is locally deafened
	SelfMute                bool        `json:"self_mute"`                            // whether this user is locally muted
	SelfStream              bool        `json:"self_stream,omitempty"`                // whether this user is streaming using "Go Live"
	SelfVideo               bool        `json:"self_video"`                           // whether this user's camera is enabled
	Suppress                bool        `json:"suppress"`                             // whether this user is muted by the current user
	RequestToSpeakTimestamp *time.Time  `json:"request_to_speak_timestamp,omitempty"` // the time at which the user requested to speak
}

VoiceState - Used to represent a user's voice connection status.

type Webhook

type Webhook struct {
	ID            Snowflake   `json:"id"`                       // the id of the webhook
	Type          WebhookType `json:"type"`                     // the type of the webhook
	GuildID       *Snowflake  `json:"guild_id,omitempty"`       // the guild id this webhook is for, if any
	ChannelID     *Snowflake  `json:"channel_id"`               // the channel id this webhook is for, if any
	User          User        `json:"user,omitempty"`           // the user this webhook was created by (not returned when getting a webhook with its token)
	Name          *string     `json:"name"`                     // the default name of the webhook
	Avatar        *string     `json:"avatar"`                   // the default user avatar hash of the webhook
	Token         string      `json:"token,omitempty"`          // the secure token of the webhook (returned for Incoming Webhooks)
	ApplicationID *Snowflake  `json:"application_id"`           // the bot/OAuth2 application that created this webhook
	SourceGuild   Guild       `json:"source_guild,omitempty"`   // the guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
	SourceChannel Channel     `json:"source_channel,omitempty"` // the channel that this webhook is following (returned for Channel Follower Webhooks)
	URL           string      `json:"url,omitempty"`            // the url used for executing the webhook (returned by the webhooks OAuth2 flow)
}

Webhook - Used to represent a webhook.

func (*Webhook) DeleteWebhook

func (w *Webhook) DeleteWebhook(channel *Channel, reason *string) error

DeleteWebhook - Delete a webhook permanently. Requires the ManageWebhooks permission. Returns a 204 No Content response on success.

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Webhook) DeleteWebhookMessage

func (w *Webhook) DeleteWebhookMessage(msgID *Snowflake, threadID *Snowflake) error

DeleteWebhookMessage - Deletes a message that was created by the webhook. Returns a 204 No Content response on success.

threadID is optional; pass nil if not needed

func (*Webhook) DeleteWebhookWithToken

func (w *Webhook) DeleteWebhookWithToken(reason *string) error

DeleteWebhookWithToken - Same as above, except this call does not require authentication.

func (*Webhook) EditWebhookMessage

func (w *Webhook) EditWebhookMessage(msgID *Snowflake,
	threadID *Snowflake,
	payload *EditWebhookMessageJSON) (
	*Message,
	error,
)

EditWebhookMessage - Edits a previously-sent webhook message from the same token. Returns a Message object on success.

When the content field is edited, the mentions array in the message object will be reconstructed from scratch based on the new content. The AllowedMentions field of the edit request controls how this happens. If there is no explicit AllowedMentions in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an AllowedMentions was present in the request that originally created the Message.

Refer to Uploading Files for details on attachments and `multipart/form-data requests`. Any provided files will be appended to the message. To remove or replace files you will have to supply the "attachments" field which specifies the files to retain on the message after edit.

Starting with API v10, the attachments array must contain all attachments that should be present after edit, including retained and new attachments provided in the request body.

All JSON parameters to this endpoint are optional and nullable.

threadID is optional; pass nil if not needed

func (*Webhook) ExecuteWebhook

func (w *Webhook) ExecuteWebhook(wait bool, threadID *Snowflake, payload *ExecuteWebhookJSON) (*Message,
	error)

ExecuteWebhook - Refer to Uploading Files for details on attachments and multipart/form-data requests.

Note that when sending a message, you must provide a value for at least one of content, embeds, or file.

wait is required; threadID is optional; pass nil if not needed

func (*Webhook) GetWebhook

func (w *Webhook) GetWebhook() (*Webhook, error)

GetWebhook - Returns the new webhook object for the given id.

func (*Webhook) GetWebhookMessage

func (w *Webhook) GetWebhookMessage(msgID *Snowflake, threadID *Snowflake) (*Message, error)

GetWebhookMessage - Returns a previously-sent webhook message from the same token. Returns a message object on success.

threadID is optional; pass nil if not needed

func (*Webhook) GetWebhookWithToken

func (w *Webhook) GetWebhookWithToken() (*Webhook, error)

GetWebhookWithToken - Same as above, except this call does not require authentication and returns no user in the webhook object.

func (*Webhook) ModifyWebhook

func (w *Webhook) ModifyWebhook(name *string, avatar *dataurl.DataURL, channel *Channel, reason *string) (
	*Webhook,
	error,
)

ModifyWebhook - Modify a webhook. Requires the ManageWebhooks permission. Returns the updated Webhook object on success. Fires a Webhooks Update Gateway event.

All parameters to this endpoint are optional

This endpoint supports the "X-Audit-Log-Reason" header.

func (*Webhook) ModifyWebhookWithToken

func (w *Webhook) ModifyWebhookWithToken(name *string, avatar *dataurl.DataURL, reason *string) (*Webhook, error)

ModifyWebhookWithToken - Same as above, except this call does not require authentication, does not accept a channel_id parameter in the body, and does not return a user in the webhook object.

type WebhookType

type WebhookType int

WebhookType - the type of the webhook

const (
	WebhookTypeIncoming        WebhookType = iota + 1 // Incoming Webhooks can post messages to channels with a generated token
	WebhookTypeChannelFollower                        // Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
	WebhookTypeApplication                            // Application webhooks are webhooks used with Interactions
)

type WelcomeScreen

type WelcomeScreen struct {
	Description     *string                 `json:"description,omitempty"`      // the server description shown in the welcome screen
	WelcomeChannels []*WelcomeScreenChannel `json:"welcome_channels,omitempty"` // the channels shown in the welcome screen, up to 5
}

WelcomeScreen - the welcome screen object

type WelcomeScreenChannel

type WelcomeScreenChannel struct {
	ChannelID   Snowflake  `json:"channel_id,omitempty"`  // the channel's id
	Description string     `json:"description,omitempty"` // the description shown for the channel
	EmojiID     *Snowflake `json:"emoji_id,omitempty"`    // the emoji id, if the emoji is custom
	EmojiName   *string    `json:"emoji_name,omitempty"`  // the emoji name if custom, the unicode character if standard, or null if no emoji is set
}

WelcomeScreenChannel - the channels shown in the welcome screen, up to 5

Jump to

Keyboard shortcuts

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