api

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

* Copyright (c) 2022. Veteran Software * * Discord API Wrapper - A custom wrapper for the Discord REST API developed for a proprietary project. * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program. * If not, see <http://www.gnu.org/licenses/>.

Index

Constants

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, 1.0)"
)

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 CanAnnounce

func CanAnnounce(c *Channel) bool

CanAnnounce Deprecated: helper function for checking bas permissions for sending announcements

func CanEmbedLinks(channel *Channel) bool

CanEmbedLinks - checks for this permission

func CanManageMessages

func CanManageMessages(channel *Channel) bool

CanManageMessages - checks for this permission

func CanManageRoles

func CanManageRoles(channel *Channel) bool

CanManageRoles - checks for this permission

func CanManageWebhooks

func CanManageWebhooks(channel *Channel) bool

CanManageWebhooks - checks for this permission

func CanMentionEveryone

func CanMentionEveryone(channel *Channel) bool

CanMentionEveryone - checks for this permission

func CanReadMessageHistory

func CanReadMessageHistory(channel *Channel) bool

CanReadMessageHistory - checks for this permission

func CanSendMessages

func CanSendMessages(channel *Channel) bool

CanSendMessages - checks for this permission

func CanUseExternalEmojis

func CanUseExternalEmojis(channel *Channel) bool

CanUseExternalEmojis - checks for this permission

func CanViewChannel

func CanViewChannel(channel *Channel) bool

CanViewChannel - checks for this permission

func CreateGlobalApplicationCommand

func CreateGlobalApplicationCommand(applicationID Snowflake) (method string, route string)

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) (method string, route string)

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 CreateStageInstance added in v0.1.10

func CreateStageInstance() (string, string)

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 DeleteGlobalApplicationCommand

func DeleteGlobalApplicationCommand(applicationID Snowflake, commandID string) (method string, route string)

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

func DeleteGuildApplicationCommand

func DeleteGuildApplicationCommand(applicationID Snowflake, guildID Snowflake, commandID string) (method string, route string)

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

func GetCurrentUser

func GetCurrentUser() (method string, route string)

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 GetGlobalApplicationCommands

func GetGlobalApplicationCommands(applicationID Snowflake) (method string, route string)

GetGlobalApplicationCommands - Fetch all the global commands for your application.

Returns an array of application command objects.

func GetGuildApplicationCommands

func GetGuildApplicationCommands(applicationID Snowflake, guildID Snowflake) (method string, route string)

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

Returns an array of application command objects.

func HasAdmin

func HasAdmin(p Permission) bool

HasAdmin checks to see if the bot has admin on the channel in question

func ListNitroStickerPacks added in v0.1.9

func ListNitroStickerPacks() (string, string)

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

func ListVoiceRegions

func ListVoiceRegions() (method string, route string)

ListVoiceRegions - Returns an array of voice region objects that can be used when setting a voice or stage channel's rtc_region.

func PtrStr

func PtrStr(s *string) string

PtrStr converts a string pointer to a string

Types

type Activity

type Activity struct {
	Name          string             `json:"name"`                     // the activity's name
	Type          ActivityType       `json:"type"`                     // activity type
	URL           *string            `json:"url,omitempty"`            // stream url, is validated when type is 1
	CreatedAt     int64              `json:"created_at"`               // unix timestamp (in milliseconds) of when the activity was added to the user's session
	Timestamps    ActivityTimestamps `json:"timestamps,omitempty"`     // unix timestamps for start and/or end of the game
	ApplicationID Snowflake          `json:"application_id,omitempty"` // application id for the game
	Details       *string            `json:"details,omitempty"`        // what the player is currently doing
	State         *string            `json:"state,omitempty"`          // the user's current party status
	Emoji         *Emoji             `json:"emoji,omitempty"`          // the emoji used for a custom status
	Party         ActivityParty      `json:"party,omitempty"`          // information for the current party of the player
	Assets        ActivityAssets     `json:"assets,omitempty"`         // images for the presence and their hover texts
	Secrets       ActivitySecrets    `json:"secrets,omitempty"`        // secrets for Rich Presence joining and spectating
	Instance      bool               `json:"instance,omitempty"`       // whether the activity is an instanced game session
	Flags         ActivityFlag       `json:"flags,omitempty"`          // activity flags ORd together, describes what the payload includes
	Buttons       []ActivityButtons  `json:"buttons,omitempty"`        // the custom buttons shown in the Rich Presence (max 2)
}

Activity - represents a user activity

type ActivityAssets

type ActivityAssets struct {
	LargeImage string `json:"large_image,omitempty"` // see https://discord.com/developers/docs/topics/gateway#activity-object-activity-asset-image
	LargeText  string `json:"large_text,omitempty"`  // text displayed when hovering over the large image of the activity
	SmallImage string `json:"small_image,omitempty"` // see https://discord.com/developers/docs/topics/gateway#activity-object-activity-asset-image
	SmallText  string `json:"small_text,omitempty"`  // text displayed when hovering over the small image of the activity
}

ActivityAssets - images for the presence and their hover texts

type ActivityButtons

type ActivityButtons struct {
	Label string `json:"label"` // the text shown on the button (1-32 characters)
	URL   string `json:"url"`   // the url opened when clicking the button (1-512 characters)
}

ActivityButtons - When received over the gateway, the buttons field is an array of strings, which are the button labels.

Bots cannot access a user's activity button URLs.

When sending, the buttons field must be an array

type ActivityEmoji added in v0.1.10

type ActivityEmoji struct {
	Name     string    `json:"name"`               // the name of the emoji
	ID       Snowflake `json:"id,omitempty"`       // the id of the emoji
	Animated bool      `json:"animated,omitempty"` // whether this emoji is animated
}

ActivityEmoji - representation of an emoji in a custom status

type ActivityFlag added in v0.1.10

type ActivityFlag uint

ActivityFlag - describes what the payload includes

const (
	ActivityFlagInstance                 ActivityFlag = 1 << 0
	ActivityFlagJoin                     ActivityFlag = 1 << 1
	ActivityFlagSpectate                 ActivityFlag = 1 << 2
	ActivityFlagJoinRequest              ActivityFlag = 1 << 3
	ActivityFlagSync                     ActivityFlag = 1 << 4
	ActivityFlagPlay                     ActivityFlag = 1 << 5
	ActivityFlagPartyPrivacyFriends      ActivityFlag = 1 << 6
	ActivityFlagPartyPrivacyVoiceChannel ActivityFlag = 1 << 7
	ActivityFlagEmbedded                 ActivityFlag = 1 << 8
)

type ActivityParty

type ActivityParty struct {
	ID   string    `json:"id,omitempty"`   // the id of the party
	Size [2]uint16 `json:"size,omitempty"` // the id of the party; used to show the party's current and maximum size
}

ActivityParty - information for the current party of the player

type ActivitySecrets

type ActivitySecrets struct {
	Join     string `json:"join,omitempty"`     // the secret for joining a party
	Spectate string `json:"spectate,omitempty"` // the secret for spectating a game
	Match    string `json:"match,omitempty"`    // the secret for a specific instanced match
}

ActivitySecrets - secrets for Rich Presence joining and spectating

type ActivityTimestamps

type ActivityTimestamps struct {
	Start int64 `json:"start,omitempty"` // unix time (in milliseconds) of when the activity started
	End   int64 `json:"end,omitempty"`   // unix time (in milliseconds) of when the activity ends
}

ActivityTimestamps - start and stop timestamps for an activity

type ActivityType added in v0.1.10

type ActivityType uint8

ActivityType - The streaming type currently only supports Twitch and YouTube.

Only https://twitch.tv/ and https://youtube.com/ urls will work.

const (
	Game      ActivityType = iota // Playing {name}
	Streaming                     // Streaming {details}
	Listening                     // Listening to {name}
	Watching                      // Watching {name}
	Custom                        // {emoji} {name}
	Competing                     // Competing in {name}
)

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"`                             // 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
	RpcOrigins          []string  `json:"rpc_origins"`                    // an array of rpc origin urls, if rpc is enabled
	BotPublic           bool      `json:"bot_public"`                     // when false only app owner can join the app's bot 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
	TermsOfServiceURL   string    `json:"terms_of_service_url,omitempty"` // the url of the app's terms of service
	PrivacyPolicyURL    string    `json:"privacy_policy_url,omitempty"`   // the url of the app's privacy policy
	Owner               User      `json:"owner,omitempty"`                // partial user object containing info on the owner of the application
	// Summary
	// Deprecated: application.summary now returns an empty string. This field will be removed in gateway v11
	Summary      string           `json:"summary"`               // if this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku
	VerifyKey    string           `json:"verify_key"`            // the hex encoded key for verification in interactions and the GameSDK's GetTicket
	Team         *Team            `json:"team"`                  // if the application belongs to a team, this will be a list of the members of that team
	GuildID      Snowflake        `json:"guild_id,omitempty"`    // if this application is a game sold on Discord, this field will be the guild to which it has been linked
	PrimarySkuID Snowflake        `json:"primary_sku_id"`        // if this application 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 application 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"` // the application's default rich presence invite cover image hash
	Flags        ApplicationFlags `json:"flags,omitempty"`       // the application's public ApplicationFlags
}

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

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
	Description        string                     `json:"description"`                   // 1-100 character description for CHAT_INPUT command, empty string for USER and MESSAGE command
	Options            []ApplicationCommandOption `json:"options,omitempty"`             // the parameters for the command, max 25; CHAT_INPUT
	DefaultPermissions bool                       `json:"default_permissions,omitempty"` // default true; whether the command is enabled by default when added to a guild
	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

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   interface{}                                `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
	Description  string                           `json:"description"`             // 1-100 character 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     interface{}                      `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     interface{}                      `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
	Autocomplete bool                             `json:"autocomplete,omitempty"`  // enable autocomplete interactions for this 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
	Value interface{} `json:"value,string"` // 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
)

type ApplicationCommandPermissionType

type ApplicationCommandPermissionType int

ApplicationCommandPermissionType - The permission type for the command

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

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 (
	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
)

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 {
	AuditLogEntries      []AuditLogEntry       `json:"audit_log_entries"`      // list of audit log entries
	GuildScheduledEvents []GuildScheduledEvent `json:"guild_scheduled_events"` // list of GuildScheduledEvent found in the audit log
	Integrations         []Integration         `json:"integrations"`           // list of partial integration objects
	Threads              []Channel             `json:"threads"`                // list of threads found in the audit log
	Users                []User                `json:"users"`                  // list of users found in the audit log
	Webhooks             []Webhook             `json:"webhooks"`               // list of webhooks found in the audit log
}

AuditLog - Whenever an admin action is performed on the API, an entry is added to the respective guild's audit log.

You can specify the reason by attaching the "X-Audit-Log-Reason" request header.

This header supports url encoded utf8 characters.

type AuditLogChange

type AuditLogChange struct {
	NewValue interface{} `json:"new_value,omitempty"` // new value of the key
	OldValue interface{} `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
)

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) GetName

func (a *Author) GetName() string

GetName - Get the Author name Deprecated: Access the struct field directly

func (*Author) GetURL

func (a *Author) GetURL() string

GetURL - Get the Author URL Deprecated: Access the struct field directly

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 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 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
  • An 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
	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
}

Channel - Represents a guild or DM channel within Discord.

func (*Channel) AddThreadMember

func (c *Channel) AddThreadMember(userID Snowflake) (method, route string)

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() (method, route string)

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() (method, route string)

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() (method, route string)

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

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 SEND_MESSAGES permission.
  • When sending a message with tts (text-to-speech) set to true, the current user must have the SEND_TTS_MESSAGES permission.
  • When creating a message as a reply to another message, the current user must have the READ_MESSAGE_HISTORY 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) (method, route string)

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 added in v0.1.8

func (c *Channel) CreateWebhook() (string, string)

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) (method, route string)

CrosspostMessage - Crosspost a message in a News 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) (method, route string)

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) (method, route string)

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() (method, route string)

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

Requires the MANAGE_CHANNELS permission for the guild, or MANAGE_THREADS if the channel is a thread.

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

Returns a channel object on success. Fires a Channel Delete Gateway event (or Thread Delete 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) (method, route string)

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) (method, route string)

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 Message Delete Gateway event.

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

func (*Channel) DeleteOwnReaction

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

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) (method, route string)

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) (method, route string)

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) (method, route string)

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) FollowNewsChannel

func (c *Channel) FollowNewsChannel() (method, route string)

FollowNewsChannel - Follow a News 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

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() (method, route string)

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) (method, route string)

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) (method, route string)

GetChannelMessages - Returns the messages for a channel.

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

If the current user is missing the 'READ_MESSAGE_HISTORY' 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

func (*Channel) GetChannelWebhooks added in v0.1.8

func (c *Channel) GetChannelWebhooks() (string, string)

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

func (*Channel) GetPinnedMessages

func (c *Channel) GetPinnedMessages() (method, route string)

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) (method, route string)

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) (method, route string)

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) (method, route string)

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) (method, route string)

GroupDmRemoveRecipient - Removes a recipient from a Group DM.

func (*Channel) JoinThread

func (c *Channel) JoinThread() (method, route string)

JoinThread - Adds the current user to a thread.

Also requires the thread is not archived.

Returns a 204 empty response on success.

Fires a Thread Members Update Gateway event.

func (*Channel) LeaveThread

func (c *Channel) LeaveThread() (method, route string)

LeaveThread - Removes the current user from a thread.

Also requires the thread is not archived.

Returns a 204 empty response on success.

Fires a Thread Members Update Gateway event.

func (*Channel) ListJoinedPrivateArchivedThreads

func (c *Channel) ListJoinedPrivateArchivedThreads(before *Snowflake, limit *int) (method, route string)

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) (method, route string)

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) (method, route string)

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 GuildNews channel returns threads of type GuildNewsThread.

Threads are ordered by archive_timestamp, in descending order.

Requires the ReadMessageHistory permission.

func (*Channel) ListThreadMembers

func (c *Channel) ListThreadMembers() (method, route string)

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) ModifyChannel

func (c *Channel) ModifyChannel(dm *map[string]interface{}, guildChannel *map[string]interface{}, name *string, icon *base64.Encoding, reason *string) *Channel

ModifyChannel - Update a channel's settings.

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

All JSON parameters are optional.

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

func (*Channel) PinMessage

func (c *Channel) PinMessage(messageID Snowflake) (method, route string)

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) (method, route string)

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) StartThreadWithMessage

func (c *Channel) StartThreadWithMessage(messageID Snowflake) (method, route string)

StartThreadWithMessage - Creates a new thread from an existing message.

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

Fires a Thread Create Gateway event.

When called on a GuildText channel, creates a GuildPublicThread.

When called on a GuildNews channel, creates a GuildNewsThread.

The id of the created thread will be the same as the id of the 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() (method, route string)

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 Thread Create Gateway event.

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

* Creating a private thread requires the server to be boosted. The guild features 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() (method, route string)

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) (method, route string)

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 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
	GuildNews                                 // a channel that users can follow and crosspost into their own server
	GuildStore                                // a channel in which game developers can sell their game on Discord
	GuildNewsThread    ChannelType = iota + 3 // a temporary sub-channel within a GuildNews 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
)

type ClientStatus

type ClientStatus struct {
	Desktop string `json:"desktop,omitempty"` // the user's status set for an active desktop (Windows, Linux, Mac) application session
	Mobile  string `json:"mobile,omitempty"`  // the user's status set for an active mobile (iOS, Android) application session
	Web     string `json:"web,omitempty"`     // the user's status set for an active web (browser, bot account) application session
}

ClientStatus - Active sessions are indicated with an "online", "idle", or "dnd" string per platform.

If a user is offline or invisible, the corresponding field is not present.

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       interface{}    `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.

func NewComponent

func NewComponent() *Component

NewComponent - Build a new Component

func (*Component) GetButtonStyle

func (c *Component) GetButtonStyle() ButtonStyle

GetButtonStyle Deprecated: access the struct field directly

func (*Component) GetCustomID

func (c *Component) GetCustomID() string

GetCustomID Deprecated: access the struct field directly

func (*Component) GetEmoji

func (c *Component) GetEmoji() *Emoji

GetEmoji Deprecated: access the struct field directly

func (*Component) GetTextInputStyle

func (c *Component) GetTextInputStyle() TextInputStyle

GetTextInputStyle Deprecated: access the struct field directly

func (*Component) GetType

func (c *Component) GetType() ComponentType

GetType Deprecated: access the struct field directly

func (*Component) GetURL

func (c *Component) GetURL() string

GetURL Deprecated: access the struct field directly

func (*Component) IsDisabled

func (c *Component) IsDisabled() bool

func (*Component) SetButtonStyle

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

func (*Component) SetCustomID

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

func (*Component) SetDisabled

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

func (*Component) SetEmoji

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

func (*Component) SetTextInputStyle

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

func (*Component) SetType

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

func (*Component) SetURL

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

type ComponentType

type ComponentType int

ComponentType - The type of component

const (
	ComponentTypeActionRow  ComponentType = iota + 1 // A container for other components
	ComponentTypeButton                              // A clickable button
	ComponentTypeSelectMenu                          // A select menu for picking from choices
	ComponentTypeTextInput                           // A text input object
)

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         string                   `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
	Visibility   ConnectionVisibilityType `json:"visibility"`             // visibility of this connection
}

Connection - The connection object that the user has attached.

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
	Description       string                      `json:"description"`                  // 1-100 character description
	Options           *[]ApplicationCommandOption `json:"options,omitempty"`            // the parameters for the command
	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 CreateChannelJSON

type CreateChannelJSON 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
}

CreateChannelJSON - JSON payload structure

type CreateEmojiJSON added in v0.1.9

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

type CreateGuildApplicationCommandJSON

type CreateGuildApplicationCommandJSON struct {
	Name              string                      `json:"name"`                         // 1-32 character name
	Description       string                      `json:"description"`                  // 1-100 character description
	Options           *[]ApplicationCommandOption `json:"options,omitempty"`            // the parameters for the command
	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
}

CreateGuildApplicationCommandJSON - JSON payload structure

type CreateMessageJSON

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

CreateMessageJSON - JSON payload structure

type CreateStageInstanceJSON added in v0.1.10

type CreateStageInstanceJSON struct {
	ChannelID    Snowflake    `json:"channel_id"`    // The id of the 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 (default GuildOnly)
}

CreateStageInstanceJSON - data to send in the CreateStageInstance payload

type CreateWebhookJSON added in v0.1.8

type CreateWebhookJSON struct {
	Name   string           `json:"name"`             // name of the webhook (1-80 characters)
	Avatar *base64.Encoding `json:"avatar,omitempty"` // image for the default webhook avatar
}

CreateWebhookJSON - JSON payload structure

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 EditApplicationCommandJSON

type EditApplicationCommandJSON struct {
	Name              string                      `json:"name"`                         // 1-32 character name
	Description       string                      `json:"description"`                  // 1-100 character description
	Options           *[]ApplicationCommandOption `json:"options,omitempty"`            // the parameters for the command
	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 added in v0.1.10

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"`
	Deny  *string        `json:"deny,omitempty"`
	Type  PermissionType `json:"type"`
}

EditChannelPermissionsJSON - JSON payload structure

type EditGuildApplicationCommandJSON

type EditGuildApplicationCommandJSON struct {
	Name              string                      `json:"name"`                         // 1-32 character name
	Description       string                      `json:"description"`                  // 1-100 character description
	Options           *[]ApplicationCommandOption `json:"options,omitempty"`            // the parameters for the command
	DefaultPermission bool                        `json:"default_permission,omitempty"` // whether the command is enabled by default when the app is added to a guild; default true
}

EditGuildApplicationCommandJSON - JSON payload structure

type EditMessageJSON

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

EditMessageJSON - JSON payload structure

type EditWebhookMessageJSON added in v0.1.8

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) GetAuthor

func (e *Embed) GetAuthor() *Author

GetAuthor - Get the Embed author Deprecated: Access the struct field directly

func (*Embed) GetColor

func (e *Embed) GetColor() int64

GetColor - Get the Embed color Deprecated: Access the struct field directly

func (*Embed) GetDescription

func (e *Embed) GetDescription() string

GetDescription - Get the Embed description Deprecated: Access the struct field directly

func (*Embed) GetFields

func (e *Embed) GetFields() []*Field

GetFields - Get the Embed fields Deprecated: Access the struct field directly

func (*Embed) GetFooter

func (e *Embed) GetFooter() *Footer

GetFooter - Get the Embed footer Deprecated: Access the struct field directly

func (*Embed) GetImage

func (e *Embed) GetImage() *Image

GetImage - Get the Embed image Deprecated: Access the struct field directly

func (*Embed) GetThumbnail

func (e *Embed) GetThumbnail() string

GetThumbnail - Get the Embed thumbnail Deprecated: Access the struct field directly

func (*Embed) GetTimestamp

func (e *Embed) GetTimestamp() (time.Time, error)

GetTimestamp - Get the Embed timestamp Deprecated: Access the struct field directly

func (*Embed) GetTitle

func (e *Embed) GetTitle() string

GetTitle - Get the Embed title Deprecated: Access the struct field directly

func (*Embed) GetURL

func (e *Embed) GetURL() string

GetURL - Get the Embed URL Deprecated: Access the struct field directly

func (*Embed) IsValidLength added in v0.1.9

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 ExecuteWebhookJSON added in v0.1.8

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)
}

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 added in v0.1.9

func NewField() *Field

NewField - Create a new base Field to chain against

func (*Field) GetName

func (f *Field) GetName() string

GetName - Get the Field name Deprecated: Access the struct field directly

func (*Field) GetValue

func (f *Field) GetValue() string

GetValue - Get the Field value Deprecated: Access the struct field directly

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 FollowNewsChannelJSON

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

FollowNewsChannelJSON - JSON payload structure

type FollowedChannel added in v0.1.9

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) GetIconURL

func (f *Footer) GetIconURL() string

GetIconURL - Get the Footer icon URL Deprecated: Access the struct field directly

func (*Footer) GetText

func (f *Footer) GetText() string

GetText - Get the Footer text Deprecated: Access the struct field directly

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 GatewayIntents added in v0.1.9

type GatewayIntents int64

GatewayIntents - Maintaining a stateful application can be difficult when it comes to the amount of data you're expected to process, especially at scale.

Gateway Intents are a system to help you lower that computational burden.

When identifying to the gateway, you can specify an intents parameter which allows you to conditionally subscribe to pre-defined "intents", groups of events defined by Discord.

If you do not specify a certain intent, you will not receive any of the gateway events that are batched into that group.

const (
	Guilds                 GatewayIntents = 1 << 0
	GuildMembers           GatewayIntents = 1 << 1
	GuildBans              GatewayIntents = 1 << 2
	GuildEmojisAndStickers GatewayIntents = 1 << 3
	GuildIntegrations      GatewayIntents = 1 << 4
	GuildWebhooks          GatewayIntents = 1 << 5
	GuildInvites           GatewayIntents = 1 << 6
	GuildVoiceStates       GatewayIntents = 1 << 7
	GuildPresences         GatewayIntents = 1 << 8
	GuildMessages          GatewayIntents = 1 << 9
	GuildMessageReactions  GatewayIntents = 1 << 10
	GuildMessageTyping     GatewayIntents = 1 << 11
	DirectMessages         GatewayIntents = 1 << 12
	DirectMessageReactions GatewayIntents = 1 << 13
	DirectMessageTyping    GatewayIntents = 1 << 14
	MessageContent         GatewayIntents = 1 << 15
	GuildScheduleEvents    GatewayIntents = 1 << 16
)

type GatewayPayload

type GatewayPayload struct {
	Op int          `json:"op"` // opcode for the payload
	D  *interface{} `json:"d"`  // event data
	S  *int         `json:"s"`  // sequence number, used for resuming sessions and heartbeats
	T  *string      `json:"t"`  // the event name for this payload
}

GatewayPayload - S and T are null when Op is not 0 (Gateway Dispatch Opcode).

type GatewayPresenceUpdate added in v0.1.9

type GatewayPresenceUpdate struct {
	Since      *int       `json:"since"`      // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
	Activities []Activity `json:"activities"` // the user's activities
	Status     StatusType `json:"status"`     // the user's new StatusType
	Afk        bool       `json:"afk"`        // whether the client is afk
}

GatewayPresenceUpdate - Sent by the client to indicate a presence or status update.

type GatewayVoiceStateUpdate added in v0.1.9

type GatewayVoiceStateUpdate struct {
	GuildID   Snowflake  `json:"guild_id"`   // id of the Guild
	ChannelID *Snowflake `json:"channel_id"` // id of the voice channel client wants to join (null if disconnecting)
	SelfMute  bool       `json:"self_mute"`  // is the client muted
	SelfDeaf  bool       `json:"self_deaf"`  // is the client deafened
}

GatewayVoiceStateUpdate - Sent when a client wants to join, move, or disconnect from a voice channel.

type GetGuildWidget added in v0.1.10

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

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

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                  int64                           `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
	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

	JoinedAt             time.Time             `json:"joined_at,omitempty"`              // when this guild was joined at
	Large                bool                  `json:"large,omitempty"`                  // true if this is considered a large guild
	Unavailable          bool                  `json:"unavailable,omitempty"`            // true if this guild is unavailable due to an outage
	MemberCount          int64                 `json:"member_count,omitempty"`           // total number of members in this guild
	VoiceStates          []VoiceState          `json:"voice_states,omitempty"`           // states of members currently in voice channels; lacks the guild_id key
	Members              []GuildMember         `json:"members,omitempty"`                // users in the guild
	Channel              []Channel             `json:"channel,omitempty"`                // channels in the guild
	Threads              []Channel             `json:"threads,omitempty"`                // all active threads in the guild that current user has permission to view
	Presences            []PresenceUpdateEvent `json:"presences,omitempty"`              // presences of the members in the guild, will only include non-offline members if the size is greater than large threshold
	StageInstances       []StageInstance       `json:"stage_instances,omitempty"`        // Stage instances in the guild
	GuildScheduledEvents []GuildScheduledEvent `json:"guild_scheduled_events,omitempty"` // the scheduled events in the guild

	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 (*Guild) AddGuildMemberRole

func (g *Guild) AddGuildMemberRole(user *User, role *Snowflake) (method string, route string)

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) CreateGuildEmoji

func (g *Guild) CreateGuildEmoji() (method string, route string)

CreateGuildEmoji - Create a new emoji for the guild.

Requires the ManageEmojisAndStickers permission.

Returns the new Emoji object on success.

Fires a Guild Emojis Update 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) CreateGuildSticker added in v0.1.9

func (g *Guild) CreateGuildSticker() (string, string)

CreateGuildSticker - Create a new sticker for the guild.

Send a multipart/form-data body.

Requires the ManageEmojisAndStickers permission.

Returns the new sticker object on success.

func (*Guild) DeleteGuildEmoji added in v0.1.9

func (g *Guild) DeleteGuildEmoji(emoji Emoji) (method string, route string)

DeleteGuildEmoji - Delete the given emoji.

Requires the ManageEmojisAndStickers permission.

Returns "204 No Content" on success.

Fires a Guild Emojis Update Gateway event.

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

func (*Guild) DeleteGuildSticker added in v0.1.9

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

DeleteGuildSticker - Delete the given sticker.

Requires the ManageEmojisAndStickers permission.

Returns "204 No Content" on success.

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

func (*Guild) GetGuild

func (g *Guild) GetGuild() (method string, route string)

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() (method string, route string)

GetGuildAuditLog - Returns an audit log object for the guild.

Requires the ViewAuditLog permission.

func (*Guild) GetGuildEmoji

func (g *Guild) GetGuildEmoji(emoji Emoji) (method string, route string)

GetGuildEmoji - Returns an emoji object for the given guild and emoji IDs.

func (*Guild) GetGuildSticker added in v0.1.9

func (g *Guild) GetGuildSticker(stickerID Snowflake) (string, string)

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

Includes the user field if the bot has the ManageEmojisAndStickers permission.

func (*Guild) GetGuildWebhooks added in v0.1.8

func (g *Guild) GetGuildWebhooks() (string, string)

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

func (*Guild) ListGuildEmojis

func (g *Guild) ListGuildEmojis() (method string, route string)

ListGuildEmojis - Returns a list of emoji objects for the given guild.

func (*Guild) ListGuildMembers

func (g *Guild) ListGuildMembers(after ...*Snowflake) (method string, route string)

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) ListGuildStickers added in v0.1.9

func (g *Guild) ListGuildStickers() (string, string)

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

Includes user fields if the bot has the ManageEmojisAndStickers permission.

func (*Guild) ModifyGuildEmoji added in v0.1.9

func (g *Guild) ModifyGuildEmoji(emoji Emoji) (method string, route string)

ModifyGuildEmoji - Modify the given emoji.

Requires the ManageEmojisAndStickers permission.

Returns the updated emoji object on success.

Fires a Guild Emojis Update Gateway event.

All JSON parameters to this endpoint are optional.

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

func (*Guild) ModifyGuildSticker added in v0.1.9

func (g *Guild) ModifyGuildSticker(stickerID Snowflake) (string, string)

ModifyGuildSticker - Modify the given sticker.

Requires the ManageEmojisAndStickers permission.

Returns the updated sticker object on success.

All parameters to this endpoint are optional.

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

func (*Guild) RemoveGuildMemberRole

func (g *Guild) RemoveGuildMemberRole(user *User, role *Snowflake) (method string, route string)

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) String

func (g *Guild) String() string

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

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 GuildFeatures

type GuildFeatures string

GuildFeatures - enabled guild features

const (
	AnimatedIcon                  GuildFeatures = "ANIMATED_ICON"                    // guild has access to set an animated guild icon
	Commerce                      GuildFeatures = "COMMERCE"                         // guild has access to use commerce features (i.e. create store channels)
	Community                     GuildFeatures = "COMMUNITY"                        // guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates
	Discoverable                  GuildFeatures = "DISCOVERABLE"                     // guild is able to be discovered in the directory
	Featurable                    GuildFeatures = "FEATURABLE"                       // guild is able to be featured in the directory
	InviteSplash                  GuildFeatures = "INVITE_SPLASH"                    // guild has access to set an invite splash background
	MemberVerificationGateEnabled GuildFeatures = "MEMBER_VERIFICATION_GATE_ENABLED" // guild has enabled Membership Screening
	MonetizationEnabled           GuildFeatures = "MONETIZATION_ENABLED"             // guild has enabled monetization
	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
	PrivateThreads                GuildFeatures = "PRIVATE_THREADS"                  // guild has access to create private threads
	RoleIcons                     GuildFeatures = "ROLE_ICONS"                       // guild is able to set role icons
	SevenDayThreadArchive         GuildFeatures = "SEVEN_DAY_THREAD_ARCHIVE"         // guild has access to the seven day archive time for threads
	ThreeDayThreadArchive         GuildFeatures = "THREE_DAY_THREAD_ARCHIVE"         // guild has access to the three day archive time for threads
	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 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
	Pending                    bool        `json:"pending,omitempty"`                      // Pending - whether the user has not yet passed the guild's Membership Screening requirements
	Permissions                string      `json:"permissions,omitempty"`                  // 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
}

GuildMember - Represents a member of a Guild

The field user won't be included in the member object attached to MESSAGE_CREATE and MESSAGE_UPDATE 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 GuildNsfwLevel

type GuildNsfwLevel int

GuildNsfwLevel - guild NSFW level

const (
	NsfwDefault GuildNsfwLevel = iota
	NsfwExplicit
	NsfwSafe
	NsfwAgeRestricted
)

type GuildPreview added in v0.1.10

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 GuildRequestMembers added in v0.1.9

type GuildRequestMembers struct {
	GuildID   Snowflake   `json:"guild_id"`            // id of the guild to get members for
	Query     string      `json:"query,omitempty"`     // string that username starts with, or an empty string to return all members
	Limit     int         `json:"limit"`               // maximum number of members to send matching the query; a limit of 0 can be used with an empty string query to return all members
	Presences bool        `json:"presences,omitempty"` // used to specify if we want the presences of the matched members
	UserIDs   []Snowflake `json:"user_ids,omitempty"`  // used to specify which users you wish to fetch
	Nonce     string      `json:"nonce,omitempty"`     // nonce to identify the Guild Members Chunk response
}

GuildRequestMembers - Used to request all members for a guild or a list of guilds.

When initially connecting, if you don't have the GuildPresences Gateway Intent, or if the guild is over 75k members, it will only send members who are in voice, plus the member for you (the connecting user).

Otherwise, if a guild has over large_threshold members (value in the Gateway Identify), it will only send members who are online, have a role, have a nickname, or are in a voice channel, and if it has under large_threshold members, it will send all members.

If a client wishes to receive additional members, they need to explicitly request them via this operation.

The server will send Guild Members Chunk events in response with up to 1000 members per chunk until all members that match the request have been sent.

Due to our privacy and infrastructural concerns with this feature, there are some limitations that apply:

GuildPresences intent is required to set presences = true. Otherwise, it will always be false
GuildMembers intent is required to request the entire member list—(query=‘’, limit=0<=n)
You will be limited to requesting 1 guild_id per request
Requesting a prefix (query parameter) will return a maximum of 100 members
Requesting user_ids will continue to be limited to returning 100 members

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 - the scheduled event is only accessible to guild members
	GuildScheduledEventPrivacyLevelGuildOnly GuildScheduledEventPrivacyLevel = iota + 2
)

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 added in v0.1.10

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 GuildWidget

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

GuildWidget - the guild widget status

type Hello added in v0.1.9

type Hello struct {
	HeartbeatInterval int `json:"heartbeat_interval"` // the interval (in milliseconds) the client should heartbeat with
}

Hello - Sent on connection to the websocket. Defines the heartbeat interval that the client should heartbeat to.

type Identify added in v0.1.9

type Identify struct {
	Token          string                `json:"token"`                     // authentication token
	Properties     string                `json:"properties"`                // IdentifyConnection properties
	Compress       bool                  `json:"compress,omitempty"`        // whether this connection supports compression of packets
	LargeThreshold int                   `json:"large_threshold,omitempty"` // value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list
	Shard          [2]int                `json:"shard,omitempty"`           // used for Guild Sharding
	Presence       GatewayPresenceUpdate `json:"presence,omitempty"`        // presence structure for initial presence information
	Intents        GatewayIntents        `json:"intents"`                   // the Gateway Intents you wish to receive
}

Identify - Used to trigger the initial handshake with the gateway.

type IdentifyConnection added in v0.1.9

type IdentifyConnection struct {
	OS      string `json:"$os"`      // your operating system
	Browser string `json:"$browser"` // your library name
	Device  string `json:"$device"`  // your library name
}

IdentifyConnection - properties

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) GetURL

func (i *Image) GetURL() string

GetURL - Get the Image URL Deprecated: Access the struct field directly

func (*Image) SetURL

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

SetURL - set the Image URL

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
}

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"`                   // the type of interaction
	Data          InteractionData `json:"data,omitempty"`         // the command data payload
	GuildID       Snowflake       `json:"guild_id,omitempty"`     // the guild it was sent from
	ChannelID     Snowflake       `json:"channel_id,omitempty"`   // the channel it was sent from
	Member        GuildMember     `json:"member,omitempty"`       // guild member 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"`                  // a 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
	Locale        string          `json:"locale,omitempty"`       // the selected language of the invoking user
	GuildLocale   string          `json:"guild_locale,omitempty"` // the guild's preferred locale, if invoked in a guild
}

An Interaction is the message that your application receives when a user uses an application command 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) BatchEditApplicationCommandPermissions

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

BatchEditApplicationCommandPermissions - Batch edits permissions for all commands in a guild.

Takes an array of partial guild application command permissions objects including id and permissions.

You can only add up to 10 permission overwrites for a command.

Returns an array of GuildApplicationCommandPermissions objects.

This endpoint will overwrite all existing permissions for all commands in a guild, including slash commands, user commands, and message commands.

func (*Interaction) BuildResponse

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

BuildResponse Deprecated: helper method for building a basic message response

func (*Interaction) BulkOverwriteGlobalApplicationCommands

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

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 (*Interaction) BulkOverwriteGuildApplicationCommands

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

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() (method string, route string)

CreateInteractionResponse Create a response to an Interaction from the gateway.

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() (method string, route string)

EditApplicationCommandPermissions - Edits command permissions for a specific command for your application in a guild.

You can only add up to 10 permission overwrites for a command.

Returns a GuildApplicationCommandPermissions object.

This endpoint will overwrite existing permissions for the command in that guild
Deleting or renaming a command will permanently delete all permissions for that command

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() (method string, route string)

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() (method string, route string)

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() (method string, route string)

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

Returns a guild application command permissions object.

func (*Interaction) GetFollowupMessage added in v0.1.10

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() (method string, route string)

GetGlobalApplicationCommand - Fetch a global command for your application.

Returns an application command object.

func (*Interaction) GetGuildApplicationCommand

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

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

func (*Interaction) GetGuildApplicationCommandPermissions

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

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() (method string, route string)

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"`                   // is the response TTS
	Content         string           `json:"content"`               // 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
	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 InteractionData

type InteractionData 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
	CustomID      string                                     `json:"custom_id,omitempty"`      // for components, the custom_id of the component
	ComponentType ComponentType                              `json:"component_type,omitempty"` // for components, the type of the component
	Values        []string                                   `json:"values,omitempty"`         // the values the user selected
	TargetID      Snowflake                                  `json:"target_id,omitempty"`      // id the of user or message targeted by a user or message command
	Components    []Component                                `json:"components,omitempty"`     // the values submitted by the user
}

InteractionData - Inner payload structure of an Interaction

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

func (*InteractionResponseAutocomplete) AddChoices added in v0.2.7

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

func (*InteractionResponseMessages) AddComponent

func (*InteractionResponseMessages) AddEmbed

func (*InteractionResponseMessages) AddEmbeds added in v0.2.7

func (*InteractionResponseMessages) AddFlag

func (*InteractionResponseMessages) GetEmbeds

func (i *InteractionResponseMessages) GetEmbeds() []Embed

GetEmbeds Deprecated: access the struct field directly

func (*InteractionResponseMessages) GetType

GetType Deprecated: access the struct field directly

func (*InteractionResponseMessages) SetContent

func (*InteractionResponseMessages) SetEphemeral

func (*InteractionResponseMessages) SetTts

func (*InteractionResponseMessages) SetType

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

func (*InteractionResponseModal) SetCustomID

func (*InteractionResponseModal) SetTitle

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
	StageInstance            InviteStageInstance `json:"stage_instance,omitempty"`             // stage instance data if there is a public Stage instance in the Stage channel this invite is for
	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() (method, route string)

DeleteInvite - Delete an Invite.

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

Returns an Invite object on success.

Fires an Invite Delete Gateway event.

func (*Invite) GetInvite

func (i *Invite) GetInvite(withCounts *bool, withExpiration *bool, guildScheduleEventID *Snowflake) (method, route string)

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 InviteStageInstance

type InviteStageInstance struct {
	Members          []GuildMember `json:"members"`
	ParticipantCount uint64        `json:"participant_count"`
	SpeakerCount     uint64        `json:"speaker_count"`
	Topic            string        `json:"topic"`
}

InviteStageInstance - stage instance data if there is a public Stage instance in the Stage channel this invite is for

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 ListArchivedThreadsResponse

type ListArchivedThreadsResponse struct {
	Threads []Channel      `json:"threads"`  // the public, archived threads
	Members []ThreadMember `json:"members"`  // a thread member object for each returned thread the current user has joined
	HasMore bool           `json:"has_more"` // whether there are potentially additional threads that could be returned on a subsequent call
}

ListArchivedThreadsResponse - JSON payload structure

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
	GuildID           Snowflake          `json:"guild_id,omitempty"`           // id of the Guild the message was sent in
	Author            User               `json:"author,omitempty"`             // the author of this message (not guaranteed to be a valid user)
	Member            GuildMember        `json:"member,omitempty"`             // member properties for this message's author
	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             interface{}        `json:"nonce,string,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
}

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

type MessageActivity added in v0.1.9

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

MessageActivity - sent with Rich Presence-related chat embeds

type MessageActivityType added in v0.1.9

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 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
)

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
	GuildMemberJoin                                                // GUILD_MEMBER_JOIN
	UserPremiumGuildSubscription                                   // USER_PREMIUM_GUILD_SUBSCRIPTION
	UserPremiumGuildSubscriptionTier1                              // USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1
	UserPremiumGuildSubscriptionTier2                              // USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2
	UserPremiumGuildSubscriptionTier3                              // USER_PREMIUM_GUILD_SUBSCRIPTION_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
)

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 ModifyGuildChannelJSON

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

	// Text
	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 or manage_channel, are unaffected

	// Text, News
	Type                       ChannelType `json:"type,omitempty"`                // the type of channel; only conversion between text and news is supported and only in guilds with the "NEWS" feature
	Topic                      *string     `json:"topic"`                         // 0-1024 character channel topic
	DefaultAutoArchiveDuration *int        `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

	// Text, News, Store
	Nsfw *bool `json:"nsfw"` // whether the channel is nsfw

	// Text, News, Store, Voice
	ParentID *Snowflake `json:"parent_id"` // id of the new parent category for a channel

	// Voice
	Bitrate          *int             `json:"bitrate"`            // the bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers)
	UserLimit        *int             `json:"user_limit"`         // the user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit
	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
}

ModifyGuildChannelJSON - Requires the MANAGE_CHANNELS permission for the guild.

Fires a Channel Update Gateway event.

If modifying a category, individual Channel Update events will fire for each child channel that also changes.

If modifying permission overwrites, the MANAGE_ROLES permission is required.

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

type ModifyGuildEmojiJSON added in v0.1.9

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 ModifyStageInstanceJSON added in v0.1.10

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

ModifyStageInstanceJSON - data to send in the ModifyStageInstance payload

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 ModifyWebhookJSON added in v0.1.8

type ModifyWebhookJSON struct {
	Name      string           `json:"name,omitempty"`       // the default name of the webhook
	Avatar    *base64.Encoding `json:"avatar,omitempty"`     // image for the default webhook avatar
	ChannelID Snowflake        `json:"channel_id,omitempty"` // the new channel id this webhook should be moved to
}

ModifyWebhookJSON - JSON payload structure

type OptionalAuditEntry

type OptionalAuditEntry struct {
	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  PermissionType `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 Permission added in v0.1.10

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 (
	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
	ManageEmojisAndStickers Permission = 1 << 30 // Allows management and editing of emojis and stickers
	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 creating, editing, and deleting scheduled events
	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
	StartEmbeddedActivities 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
)

type PermissionType

type PermissionType int

PermissionType - either PermissionRole or PermissionMember

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

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 (
	None         PremiumType = iota // None
	NitroClassic                    // Nitro Classic
	Nitro                           // Nitro
)

type PresenceStatus

type PresenceStatus string

PresenceStatus - either "idle", "dnd", "online", or "offline"

const (
	Idle    PresenceStatus = "idle"    // Online
	Dnd     PresenceStatus = "dnd"     // Do Not Disturb
	Online  PresenceStatus = "online"  // Online
	Offline PresenceStatus = "offline" // Offline
)

type PresenceUpdateEvent

type PresenceUpdateEvent struct {
	User         User           `json:"user"`          // the user presence is being updated for
	GuildID      Snowflake      `json:"guild_id"`      // id of the guild
	Status       PresenceStatus `json:"status"`        // either "idle", "dnd", "online", or "offline"
	Activities   []Activity     `json:"activities"`    // user's current activities
	ClientStatus ClientStatus   `json:"client_status"` // user's platform-dependent status
}

PresenceUpdateEvent - If you are using Gateway Intents, you must specify the GuildPresences intent in order to receive Presence Update events

A user's presence is their current state on a guild.

This event is sent when a user's presence or info, such as name or avatar, is updated.

The user object within this event can be partial, the only field which must be sent is the id field, everything else is optional.
Along with this limitation, no fields are required, and the types of the fields are not validated.
Your client should expect any combination of fields and types within this event.

type PrivacyLevel

type PrivacyLevel int

PrivacyLevel - The privacy level of the Stage instance

const (
	Public    PrivacyLevel = iota + 1 // Deprecated: The Stage instance is visible publicly. (deprecated)
	GuildOnly                         // The Stage instance is visible to only guild members.
)

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 interface{}, reason *string) (*http.Response, error)

Request - send an HTTP request with rate limiting

type Reaction added in v0.1.10

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 Ready added in v0.1.9

type Ready struct {
	V           int                `json:"v"`               // gateway version
	User        User               `json:"user"`            // information about the user including email
	Guilds      []UnavailableGuild `json:"guilds"`          // the guilds the user is in
	SessionID   string             `json:"session_id"`      // used for resuming connections
	Shard       [2]int             `json:"shard,omitempty"` // the shard information associated with this session, if sent when identifying
	Application Application        `json:"application"`     // contains id and flags
}

Ready - The ready event is dispatched when a client has completed the initial handshake with the gateway (for new sessions).

The ready event can be the largest and most complex event the gateway will send, as it contains all the state required for a client to begin interacting with the rest of the platform.

"guilds" are the guilds of which your bot is a member.

They start out as unavailable when you connect to the gateway.

As they become available, your bot will be notified via Guild Create events.

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 Resume added in v0.1.9

type Resume struct {
	Token     string `json:"token"`      // session token
	SessionID string `json:"session_id"` // session id
	Seq       int    `json:"seq"`        // last sequence number received
}

Resume - Used to replay missed events when a disconnected client resumes.

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"`             // 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 RoleTags

type RoleTags struct {
	BotID             string  `json:"bot_id,omitempty"`             // the id of the bot this role belongs to
	IntegrationID     string  `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
	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 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 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 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 (*StageInstance) DeleteStageInstance added in v0.1.10

func (s *StageInstance) DeleteStageInstance() (string, string)

DeleteStageInstance - Deletes the Stage instance.

Requires the user to be a moderator of the Stage channel.

func (*StageInstance) GetStageInstance added in v0.1.10

func (s *StageInstance) GetStageInstance() (string, string)

GetStageInstance - Gets the stage instance associated with the Stage channel, if it exists.

func (*StageInstance) ModifyStageInstance added in v0.1.10

func (s *StageInstance) ModifyStageInstance() (string, string)

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 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 StatusType added in v0.1.9

type StatusType string

StatusType - a user's current activity status

const (
	StatusTypeOnline       StatusType = "online"    // Online
	StatusTypeDoNotDisturb StatusType = "dnd"       // Do Not Disturb
	StatusTypeIdle         StatusType = "idle"      // AFK
	StatusTypeInvisible    StatusType = "invisible" // Invisible and shown as offline
	StatusTypeOffline      StatusType = "offline"   // Offline
)

type Sticker added in v0.1.9

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)
	Asset       string      `json:"asset,omitempty"`      // Deprecated: previously the sticker asset hash, now an empty string
	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 added in v0.1.9

func (s *Sticker) GetSticker() (string, string)

GetSticker - Returns a sticker object for the given sticker ID.

type StickerFormatType added in v0.1.9

type StickerFormatType int

StickerFormatType - The format of the Sticker

const (
	StickerFormatTypePng         StickerFormatType = iota + 1 // PNG
	StickerFormatTypeAnimatedPng                              // APNG
	StickerFormatTypeLottie                                   // LOTTIE
)

type StickerItem added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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
)

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 added in v0.1.10

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 ThreadMember

type ThreadMember struct {
	ID            Snowflake `json:"id,omitempty"`      // the id of the thread
	UserID        Snowflake `json:"user_id,omitempty"` // the id of the User
	JoinTimestamp time.Time `json:"join_timestamp"`    // the time the current user last joined the thread
	Flags         int64     `json:"flags"`             // any user-thread settings, currently only used for notifications
}

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) GetURL

func (t *Thumbnail) GetURL() string

GetURL - Get the Thumbnail URL Deprecated: Access the struct field directly

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 UnavailableGuild added in v0.1.9

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

	// Below required `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: '@', '#', ':', '```'.
Names cannot be: 'discordtag', '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 (*User) GetAvatarUrl

func (user *User) GetAvatarUrl() string

GetAvatarUrl - returns a properly formatted avatar url

func (*User) GetDefaultUserAvatarUrl

func (user *User) GetDefaultUserAvatarUrl() string

GetDefaultUserAvatarUrl - returns the default Discord avatar

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
)

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

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 added in v0.1.8

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 added in v0.1.8

func (w *Webhook) DeleteWebhook() (string, string)

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 added in v0.1.8

func (w *Webhook) DeleteWebhookMessage(msgID Snowflake, threadID *Snowflake) (string, string)

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 added in v0.1.8

func (w *Webhook) DeleteWebhookWithToken() (string, string)

DeleteWebhookWithToken - Same as above, except this call does not require authentication.

func (*Webhook) EditWebhookMessage added in v0.1.8

func (w *Webhook) EditWebhookMessage(msgID Snowflake, threadID *Snowflake) (string, string)

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 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.

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) ExecuteGitHubCompatibleWebhook added in v0.1.8

func (w *Webhook) ExecuteGitHubCompatibleWebhook(wait *bool, threadID *Snowflake) (string, string)

ExecuteGitHubCompatibleWebhook - Add a new webhook to your GitHub repo (in the repo's settings), and use this endpoint as the "Payload URL."

You can choose what events your Discord channel receives by choosing the "Let me select individual events" option and selecting individual events for the new webhook you're configuring.

wait and threadID are optional; pass nil if not needed

func (*Webhook) ExecuteSlackCompatibleWebhook added in v0.1.8

func (w *Webhook) ExecuteSlackCompatibleWebhook(wait *bool, threadID *Snowflake) (string, string)

ExecuteSlackCompatibleWebhook - Refer to Slack's documentation for more information. We do not support Slack's channel, icon_emoji, mrkdwn, or mrkdwn_in properties.

wait and threadID are optional; pass nil if not needed

func (*Webhook) ExecuteWebhook added in v0.1.8

func (w *Webhook) ExecuteWebhook(wait *bool, threadID *Snowflake) (string, string)

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 and threadID are optional; pass nil if not needed

func (*Webhook) GetWebhook added in v0.1.8

func (w *Webhook) GetWebhook() (string, string)

GetWebhook - Returns the new webhook object for the given id.

func (*Webhook) GetWebhookMessage added in v0.1.8

func (w *Webhook) GetWebhookMessage(msgID Snowflake, threadID *Snowflake) (string, string)

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 added in v0.1.8

func (w *Webhook) GetWebhookWithToken() (string, string)

GetWebhookWithToken - Same as above, except this call does not require authentication and returns no user in the webhook object.

func (*Webhook) ModifyWebhook added in v0.1.8

func (w *Webhook) ModifyWebhook() (string, string)

ModifyWebhook - Modify a webhook. Requires the ManageWebhooks permission. Returns the updated webhook object on success.

All parameters to this endpoint are optional

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

func (*Webhook) ModifyWebhookWithToken added in v0.1.8

func (w *Webhook) ModifyWebhookWithToken() (string, string)

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 added in v0.1.8

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