discord

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package discord holds the different structures of Discord's API

Index

Constants

View Source
const (
	TextInputStyleShort = 1 + iota
	TextInputStyleParagraph
)
View Source
const (
	OnboardingPromptTypeMultipleChoice = iota
	OnboardingPromptTypeDropdown
)
View Source
const (
	GuildScheduledEventEntityTypeStageInstance = 1 + iota
	GuildScheduledEventEntityTypeVoice
	GuildScheduledEventEntityTypeExternal
)
View Source
const (
	StickerTypeStandard = 1 + iota
	StickerTypeGuild
)

Variables

View Source
var LocaleLanguageNames = map[Locale]string{
	LocaleIndonesian:   "Indonesian",
	LocaleDanish:       "Danish",
	LocaleGerman:       "German",
	LocaleEnglishGB:    "English, UK",
	LocaleEnglishUS:    "English, US",
	LocaleSpanishES:    "Spanish",
	LocaleFrench:       "French",
	LocaleCroatian:     "Croatian",
	LocaleItalian:      "Italian",
	LocaleLithuanian:   "Lithuanian",
	LocaleHungarian:    "Hungarian",
	LocaleDutch:        "Dutch",
	LocaleNorwegian:    "Norwegian",
	LocalePolish:       "Polish",
	LocalePortugueseBR: "Portuguese, Brazilian",
	LocaleRomanian:     "Romanian, Romania",
	LocaleFinnish:      "Finnish",
	LocaleSwedish:      "Swedish",
	LocaleVietnamese:   "Vietnamese",
	LocaleTurkish:      "Turkish",
	LocaleCzech:        "Czech",
	LocaleGreek:        "Greek",
	LocaleBulgarian:    "Bulgarian",
	LocaleRussian:      "Russian",
	LocaleUkrainian:    "Ukrainian",
	LocaleHindi:        "Hindi",
	LocaleThai:         "Thai",
	LocaleChineseCN:    "Chinese, China",
	LocaleJapanese:     "Japanese",
	LocaleChineseTW:    "Chinese, Taiwan",
	LocaleKorean:       "Korean",
	LocaleUnknown:      "",
}
View Source
var LocaleNativeName = map[Locale]string{
	LocaleIndonesian:   "Bahasa Indonesia",
	LocaleDanish:       "Dansk",
	LocaleGerman:       "Deutsch",
	LocaleEnglishGB:    "English, UK",
	LocaleEnglishUS:    "English, US",
	LocaleSpanishES:    "Español",
	LocaleFrench:       "Français",
	LocaleCroatian:     "Hrvatski",
	LocaleItalian:      "Italiano",
	LocaleLithuanian:   "Lietuviškai",
	LocaleHungarian:    "Magyar",
	LocaleDutch:        "Nederlands",
	LocaleNorwegian:    "Norsk",
	LocalePolish:       "Polski",
	LocalePortugueseBR: "Português do Brasil",
	LocaleRomanian:     "Română",
	LocaleFinnish:      "Suomi",
	LocaleSwedish:      "Svenska",
	LocaleVietnamese:   "Tiếng Việt",
	LocaleTurkish:      "Türkçe",
	LocaleCzech:        "Čeština",
	LocaleGreek:        "Ελληνικά",
	LocaleBulgarian:    "български",
	LocaleRussian:      "Pусский",
	LocaleUkrainian:    "Українська",
	LocaleHindi:        "हिन्दी",
	LocaleThai:         "ไทย",
	LocaleChineseCN:    "中文",
	LocaleJapanese:     "日本語",
	LocaleChineseTW:    "繁體中文",
	LocaleKorean:       "한국어",
	LocaleUnknown:      "",
}

Functions

This section is empty.

Types

type ActionRow added in v0.3.0

type ActionRow struct {
	Components []Component `json:"components"`
}

ActionRow represents a non-interactive container component for other types of components https://discord.com/developers/docs/interactions/message-components#action-rows

func (*ActionRow) MarshalJSON added in v0.3.0

func (c *ActionRow) MarshalJSON() ([]byte, error)

func (*ActionRow) Type added in v0.3.0

func (c *ActionRow) Type() ComponentType

func (*ActionRow) UnmarshalJSON added in v0.3.0

func (c *ActionRow) UnmarshalJSON(b []byte) error

type ActiveThreads added in v0.3.0

type ActiveThreads struct {
	Threads []Channel      `json:"threads"`
	Members []ThreadMember `json:"members"`
}

ActiveThreads represents the list of active threads and members within those https://discord.com/developers/docs/resources/guild#list-active-guild-threads-response-body

type Activity added in v0.6.0

type Activity struct {
	Name          string             `json:"name"`
	Type          ActivityType       `json:"type"`
	URL           string             `json:"url,omitempty"`
	CreatedAt     int                `json:"created_at"`
	Timestamps    ActivityTimeStamps `json:"timestamps"`
	ApplicationID Snowflake          `json:"application_id"`
	Details       string             `json:"details,omitempty"`
	State         string             `json:"state,omitempty"`
	Emoji         Emoji              `json:"emoji,omitempty"`
	Party         ActivityParty      `json:"party,omitempty"`
	Assets        ActivityAssets     `json:"assets,omitempty"`
	Secrets       ActivitySecrets    `json:"secrets"`
	Instance      bool               `json:"instance"`
	Flags         ActivityFlags      `json:"flags"`
	Buttons       []ActivityButton   `json:"buttons"`
}

Activity represents a user's activity on Discord https://discord.com/developers/docs/topics/gateway-events#activity-object

type ActivityAssets added in v0.6.0

type ActivityAssets struct {
	LargeImage string `json:"large_image,omitempty"`
	LargeText  string `json:"large_text,omitempty"`
	SmallImage string `json:"small_image,omitempty"`
	SmallText  string `json:"small_text,omitempty"`
}

ActivityAssets represents the images for the presence and their hover texts https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-assets

type ActivityButton added in v0.6.0

type ActivityButton struct {
	Label string `json:"label"`
	URL   string `json:"url"`
}

ActivityButton represents buttons in an activity (discord.Activity) https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-buttons

type ActivityFlags added in v0.6.0

type ActivityFlags uint64

ActivityFlags represents the various flags an activity can have https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-flags

const (
	ActivityFlagInstance ActivityFlags = 1 << iota
	ActivityFlagJoin
	ActivityFlagSpectate
	ActivityFlagJoinRequest
	ActivityFlagSync
	ActivityFlagPlay
	ActivityFlagPartyPrivacyFriends
	ActivityFlagPartyPrivacyVoiceChannel
	ActivityFlagEmbedded
)
const ActivityFlagNone ActivityFlags = 0

func ComputeActivityFlags added in v0.6.0

func ComputeActivityFlags(activityFlags ...ActivityFlags) ActivityFlags

ComputeActivityFlags creates a new activity flags structure (discord.ActivityFlags) from the given activity flags

func (ActivityFlags) Add added in v0.6.0

func (f ActivityFlags) Add(activityFlags ...ActivityFlags) ActivityFlags

Add adds the given activity flags (discord.ActivityFlags)

func (ActivityFlags) Has added in v0.6.0

func (f ActivityFlags) Has(activityFlags ...ActivityFlags) bool

Has checks if all the given activity flags (discord.ActivityFlags) are set

func (ActivityFlags) HasAny added in v0.6.0

func (f ActivityFlags) HasAny(activityFlags ...ActivityFlags) bool

HasAny checks if any of the given activity flags (discord.ActivityFlags) is set

func (ActivityFlags) HasNot added in v0.6.0

func (f ActivityFlags) HasNot(activityFlags ...ActivityFlags) bool

HasNot checks if all the given activity flags (discord.ActivityFlags) are not set

func (ActivityFlags) HasNotAny added in v0.6.0

func (f ActivityFlags) HasNotAny(activityFlags ...ActivityFlags) bool

HasNotAny checks if any of the given activity flags (discord.ActivityFlags) is not set

func (ActivityFlags) Remove added in v0.6.0

func (f ActivityFlags) Remove(activityFlags ...ActivityFlags) ActivityFlags

Remove removes the given activity flags (discord.ActivityFlags)

func (ActivityFlags) Toggle added in v0.6.0

func (f ActivityFlags) Toggle(activityFlags ...ActivityFlags) ActivityFlags

Toggle toggles the given activity flags (discord.ActivityFlags)

type ActivityParty added in v0.6.0

type ActivityParty struct {
	ID   string `json:"id"`
	Size [2]int `json:"size"`
}

ActivityParty represents a party of a player https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-party

type ActivitySecrets added in v0.6.0

type ActivitySecrets struct {
	Join     string `json:"join,omitempty"`
	Spectate string `json:"spectate,omitempty"`
	Match    string `json:"match,omitempty"`
}

ActivitySecrets represents the secrets for joining and spectating https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-secrets

type ActivityTimeStamps added in v0.6.0

type ActivityTimeStamps struct {
	Start int `json:"start,omitempty"`
	End   int `json:"end,omitempty"`
}

ActivityTimeStamps represents the unix timestamps for the start and/or end of the activity (discord.Activity) https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-timestamps

type ActivityType added in v0.6.0

type ActivityType int

ActivityType represents the type of activity (discord.Activity) https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types

const (
	ActivityTypePlaying ActivityType = iota
	ActivityTypeStreaming
	ActivityTypeListening
	ActivityTypeWatching
	ActivityTypeCustom
	ActivityTypeCompeting
)

type AllowedMentionType added in v0.4.0

type AllowedMentionType string

AllowedMentionType represents the allowed mention types for an allowed mentions structure (discord.AllowedMentions) https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types

const (
	AllowedMentionTypeRoleMentions     AllowedMentionType = "roles"
	AllowedMentionTypeUserMentions     AllowedMentionType = "users"
	AllowedMentionTypeEveryoneMentions AllowedMentionType = "everyone"
)

type AllowedMentions added in v0.4.0

type AllowedMentions struct {
	Parse       []AllowedMentionType `json:"parse,omitempty"`
	Roles       ArraySnowflakes      `json:"roles,omitempty"`
	Users       ArraySnowflakes      `json:"users,omitempty"`
	RepliedUser *bool                `json:"replied_user,omitempty"`
}

AllowedMentions represents the allowed mentions for a message (discord.Message) https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure

type Application added in v0.3.0

type Application struct {
	ID                             Snowflake        `json:"id"`
	Name                           string           `json:"name"`
	Icon                           string           `json:"icon,omitempty"`
	Description                    string           `json:"description"`
	RPCOrigins                     []string         `json:"rpc_origins,omitempty"`
	BotPublic                      bool             `json:"bot_public"`
	BotRequireCodeGrant            bool             `json:"bot_require_code_grant"`
	TermsOfServiceURL              string           `json:"terms_of_service_url,omitempty"`
	PrivacyPolicyURL               string           `json:"privacy_policy_url,omitempty"`
	Owner                          *User            `json:"owner,omitempty"`
	VerifyKey                      string           `json:"verify_key"`
	Team                           *Team            `json:"team,omitempty"`
	GuildID                        Snowflake        `json:"guild_id,omitempty"`
	PrimarySKUID                   Snowflake        `json:"primary_sku_id,omitempty"`
	Slug                           string           `json:"slug,omitempty"`
	CoverImage                     string           `json:"cover_image,omitempty"`
	Flags                          ApplicationFlags `json:"flags,omitempty"`
	Tags                           []string         `json:"tags,omitempty"`
	InstallParams                  InstallParams    `json:"install_params,omitempty"`
	CustomInstallURL               string           `json:"custom_install_url,omitempty"`
	RoleConnectionsVerificationURL string           `json:"role_connections_verification_url,omitempty"`
}

Application represents a Discord application https://discord.com/developers/docs/resources/application#application-object-application-structure

func (*Application) CoverURL added in v0.5.0

func (a *Application) CoverURL(asFormat ImageFormat) string

CoverURL returns the cover URL of the application (discord.Application)

func (*Application) CreatedAt added in v0.5.0

func (a *Application) CreatedAt() time.Time

CreatedAt returns the creation time of the application (discord.Application)

func (*Application) IconURL added in v0.5.0

func (a *Application) IconURL(asFormat ImageFormat) string

IconURL returns the icon URL of the application (discord.Application)

type ApplicationCommand added in v0.3.0

type ApplicationCommand struct {
	ID                       Snowflake                 `json:"id"`
	Type                     ApplicationCommandType    `json:"type,omitempty"`
	ApplicationID            Snowflake                 `json:"application_id"`
	GuildID                  Snowflake                 `json:"guild_id,omitempty"`
	Name                     string                    `json:"name"`
	NameLocalizations        map[Locale]string         `json:"name_localizations,omitempty"`
	Description              string                    `json:"description"`
	DescriptionLocalizations map[Locale]string         `json:"description_localizations,omitempty"`
	Options                  ApplicationCommandOptions `json:"options,omitempty"`
	DefaultMemberPermissions *Permissions              `json:"default_member_permissions,omitempty"`
	DMPermission             bool                      `json:"dm_permission,omitempty"`
	NSFW                     bool                      `json:"nsfw,omitempty"`
	Version                  Snowflake                 `json:"version"`
}

ApplicationCommand represents an application command that is natively implemented within Discord https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure

func (*ApplicationCommand) CreatedAt added in v0.5.0

func (c *ApplicationCommand) CreatedAt() time.Time

CreatedAt returns the creation time of the application command (discord.ApplicationCommand)

func (*ApplicationCommand) Mention added in v0.6.0

func (c *ApplicationCommand) Mention() string

Mention returns the string to mention the application command (discord.ApplicationCommand)

type ApplicationCommandOption added in v0.3.0

type ApplicationCommandOption interface {
	Type() ApplicationCommandOptionType
}

ApplicationCommandOption is an interface that will be implemented by all application command options

type ApplicationCommandOptionType added in v0.3.0

type ApplicationCommandOptionType int

ApplicationCommandOptionType represents the type of option it is https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type

const (
	ApplicationCommandOptionTypeSubCommand ApplicationCommandOptionType = 1 + iota
	ApplicationCommandOptionTypeSubCommandGroup
	ApplicationCommandOptionTypeString
	ApplicationCommandOptionTypeInteger
	ApplicationCommandOptionTypeBoolean
	ApplicationCommandOptionTypeUser
	ApplicationCommandOptionTypeChannel
	ApplicationCommandOptionTypeRole
	ApplicationCommandOptionTypeMentionable
	ApplicationCommandOptionTypeNumber
	ApplicationCommandOptionTypeAttachment
)

type ApplicationCommandOptions added in v0.3.0

type ApplicationCommandOptions []ApplicationCommandOption

ApplicationCommandOptions is a list of application command options (discord.ApplicationCommandOption)

func (*ApplicationCommandOptions) UnmarshalJSON added in v0.3.0

func (o *ApplicationCommandOptions) UnmarshalJSON(b []byte) error

type ApplicationCommandPermission added in v0.3.0

type ApplicationCommandPermission struct {
	ID         Snowflake                        `json:"id"`
	Type       ApplicationCommandPermissionType `json:"type"`
	Permission bool                             `json:"permission"`
}

ApplicationCommandPermission represents the permissions for an application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure

func (*ApplicationCommandPermission) CreatedAt added in v0.5.0

func (p *ApplicationCommandPermission) CreatedAt() time.Time

CreatedAt returns the creation time of the application command permission (discord.ApplicationCommandPermission)

type ApplicationCommandPermissionType added in v0.3.0

type ApplicationCommandPermissionType int

ApplicationCommandPermissionType represents the type of application command permission (discord.ApplicationCommandPermission) it is https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type

const (
	ApplicationCommandPermissionTypeRole ApplicationCommandPermissionType = 1 + iota
	ApplicationCommandPermissionTypeUser
	ApplicationCommandPermissionTypeChannel
)

type ApplicationCommandType added in v0.3.0

type ApplicationCommandType int

ApplicationCommandType represents the type of command it is https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types

const (
	ApplicationCommandTypeChatInput ApplicationCommandType = 1 + iota
	ApplicationCommandTypeUser
	ApplicationCommandTypeMessage
)

type ApplicationFlags added in v0.3.0

type ApplicationFlags uint64

ApplicationFlags represents the list of public flags of an application (discord.Application) https://discord.com/developers/docs/resources/application#application-object-application-flags

const (
	ApplicationFlagApplicationAutoModerationRuleCreateBadge ApplicationFlags

	ApplicationFlagGatewayPresence
	ApplicationFlagGatewayPresenceLimited
	ApplicationFlagGatewayGuildMembers
	ApplicationFlagGatewayGuildMembersLimited
	ApplicationFlagVerificationPendingGuildLimit
	ApplicationFlagEmbedded
	ApplicationFlagGatewayMessageContent
	ApplicationFlagGatewayMessageContentLimited

	ApplicationFlagApplicationCommandBadge
)
const ApplicationFlagsNone ApplicationFlags = 0

func ComputeApplicationFlags added in v0.6.0

func ComputeApplicationFlags(applicationFlags ...ApplicationFlags) ApplicationFlags

ComputeApplicationFlags creates a new application flags structure (discord.ApplicationFlags) from the given application flags

func (ApplicationFlags) Add added in v0.6.0

func (f ApplicationFlags) Add(applicationFlags ...ApplicationFlags) ApplicationFlags

Add adds the given application flags (discord.ApplicationFlags)

func (ApplicationFlags) Has added in v0.6.0

func (f ApplicationFlags) Has(applicationFlags ...ApplicationFlags) bool

Has checks if all the given application flags (discord.ApplicationFlags) are set

func (ApplicationFlags) HasAny added in v0.6.0

func (f ApplicationFlags) HasAny(applicationFlags ...ApplicationFlags) bool

HasAny checks if any of the given application flags (discord.ApplicationFlags) is set

func (ApplicationFlags) HasNot added in v0.6.0

func (f ApplicationFlags) HasNot(applicationFlags ...ApplicationFlags) bool

HasNot checks if all the given application flags (discord.ApplicationFlags) are not set

func (ApplicationFlags) HasNotAny added in v0.6.0

func (f ApplicationFlags) HasNotAny(applicationFlags ...ApplicationFlags) bool

HasNotAny checks if any of the given application flags (discord.ApplicationFlags) is not set

func (ApplicationFlags) Remove added in v0.6.0

func (f ApplicationFlags) Remove(applicationFlags ...ApplicationFlags) ApplicationFlags

Remove removes the given application flags (discord.ApplicationFlags)

func (ApplicationFlags) Toggle added in v0.6.0

func (f ApplicationFlags) Toggle(applicationFlags ...ApplicationFlags) ApplicationFlags

Toggle toggles the given application flags (discord.ApplicationFlags)

type ApplicationRoleConnectionMetadata added in v0.3.0

type ApplicationRoleConnectionMetadata struct {
	Type                     ApplicationRoleConnectionMetadataType `json:"type"`
	Key                      string                                `json:"key"`
	Name                     string                                `json:"name"`
	NameLocalizations        map[Locale]string                     `json:"name_localizations,omitempty"`
	Description              string                                `json:"description"`
	DescriptionLocalizations map[Locale]string                     `json:"description_localizations,omitempty"`
}

ApplicationRoleConnectionMetadata represents a role connection metadata for an application (discord.Application) https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-structure

type ApplicationRoleConnectionMetadataType added in v0.3.0

type ApplicationRoleConnectionMetadataType int

ApplicationRoleConnectionMetadataType represents the type of metadata value https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type

const (
	ApplicationRoleConnectionMetadataTypeIntegerLessThanOrEqual ApplicationRoleConnectionMetadataType = 1 + iota
	ApplicationRoleConnectionMetadataTypeIntegerGreaterThanOrEqual
	ApplicationRoleConnectionMetadataTypeIntegerEqual
	ApplicationRoleConnectionMetadataTypeIntegerNotEqual
	ApplicationRoleConnectionMetadataTypeDatetimeLessThanOrEqual
	ApplicationRoleConnectionMetadataTypeDatetimeGreaterThanOrEqual
	ApplicationRoleConnectionMetadataTypeBooleanEqual
	ApplicationRoleConnectionMetadataTypeBooleanNotEqual
)

type ArchivedThreads added in v0.3.0

type ArchivedThreads struct {
	Threads []Channel      `json:"threads"`
	Members []ThreadMember `json:"members"`
	HasMore bool           `json:"has_more"`
}

ArchivedThreads represents the list of archived threads and members within those https://discord.com/developers/docs/resources/channel#list-public-archived-threads-response-body

type ArraySnowflakes added in v0.5.0

type ArraySnowflakes []Snowflake

ArraySnowflakes represents an array of snowflakes

func (*ArraySnowflakes) MarshalJSON added in v0.5.0

func (s *ArraySnowflakes) MarshalJSON() ([]byte, error)

MarshalJSON will take care to marshal an array of snowflakes (discord.Snowflake) to an array of strings

func (*ArraySnowflakes) String added in v0.5.0

func (s *ArraySnowflakes) String() string

String returns a comma-separated string of the array of strings

func (*ArraySnowflakes) UnmarshalJSON added in v0.5.0

func (s *ArraySnowflakes) UnmarshalJSON(b []byte) error

UnmarshalJSON will take care to unmarshal an array of strings to an array of snowflakes (discord.Snowflake)

type Attachment added in v0.3.0

type Attachment struct {
	ID           Snowflake       `json:"id"`
	Filename     string          `json:"filename"`
	Description  string          `json:"description,omitempty"`
	ContentType  string          `json:"content_type,omitempty"`
	Size         int             `json:"size,omitempty"`
	URL          string          `json:"url,omitempty"`
	ProxyURL     string          `json:"proxy_url,omitempty"`
	Height       int             `json:"height,omitempty"`
	Width        int             `json:"width,omitempty"`
	Ephemeral    bool            `json:"ephemeral,omitempty"`
	DurationSecs float64         `json:"duration_secs,omitempty"`
	Waveform     string          `json:"waveform,omitempty"`
	Flags        AttachmentFlags `json:"flags"`
}

Attachment represents an attached file in a message (discord.Message) https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure

func (*Attachment) CreatedAt added in v0.5.0

func (a *Attachment) CreatedAt() time.Time

CreatedAt returns the creation time of the attachment (discord.Attachment)

type AttachmentCommandOption added in v0.3.0

type AttachmentCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
}

AttachmentCommandOption represents an application command option (discord.ApplicationCommandOption) to pass an attachment (discord.Attachment)

func (*AttachmentCommandOption) MarshalJSON added in v0.3.0

func (o *AttachmentCommandOption) MarshalJSON() ([]byte, error)

func (*AttachmentCommandOption) Type added in v0.3.0

type AttachmentFlags added in v0.7.0

type AttachmentFlags int

AttachmentFlags represents the flags of an attachment (discord.Attachment)

const (
	AttachmentFlagIsClip AttachmentFlags = 1 << iota
	AttachmentFlagIsThumbnail
	AttachmentFlagIsRemix
)
const AttachmentFlagNone AttachmentFlags = 0

func ComputeAttachmentFlags added in v0.7.0

func ComputeAttachmentFlags(AttachmentFlags ...AttachmentFlags) AttachmentFlags

ComputeAttachmentFlags creates a new attachment flags structure (discord.AttachmentFlags) from the given attachment flags

func (AttachmentFlags) Add added in v0.7.0

func (f AttachmentFlags) Add(AttachmentFlags ...AttachmentFlags) AttachmentFlags

Add adds the given attachment flags (discord.AttachmentFlags)

func (AttachmentFlags) Has added in v0.7.0

func (f AttachmentFlags) Has(AttachmentFlags ...AttachmentFlags) bool

Has checks if all the given attachment flags (discord.AttachmentFlags) are set

func (AttachmentFlags) HasAny added in v0.7.0

func (f AttachmentFlags) HasAny(AttachmentFlags ...AttachmentFlags) bool

HasAny checks if any of the given attachment flags (discord.AttachmentFlags) is set

func (AttachmentFlags) HasNot added in v0.7.0

func (f AttachmentFlags) HasNot(AttachmentFlags ...AttachmentFlags) bool

HasNot checks if all the given attachment flags (discord.AttachmentFlags) are not set

func (AttachmentFlags) HasNotAny added in v0.7.0

func (f AttachmentFlags) HasNotAny(AttachmentFlags ...AttachmentFlags) bool

HasNotAny checks if any of the given attachment flags (discord.AttachmentFlags) is not set

func (AttachmentFlags) Remove added in v0.7.0

func (f AttachmentFlags) Remove(AttachmentFlags ...AttachmentFlags) AttachmentFlags

Remove removes the given attachment flags (discord.AttachmentFlags)

func (AttachmentFlags) Toggle added in v0.7.0

func (f AttachmentFlags) Toggle(AttachmentFlags ...AttachmentFlags) AttachmentFlags

Toggle toggles the given attachment flags (discord.AttachmentFlags)

type AttachmentSend added in v0.6.0

type AttachmentSend struct {
	ID          int    `json:"id"`
	Description string `json:"description"`
}

AttachmentSend represents an attachment that is attached to a message to send, these are the only fields necessary when sending an attachment

type AuditLog added in v0.3.0

type AuditLog struct {
	ApplicationCommands  []ApplicationCommand  `json:"application_commands"`
	AuditLogEntries      []AuditLogEntry       `json:"audit_log_entries"`
	AutoModerationRules  []AutoModerationRule  `json:"auto_moderation_rules"`
	GuildScheduledEvents []GuildScheduledEvent `json:"guild_scheduled_events"`
	Integrations         []Integration         `json:"integrations"`
	Threads              []Channel             `json:"threads"`
	Users                []User                `json:"users"`
	Webhooks             []Webhook             `json:"webhooks"`
}

AuditLog represents a list of administrative actions performed in a guild https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure

type AuditLogActionType added in v0.3.0

type AuditLogActionType int

AuditLogActionType represents the type of administrative action (discord.AuditLogEntry) that has been performed https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events

const (
	AuditLogActionTypeGuildUpdate AuditLogActionType = 1 + iota

	AuditLogActionTypeChannelCreate
	AuditLogActionTypeChannelUpdate
	AuditLogActionTypeChannelDelete
	AuditLogActionTypeChannelOverwriteCreate
	AuditLogActionTypeChannelOverwriteUpdate
	AuditLogActionTypeChannelOverwriteDelete

	AuditLogActionTypeMemberKick
	AuditLogActionTypeMemberPrune
	AuditLogActionTypeMemberBanAdd
	AuditLogActionTypeMemberBanRemove
	AuditLogActionTypeMemberUpdate
	AuditLogActionTypeMemberRoleUpdate
	AuditLogActionTypeMemberMove
	AuditLogActionTypeMemberDisconnect
	AuditLogActionTypeBotAdd

	AuditLogActionTypeRoleCreate
	AuditLogActionTypeRoleUpdate
	AuditLogActionTypeRoleDelete

	AuditLogActionTypeInviteCreate
	AuditLogActionTypeInviteUpdate
	AuditLogActionTypeInviteDelete

	AuditLogActionTypeWebhookCreate
	AuditLogActionTypeWebhookUpdate
	AuditLogActionTypeWebhookDelete

	AuditLogActionTypeEmojiCreate
	AuditLogActionTypeEmojiUpdate
	AuditLogActionTypeEmojiDelete

	AuditLogActionTypeMessageDelete
	AuditLogActionTypeMessageBulkDelete
	AuditLogActionTypeMessagePin
	AuditLogActionTypeMessageUnpin

	AuditLogActionTypeIntegrationCreate
	AuditLogActionTypeIntegrationUpdate
	AuditLogActionTypeIntegrationDelete
	AuditLogActionTypeStanceInstanceCreate
	AuditLogActionTypeStageInstanceUpdate
	AuditLogActionTypeStageInstanceDelete

	AuditLogActionTypeStickerCreate
	AuditLogActionTypeStickerUpdate
	AuditLogActionTypeStickerDelete

	AuditLogActionTypeGuildScheduledEventCreate
	AuditLogActionTypeGuildScheduledEventUpdate
	AuditLogActionTypeGuildScheduledEventDelete

	AuditLogActionTypeThreadCreate
	AuditLogActionTypeThreadUpdate
	AuditLogActionTypeThreadDelete

	AuditLogActionTypeApplicationCommandPermissionUpdate

	AuditLogActionTypeSoundboardSoundCreate
	AuditLogActionTypeSoundboardSoundUpdate
	AuditLogActionTypeSoundboardSoundDelete

	AuditLogActionTypeAutoModerationRuleCreate
	AuditLogActionTypeAutoModerationRuleUpdate
	AuditLogActionTypeAutoModerationRuleDelete
	AuditLogActionTypeAutoModerationBlockMessage
	AuditLogActionTypeAutoModerationFlagToChannel
	AuditLogActionTypeAutoModerationUserCommunicationDisabled
	AuditLogActionTypeAutoModerationQuarantineUser

	AuditLogActionTypeCreatorMonetizationRequestCreated
)

type AuditLogChange added in v0.3.0

type AuditLogChange struct {
	NewValue json.RawMessage `json:"new_value,omitempty"`
	OldValue json.RawMessage `json:"old_value,omitempty"`
	Key      string          `json:"key"`
}

AuditLogChange represents a potential change that has been performed during an administrative action (discord.AuditLogEntry) https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure

func (*AuditLogChange) ParseChangedValuesTo added in v0.3.0

func (c *AuditLogChange) ParseChangedValuesTo(old, new interface{}) error

ParseChangedValuesTo parses the different changed values in the audit log change (discord.AuditLogChange) to a custom structure

type AuditLogEntry added in v0.3.0

type AuditLogEntry struct {
	ID         Snowflake                `json:"id"`
	TargetID   string                   `json:"target_id"`
	Changes    []AuditLogChange         `json:"changes,omitempty"`
	UserID     Snowflake                `json:"user_id,omitempty"`
	ActionType AuditLogActionType       `json:"action_type,omitempty"`
	Options    AuditLogEntryInformation `json:"options,omitempty"`
	Reason     string                   `json:"reason,omitempty"`
}

AuditLogEntry represents an administrative action https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure

func (*AuditLogEntry) CreatedAt added in v0.5.0

func (e *AuditLogEntry) CreatedAt() time.Time

CreatedAt returns the creation time of the audit log entry (discord.AuditLogEntry)

type AuditLogEntryInformation added in v0.3.0

type AuditLogEntryInformation struct {
	ApplicationID                 Snowflake `json:"application_id,omitempty"`
	AutoModerationRuleName        string    `json:"auto_moderation_rule_name,omitempty"`
	AutoModerationRuleTriggerType string    `json:"auto_moderation_rule_trigger_type,omitempty"`
	ChannelID                     Snowflake `json:"channel_id,omitempty"`
	Count                         string    `json:"count,omitempty"`
	DeleteMemberDays              string    `json:"delete_member_days,omitempty"`
	ID                            Snowflake `json:"id,omitempty"`
	MembersRemoved                string    `json:"members_removed,omitempty"`
	MessageID                     Snowflake `json:"message_id,omitempty"`
	RoleName                      string    `json:"role_name,omitempty"`
	Type                          string    `json:"type,omitempty"`
	IntegrationType               string    `json:"integration_type,omitempty"`
}

AuditLogEntryInformation represents additional information for some administrative actions (discord.AuditLogEntry) https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info

type AutoCompleteInteractionResponse added in v0.6.0

type AutoCompleteInteractionResponse[T IntegerChoice | StringChoice | NumberChoice] struct {
	Choices []T `json:"choices"`
}

AutoCompleteInteractionResponse represents a response to an interaction (discord.Interaction) with auto complete choices https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-autocomplete

func (AutoCompleteInteractionResponse[T]) Type added in v0.6.0

Type returns the type of interaction response

type AutoModerationAction added in v0.3.0

type AutoModerationAction struct {
	Type     AutoModerationActionType      `json:"type"`
	Metadata *AutoModerationActionMetadata `json:"metadata,omitempty"`
}

AutoModerationAction represents the action which will execute whenever a rule (discord.AutoModerationRule) is triggered https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure

type AutoModerationActionMetadata added in v0.3.0

type AutoModerationActionMetadata struct {
	ChannelID       Snowflake `json:"channel_id,omitempty"`
	DurationSeconds int       `json:"duration_seconds,omitempty"`
	CustomMessage   string    `json:"custom_message,omitempty"`
}

AutoModerationActionMetadata represents additional data used when an action (discord.AutoModerationAction) is executed. Different fields are relevant based on the value of action type (discord.AutoModerationActionType) https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata

type AutoModerationActionType added in v0.3.0

type AutoModerationActionType int

AutoModerationActionType represents the type of action (discord.AutoModerationAction) that will be performed https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types

const (
	AutoModerationActionTypeBlockMessage AutoModerationActionType = 1 + iota
	AutoModerationActionTypeSendAlertMessage
	AutoModerationActionTypeTimeout
)

type AutoModerationEventType added in v0.3.0

type AutoModerationEventType int

AutoModerationEventType represents in what event context a rule (discord.AutoModerationRule) should be checked https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types

const (
	AutoModerationEventTypeMessageSend AutoModerationEventType = 1 + iota
)

type AutoModerationKeywordPresetType added in v0.3.0

type AutoModerationKeywordPresetType int

AutoModerationKeywordPresetType represents the internally pre-defined word sets which will be searched for in content https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types

const (
	AutoModerationKeywordPresetTypeProfanity AutoModerationKeywordPresetType = 1 + iota
	AutoModerationKeywordPresetTypeSexualContent
	AutoModerationKeywordPresetTypeSlurs
)

type AutoModerationRule added in v0.3.0

type AutoModerationRule struct {
	ID              Snowflake                     `json:"id"`
	GuildID         Snowflake                     `json:"guild_id"`
	Name            string                        `json:"name"`
	CreatorID       string                        `json:"creator_id"`
	EventType       AutoModerationEventType       `json:"event_type"`
	TriggerType     AutoModerationTriggerType     `json:"trigger_type"`
	TriggerMetadata AutoModerationTriggerMetadata `json:"trigger_metadata"`
	Actions         []AutoModerationAction        `json:"actions"`
	Enabled         bool                          `json:"enabled"`
	ExemptRoles     ArraySnowflakes               `json:"exempt_roles"`
	ExemptChannels  ArraySnowflakes               `json:"exempt_channels"`
}

AutoModerationRule is a rule that trigger based on some criteria https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure

func (*AutoModerationRule) CreatedAt added in v0.5.0

func (r *AutoModerationRule) CreatedAt() time.Time

CreatedAt returns the creation time of the auto moderation rule (discord.AutoModerationRule)

type AutoModerationTriggerMetadata added in v0.3.0

type AutoModerationTriggerMetadata struct {
	KeywordFilter     []string                          `json:"keyword_filter,omitempty"`
	RegexPatterns     []string                          `json:"regex_patterns,omitempty"`
	Presets           []AutoModerationKeywordPresetType `json:"presets,omitempty"`
	AllowList         []string                          `json:"allow_list,omitempty"`
	MentionTotalLimit int                               `json:"mention_total_limit,omitempty"`
}

AutoModerationTriggerMetadata represents additional data used to determine whether a rule (discord.AutoModerationRule) should be triggered https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata

type AutoModerationTriggerType added in v0.3.0

type AutoModerationTriggerType int

AutoModerationTriggerType represents the type of content which can trigger the rule (discord.AutoModerationRule) https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types

const (
	AutoModerationTriggerTypeKeyword AutoModerationTriggerType = 1 + iota

	AutoModerationTriggerTypeSpam
	AutoModerationTriggerTypeKeywordPreset
	AutoModerationTriggerTypeMentionSpam
)

type BeginGuildPrune added in v0.4.0

type BeginGuildPrune struct {
	Days              *int            `json:"days,omitempty"`
	ComputePruneCount *bool           `json:"compute_prune_count,omitempty"`
	IncludeRoles      ArraySnowflakes `json:"include_roles,omitempty"`

	AuditLogReason string `json:"-"`
}

BeginGuildPrune represents the payload to send to Discord to begin a guild prune operation (discord.GuildPrune) https://discord.com/developers/docs/resources/guild#begin-guild-prune-json-params

type BooleanCommandOption added in v0.3.0

type BooleanCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
}

BooleanCommandOption represents an application command option (discord.ApplicationCommandOption) to pass an integer

func (*BooleanCommandOption) MarshalJSON added in v0.3.0

func (o *BooleanCommandOption) MarshalJSON() ([]byte, error)

func (*BooleanCommandOption) Type added in v0.3.0

type BulkDeleteMessages added in v0.4.0

type BulkDeleteMessages struct {
	Messages ArraySnowflakes `json:"messages"`

	AuditLogReason string `json:"-"`
}

BulkDeleteMessages represents the payload to send to Discord to perform a bulk delete of multiple messages (discord.Message) https://discord.com/developers/docs/resources/channel#bulk-delete-messages-json-params

type Button added in v0.3.0

type Button struct {
	Style    ButtonStyle `json:"style"`
	Label    string      `json:"label"`
	Emoji    *Emoji      `json:"emoji,omitempty"`
	CustomID string      `json:"custom_id,omitempty"`
	URL      string      `json:"url,omitempty"`
	Disabled bool        `json:"disabled"`
}

Button represents an interactive components that render in messages which can be clicked by users https://discord.com/developers/docs/interactions/message-components#button-object-button-structure

func (*Button) MarshalJSON added in v0.3.0

func (c *Button) MarshalJSON() ([]byte, error)

func (*Button) Type added in v0.3.0

func (c *Button) Type() ComponentType

type ButtonStyle added in v0.3.0

type ButtonStyle int

ButtonStyle represents the style of the button (discord.Button) https://discord.com/developers/docs/interactions/message-components#button-object-button-styles

const (
	ButtonStylePrimary ButtonStyle = 1 + iota
	ButtonStyleSecondary
	ButtonStyleSuccess
	ButtonStyleDanger
	ButtonStyleLink
)

type Channel added in v0.3.0

type Channel struct {
	ID                            Snowflake              `json:"id"`
	Type                          ChannelType            `json:"type"`
	GuildID                       Snowflake              `json:"guild_id,omitempty"`
	Position                      int                    `json:"position,omitempty"`
	PermissionOverwrites          []Overwrite            `json:"permission_overwrites"`
	Name                          string                 `json:"name,omitempty"`
	Topic                         string                 `json:"topic,omitempty"`
	NSFW                          bool                   `json:"nsfw,omitempty"`
	LastMessageID                 Snowflake              `json:"last_message_id,omitempty"`
	Bitrate                       int                    `json:"bitrate,omitempty"`
	UserLimit                     int                    `json:"user_limit,omitempty"`
	RateLimitPerUser              int                    `json:"rate_limit_per_user,omitempty"`
	Recipients                    []User                 `json:"recipients,omitempty"`
	Icon                          string                 `json:"icon,omitempty"`
	OwnerID                       Snowflake              `json:"owner_id,omitempty"`
	ApplicationID                 Snowflake              `json:"application_id,omitempty"`
	Managed                       bool                   `json:"managed,omitempty"`
	ParentID                      Snowflake              `json:"parent_id,omitempty"`
	LastPinTimestamp              *time.Time             `json:"last_pin_timestamp,omitempty"`
	RTCRegion                     string                 `json:"rtc_region,omitempty"`
	VideoQualityMode              VideoQualityMode       `json:"video_quality_mode,omitempty"`
	MessageCount                  int                    `json:"message_count,omitempty"`
	MemberCount                   int                    `json:"member_count,omitempty"`
	ThreadMetadata                ThreadMetadata         `json:"thread_metadata,omitempty"`
	Member                        ThreadMember           `json:"member,omitempty"`
	DefaultAutoArchiveDuration    int                    `json:"default_auto_archive_duration,omitempty"`
	Permissions                   Permissions            `json:"permissions,omitempty"`
	Flags                         ChannelFlags           `json:"flags,omitempty"`
	TotalMessageSent              int                    `json:"total_message_sent,omitempty"`
	AvailableTags                 []Tag                  `json:"available_tags,omitempty"`
	AppliedTags                   ArraySnowflakes        `json:"applied_tags,omitempty"`
	DefaultReactionEmoji          DefaultReaction        `json:"default_reaction_emoji,omitempty"`
	DefaultThreadRateLimitPerUser int                    `json:"default_thread_rate_limit_per_user,omitempty"`
	DefaultSortOrder              DefaultSortOrderType   `json:"default_sort_order,omitempty"`
	DefaultForumLayout            DefaultForumLayoutView `json:"default_forum_layout,omitempty"`
}

Channel represents a guild or DM channel within Discord https://discord.com/developers/docs/resources/channel#channel-object-channel-structure

func (*Channel) CreatedAt added in v0.5.0

func (c *Channel) CreatedAt() time.Time

CreatedAt returns the creation time of the channel (discord.Channel)

func (*Channel) Mention added in v0.6.0

func (c *Channel) Mention() string

Mention returns the string to mention the channel (discord.Channel)

func (*Channel) URL added in v0.5.0

func (c *Channel) URL() string

URL returns the URL for the channel (discord.Channel)

type ChannelCommandOption added in v0.3.0

type ChannelCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
	ChannelTypes             []ChannelType     `json:"channel_types,omitempty"`
}

ChannelCommandOption represents an application command option (discord.ApplicationCommandOption) to pass a channel (discord.Channel)

func (*ChannelCommandOption) MarshalJSON added in v0.3.0

func (o *ChannelCommandOption) MarshalJSON() ([]byte, error)

func (*ChannelCommandOption) Type added in v0.3.0

type ChannelFlags added in v0.3.0

type ChannelFlags uint64

ChannelFlags represents the channel (discord.Channel) flags https://discord.com/developers/docs/resources/channel#channel-object-channel-flags

const (
	ChannelFlagPinned ChannelFlags

	ChannelFlagRequireTag

	ChannelFlagHideMediaDownloadOptions
)
const ChannelFlagsNone ChannelFlags = 0

func ComputeChannelFlags added in v0.6.0

func ComputeChannelFlags(channelFlags ...ChannelFlags) ChannelFlags

ComputeChannelFlags creates a new channel flags structure (discord.ChannelFlags) from the given channel flags

func (ChannelFlags) Add added in v0.5.0

func (f ChannelFlags) Add(channelFlags ...ChannelFlags) ChannelFlags

Add adds the given channel flags (discord.ChannelFlags)

func (ChannelFlags) Has added in v0.5.0

func (f ChannelFlags) Has(channelFlags ...ChannelFlags) bool

Has checks if all the given channel flags (discord.ChannelFlags) are set

func (ChannelFlags) HasAny added in v0.5.0

func (f ChannelFlags) HasAny(channelFlags ...ChannelFlags) bool

HasAny checks if any of the given channel flags (discord.ChannelFlags) is set

func (ChannelFlags) HasNot added in v0.5.0

func (f ChannelFlags) HasNot(channelFlags ...ChannelFlags) bool

HasNot checks if all the given channel flags (discord.ChannelFlags) are not set

func (ChannelFlags) HasNotAny added in v0.5.0

func (f ChannelFlags) HasNotAny(channelFlags ...ChannelFlags) bool

HasNotAny checks if any of the given channel flags (discord.ChannelFlags) is not set

func (ChannelFlags) Remove added in v0.5.0

func (f ChannelFlags) Remove(channelFlags ...ChannelFlags) ChannelFlags

Remove removes the given channel flags (discord.ChannelFlags)

func (ChannelFlags) Toggle added in v0.5.0

func (f ChannelFlags) Toggle(channelFlags ...ChannelFlags) ChannelFlags

Toggle toggles the given channel flags (discord.ChannelFlags)

type ChannelType added in v0.3.0

type ChannelType int

ChannelType represents the type of channel (discord.Channel) https://discord.com/developers/docs/resources/channel#channel-object-channel-types

const (
	ChannelTypeGuildText ChannelType = iota
	ChannelTypeDM
	ChannelTypeGuildVoice
	ChannelTypeGroupDM
	ChannelTypeGuildCategory
	ChannelTypeGuildAnnouncement
	ChannelTypeGuildStore // Undocumented

	ChannelTypeAnnouncementThread
	ChannelTypePublicThread
	ChannelTypePrivateThread
	ChannelTypeGuildStageVoice
	ChannelTypeGuildDirectory
	ChannelTypeGuildForum
	ChannelTypeGuildMedia
)

type ClientStatus added in v0.6.0

type ClientStatus struct {
	Desktop string `json:"desktop,omitempty"`
	Mobile  string `json:"mobile,omitempty"`
	Web     string `json:"web,omitempty"`
}

ClientStatus represents the active sessions of a user on the various platforms https://discord.com/developers/docs/topics/gateway-events#client-status-object

type Component added in v0.3.0

type Component interface {
	Type() ComponentType
}

Component represents an interface that is implemented by all message components below https://discord.com/developers/docs/interactions/message-components#message-components

type ComponentType added in v0.3.0

type ComponentType int

ComponentType represents the type of component (discord.Component) https://discord.com/developers/docs/interactions/message-components#component-object-component-types

const (
	ComponentTypeActionRow ComponentType = 1 + iota
	ComponentTypeButton
	ComponentTypeSelectMenu
	ComponentTypeTextInput
	ComponentTypeUserSelect
	ComponentTypeRoleSelect
	ComponentTypeMentionableSelect
	ComponentTypeChannelSelect
)

type CreateAutoModerationRule added in v0.4.0

type CreateAutoModerationRule struct {
	Name            string                         `json:"name"`
	EventType       AutoModerationEventType        `json:"event_type"`
	TriggerType     AutoModerationTriggerType      `json:"trigger_type"`
	TriggerMetadata *AutoModerationTriggerMetadata `json:"trigger_metadata,omitempty"`
	Actions         []AutoModerationAction         `json:"actions"`
	Enabled         *bool                          `json:"enabled,omitempty"`
	ExemptRoles     ArraySnowflakes                `json:"exempt_roles,omitempty"`
	ExemptChannels  ArraySnowflakes                `json:"exempt_channels,omitempty"`

	AuditLogReason string `json:"-"`
}

CreateAutoModerationRule represents the payload to send to Discord to create a new auto moderation rule (discord.AutoModerationRule) https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule-json-params

type CreateChannelInvite added in v0.4.0

type CreateChannelInvite struct {
	MaxAge              *int              `json:"max_age,omitempty"`
	MaxUses             *int              `json:"max_uses,omitempty"`
	Temporary           *bool             `json:"temporary,omitempty"`
	Unique              *bool             `json:"unique,omitempty"`
	TargetType          *InviteTargetType `json:"target_type,omitempty"`
	TargetUserID        Snowflake         `json:"target_user_id,omitempty"`
	TargetApplicationID Snowflake         `json:"target_application_id,omitempty"`

	AuditLogReason string `json:"-"`
}

CreateChannelInvite represents the payload to send to Discord to create an invite (discord.Invite) for a channel (discord.Channel) https://discord.com/developers/docs/resources/channel#create-channel-invite-json-params

type CreateFollowupMessage added in v0.6.0

type CreateFollowupMessage struct {
	Content         *string          `json:"content,omitempty"`
	TTS             *bool            `json:"tts,omitempty"`
	Embeds          []Embed          `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []Component      `json:"components,omitempty"`
	Flags           *MessageFlags    `json:"flags,omitempty"`
	ThreadName      *string          `json:"thread_name,omitempty"`
	Attachments     []AttachmentSend `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

CreateFollowupMessage represents the payload to send to Discord to create a followup message https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

type CreateGlobalApplicationCommand added in v0.4.0

type CreateGlobalApplicationCommand struct {
	Name                     string                    `json:"name"`
	NameLocalizations        map[Locale]string         `json:"name_localizations,omitempty"`
	Description              *string                   `json:"description,omitempty"`
	DescriptionLocalizations map[Locale]string         `json:"description_localizations,omitempty"`
	Options                  ApplicationCommandOptions `json:"options,omitempty"`
	DefaultMemberPermissions *Permissions              `json:"default_member_permissions,omitempty"`
	DMPermission             *bool                     `json:"dm_permission,omitempty"`
	Type                     *ApplicationCommandType   `json:"type,omitempty"`
	NSFW                     *bool                     `json:"nsfw,omitempty"`
}

CreateGlobalApplicationCommand represents the payload to send to Discord to create a new global application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#create-global-application-command-json-params

type CreateGuild added in v0.4.0

type CreateGuild struct {
	Name                        string                    `json:"name"`
	Region                      *string                   `json:"region,omitempty"`
	Icon                        *string                   `json:"icon,omitempty"`
	VerificationLevel           *GuildVerificationLevel   `json:"verification_level,omitempty"`
	DefaultMessageNotifications *MessageNotificationLevel `json:"default_message_notifications,omitempty"`
	ExplicitContentFilter       *ExplicitContentFilter    `json:"explicit_content_filter,omitempty"`
	Roles                       []Role                    `json:"roles,omitempty"`
	Channels                    []Channel                 `json:"channels,omitempty"`
	AFKChannelID                *Snowflake                `json:"afk_channel_id,omitempty"`
	AFKTimeout                  *int                      `json:"afk_timeout,omitempty"`
	SystemChannelID             *Snowflake                `json:"system_channel_id,omitempty"`
	SystemChannelFlags          *SystemChannelFlags       `json:"system_channel_flags,omitempty"`
}

CreateGuild represents the payload to send to Discord to create a new guild (discord.Guild) https://discord.com/developers/docs/resources/guild#create-guild-json-params

type CreateGuildApplicationCommand added in v0.4.0

type CreateGuildApplicationCommand struct {
	Name                     string                    `json:"name"`
	NameLocalizations        map[Locale]string         `json:"name_localizations,omitempty"`
	Description              *string                   `json:"description,omitempty"`
	DescriptionLocalizations map[Locale]string         `json:"description_localizations,omitempty"`
	Options                  ApplicationCommandOptions `json:"options,omitempty"`
	DefaultMemberPermissions *Permissions              `json:"default_member_permissions,omitempty"`
	Type                     *ApplicationCommandType   `json:"type,omitempty"`
	NSFW                     *bool                     `json:"nsfw,omitempty"`
}

CreateGuildApplicationCommand represents the payload to send to Discord to create a new application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command-json-params

type CreateGuildBan added in v0.4.0

type CreateGuildBan struct {
	DeleteMessageSeconds *int `json:"delete_message_seconds,omitempty"`

	UserID         Snowflake `json:"-"`
	AuditLogReason string    `json:"-"`
}

CreateGuildBan represents the payload to send to Discord to create a guild ban (discord.GuildBan) https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params

type CreateGuildChannel added in v0.4.0

type CreateGuildChannel struct {
	Name                          string                  `json:"name"`
	Type                          *ChannelType            `json:"type,omitempty"`
	Topic                         *string                 `json:"topic,omitempty"`
	Bitrate                       *int                    `json:"bitrate,omitempty"`
	UserLimit                     *int                    `json:"user_limit,omitempty"`
	RateLimitPerUser              *int                    `json:"rate_limit_per_user,omitempty"`
	Position                      *int                    `json:"position,omitempty"`
	PermissionOverwrites          []Overwrite             `json:"permission_overwrites"`
	ParentID                      *Snowflake              `json:"parent_id,omitempty"`
	NSFW                          *bool                   `json:"nsfw,omitempty"`
	RTCRegion                     *string                 `json:"rtc_region,omitempty"`
	VideoQualityMode              *VideoQualityMode       `json:"video_quality_mode,omitempty"`
	DefaultAutoArchiveDuration    *int                    `json:"default_auto_archive_duration,omitempty"`
	DefaultReaction               *DefaultReaction        `json:"default_reaction,omitempty"`
	AvailableTags                 []Tag                   `json:"available_tags,omitempty"`
	DefaultSortOrder              *DefaultSortOrderType   `json:"default_sort_order,omitempty"`
	DefaultForumLayoutView        *DefaultForumLayoutView `json:"default_forum_layout_view,omitempty"`
	DefaultThreadRateLimitPerUser *int                    `json:"default_thread_rate_limit_per_user,omitempty"`

	AuditLogReason string `json:"-"`
}

CreateGuildChannel represents the payload to send to Discord to create a new channel (discord.Channel) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#create-guild-channel-json-params

type CreateGuildEmoji added in v0.4.0

type CreateGuildEmoji struct {
	Name  string          `json:"name"`
	Image string          `json:"image"`
	Roles ArraySnowflakes `json:"roles,omitempty"`

	AuditLogReason string `json:"-"`
}

CreateGuildEmoji represents the payload to send to Discord to create a new emoji (discord.Emoji) in a guild (discord.Guild) https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params

type CreateGuildFromTemplate added in v0.4.0

type CreateGuildFromTemplate struct {
	Name  string  `json:"name"`
	Image *string `json:"image,omitempty"`
}

CreateGuildFromTemplate represents the payload to send to Discord to create a guild (discord.Guild) based on a template code https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template-json-params

type CreateGuildRole added in v0.4.0

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

	AuditLogReason string `json:"-"`
}

CreateGuildRole represents the payload to send to Discord to create a new role (discord.Role) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#create-guild-role-json-params

type CreateGuildScheduledEvent added in v0.4.0

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

	AuditLogReason string `json:"-"`
}

CreateGuildScheduledEvent represents the payload to send to Discord to create a new scheduled event (discord.GuildScheduledEvent) https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event-json-params

type CreateGuildSticker added in v0.4.0

type CreateGuildSticker struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Tags        string `json:"tags"`

	File           File   `json:"-"`
	AuditLogReason string `json:"-"`
}

CreateGuildSticker represents the payload to send to Discord to create a new guild sticker (discord.Sticker) https://discord.com/developers/docs/resources/sticker#create-guild-sticker-form-params

type CreateGuildTemplate added in v0.4.0

type CreateGuildTemplate struct {
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
}

CreateGuildTemplate represents the payload to send to Discord to create a guild template (discord.GuildTemplate) https://discord.com/developers/docs/resources/guild-template#create-guild-template-json-params

type CreateInteractionResponse added in v0.6.0

type CreateInteractionResponse struct {
	Type InteractionResponseType `json:"type"`
	Data InteractionResponse     `json:"data"`
}

CreateInteractionResponse represents the payload to send to Discord to respond to an interaction (discord.Interaction) https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object

type CreateMessage added in v0.4.0

type CreateMessage struct {
	Content          *string           `json:"content,omitempty"`
	Nonce            *string           `json:"nonce,omitempty"`
	TTS              *bool             `json:"tts,omitempty"`
	Embeds           []Embed           `json:"embeds,omitempty"`
	AllowedMentions  *AllowedMentions  `json:"allowed_mentions,omitempty"`
	MessageReference *MessageReference `json:"message_reference,omitempty"`
	Components       []Component       `json:"components,omitempty"`
	StickerIDs       ArraySnowflakes   `json:"sticker_ids,omitempty"`
	Flags            *MessageFlags     `json:"flags,omitempty"`
	Attachments      []AttachmentSend  `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

CreateMessage represents the payload to send to Discord to post a message (discord.Message) in a channel (discord.Channel) https://discord.com/developers/docs/resources/channel#create-message-jsonform-params

type CreateStageInstance added in v0.4.0

type CreateStageInstance struct {
	ChannelID             Snowflake                  `json:"channel_id"`
	Topic                 string                     `json:"topic"`
	PrivacyLevel          *StageInstancePrivacyLevel `json:"privacy_level,omitempty"`
	SendStartNotification *bool                      `json:"send_start_notification,omitempty"`

	AuditLogReason string `json:"-"`
}

CreateStageInstance represents the payload to send to Discord to create a new stage instance (discord.StageInstance) https://discord.com/developers/docs/resources/stage-instance#create-stage-instance-json-params

type CreateWebhook added in v0.4.0

type CreateWebhook struct {
	Name   string  `json:"name"`
	Avatar *string `json:"avatar,omitempty"`

	AuditLogReason string `json:"-"`
}

CreateWebhook represents the payload to send to Discord to create a new webhook (discord.Webhook) https://discord.com/developers/docs/resources/webhook#create-webhook-json-params

type DefaultForumLayoutView added in v0.3.0

type DefaultForumLayoutView int

DefaultForumLayoutView represents the default layout view for forum channels (discord.ChannelTypeGuildForum) https://discord.com/developers/docs/resources/channel#channel-object-forum-layout-types

const (
	DefaultForumLayoutViewNotSet DefaultForumLayoutView = iota
	DefaultForumLayoutViewListView
	DefaultForumLayoutViewGalleryView
)

type DefaultReaction added in v0.3.0

type DefaultReaction struct {
	EmojiID   Snowflake `json:"emoji_id,omitempty"`
	EmojiName string    `json:"emoji_name,omitempty"`
}

DefaultReaction represents the default reaction that is used when creating a new post in a forum channel (discord.ChannelTypeGuildForum) https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure

type DefaultSortOrderType added in v0.3.0

type DefaultSortOrderType int

DefaultSortOrderType represents the default sorting method for forum channels (discord.ChannelTypeGuildForum) https://discord.com/developers/docs/resources/channel#channel-object-sort-order-types

const (
	DefaultSortOrderTypeLatestActivity DefaultSortOrderType = iota
	DefaultSortOrderTypeCreationDate
)

type DefaultValue added in v0.7.0

type DefaultValue struct {
	ID   Snowflake        `json:"id"`
	Type DefaultValueType `json:"type"`
}

DefaultValue represents a default value object for select menus https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-default-value-structure

type DefaultValueType added in v0.7.0

type DefaultValueType string

DefaultValueType represents the type of the default value (discord.DefaultValue) object

const (
	DefaultValueTypeUser    DefaultValueType = "user"
	DefaultValueTypeRole    DefaultValueType = "role"
	DefaultValueTypeChannel DefaultValueType = "channel"
)

type EditChannelPermissions added in v0.4.0

type EditChannelPermissions struct {
	Type  OverwriteType `json:"type"`
	Allow *Permissions  `json:"allow,omitempty"`
	Deny  *Permissions  `json:"deny,omitempty"`

	AuditLogReason string `json:"-"`
}

EditChannelPermissions represents the payload to send to Discord to edit the channel permission overwrites https://discord.com/developers/docs/resources/channel#edit-channel-permissions-json-params

type EditFollowupMessage added in v0.6.0

type EditFollowupMessage struct {
	EditWebhookMessage
}

EditFollowupMessage represents the payload to send to Discord to edit a followup message https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params

type EditGlobalApplicationCommand added in v0.4.0

type EditGlobalApplicationCommand struct {
	Name                     *string                   `json:"name,omitempty"`
	NameLocalizations        map[Locale]string         `json:"name_localizations,omitempty"`
	Description              *string                   `json:"description,omitempty"`
	DescriptionLocalizations map[Locale]string         `json:"description_localizations,omitempty"`
	Options                  ApplicationCommandOptions `json:"options,omitempty"`
	DefaultMemberPermissions *Permissions              `json:"default_member_permissions,omitempty"`
	DMPermission             *bool                     `json:"dm_permission,omitempty"`
	NSFW                     *bool                     `json:"nsfw,omitempty"`
}

EditGlobalApplicationCommand represents the payload to send to Discord to edit and existing application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command-json-params

type EditGuildApplicationCommand added in v0.4.0

type EditGuildApplicationCommand struct {
	Name                     *string                   `json:"name,omitempty"`
	NameLocalizations        map[Locale]string         `json:"name_localizations,omitempty"`
	Description              *string                   `json:"description,omitempty"`
	DescriptionLocalizations map[Locale]string         `json:"description_localizations,omitempty"`
	Options                  ApplicationCommandOptions `json:"options,omitempty"`
	DefaultMemberPermissions *Permissions              `json:"default_member_permissions,omitempty"`
	NSFW                     *bool                     `json:"nsfw,omitempty"`
}

EditGuildApplicationCommand represents the payload to send to Discord to edit and existing application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command-json-params

type EditMessage added in v0.4.0

type EditMessage struct {
	Content         *string          `json:"content,omitempty"`
	Embeds          []Embed          `json:"embeds,omitempty"`
	Flags           *MessageFlags    `json:"flags,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Attachments     []AttachmentSend `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

EditMessage represents the payload to send to Discord to edit an existing message (discord.Message) in a channel (discord.Channel) https://discord.com/developers/docs/resources/channel#edit-message-jsonform-params

type EditOriginalInteractionResponse added in v0.6.0

type EditOriginalInteractionResponse struct {
	EditWebhookMessage
}

EditOriginalInteractionResponse represents the payload to send to Discord to edit an original interaction response https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params

type EditWebhookMessage added in v0.5.0

type EditWebhookMessage struct {
	Content         *string          `json:"content,omitempty"`
	Embeds          []Embed          `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []Component      `json:"components,omitempty"`
	Attachments     []AttachmentSend `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

EditWebhookMessage represents the payload to send to Discord to edit a message (discord.Message) sent by a webhook (discord.Webhook) https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params

type Embed added in v0.3.0

type Embed struct {
	Title       string         `json:"title,omitempty"`
	Description string         `json:"description,omitempty"`
	URL         string         `json:"url,omitempty"`
	Timestamp   *time.Time     `json:"timestamp,omitempty"`
	Color       int            `json:"color,omitempty"`
	Footer      *EmbedFooter   `json:"footer,omitempty"`
	Image       *EmbedResource `json:"image,omitempty"`
	Thumbnail   *EmbedResource `json:"thumbnail,omitempty"`
	Video       *EmbedResource `json:"video,omitempty"`
	Provider    *EmbedProvider `json:"provider,omitempty"`
	Author      *EmbedAuthor   `json:"author,omitempty"`
	Fields      []EmbedField   `json:"fields,omitempty"`
}

Embed represents embedded content in a message (discord.Message) https://discord.com/developers/docs/resources/channel#embed-object-embed-structure

func NewEmbedBuilder added in v0.6.0

func NewEmbedBuilder() Embed

NewEmbedBuilder creates a new embed and facilitates the creation of embed structures (discord.Embed)

func (Embed) AddField added in v0.6.0

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

AddField adds a field to the embed

func (Embed) SetAuthor added in v0.6.0

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

SetAuthor sets the author of the embed

func (Embed) SetColor added in v0.6.0

func (e Embed) SetColor(color int) Embed

SetColor sets the color of the embed

func (Embed) SetDescription added in v0.6.0

func (e Embed) SetDescription(description string) Embed

SetDescription sets the description of the embed

func (Embed) SetFields added in v0.6.0

func (e Embed) SetFields(fields []EmbedField) Embed

SetFields sets the fields of the embed

func (Embed) SetFooter added in v0.6.0

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

SetFooter sets the footer of the embed

func (Embed) SetImage added in v0.6.0

func (e Embed) SetImage(url string) Embed

SetImage sets the image of the embed

func (Embed) SetThumbnail added in v0.6.0

func (e Embed) SetThumbnail(url string) Embed

SetThumbnail sets the thumbnail of the embed

func (Embed) SetTimestamp added in v0.6.0

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

SetTimestamp sets the URL of the embed

func (Embed) SetTitle added in v0.6.0

func (e Embed) SetTitle(title string) Embed

SetTitle sets the title of the embed

func (Embed) SetURL added in v0.6.0

func (e Embed) SetURL(url string) Embed

SetURL sets the URL of the embed

type EmbedAuthor added in v0.3.0

type EmbedAuthor struct {
	Name         string `json:"name"`
	URL          string `json:"url,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

EmbedAuthor represents the author information in embedded content (discord.Embed) https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure

type EmbedField added in v0.3.0

type EmbedField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline,omitempty"`
}

EmbedField represents the field information in embedded content (discord.Embed) https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure

type EmbedFooter added in v0.3.0

type EmbedFooter struct {
	Text         string `json:"text"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

EmbedFooter represents footer information in embedded content (discord.Embed) https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure

type EmbedProvider added in v0.3.0

type EmbedProvider struct {
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

EmbedProvider represents the provider information in embedded content (discord.Embed) https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure

type EmbedResource added in v0.3.0

type EmbedResource struct {
	URL          string `json:"url"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
	Height       int    `json:"height,omitempty"`
	Width        int    `json:"width,omitempty"`
}

EmbedResource represents resource information in embedded content (discord.Embed) https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure

type Emoji added in v0.3.0

type Emoji struct {
	ID            Snowflake       `json:"id"`
	Name          string          `json:"name,omitempty"`
	Roles         ArraySnowflakes `json:"roles,omitempty"`
	User          *User           `json:"user,omitempty"`
	RequireColons bool            `json:"require_colons,omitempty"`
	Managed       bool            `json:"managed,omitempty"`
	Animated      bool            `json:"animated,omitempty"`
	Available     bool            `json:"available,omitempty"`
}

Emoji represents a custom, or not, emoji on Discord https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure

func (*Emoji) CreatedAt added in v0.5.0

func (e *Emoji) CreatedAt() time.Time

CreatedAt returns the creation time of the emoji (discord.Emoji)

func (*Emoji) String added in v0.6.0

func (e *Emoji) String() string

String returns the string to send the emoji (discord.Emoji)

func (*Emoji) URL added in v0.5.0

func (e *Emoji) URL(asFormat ImageFormat) string

URL returns the URL for the emoji (discord.Emoji)

type Error added in v0.3.0

type Error struct {
	Request  *http.Request  `json:"-"`
	Response *http.Response `json:"-"`

	Code    int             `json:"code"`
	Errors  json.RawMessage `json:"errors"`
	Message string          `json:"message"`
}

Error represents an error JSON response coming from Discord https://discord.com/developers/docs/reference#error-messages

func NewError added in v0.3.0

func NewError(body []byte, request *http.Request, response *http.Response) Error

NewError creates a new error coming from Discord

func (Error) Error added in v0.3.0

func (e Error) Error() string

Error returns the error code and message of a discord.Error

type ExecuteWebhook added in v0.4.0

type ExecuteWebhook struct {
	Content         *string          `json:"content,omitempty"`
	Username        *string          `json:"username,omitempty"`
	AvatarURL       *string          `json:"avatar_url,omitempty"`
	TTS             *bool            `json:"tts,omitempty"`
	Embeds          []Embed          `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []Component      `json:"components,omitempty"`
	Flags           *MessageFlags    `json:"flags,omitempty"`
	ThreadName      *string          `json:"thread_name,omitempty"`
	Attachments     []AttachmentSend `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

ExecuteWebhook represents the payload to send to Discord to execute a webhook (discord.Webhook) aka send a message https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

type ExplicitContentFilter added in v0.3.0

type ExplicitContentFilter int

ExplicitContentFilter represents the explicit content filter in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level

const (
	ExplicitContentFilterDisabled ExplicitContentFilter = iota
	ExplicitContentFilterMembersWithoutRoles
	ExplicitContentFilterAllMembers
)

type File added in v0.4.0

type File struct {
	Name        string
	Description string
	Reader      io.Reader
}

File represents a file that can be used to send to Discord in a message

type FollowedChannel added in v0.4.0

type FollowedChannel struct {
	ChannelID Snowflake `json:"channel_id"`
	WebhookID Snowflake `json:"webhook_id"`
}

FollowedChannel represents a channel that is being followed in a target channel https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure

type ForumThreadMessage added in v0.4.0

type ForumThreadMessage struct {
	Content         *string          `json:"content,omitempty"`
	Embeds          []Embed          `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []Component      `json:"components,omitempty"`
	StickerIDs      ArraySnowflakes  `json:"sticker_ids,omitempty"`
	Flags           MessageFlags     `json:"flags,omitempty"`
	Attachments     []AttachmentSend `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

ForumThreadMessage represents a forum thread message when creating a new thread https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel-forum-thread-message-params-object

type Guild added in v0.3.0

type Guild struct {
	ID                          Snowflake                `json:"id"`
	Name                        string                   `json:"name"`
	Icon                        string                   `json:"icon"`
	IconHash                    string                   `json:"icon_hash"`
	Splash                      string                   `json:"splash"`
	DiscoverySplash             string                   `json:"discovery_splash"`
	Owner                       bool                     `json:"owner"`
	OwnerID                     Snowflake                `json:"owner_id"`
	Permissions                 Permissions              `json:"permissions"`
	Region                      string                   `json:"region"`
	AFKChannelID                Snowflake                `json:"afk_channel_id"`
	AFKTimeout                  int                      `json:"afk_timeout"`
	WidgetEnabled               bool                     `json:"widget_enabled"`
	WidgetChannelID             Snowflake                `json:"widget_channel_id"`
	VerificationLevel           GuildVerificationLevel   `json:"verification_level"`
	DefaultMessageNotifications MessageNotificationLevel `json:"default_message_notifications"`
	ExplicitContentFilter       ExplicitContentFilter    `json:"explicit_content_filter"`
	Roles                       []Role                   `json:"roles"`
	Emojis                      []Emoji                  `json:"emojis"`
	Features                    []GuildFeature           `json:"features"`
	MFALevel                    MFALevel                 `json:"mfa_level"`
	ApplicationID               Snowflake                `json:"application_id"`
	SystemChannelID             Snowflake                `json:"system_channel_id"`
	SystemChannelFlags          SystemChannelFlags       `json:"system_channel_flags"`
	RulesChannelID              Snowflake                `json:"rules_channel_id"`
	MaxPresences                int                      `json:"max_presences"`
	MaxMembers                  int                      `json:"max_members"`
	VanityURLCode               string                   `json:"vanity_url_code"`
	Description                 string                   `json:"description"`
	Banner                      string                   `json:"banner"`
	PremiumTier                 PremiumTier              `json:"premium_tier"`
	PremiumSubscriptionCount    int                      `json:"premium_subscription_count"`
	PreferredLocale             Locale                   `json:"preferred_locale"`
	PublicUpdatesChannelID      Snowflake                `json:"public_updates_channel_id"`
	MaxVideoChannelUsers        int                      `json:"max_video_channel_users"`
	MaxStageVideoChannelUsers   int                      `json:"max_stage_video_channel_users"`
	ApproximateMemberCount      int                      `json:"approximate_member_count"`
	ApproximatePresenceCount    int                      `json:"approximate_presence_count"`
	WelcomeScreen               *WelcomeScreen           `json:"welcome_screen"`
	NSFWLevel                   NSFWLevel                `json:"nsfw_level"`
	Stickers                    []Sticker                `json:"stickers"`
	PremiumProgressBarEnabled   bool                     `json:"premium_progress_bar_enabled"`
	SafetyAlertsChannelID       Snowflake                `json:"safety_alerts_channel_id,omitempty"`
}

Guild represents an isolated collection of users and channels, and are often referred to as "servers" in the UI https://discord.com/developers/docs/resources/guild#guild-object-guild-structure

func (*Guild) BannerURL added in v0.5.0

func (g *Guild) BannerURL(asFormat ImageFormat) string

BannerURL returns the URL for the guild banner

func (*Guild) CreatedAt added in v0.5.0

func (g *Guild) CreatedAt() time.Time

CreatedAt returns the creation time of the guild (discord.Guild)

func (*Guild) DiscoverySplashURL added in v0.5.0

func (g *Guild) DiscoverySplashURL(asFormat ImageFormat) string

DiscoverySplashURL returns the URL for the guild discovery splash

func (*Guild) IconURL added in v0.5.0

func (g *Guild) IconURL(asFormat ImageFormat) string

IconURL returns the URL for the guild icon

func (*Guild) SplashURL added in v0.5.0

func (g *Guild) SplashURL(asFormat ImageFormat) string

SplashURL returns the URL for the guild splash

type GuildApplicationCommandPermissions added in v0.3.0

type GuildApplicationCommandPermissions struct {
	ID            Snowflake                      `json:"id"`
	ApplicationID Snowflake                      `json:"application_id"`
	GuildID       Snowflake                      `json:"guild_id"`
	Permissions   []ApplicationCommandPermission `json:"permissions"`
}

GuildApplicationCommandPermissions represents the permissions for an app's command in a guild https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure

type GuildBan added in v0.3.0

type GuildBan struct {
	Reason string `json:"reason"`
	User   *User  `json:"user"`
}

GuildBan represents a banned user (discord.User) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#ban-object-ban-structure

type GuildFeature added in v0.3.0

type GuildFeature string

GuildFeature represents the different features a guild may have activated https://discord.com/developers/docs/resources/guild#guild-object-guild-features

const (
	GuildFeatureAnimatedBanner                        GuildFeature = "ANIMATED_BANNER"
	GuildFeatureAnimatedIcon                          GuildFeature = "ANIMATED_ICON"
	GuildFeatureApplicationCommandPermissionsV2       GuildFeature = "APPLICATION_COMMAND_PERMISSIONS_V2"
	GuildFeatureAutoModeration                        GuildFeature = "AUTO_MODERATION"
	GuildFeatureBanner                                GuildFeature = "BANNER"
	GuildFeatureCommunity                             GuildFeature = "COMMUNITY"
	GuildFeatureCreatorMonetizableProvisional         GuildFeature = "CREATOR_MONETIZABLE_PROVISIONAL"
	GuildFeatureCreatorStorePage                      GuildFeature = "CREATOR_STORE_PAGE"
	GuildFeatureDeveloperSupportServer                GuildFeature = "DEVELOPER_SUPPORT_SERVER"
	GuildFeatureDiscoverable                          GuildFeature = "DISCOVERABLE"
	GuildFeatureFeaturable                            GuildFeature = "FEATURABLE"
	GuildFeatureInvitesDisabled                       GuildFeature = "INVITES_DISABLED"
	GuildFeatureInviteSplash                          GuildFeature = "INVITE_SPLASH"
	GuildFeatureMemberVerificationGateEnabled         GuildFeature = "MEMBER_VERIFICATION_GATE_ENABLED"
	GuildFeatureMoreStickers                          GuildFeature = "MORE_STICKERS"
	GuildFeatureNews                                  GuildFeature = "NEWS"
	GuildFeaturePartnered                             GuildFeature = "PARTNERED"
	GuildFeaturePreviewEnabled                        GuildFeature = "PREVIEW_ENABLED"
	GuildFeatureRaidAlertsDisabled                    GuildFeature = "RAID_ALERTS_DISABLED"
	GuildFeatureRoleIcons                             GuildFeature = "ROLE_ICONS"
	GuildFeatureRoleSubscriptionsAvailableForPurchase GuildFeature = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE"
	GuildFeatureRoleSubscriptionsEnabled              GuildFeature = "ROLE_SUBSCRIPTIONS_ENABLED"
	GuildFeatureTicketedEventsEnabled                 GuildFeature = "TICKETED_EVENTS_ENABLED"
	GuildFeatureVanityURL                             GuildFeature = "VANITY_URL"
	GuildFeatureVerified                              GuildFeature = "VERIFIED"
	GuildFeatureVIPRegions                            GuildFeature = "VIP_REGIONS"
	GuildFeatureWelcomeScreenEnabled                  GuildFeature = "WELCOME_SCREEN_ENABLED"
)

type GuildPreview added in v0.3.0

type GuildPreview struct {
	ID                       Snowflake      `json:"id"`
	Name                     string         `json:"name"`
	Icon                     string         `json:"icon"`
	Splash                   string         `json:"splash"`
	DiscoverySplash          string         `json:"discovery_splash"`
	Emojis                   []Emoji        `json:"emojis"`
	Features                 []GuildFeature `json:"features"`
	ApproximateMemberCount   int            `json:"approximate_member_count"`
	ApproximatePresenceCount int            `json:"approximate_presence_count"`
	Description              string         `json:"description"`
	Stickers                 []Sticker      `json:"stickers"`
}

GuildPreview represents a small preview of a guild (discord.Guild) with partial information https://discord.com/developers/docs/resources/guild#guild-preview-object-guild-preview-structure

func (*GuildPreview) CreatedAt added in v0.5.0

func (p *GuildPreview) CreatedAt() time.Time

CreatedAt returns the creation time of the guild preview (discord.GuildPreview)

type GuildPrune added in v0.3.0

type GuildPrune struct {
	Pruned int `json:"pruned"`
}

GuildPrune represents how many members (discord.Member) will get pruned when performing a prune https://discord.com/developers/docs/resources/guild#get-guild-prune-count

type GuildRolePosition added in v0.4.0

type GuildRolePosition struct {
	ID       Snowflake `json:"id"`
	Position *int      `json:"position,omitempty"`
}

GuildRolePosition represents an element of the array of the payload to send to Discord to modify the positions of roles (discord.Role) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-guild-role-positions-json-params

type GuildScheduledEvent added in v0.3.0

type GuildScheduledEvent struct {
	ID                 Snowflake                          `json:"id"`
	GuildID            Snowflake                          `json:"guild_id"`
	ChannelID          Snowflake                          `json:"channel_id"`
	CreatorID          Snowflake                          `json:"creator_id"`
	Name               string                             `json:"name"`
	Description        string                             `json:"description"`
	ScheduledStartTime time.Time                          `json:"scheduled_start_time"`
	ScheduledEndTime   *time.Time                         `json:"scheduled_end_time"`
	PrivacyLevel       GuildScheduledEventPrivacyLevel    `json:"privacy_level"`
	Status             GuildScheduledEventStatus          `json:"status"`
	EntityType         GuildScheduledEventEntityType      `json:"entity_type"`
	EntityID           Snowflake                          `json:"entity_id"`
	EntityMetadata     *GuildScheduledEventEntityMetadata `json:"entity_metadata"`
	Creator            *User                              `json:"creator"`
	UserCount          int                                `json:"user_count"`
	Image              string                             `json:"image"`
}

GuildScheduledEvent represents a scheduled event in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-structure

func (*GuildScheduledEvent) CoverURL added in v0.5.0

func (e *GuildScheduledEvent) CoverURL(asFormat ImageFormat) string

CoverURL returns the cover URL of the guild scheduled event (discord.GuildScheduledEvent)

func (*GuildScheduledEvent) CreatedAt added in v0.5.0

func (e *GuildScheduledEvent) CreatedAt() time.Time

CreatedAt returns the creation time of the guild scheduled event (discord.GuildScheduledEvent)

type GuildScheduledEventEntityMetadata added in v0.3.0

type GuildScheduledEventEntityMetadata struct {
	Location string `json:"location,omitempty"`
}

GuildScheduledEventEntityMetadata represents additional metadata for the scheduled event (discord.GuildScheduledEvent) of type external (discord.GuildScheduledEventEntityTypeExternal) https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata

type GuildScheduledEventEntityType added in v0.3.0

type GuildScheduledEventEntityType int

GuildScheduledEventEntityType represents the type of the scheduled event (discord.GuildScheduledEvent) https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types

type GuildScheduledEventPrivacyLevel added in v0.3.0

type GuildScheduledEventPrivacyLevel int

GuildScheduledEventPrivacyLevel represents the privacy level for the scheduled event (discord.GuildScheduledEvent) https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level

const (
	GuildScheduledEventPrivacyLevelGuildOnly GuildScheduledEventPrivacyLevel
)

type GuildScheduledEventStatus added in v0.3.0

type GuildScheduledEventStatus int

GuildScheduledEventStatus represents the current status of the scheduled event (discord.GuildScheduledEvent) https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status

const (
	GuildScheduledEventStatusScheduled GuildScheduledEventStatus = 1 + iota
	GuildScheduledEventStatusActive
	GuildScheduledEventStatusCompleted
	GuildScheduledEventStatusCancelled
)

type GuildScheduledEventUser added in v0.3.0

type GuildScheduledEventUser struct {
	GuildScheduledEventID Snowflake `json:"guild_scheduled_event_id"`
	User                  *User     `json:"user"`
	Member                *Member   `json:"member,omitempty"`
}

GuildScheduledEventUser represents a user (discord.User) and member (discord.Member), if any, that is subscribed to a scheduled event (discord.GuildScheduledEvent) https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure

type GuildTemplate added in v0.3.0

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

GuildTemplate represents a template that can be used to creates a guild (discord.Guild) based on a snapshot of an existing guild (discord.Guild) https://discord.com/developers/docs/resources/guild-template#guild-template-object-guild-template-structure

type GuildVerificationLevel added in v0.3.0

type GuildVerificationLevel int

GuildVerificationLevel represents the verification level used in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-verification-level

const (
	GuildVerificationLevelNone GuildVerificationLevel = iota
	GuildVerificationLevelLow
	GuildVerificationLevelMedium
	GuildVerificationLevelHigh
	GuildVerificationLevelVeryHigh
)

type ImageFormat added in v0.5.0

type ImageFormat string

ImageFormat represents the different image formats Discord accepts https://discord.com/developers/docs/reference#image-formatting-image-formats

const (
	ImageFormatJPG    ImageFormat = "jpg"
	ImageFormatJPEG   ImageFormat = "jpeg"
	ImageFormatPNG    ImageFormat = "png"
	ImageFormatWebP   ImageFormat = "webp"
	ImageFormatGIF    ImageFormat = "gif"
	ImageFormatLottie ImageFormat = "json"
)

type InstallParams added in v0.3.0

type InstallParams struct {
	Scopes      []Scope     `json:"scopes"`
	Permissions Permissions `json:"permissions"`
}

InstallParams represents the application's default in-app authorization link https://discord.com/developers/docs/resources/application#install-params-object-install-params-structure

type IntegerChoice added in v0.3.0

type IntegerChoice struct {
	Name              string            `json:"name"`
	NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
	Value             int               `json:"value"`
}

IntegerChoice is a choice which can be given in an integer command option (discord.IntegerCommandOption)

type IntegerCommandOption added in v0.3.0

type IntegerCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
	Choices                  []IntegerChoice   `json:"choices,omitempty"`
	MinValue                 *int              `json:"min_value,omitempty"`
	MaxValue                 *int              `json:"max_value,omitempty"`
	AutoComplete             bool              `json:"auto_complete,omitempty"`
}

IntegerCommandOption represents an application command option (discord.ApplicationCommandOption) to pass an integer

func (*IntegerCommandOption) MarshalJSON added in v0.3.0

func (o *IntegerCommandOption) MarshalJSON() ([]byte, error)

func (*IntegerCommandOption) Type added in v0.3.0

type Integration added in v0.3.0

type Integration struct {
	ID                Snowflake                 `json:"id"`
	Name              string                    `json:"name"`
	Type              string                    `json:"type"`
	Enabled           bool                      `json:"enabled"`
	Syncing           bool                      `json:"syncing,omitempty"`
	RoleID            Snowflake                 `json:"role_id,omitempty"`
	EnableEmoticons   bool                      `json:"enable_emoticons,omitempty"`
	ExpireBehavior    IntegrationExpireBehavior `json:"expire_behavior,omitempty"`
	ExpireGracePeriod int                       `json:"expire_grace_period,omitempty"`
	User              *User                     `json:"user,omitempty"`
	Account           IntegrationAccount        `json:"account"`
	SyncedAt          *time.Time                `json:"synced_at,omitempty"`
	SubscriberCount   int                       `json:"subscriber_count,omitempty"`
	Revoked           bool                      `json:"revoked,omitempty"`
	Application       IntegrationApplication    `json:"application,omitempty"`
	Scopes            []Scope                   `json:"scopes,omitempty"`
}

Integration represents an integration that is contained within a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#integration-object-integration-structure

func (*Integration) CreatedAt added in v0.5.0

func (i *Integration) CreatedAt() time.Time

CreatedAt returns the creation time of the integration (discord.Integration)

type IntegrationAccount added in v0.3.0

type IntegrationAccount struct {
	ID   Snowflake `json:"id"`
	Name string    `json:"name"`
}

IntegrationAccount represents the integration account information https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure

type IntegrationApplication added in v0.3.0

type IntegrationApplication struct {
	ID          Snowflake `json:"id"`
	Name        string    `json:"name"`
	Icon        string    `json:"icon"`
	Description string    `json:"description"`
	Bot         *User     `json:"bot,omitempty"`
}

IntegrationApplication represents the bot/OAuth2 application for the integration (discord.Integration) https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure

func (*IntegrationApplication) CreatedAt added in v0.5.0

func (a *IntegrationApplication) CreatedAt() time.Time

CreatedAt returns the creation time of the integration application (discord.IntegrationApplication)

type IntegrationExpireBehavior added in v0.3.0

type IntegrationExpireBehavior int

IntegrationExpireBehavior represents the behavior of expiring subscribers https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors

const (
	IntegrationExpireBehaviorRemoveRole IntegrationExpireBehavior = iota
	IntegrationExpireBehaviorKick
)

type Intents added in v0.6.0

type Intents uint64

Intents represents the gateway intents https://discord.com/developers/docs/topics/gateway#gateway-intents

const (
	IntentsGuilds Intents = 1 << iota
	IntentsGuildMembers
	IntentsGuildModeration
	IntentsGuildEmojisAndStickers
	IntentsGuildIntegrations
	IntentsGuildWebhooks
	IntentsGuildInvites
	IntentsGuildVoiceStates
	IntentsGuildPresences
	IntentsGuildMessages
	IntentsGuildMessageReactions
	IntentsGuildMessageTyping
	IntentsDirectMessages
	IntentsDirectMessageReactions
	IntentsDirectMessageTyping
	IntentsMessageContent
	IntentsGuildScheduledEvents

	IntentsAutoModerationConfiguration
	IntentsAutoModerationExecution
)

func ComputeIntents added in v0.6.0

func ComputeIntents(intents ...Intents) Intents

ComputeIntents creates a new intents structure (discord.Intents) from the given intents

func (Intents) Add added in v0.6.0

func (f Intents) Add(intents ...Intents) Intents

Add adds the given intents (discord.Intents)

func (Intents) Has added in v0.6.0

func (f Intents) Has(intents ...Intents) bool

Has checks if all the given intents (discord.Intents) are set

func (Intents) HasAny added in v0.6.0

func (f Intents) HasAny(intents ...Intents) bool

HasAny checks if any of the given intents (discord.Intents) is set

func (Intents) HasNot added in v0.6.0

func (f Intents) HasNot(intents ...Intents) bool

HasNot checks if all the given intents (discord.Intents) are not set

func (Intents) HasNotAny added in v0.6.0

func (f Intents) HasNotAny(intents ...Intents) bool

HasNotAny checks if any of the given intents (discord.Intents) is not set

func (Intents) Remove added in v0.6.0

func (f Intents) Remove(intents ...Intents) Intents

Remove removes the given intents (discord.Intents)

func (Intents) Toggle added in v0.6.0

func (f Intents) Toggle(intents ...Intents) Intents

Toggle toggles the given intents (discord.Intents)

type Interaction added in v0.6.0

type Interaction struct {
	ID             Snowflake       `json:"id"`
	ApplicationID  Snowflake       `json:"application_id"`
	Type           InteractionType `json:"type"`
	Data           InteractionData `json:"data"`
	GuildID        Snowflake       `json:"guild_id"`
	Channel        Channel         `json:"channel"`
	ChannelID      Snowflake       `json:"channel_id"`
	Member         *Member         `json:"member,omitempty"`
	User           *User           `json:"user,omitempty"`
	Token          string          `json:"token"`
	Version        int             `json:"version"`
	Message        *Message        `json:"message,omitempty"`
	AppPermissions Permissions     `json:"app_permissions"`
	Locale         Locale          `json:"locale"`
	GuildLocale    Locale          `json:"guild_locale"`
}

Interaction represents a generic Discord interaction https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure

func (*Interaction) CreatedAt added in v0.6.0

func (i *Interaction) CreatedAt() time.Time

CreatedAt returns the creation time of the interaction (discord.Interaction)

func (*Interaction) UnmarshalJSON added in v0.6.0

func (i *Interaction) UnmarshalJSON(b []byte) error

type InteractionApplicationCommandData added in v0.6.0

type InteractionApplicationCommandData struct {
	ID       Snowflake                 `json:"id"`
	Name     string                    `json:"name"`
	Type     ApplicationCommandType    `json:"type"`
	Resolved Resolved                  `json:"resolved,omitempty"`
	Options  ApplicationCommandOptions `json:"options,omitempty"`
	GuildID  Snowflake                 `json:"guild_id,omitempty"`
	TargetID Snowflake                 `json:"target_id,omitempty"`
}

InteractionApplicationCommandData represents the data of an application command interaction https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure

func (*InteractionApplicationCommandData) InteractionType added in v0.6.0

InteractionType returns the type of the interaction

type InteractionData added in v0.6.0

type InteractionData interface {
	InteractionType() InteractionType
}

InteractionData represents an interface that is implemented by all interaction data structures below

type InteractionMessageComponentData added in v0.6.0

type InteractionMessageComponentData struct {
	CustomID      string         `json:"custom_id"`
	ComponentType ComponentType  `json:"component_type"`
	Values        []SelectOption `json:"values"`
}

InteractionMessageComponentData represents the data of a message component interaction https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-message-component-data-structure

func (*InteractionMessageComponentData) InteractionType added in v0.6.0

func (d *InteractionMessageComponentData) InteractionType() InteractionType

InteractionType returns the type of the interaction

type InteractionModalSubmitData added in v0.6.0

type InteractionModalSubmitData struct {
	CustomID   string      `json:"custom_id"`
	Components []Component `json:"components"`
}

InteractionModalSubmitData represents the data of a modal submit interaction https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure

func (*InteractionModalSubmitData) InteractionType added in v0.6.0

func (d *InteractionModalSubmitData) InteractionType() InteractionType

InteractionType returns the type of the interaction

func (*InteractionModalSubmitData) UnmarshalJSON added in v0.6.0

func (d *InteractionModalSubmitData) UnmarshalJSON(b []byte) error

type InteractionResponse added in v0.6.0

type InteractionResponse interface {
	Type() InteractionResponseType
}

InteractionResponse represents an interface that is implemented by all interaction response types

type InteractionResponseType added in v0.6.0

type InteractionResponseType int

InteractionResponseType represents the interaction response types https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type

const (
	InteractionResponseTypePong InteractionResponseType = 1 + iota

	InteractionResponseTypeMessage
	InteractionResponseTypeDefer
	InteractionResponseTypeDeferUpdateMessage
	InteractionResponseTypeUpdateMessage
	InteractionResponseTypeAutoCompleteResult
	InteractionResponseTypeModal
)

type InteractionType added in v0.3.0

type InteractionType int

InteractionType represents the type of interaction (discord.Interaction) that has been executed https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type

const (
	InteractionTypePing InteractionType = 1 + iota
	InteractionTypeApplicationCommand
	InteractionTypeMessageComponent
	InteractionTypeApplicationCommandAutocomplete
	InteractionTypeModalSubmit
)

type Invite added in v0.3.0

type Invite struct {
	Code                     string               `json:"code"`
	Guild                    *PartialGuild        `json:"guild,omitempty"`
	Channel                  *Channel             `json:"channel,omitempty"`
	Inviter                  *User                `json:"inviter,omitempty"`
	TargetType               InviteTargetType     `json:"target_type,omitempty"`
	TargetUser               *User                `json:"target_user,omitempty"`
	TargetApplication        *Application         `json:"target_application,omitempty"`
	ApproximatePresenceCount int                  `json:"approximate_presence_count"`
	ApproximateMemberCount   int                  `json:"approximate_member_count"`
	ExpiresAt                *time.Time           `json:"expires_at"`
	GuildScheduledEvent      *GuildScheduledEvent `json:"guild_scheduled_event,omitempty"`
}

Invite represents a code that when used, adds a user to a guild or group DM channel https://discord.com/developers/docs/resources/invite#invite-object-invite-structure

type InviteTargetType added in v0.3.0

type InviteTargetType int

InviteTargetType represents the target type of the invite (discord.Invite) https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types

const (
	InviteTargetTypeStream InviteTargetType = 1 + iota
	InviteTargetTypeEmbeddedApplication
)

type InviteWithMetadata added in v0.3.0

type InviteWithMetadata struct {
	Invite
	Uses      int       `json:"uses"`
	MaxUses   int       `json:"max_uses"`
	MaxAge    int       `json:"max_age"`
	Temporary bool      `json:"temporary"`
	CreatedAt time.Time `json:"created_at"`
}

InviteWithMetadata represents an invite (discord.Invite) with additional metadata https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure

type Locale added in v0.3.0

type Locale string

Locale represents the different locales that are available on Discord https://discord.com/developers/docs/reference#locales

const (
	LocaleIndonesian   Locale = "id"
	LocaleDanish       Locale = "da"
	LocaleGerman       Locale = "de"
	LocaleEnglishGB    Locale = "en-GB"
	LocaleEnglishUS    Locale = "en-US"
	LocaleSpanishES    Locale = "es-ES"
	LocaleFrench       Locale = "fr"
	LocaleCroatian     Locale = "hr"
	LocaleItalian      Locale = "it"
	LocaleLithuanian   Locale = "lt"
	LocaleHungarian    Locale = "hu"
	LocaleDutch        Locale = "nl"
	LocaleNorwegian    Locale = "no"
	LocalePolish       Locale = "pl"
	LocalePortugueseBR Locale = "pt-BR"
	LocaleRomanian     Locale = "ro"
	LocaleFinnish      Locale = "fi"
	LocaleSwedish      Locale = "sv-SE"
	LocaleVietnamese   Locale = "vi"
	LocaleTurkish      Locale = "tr"
	LocaleCzech        Locale = "cs"
	LocaleGreek        Locale = "el"
	LocaleBulgarian    Locale = "bg"
	LocaleRussian      Locale = "ru"
	LocaleUkrainian    Locale = "uk"
	LocaleHindi        Locale = "hi"
	LocaleThai         Locale = "th"
	LocaleChineseCN    Locale = "zh-CN"
	LocaleJapanese     Locale = "ja"
	LocaleChineseTW    Locale = "zh-TW"
	LocaleKorean       Locale = "ko"
	LocaleUnknown      Locale = "" // Not sure if that will ever be the case, nice to have
)

func (Locale) LanguageName added in v0.3.0

func (l Locale) LanguageName() string

LanguageName returns the language name of the locale

func (Locale) NativeName added in v0.3.0

func (l Locale) NativeName() string

NativeName returns the language name of the locale in the language itself

type MFALevel added in v0.3.0

type MFALevel int

MFALevel represents the required MFA level in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-mfa-level

const (
	MFALevelNone MFALevel = iota
	MFALevelElevated
)

type Member added in v0.3.0

type Member struct {
	User                       *User           `json:"user,omitempty"`
	Nick                       string          `json:"nick,omitempty"`
	Avatar                     string          `json:"avatar,omitempty"`
	Roles                      ArraySnowflakes `json:"roles,omitempty"`
	JoinedAt                   time.Time       `json:"joined_at"`
	PremiumSince               *time.Time      `json:"premium_since,omitempty"`
	Deaf                       bool            `json:"deaf"`
	Mute                       bool            `json:"mute"`
	Flags                      MemberFlags     `json:"flags"`
	Pending                    bool            `json:"pending,omitempty"`
	Permissions                Permissions     `json:"permissions,omitempty"`
	CommunicationDisabledUntil *time.Time      `json:"communication_disabled_until,omitempty"`

	// Usually that's set by Centauri
	GuildID Snowflake `json:"guild_id,omitempty"`
}

Member represents a user (discord.User) that is a member/that has joined a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure

func (*Member) CreatedAt added in v0.5.0

func (m *Member) CreatedAt() time.Time

CreatedAt returns the creation time of the member (discord.Member)

func (*Member) EffectiveAvatarURL added in v0.5.0

func (m *Member) EffectiveAvatarURL(asFormat ImageFormat) string

EffectiveAvatarURL returns the avatar URL specific to the guild (discord.Guild) if set, otherwise the user's default avatar

func (*Member) EffectiveName added in v0.5.0

func (m *Member) EffectiveName() string

EffectiveName returns either the nickname of the member (discord.Member) or the username/global name of the user (discord.User) which is displayed in the client

func (*Member) GuildAvatarURL added in v0.5.0

func (m *Member) GuildAvatarURL(asFormat ImageFormat) string

GuildAvatarURL returns the avatar URL specific to the guild (discord.Guild)

type MemberFlags added in v0.3.0

type MemberFlags uint64

MemberFlags represents the flags of a member (discord.Member) https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-flags

const (
	MemberFlagDidRejoin MemberFlags = 1 << iota
	MemberFlagCompletedOnboarding
	MemberFlagBypassesVerification
	MemberFlagStartedOnboarding
)
const MemberFlagsNone MemberFlags = 0

func ComputeMemberFlags added in v0.6.0

func ComputeMemberFlags(memberFlags ...MemberFlags) MemberFlags

ComputeMemberFlags creates a new member flags structure (discord.MemberFlags) from the given member flags

func (MemberFlags) Add added in v0.5.0

func (f MemberFlags) Add(memberFlags ...MemberFlags) MemberFlags

Add adds the given member flags (discord.MemberFlags)

func (MemberFlags) Has added in v0.5.0

func (f MemberFlags) Has(memberFlags ...MemberFlags) bool

Has checks if all the given member flags (discord.MemberFlags) are set

func (MemberFlags) HasAny added in v0.5.0

func (f MemberFlags) HasAny(memberFlags ...MemberFlags) bool

HasAny checks if any of the given member flags (discord.MemberFlags) is set

func (MemberFlags) HasNot added in v0.5.0

func (f MemberFlags) HasNot(memberFlags ...MemberFlags) bool

HasNot checks if all the given member flags (discord.MemberFlags) are not set

func (MemberFlags) HasNotAny added in v0.5.0

func (f MemberFlags) HasNotAny(memberFlags ...MemberFlags) bool

HasNotAny checks if any of the given member flags (discord.MemberFlags) is not set

func (MemberFlags) Remove added in v0.5.0

func (f MemberFlags) Remove(memberFlags ...MemberFlags) MemberFlags

Remove removes the given member flags (discord.MemberFlags)

func (MemberFlags) Toggle added in v0.5.0

func (f MemberFlags) Toggle(memberFlags ...MemberFlags) MemberFlags

Toggle toggles the given member flags (discord.MemberFlags)

type MembershipState added in v0.3.0

type MembershipState int

MembershipState represents the membership state of a team member (discord.TeamMember) https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum

const (
	MembershipStateInvited MembershipState = 1 + iota
	MembershipStateAccepted
)

type MentionableCommandOption added in v0.3.0

type MentionableCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
}

MentionableCommandOption represents an application command option (discord.ApplicationCommandOption) to pass a mentionable (discord.User & discord.Role)

func (*MentionableCommandOption) MarshalJSON added in v0.3.0

func (o *MentionableCommandOption) MarshalJSON() ([]byte, error)

func (*MentionableCommandOption) Type added in v0.3.0

type Message added in v0.3.0

type Message struct {
	ID                   Snowflake             `json:"id"`
	ChannelID            Snowflake             `json:"channel_id"`
	Author               *User                 `json:"author"`
	Content              string                `json:"content"`
	Timestamp            time.Time             `json:"timestamp"`
	EditedTimestamp      *time.Time            `json:"edited_timestamp,omitempty"`
	TTS                  bool                  `json:"tts"`
	MentionEveryone      bool                  `json:"mention_everyone"`
	Mentions             []User                `json:"mentions"`
	MentionRoles         []Role                `json:"mention_roles"`
	MentionChannels      []Channel             `json:"mention_channels,omitempty"`
	Attachments          []Attachment          `json:"attachments"`
	Embeds               []Embed               `json:"embeds"`
	Reactions            []Reaction            `json:"reactions,omitempty"`
	Nonce                string                `json:"nonce,omitempty"`
	Pinned               bool                  `json:"pinned"`
	WebhookID            Snowflake             `json:"webhook_id,omitempty"`
	Type                 MessageType           `json:"type"`
	Activity             *MessageActivity      `json:"activity,omitempty"`
	Application          *Application          `json:"application,omitempty"`
	ApplicationID        Snowflake             `json:"application_id,omitempty"`
	MessageReference     *MessageReference     `json:"message_reference,omitempty"`
	Flags                MessageFlags          `json:"flags,omitempty"`
	ReferencedMessage    *Message              `json:"referenced_message,omitempty"`
	Interaction          *MessageInteraction   `json:"interaction,omitempty"`
	Thread               *Channel              `json:"thread,omitempty"`
	Components           []Component           `json:"components,omitempty"`
	StickerItems         []StickerItem         `json:"sticker_items,omitempty"`
	Stickers             []Sticker             `json:"stickers,omitempty"`
	Position             int                   `json:"position"`
	RoleSubscriptionData *RoleSubscriptionData `json:"role_subscription_data,omitempty"`
	Resolved             *Resolved             `json:"resolved,omitempty"`

	// Usually that's set by Centauri
	GuildID string `json:"guild_id"`
}

Message represents a message sent in a channel (discord.Channel) within Discord https://discord.com/developers/docs/resources/channel#message-object-message-structure

func (*Message) CreatedAt added in v0.5.0

func (m *Message) CreatedAt() time.Time

CreatedAt returns the creation time of the message (discord.Message)

func (*Message) URL added in v0.5.0

func (m *Message) URL() string

URL returns the URL of the message (discord.Message)

func (*Message) UnmarshalJSON added in v0.3.0

func (m *Message) UnmarshalJSON(b []byte) error

type MessageActivity added in v0.3.0

type MessageActivity struct {
	Type    MessageActivityType `json:"type"`
	PartyID string              `json:"party_id,omitempty"`
}

MessageActivity represents the message activity, sent with Rich Presence-related chat embeds (discord.Embed) https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure

type MessageActivityType added in v0.3.0

type MessageActivityType int

MessageActivityType represents teh type of message activity (discord.MessageActivity)

const (
	MessageActivityTypeJoin MessageActivityType = 1 + iota
	MessageActivityTypeSpectate
	MessageActivityTypeListen
	MessageActivityTypeJoinRequest
)

type MessageFlags added in v0.3.0

type MessageFlags uint64

MessageFlags represents the flags for a message (discord.Message) https://discord.com/developers/docs/resources/channel#message-object-message-flags

const (
	MessageFlagCrossposted MessageFlags = 1 << iota
	MessageFlagIsCrosspost
	MessageFlagSuppressEmbeds
	MessageFlagSourceMessageDeleted
	MessageFlagUrgent
	MessageFlagHasThread
	MessageFlagEphemeral
	MessageFlagLoading
	MessageFlagFailedToMentionSomeRolesInThread

	MessageFlagSuppressNotifications
	MessageFlagIsVoiceMessage
)
const MessageFlagsNone MessageFlags = 0

func ComputeMessageFlags added in v0.6.0

func ComputeMessageFlags(messageFlags ...MessageFlags) MessageFlags

ComputeMessageFlags creates a new message flags structure (discord.MessageFlags) from the given message flags

func (MessageFlags) Add added in v0.5.0

func (f MessageFlags) Add(messageFlags ...MessageFlags) MessageFlags

Add adds the given message flags (discord.MessageFlags) to the current message flags

func (MessageFlags) Has added in v0.5.0

func (f MessageFlags) Has(messageFlags ...MessageFlags) bool

Has checks if all the given message flags (discord.MessageFlags) are set

func (MessageFlags) HasAny added in v0.5.0

func (f MessageFlags) HasAny(messageFlags ...MessageFlags) bool

HasAny checks if any of the given message flags (discord.MessageFlags) is set

func (MessageFlags) HasNot added in v0.5.0

func (f MessageFlags) HasNot(messageFlags ...MessageFlags) bool

HasNot checks if all the given message flags (discord.MessageFlags) are not set

func (MessageFlags) HasNotAny added in v0.5.0

func (f MessageFlags) HasNotAny(messageFlags ...MessageFlags) bool

HasNotAny checks if any of the given message flags (discord.MessageFlags) is not set

func (MessageFlags) Remove added in v0.5.0

func (f MessageFlags) Remove(messageFlags ...MessageFlags) MessageFlags

Remove removes the given message flags (discord.MessageFlags)

func (MessageFlags) Toggle added in v0.5.0

func (f MessageFlags) Toggle(messageFlags ...MessageFlags) MessageFlags

Toggle toggles the given message flags (discord.MessageFlags)

type MessageInteraction added in v0.3.0

type MessageInteraction struct {
	ID     Snowflake       `json:"id"`
	Type   InteractionType `json:"type"`
	Name   string          `json:"name"`
	User   *User           `json:"user"`
	Member *Member         `json:"member,omitempty"`
}

MessageInteraction represents an interaction structure that is sent if the message is a response to an interaction https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure

func (*MessageInteraction) CreatedAt added in v0.5.0

func (i *MessageInteraction) CreatedAt() time.Time

CreatedAt returns the creation time of the message interaction (discord.MessageInteraction)

type MessageInteractionResponse added in v0.6.0

type MessageInteractionResponse struct {
	TTS             bool             `json:"tts"`
	Content         *string          `json:"content,omitempty"`
	Embeds          []Embed          `json:"embeds"`
	AllowedMentions AllowedMentions  `json:"allowed_mentions"`
	Flags           MessageFlags     `json:"flags"`
	Components      []Component      `json:"components"`
	Attachments     []AttachmentSend `json:"attachments,omitempty"`

	Files []File `json:"-"`
}

MessageInteractionResponse represents a response to an interaction (discord.Interaction) with a message https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-messages

func (MessageInteractionResponse) Type added in v0.6.0

Type returns the type of interaction response

type MessageNotificationLevel added in v0.3.0

type MessageNotificationLevel int

MessageNotificationLevel represents the default message notification level in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level

const (
	MessageNotificationLevelAllMessages MessageNotificationLevel = iota
	MessageNotificationLevelOnlyMentions
)

type MessageReference added in v0.3.0

type MessageReference struct {
	MessageID       Snowflake `json:"message_id"`
	ChannelID       Snowflake `json:"channel_id,omitempty"`
	GuildID         Snowflake `json:"guild_id,omitempty"`
	FailIfNotExists bool      `json:"fail_if_not_exists,omitempty"`
}

MessageReference represents the referenced message (discord.Message) during a cross-post, channel follow add, pin, or reply message https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure

type MessageType added in v0.3.0

type MessageType int

MessageType represents the type of message (discord.Message) https://discord.com/developers/docs/resources/channel#message-object-message-types

const (
	MessageTypeDefault MessageType = iota
	MessageTypeRecipientAdd
	MessageTypeRecipientRemove
	MessageTypeCall
	MessageTypeChannelNameChange
	MessageTypeChannelIconChange
	MessageTypeChannelPinnedMessage
	MessageTypeUserJoin
	MessageTypeGuildBoost
	MessageTypeGuildBoostTier1
	MessageTypeGuildBoostTier2
	MessageTypeGuildBoostTier3
	MessageTypeChannelFollowAdd

	MessageTypeGuildDiscoveryDisqualified
	MessageTypeGuildDiscoveryRequalified
	MessageTypeGuildDiscoveryGracePeriodInitialWarning
	MessageTypeGuildDiscoveryGracePeriodFinalWarning
	MessageTypeThreadCreated
	MessageTypeReply
	MessageTypeChatInputCommand
	MessageTypeThreadStarterMessage
	MessageTypeGuildInviteReminder
	MessageTypeContextMenuCommand
	MessageTypeAutoModerationAction
	MessageTypeRoleSubscriptionPurchase
	MessageTypeInteractionPremiumUpsell
	MessageTypeStageStart
	MessageTypeStageEnd
	MessageTypeStageSpeaker

	MessageTypeStageTopic
	MessageTypeGuildApplicationPremiumSubscription
)

type ModalInteractionResponse added in v0.6.0

type ModalInteractionResponse struct {
	CustomID   string      `json:"custom_id"`
	Title      string      `json:"title"`
	Components []TextInput `json:"components"`
}

ModalInteractionResponse represents a response to an interaction (discord.Interaction) with a modal https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal

func (ModalInteractionResponse) Type added in v0.6.0

Type returns the type of interaction response

type ModifyAutoModerationRule added in v0.4.0

type ModifyAutoModerationRule struct {
	Name            *string                        `json:"name,omitempty"`
	EventType       *AutoModerationEventType       `json:"event_type,omitempty"`
	TriggerMetadata *AutoModerationTriggerMetadata `json:"trigger_metadata,omitempty"`
	Actions         []AutoModerationAction         `json:"actions,omitempty"`
	Enabled         *bool                          `json:"enabled,omitempty"`
	ExemptRoles     ArraySnowflakes                `json:"exempt_roles,omitempty"`
	ExemptChannels  ArraySnowflakes                `json:"exempt_channels,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyAutoModerationRule represents the payload to send to Discord to modify an existing auto moderation rule (discord.AutoModerationRule) https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule-json-params

type ModifyChannel added in v0.4.0

type ModifyChannel struct {
	Name                          *string                 `json:"name,omitempty"`
	Type                          *ChannelType            `json:"type,omitempty"`
	Position                      *int                    `json:"position,omitempty"`
	Topic                         *string                 `json:"topic,omitempty"`
	NSFW                          *bool                   `json:"nsfw,omitempty"`
	RateLimitPerUser              *int                    `json:"rate_limit_per_user,omitempty"`
	Bitrate                       *int                    `json:"bitrate,omitempty"`
	UserLimit                     *int                    `json:"user_limit,omitempty"`
	PermissionOverwrites          []Overwrite             `json:"permission_overwrites,omitempty"`
	ParentID                      *Snowflake              `json:"parent_id,omitempty"`
	RTCRegion                     *string                 `json:"rtc_region,omitempty"`
	VideoQualityMode              *VideoQualityMode       `json:"video_quality_mode,omitempty"`
	DefaultAutoArchiveDuration    *int                    `json:"default_auto_archive_duration,omitempty"`
	Flags                         *ChannelFlags           `json:"flags,omitempty"`
	AvailableTags                 []Tag                   `json:"available_tags,omitempty"`
	DefaultReaction               *DefaultReaction        `json:"default_reaction,omitempty"`
	DefaultSortOrder              *DefaultSortOrderType   `json:"default_sort_order,omitempty"`
	DefaultForumLayoutView        *DefaultForumLayoutView `json:"default_forum_layout_view,omitempty"`
	DefaultThreadRateLimitPerUser *int                    `json:"default_thread_rate_limit_per_user,omitempty"`

	// Group DMS only
	Icon *string `json:"icon,omitempty"`

	// Thread only
	Archived            *bool           `json:"archived,omitempty"`
	AutoArchiveDuration *int            `json:"auto_archive_duration,omitempty"`
	Locked              *bool           `json:"locked,omitempty"`
	Invitable           *bool           `json:"invitable,omitempty"`
	AppliedTags         ArraySnowflakes `json:"applied_tags,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyChannel represents the payload to send to Discord to modify an existing channel (discord.Channel) https://discord.com/developers/docs/resources/channel#modify-channel-json-params-group-dm https://discord.com/developers/docs/resources/channel#modify-channel-json-params-guild-channel https://discord.com/developers/docs/resources/channel#modify-channel-json-params-thread

type ModifyCurrentUser added in v0.4.0

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

ModifyCurrentUser represents the payload to send to Discord to modify the current user (discord.User) https://discord.com/developers/docs/resources/user#modify-current-user-json-params

type ModifyCurrentUserVoiceState added in v0.4.0

type ModifyCurrentUserVoiceState struct {
	ChannelID               *Snowflake `json:"channel_id,omitempty"`
	Suppress                *bool      `json:"suppress,omitempty"`
	RequestToSpeakTimestamp *time.Time `json:"request_to_speak_timestamp,omitempty"`
}

ModifyCurrentUserVoiceState represents the payload to send to Discord to modify the voice state of the current user (discord.User) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state-json-params

type ModifyGuild added in v0.4.0

type ModifyGuild struct {
	Name                        *string                   `json:"name,omitempty"`
	Region                      *string                   `json:"region,omitempty"`
	VerificationLevel           *GuildVerificationLevel   `json:"verification_level,omitempty"`
	DefaultMessageNotifications *MessageNotificationLevel `json:"default_message_notifications,omitempty"`
	ExplicitContentFilter       *ExplicitContentFilter    `json:"explicit_content_filter,omitempty"`
	AFKChannelID                *Snowflake                `json:"afk_channel_id,omitempty"`
	AFKTimeout                  *int                      `json:"afk_timeout,omitempty"`
	Icon                        *string                   `json:"icon,omitempty"`
	OwnerID                     *Snowflake                `json:"owner_id,omitempty"`
	Splash                      *string                   `json:"splash,omitempty"`
	DiscoverySplash             *string                   `json:"discovery_splash,omitempty"`
	Banner                      *string                   `json:"banner,omitempty"`
	SystemChannelID             *Snowflake                `json:"system_channel_id,omitempty"`
	SystemChannelFlags          *SystemChannelFlags       `json:"system_channel_flags,omitempty"`
	RulesChannelID              *Snowflake                `json:"rules_channel_id,omitempty"`
	PublicUpdatesChannelID      *Snowflake                `json:"public_updates_channel_id,omitempty"`
	PreferredLocale             *Locale                   `json:"preferred_locale,omitempty"`
	Features                    []GuildFeature            `json:"features,omitempty"`
	Description                 *string                   `json:"description,omitempty"`
	PremiumProgressBarEnabled   *bool                     `json:"premium_progress_bar_enabled,omitempty"`
	SafetyAlertsChannelID       *Snowflake                `json:"safety_alerts_channel_id,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyGuild represents the payload to send to Discord to modify an existing guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-guild-json-params

type ModifyGuildChannelPosition added in v0.4.0

type ModifyGuildChannelPosition struct {
	ID              Snowflake  `json:"id"`
	Position        *int       `json:"position,omitempty"`
	LockPermissions *bool      `json:"lock_permissions,omitempty"`
	ParentID        *Snowflake `json:"parent_id,omitempty"`
}

ModifyGuildChannelPosition represents the payload to send to Discord to modify the position of an existing channel (discord.Channel) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions-json-params

type ModifyGuildEmoji added in v0.4.0

type ModifyGuildEmoji struct {
	Name  *string         `json:"name,omitempty"`
	Roles ArraySnowflakes `json:"roles,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyGuildEmoji represents the payload to send to Discord to modify an existing emoji (discord.Emoji) in a guild (discord.Guild) https://discord.com/developers/docs/resources/emoji#modify-guild-emoji-json-params

type ModifyGuildMFALevel added in v0.4.0

type ModifyGuildMFALevel struct {
	Level MFALevel `json:"level"`

	AuditLogReason string `json:"-"`
}

ModifyGuildMFALevel represents the payload to send to Discord to modify the MFA level for a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level-json-params

type ModifyGuildMember added in v0.4.0

type ModifyGuildMember struct {
	Nick                       *string         `json:"nick,omitempty"`
	Roles                      ArraySnowflakes `json:"roles,omitempty"`
	Deaf                       *bool           `json:"deaf,omitempty"`
	Mute                       *bool           `json:"mute,omitempty"`
	ChannelID                  *Snowflake      `json:"channel_id,omitempty"`
	CommunicationDisabledUntil *time.Time      `json:"communication_disabled_until,omitempty"`
	Flags                      *MemberFlags    `json:"flags,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyGuildMember represents the payload to send to Discord to modify a guild member (discord.Member) https://discord.com/developers/docs/resources/guild#modify-guild-member-json-params

type ModifyGuildRole added in v0.4.0

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

	AuditLogReason string `json:"-"`
}

ModifyGuildRole represents the payload to send to Discord to modify an existing role (discord.Role) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-guild-role-json-params

type ModifyGuildScheduledEvent added in v0.4.0

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

	AuditLogReason string `json:"-"`
}

ModifyGuildScheduledEvent represents the payload to send to Discord to modify an existing scheduled event (discord.GuildScheduledEvent) https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event-json-params

type ModifyGuildSticker added in v0.4.0

type ModifyGuildSticker struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	Tags        *string `json:"tags,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyGuildSticker represents the payload to send to Discord to modify an existing sticker (discord.Sticker) https://discord.com/developers/docs/resources/sticker#modify-guild-sticker-json-params

type ModifyGuildTemplate added in v0.4.0

type ModifyGuildTemplate struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

ModifyGuildTemplate represents the payload to send to Discord to modify an existing a guild template (discord.GuildTemplate) https://discord.com/developers/docs/resources/guild-template#modify-guild-template-json-params

type ModifyGuildWelcomeScreen added in v0.4.0

type ModifyGuildWelcomeScreen struct {
	Enabled         *bool                  `json:"enabled,omitempty"`
	WelcomeChannels []WelcomeScreenChannel `json:"welcome_channels,omitempty"`
	Description     *string                `json:"description,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyGuildWelcomeScreen represents the payload to send to Discord to modify and existing welcome screen (discord.WelcomeScreen) https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen-json-params

type ModifyGuildWidget added in v0.4.0

type ModifyGuildWidget struct {
	Enabled   *bool      `json:"enabled,omitempty"`
	ChannelID *Snowflake `json:"channel_id,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyGuildWidget represents the payload to send to Discord to modify the guild widget (discord.Widget) https://discord.com/developers/docs/resources/guild#guild-widget-settings-object-guild-widget-settings-structure

type ModifyStageInstance added in v0.4.0

type ModifyStageInstance struct {
	Topic        *string                    `json:"topic,omitempty"`
	PrivacyLevel *StageInstancePrivacyLevel `json:"privacy_level,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyStageInstance represents the payload to send to Discord to modify an existing stage instance (discord.StageInstance) https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance-json-params

type ModifyUserVoiceState added in v0.4.0

type ModifyUserVoiceState struct {
	ChannelID *Snowflake `json:"channel_id,omitempty"`
	Suppress  *bool      `json:"suppress,omitempty"`
}

ModifyUserVoiceState represents the payload to send to Discord to modify the voice state of a user (discord.User) in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#modify-user-voice-state-json-params

type ModifyWebhook added in v0.4.0

type ModifyWebhook struct {
	Name      *string    `json:"name,omitempty"`
	Avatar    *string    `json:"avatar,omitempty"`
	ChannelID *Snowflake `json:"channel_id,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyWebhook represents the payload to send to Discord to modify an existing webhook (discord.Webhook) https://discord.com/developers/docs/resources/webhook#modify-webhook-json-params

type ModifyWebhookWithToken added in v0.4.0

type ModifyWebhookWithToken struct {
	Name   *string `json:"name,omitempty"`
	Avatar *string `json:"avatar,omitempty"`

	AuditLogReason string `json:"-"`
}

ModifyWebhookWithToken represents the payload to send to Discord to modify an existing webhook (discord.Webhook) with token only https://discord.com/developers/docs/resources/webhook#modify-webhook-json-params

type NSFWLevel added in v0.3.0

type NSFWLevel int

NSFWLevel represents the NSFW level of a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level

const (
	NSFWLevelDefault NSFWLevel = iota
	NSFWLevelExplicit
	NSFWLevelSafe
	NSFWLevelAgeRestricted
)

type NitroStickerPacks added in v0.3.0

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

NitroStickerPacks represents a list of default stickers (discord.Sticker) available for Nitro subscribers https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs-response-structure

type NumberChoice added in v0.3.0

type NumberChoice struct {
	Name              string            `json:"name"`
	NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
	Value             float64           `json:"value"`
}

NumberChoice is a choice which can be given in a number command option (discord.NumberCommandOption)

type NumberCommandOption added in v0.3.0

type NumberCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
	Choices                  []NumberChoice    `json:"choices,omitempty"`
	MinValue                 float64           `json:"min_value,omitempty"`
	MaxValue                 float64           `json:"max_value,omitempty"`
	Autocomplete             bool              `json:"autocomplete,omitempty"`
}

NumberCommandOption represents an application command option (discord.ApplicationCommandOption) to pass a number

func (*NumberCommandOption) MarshalJSON added in v0.3.0

func (o *NumberCommandOption) MarshalJSON() ([]byte, error)

func (*NumberCommandOption) Type added in v0.3.0

type Onboarding added in v0.3.0

type Onboarding struct {
	GuildID           Snowflake          `json:"guild_id"`
	Prompts           []OnboardingPrompt `json:"prompts"`
	DefaultChannelIDs ArraySnowflakes    `json:"default_channel_ids"`
	Enabled           bool               `json:"enabled"`
}

Onboarding represents the onboarding flow for a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-onboarding-object-guild-onboarding-structure

type OnboardingPrompt added in v0.3.0

type OnboardingPrompt struct {
	ID           Snowflake                `json:"id"`
	Type         OnboardingPromptType     `json:"type"`
	Options      []OnboardingPromptOption `json:"options"`
	Title        string                   `json:"title"`
	SingleSelect bool                     `json:"single_select"`
	Required     bool                     `json:"required"`
	InOnboarding bool                     `json:"in_onboarding"`
}

OnboardingPrompt represents a prompt shown during onboarding (discord.Onboarding) and in customize community https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure

func (*OnboardingPrompt) CreatedAt added in v0.5.0

func (p *OnboardingPrompt) CreatedAt() time.Time

CreatedAt returns the creation time of the onboarding prompt (discord.OnboardingPrompt)

type OnboardingPromptOption added in v0.3.0

type OnboardingPromptOption struct {
	ID          Snowflake       `json:"id"`
	ChannelIDs  ArraySnowflakes `json:"channel_ids"`
	RoleIDs     ArraySnowflakes `json:"role_ids"`
	Emoji       *Emoji          `json:"emoji"`
	Title       string          `json:"title"`
	Description string          `json:"description"`
}

OnboardingPromptOption represents the options available within the prompt (discord.OnboardingPrompt) https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure

func (*OnboardingPromptOption) CreatedAt added in v0.5.0

func (o *OnboardingPromptOption) CreatedAt() time.Time

CreatedAt returns the creation time of the onboarding prompt option (discord.OnboardingPromptOption)

type OnboardingPromptType added in v0.3.0

type OnboardingPromptType int

OnboardingPromptType represents the type of prompt for the onboarding prompt (discord.OnboardingPrompt) https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types

type Overwrite added in v0.3.0

type Overwrite struct {
	ID    Snowflake     `json:"id"`
	Type  OverwriteType `json:"type"`
	Allow Permissions   `json:"allow"`
	Deny  Permissions   `json:"deny"`
}

Overwrite represents explicit permission overwrites for members (discord.Member) and roles (discord.Role) https://discord.com/developers/docs/resources/channel#overwrite-object

type OverwriteType added in v0.3.0

type OverwriteType int

OverwriteType represents the type of overwrite (discord.Overwrite)

const (
	OverwriteTypeRole OverwriteType = iota
	OverwriteTypeMember
)

type PartialGuild added in v0.3.0

type PartialGuild struct {
	ID          Snowflake      `json:"id"`
	Name        string         `json:"name"`
	Icon        string         `json:"icon"`
	Owner       bool           `json:"owner"`
	Permissions Permissions    `json:"permissions"`
	Features    []GuildFeature `json:"features"`
}

PartialGuild represents a guild (discord.Guild) with only a few fields https://discord.com/developers/docs/resources/user#get-current-user-guilds-example-partial-guild

func (*PartialGuild) CreatedAt added in v0.5.0

func (g *PartialGuild) CreatedAt() time.Time

CreatedAt returns the creation time of the partial guild (discord.PartialGuild)

type PartialInvite added in v0.3.0

type PartialInvite struct {
	Code string `json:"code"`
	Uses int    `json:"uses"`
}

PartialInvite represents a partial invite (discord.Invite) - for so-called vanity invites https://discord.com/developers/docs/resources/guild#get-guild-vanity-url-example-partial-invite-object

type Permissions added in v0.4.0

type Permissions uint64

Permissions represents a bitfield of Discord permissions https://discord.com/developers/docs/topics/permissions

const (
	PermissionsCreateInstantInvite Permissions = 1 << iota
	PermissionsKickMembers
	PermissionsBanMembers
	PermissionsAdministrator
	PermissionsManageChannels
	PermissionsManageGuild
	PermissionsAddReactions
	PermissionsViewAuditLog
	PermissionsPrioritySpeaker
	PermissionsStream
	PermissionsViewChannel
	PermissionsSendMessages
	PermissionsSendTTSMessages
	PermissionsManageMessages
	PermissionsEmbedLinks
	PermissionsAttachFiles
	PermissionsReadMessageHistory
	PermissionsMentionEveryone
	PermissionsUseExternalEmojis
	PermissionsViewGuildInsights
	PermissionsConnect
	PermissionsSpeak
	PermissionsMuteMembers
	PermissionsDeafenMembers
	PermissionsMoveMembers
	PermissionsUseVoiceActivityDetection
	PermissionsChangeNickname
	PermissionsManageNicknames
	PermissionsManageRoles
	PermissionsManageWebhooks
	PermissionsManageExpressions
	PermissionsUseApplicationCommands
	PermissionsRequestToSpeak
	PermissionsManageEvents
	PermissionsManageThreads
	PermissionsCreatePublicThreads
	PermissionsCreatePrivateThreads
	PermissionsUseExternalStickers
	PermissionsSendMessagesInThreads
	PermissionsUseEmbeddedActivities
	PermissionsModerateMembers
	PermissionsViewCreatorMonetizationAnalytics
	PermissionsUseSoundboard
	PermissionsCreateExpressions

	PermissionsSendVoiceMessages
)
const PermissionsNone Permissions = 0

func ComputePermissions added in v0.6.0

func ComputePermissions(permissions ...Permissions) Permissions

ComputePermissions creates a new permissions structure (discord.Permissions) from the given permissions

func ParsePermissions added in v0.5.0

func ParsePermissions(permissions string) (Permissions, error)

ParsePermissions parses a string as a permissions bitfield (discord.Permissions)

func (*Permissions) Add added in v0.5.0

func (p *Permissions) Add(permissions ...Permissions) Permissions

Add adds the given permissions (discord.Permissions)

func (*Permissions) Has added in v0.5.0

func (p *Permissions) Has(permissions ...Permissions) bool

Has checks if all the given permissions (discord.Permissions) are set

func (*Permissions) HasAny added in v0.5.0

func (p *Permissions) HasAny(permissions ...Permissions) bool

HasAny checks if any of the given permissions (discord.Permissions) is set

func (*Permissions) HasNot added in v0.5.0

func (p *Permissions) HasNot(permissions ...Permissions) bool

HasNot checks if all the given permissions (discord.Permissions) are not set

func (*Permissions) HasNotAny added in v0.5.0

func (p *Permissions) HasNotAny(permissions ...Permissions) bool

HasNotAny checks if any of the given permissions (discord.Permissions) is not set

func (*Permissions) MarshalJSON added in v0.5.0

func (p *Permissions) MarshalJSON() ([]byte, error)

MarshalJSON will take care to marshal a permissions bitfield (discord.Permissions) to a string

func (*Permissions) Remove added in v0.5.0

func (p *Permissions) Remove(permissions ...Permissions) Permissions

Remove removes the given permissions (discord.Permissions)

func (*Permissions) Toggle added in v0.5.0

func (p *Permissions) Toggle(permissions ...Permissions) Permissions

Toggle toggles the given permissions (discord.Permissions)

func (*Permissions) UnmarshalJSON added in v0.5.0

func (p *Permissions) UnmarshalJSON(b []byte) error

UnmarshalJSON will take care to unmarshal a string to a permissions bitfield (discord.Permissions)

type PremiumTier added in v0.3.0

type PremiumTier int

PremiumTier represents the premium tier, also known as server boost, in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-premium-tier

const (
	PremiumTierNone PremiumTier = iota
	PremiumTier1
	PremiumTier2
	PremiumTier3
)

type PremiumType

type PremiumType int

PremiumType represents the premium type a User has

const (
	PremiumTypeNone PremiumType = iota
	PremiumTypeNitroClassic
	PremiumTypeNitro
	PremiumTypeNitroBasic
)

type PremiumUsageFlags

type PremiumUsageFlags int

PremiumUsageFlags represents a user's usage flags of premium features

const (
	PremiumUsageFlagPremiumDiscriminator PremiumUsageFlags = 1 << iota
	PremiumUsageFlagAnimatedAvatar
	PremiumUsageFlagProfileBanner
)

type PurchasedFlags

type PurchasedFlags int

PurchasedFlags represents a user's purchased state

const (
	PurchasedFlagNitroClassic PurchasedFlags = 1 << iota
	PurchasedFlagNitro
	PurchasedFlagGuildBoost
)

type RateLimitExceeded

type RateLimitExceeded struct {
	Message    string  `json:"message"`
	RetryAfter float64 `json:"retry_after"`
	Global     bool    `json:"global"`
	Code       int     `json:"code,omitempty"`
}

RateLimitExceeded represents content sent by Discord once a rate limit has been exceeded https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-example-exceeded-user-rate-limit-response

type Reaction added in v0.3.0

type Reaction struct {
	Count int   `json:"count"`
	Me    bool  `json:"me"`
	Emoji Emoji `json:"emoji"`
}

Reaction represents a reaction that has been added to a message (discord.Message) https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure

type Resolved added in v0.6.0

type Resolved struct {
	Users       map[Snowflake]User       `json:"users,omitempty"`
	Members     map[Snowflake]Member     `json:"members,omitempty"`
	Roles       map[Snowflake]Role       `json:"roles,omitempty"`
	Channels    map[Snowflake]Channel    `json:"channels,omitempty"`
	Messages    map[Snowflake]Message    `json:"messages,omitempty"`
	Attachments map[Snowflake]Attachment `json:"attachments,omitempty"`
}

Resolved represents the mapped data from Snowflakes to their structures

type Role added in v0.3.0

type Role struct {
	ID           Snowflake   `json:"id"`
	Name         string      `json:"name"`
	Color        int         `json:"color"`
	Hoist        bool        `json:"hoist"`
	Icon         string      `json:"icon,omitempty"`
	UnicodeEmoji string      `json:"unicode_emoji"`
	Position     int         `json:"position"`
	Permissions  Permissions `json:"permissions"`
	Managed      bool        `json:"managed"`
	Mentionable  bool        `json:"mentionable"`
	Tags         *RoleTags   `json:"tags,omitempty"`
	Flags        RoleFlags   `json:"flags,omitempty"`
}

Role represents a set of permissions attached to a group of users https://discord.com/developers/docs/topics/permissions#role-object-role-structure

func (*Role) CreatedAt added in v0.5.0

func (r *Role) CreatedAt() time.Time

CreatedAt returns the creation time of the role (discord.Role)

func (*Role) IconURL added in v0.5.0

func (r *Role) IconURL(asFormat ImageFormat) string

IconURL returns the URL for the role icon

func (*Role) Mention added in v0.6.0

func (r *Role) Mention() string

Mention returns the string to mention the role (discord.Role)

type RoleCommandOption added in v0.3.0

type RoleCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
}

RoleCommandOption represents an application command option (discord.ApplicationCommandOption) to pass a role (discord.Role)

func (*RoleCommandOption) MarshalJSON added in v0.3.0

func (o *RoleCommandOption) MarshalJSON() ([]byte, error)

func (*RoleCommandOption) Type added in v0.3.0

type RoleFlags added in v0.7.0

type RoleFlags int

RoleFlags represents the flags the role (discord.Role) has https://discord.com/developers/docs/topics/permissions#role-object-role-flags

const (
	RoleFlagInPrompt RoleFlags = 1 << iota
)
const RoleFlagNone RoleFlags = 0

func ComputeRoleFlags added in v0.7.0

func ComputeRoleFlags(roleFlags ...RoleFlags) RoleFlags

ComputeRoleFlags creates a new role flags structure (discord.RoleFlags) from the given role flags

func (RoleFlags) Add added in v0.7.0

func (f RoleFlags) Add(roleFlags ...RoleFlags) RoleFlags

Add adds the given role flags (discord.RoleFlags)

func (RoleFlags) Has added in v0.7.0

func (f RoleFlags) Has(roleFlags ...RoleFlags) bool

Has checks if all the given role flags (discord.RoleFlags) are set

func (RoleFlags) HasAny added in v0.7.0

func (f RoleFlags) HasAny(roleFlags ...RoleFlags) bool

HasAny checks if any of the given role flags (discord.RoleFlags) is set

func (RoleFlags) HasNot added in v0.7.0

func (f RoleFlags) HasNot(roleFlags ...RoleFlags) bool

HasNot checks if all the given role flags (discord.RoleFlags) are not set

func (RoleFlags) HasNotAny added in v0.7.0

func (f RoleFlags) HasNotAny(roleFlags ...RoleFlags) bool

HasNotAny checks if any of the given role flags (discord.RoleFlags) is not set

func (RoleFlags) Remove added in v0.7.0

func (f RoleFlags) Remove(roleFlags ...RoleFlags) RoleFlags

Remove removes the given role flags (discord.RoleFlags)

func (RoleFlags) Toggle added in v0.7.0

func (f RoleFlags) Toggle(roleFlags ...RoleFlags) RoleFlags

Toggle toggles the given role flags (discord.RoleFlags)

type RoleSubscriptionData added in v0.3.0

type RoleSubscriptionData struct {
	RoleSubscriptionListingID Snowflake `json:"role_subscription_listing_id"`
	TierName                  string    `json:"tier_name"`
	TotalMonthsSubscribed     int       `json:"total_months_subscribed"`
	IsRenewal                 bool      `json:"is_renewal"`
}

RoleSubscriptionData represents the data of the role subscription purchase or renewal that prompted the message (discord.MessageTypeRoleSubscriptionPurchase) https://discord.com/developers/docs/resources/channel#role-subscription-data-object-role-subscription-data-object-structure

type RoleTags added in v0.3.0

type RoleTags struct {
	BotID                 Snowflake `json:"bot_id"`
	IntegrationID         Snowflake `json:"integration_id"`
	PremiumSubscriber     bool      `json:"premium_subscriber"`
	SubscriptionListingID Snowflake `json:"subscription_listing_id"`
	AvailableForPurchase  bool      `json:"available_for_purchase"`
	GuildConnections      bool      `json:"guild_connections"`
}

RoleTags represents the tags the role (discord.Role) has https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure

type Scope added in v0.5.0

type Scope string

Scope represents the various OAuth 2 scopes available https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes

const (
	ScopeActivitiesRead                        Scope = "activities.read"
	ScopeActivitiesWrite                       Scope = "activities.write"
	ScopeApplicationsBuildsRead                Scope = "applications.builds.read"
	ScopeApplicationsBuildsUpload              Scope = "applications.builds.upload"
	ScopeApplicationsCommands                  Scope = "applications.commands"
	ScopeApplicationsCommandsUpdate            Scope = "applications.commands.update"
	ScopeApplicationsCommandsPermissionsUpdate Scope = "applications.commands.permissions.update"
	ScopeApplicationsEntitlements              Scope = "applications.entitlements"
	ScopeApplicationsStoreUpdate               Scope = "applications.store.update"
	ScopeBot                                   Scope = "bot"
	ScopeConnections                           Scope = "connections"
	ScopeDMChannelsRead                        Scope = "dm_channels.read"
	ScopeEmail                                 Scope = "email"
	ScopeGroupDMJoin                           Scope = "gdm.join"
	ScopeGuilds                                Scope = "guilds"
	ScopeGuildsJoin                            Scope = "guilds.join"
	ScopeGuildsMembersRead                     Scope = "guilds.members.read"
	ScopeIdentify                              Scope = "identify"
	ScopeMessagesRead                          Scope = "messages.read"
	ScopeRelationshipsRead                     Scope = "relationships.read"
	ScopeRoleConnectionsWrite                  Scope = "role_connections.write"
	ScopeRPC                                   Scope = "rpc"
	ScopeRPCActivitiesRead                     Scope = "rpc.activities.write"
	ScopeRPCNotificationsRead                  Scope = "rpc.notifications.read"
	ScopeRPCVoiceRead                          Scope = "rpc.voice.read"
	ScopeRPCVoiceWrite                         Scope = "rpc.voice.write"
	ScopeVoice                                 Scope = "voice"
	ScopeWebhookIncoming                       Scope = "webhook.incoming"
)

type SelectMenu added in v0.3.0

type SelectMenu struct {
	MenuType      SelectMenuType `json:"type"`
	CustomID      string         `json:"custom_id,omitempty"`
	Options       []SelectOption `json:"options,omitempty"`
	ChannelTypes  []ChannelType  `json:"channel_types,omitempty"`
	Placeholder   string         `json:"placeholder,omitempty"`
	DefaultValues []DefaultValue `json:"default_values,omitempty"`
	MinValues     int            `json:"min_values,omitempty"`
	MaxValues     int            `json:"max_values,omitempty"`
	Disabled      bool           `json:"disabled"`
}

SelectMenu represents an interactive components that allow users to select one or more options from a dropdown list in messages https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure

func (*SelectMenu) Type added in v0.3.0

func (c *SelectMenu) Type() ComponentType

type SelectMenuType added in v0.3.0

type SelectMenuType int

SelectMenuType represents the type of select menu (discord.SelectMenu) https://discord.com/developers/docs/interactions/message-components#component-object-component-types

const (
	SelectMenuTypeText SelectMenuType

	SelectMenuTypeUser
	SelectMenuTypeRole
	SelectMenuTypeMentionable
	SelectMenuTypeChannels
)

type SelectOption added in v0.3.0

type SelectOption struct {
	Label       string `json:"label"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
	Emoji       *Emoji `json:"emoji,omitempty"`
	Default     bool   `json:"default"`
}

SelectOption represents the choices a user can choose from https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure

type Snowflake added in v0.5.0

type Snowflake uint64

Snowflake represents a unique ID

func MustParseSnowflake added in v0.5.0

func MustParseSnowflake(snowflake string) Snowflake

MustParseSnowflake parses a string as a snowflake (discord.Snowflake) - must be valid

func ParseSnowflake added in v0.5.0

func ParseSnowflake(snowflake string) (Snowflake, error)

ParseSnowflake parses a string as a snowflake (discord.Snowflake)

func (*Snowflake) CreatedAt added in v0.5.0

func (s *Snowflake) CreatedAt() time.Time

CreatedAt returns the creation time of a snowflake (discord.Snowflake)

func (*Snowflake) MarshalJSON added in v0.5.0

func (s *Snowflake) MarshalJSON() ([]byte, error)

MarshalJSON will take care to marshal a snowflake (discord.Snowflake) to a string

func (*Snowflake) String added in v0.5.0

func (s *Snowflake) String() string

String returns the string representation of a snowflake (discord.Snowflake)

func (*Snowflake) UnmarshalJSON added in v0.5.0

func (s *Snowflake) UnmarshalJSON(b []byte) error

UnmarshalJSON will take care to unmarshal a string to a snowflake (discord.Snowflake)

type StageInstance added in v0.3.0

type StageInstance struct {
	ID                    Snowflake                 `json:"id"`
	GuildID               Snowflake                 `json:"guild_id"`
	ChannelID             Snowflake                 `json:"channel_id"`
	Topic                 string                    `json:"topic"`
	PrivacyLevel          StageInstancePrivacyLevel `json:"privacy_level"`
	DiscoverableDisabled  bool                      `json:"discoverable_disabled"`
	GuildScheduledEventID Snowflake                 `json:"guild_scheduled_event_id"`
}

StageInstance represents a live stage https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure

func (*StageInstance) CreatedAt added in v0.5.0

func (i *StageInstance) CreatedAt() time.Time

CreatedAt returns the creation date of the stage instance (discord.StageInstance)

type StageInstancePrivacyLevel added in v0.3.0

type StageInstancePrivacyLevel int

StageInstancePrivacyLevel represents the privacy level of the stage instance (discord.StageInstance) https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level

const (
	StageInstancePrivacyLevelPublic StageInstancePrivacyLevel = 1 + iota
	StageInstancePrivacyLevelGuildOnly
)

type StartThreadFromMessage added in v0.4.0

type StartThreadFromMessage struct {
	Name                string `json:"name"`
	AutoArchiveDuration *int   `json:"auto_archive_duration,omitempty"`
	RateLimitPerUser    *int   `json:"rate_limit_per_user,omitempty"`

	AuditLogReason string `json:"-"`
}

StartThreadFromMessage represents the payload to send to Discord to start a thread from an existing message (discord.Message) https://discord.com/developers/docs/resources/channel#start-thread-from-message-json-params

type StartThreadInForumChannel added in v0.4.0

type StartThreadInForumChannel struct {
	Name                string             `json:"name"`
	AutoArchiveDuration *int               `json:"auto_archive_duration,omitempty"`
	RateLimitPerUser    *int               `json:"rate_limit_per_user,omitempty"`
	Message             ForumThreadMessage `json:"message"`
	AppliedTags         ArraySnowflakes    `json:"applied_tags,omitempty"`

	AuditLogReason string `json:"-"`
}

StartThreadInForumChannel represents the payload to send to Discord to start a thread in a forum channel (discord.Channel) https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel-jsonform-params

type StartThreadWithoutMessage added in v0.4.0

type StartThreadWithoutMessage struct {
	Name                string      `json:"name"`
	AutoArchiveDuration *int        `json:"auto_archive_duration,omitempty"`
	Type                *ThreadType `json:"thread_type,omitempty"`
	Invitable           *bool       `json:"invitable,omitempty"`
	RateLimitPerUser    *int        `json:"rate_limit_per_user,omitempty"`

	AuditLogReason string `json:"-"`
}

StartThreadWithoutMessage represents the payload to send to Discord to start a thread https://discord.com/developers/docs/resources/channel#start-thread-without-message-json-params

type StatusType added in v0.6.0

type StatusType string

StatusType represents the status of a user https://discord.com/developers/docs/topics/gateway-events#update-presence-status-types

const (
	StatusTypeOnline    StatusType = "online"
	StatusTypeDND       StatusType = "dnd"
	StatusTypeIdle      StatusType = "idle"
	StatusTypeInvisible StatusType = "invisible"
	StatusTypeOffline   StatusType = "offline"
)

type Sticker added in v0.3.0

type Sticker struct {
	ID          Snowflake         `json:"id"`
	PackID      Snowflake         `json:"pack_id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Tags        string            `json:"tags"`
	Type        StickerType       `json:"type"`
	FormatType  StickerFormatType `json:"format_type"`
	Available   bool              `json:"available"`
	GuildID     Snowflake         `json:"guild_id,omitempty"`
	User        *User             `json:"user,omitempty"`
	SortValue   int               `json:"sort_value"`
}

Sticker represents a sticker that can be sent in messages https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure

func (*Sticker) CreatedAt added in v0.5.0

func (s *Sticker) CreatedAt() time.Time

CreatedAt returns the creation date of the sticker (discord.Sticker)

func (*Sticker) URL added in v0.5.0

func (s *Sticker) URL(asFormat ImageFormat) string

URL returns the URL for the sticker (discord.Sticker)

type StickerFormatType added in v0.3.0

type StickerFormatType int

StickerFormatType represents the type of format of the sticker (discord.Sticker) https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types

const (
	StickerFormatTypePNG StickerFormatType = 1 + iota
	StickerFormatTypeAPNG
	StickerFormatTypeLottie
	StickerFormatTypeGIF
)

type StickerItem added in v0.3.0

type StickerItem struct {
	ID         Snowflake         `json:"id"`
	Name       string            `json:"name"`
	FormatType StickerFormatType `json:"format_type"`
}

StickerItem represents a partial sticker (discord.Sticker) https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure

func (*StickerItem) CreatedAt added in v0.5.0

func (i *StickerItem) CreatedAt() time.Time

CreatedAt returns the creation date of the sticker item (discord.StickerItem)

type StickerPack added in v0.3.0

type StickerPack struct {
	ID             Snowflake `json:"id"`
	Stickers       []Sticker `json:"stickers"`
	Name           string    `json:"name"`
	SkuID          Snowflake `json:"sku_id"`
	CoverStickerID Snowflake `json:"cover_sticker_id"`
	Description    string    `json:"description"`
	BannerAssetID  Snowflake `json:"banner_asset_id"`
}

StickerPack represents a pack containing multiple standard stickers (discord.StickerTypeStandard) https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure

func (*StickerPack) BannerURL added in v0.5.0

func (p *StickerPack) BannerURL() string

BannerURL returns the banner URL of the sticker pack (discord.StickerPack)

func (*StickerPack) CreatedAt added in v0.5.0

func (p *StickerPack) CreatedAt() time.Time

CreatedAt returns the creation date of the sticker pack (discord.StickerPack)

type StickerType added in v0.3.0

type StickerType int

StickerType represents the type of sticker (discord.Sticker) https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types

type StringChoice added in v0.3.0

type StringChoice struct {
	Name              string            `json:"name"`
	NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
	Value             string            `json:"value"`
}

StringChoice is a choice which can be given in a string command option (discord.StringCommandOption)

type StringCommandOption added in v0.3.0

type StringCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
	Choices                  []StringChoice    `json:"choices,omitempty"`
	MinLength                *int              `json:"min_length,omitempty"`
	MaxLength                *int              `json:"max_length,omitempty"`
	AutoComplete             bool              `json:"auto_complete,omitempty"`
}

StringCommandOption represents an application command option (discord.ApplicationCommandOption) to pass a string

func (*StringCommandOption) MarshalJSON added in v0.3.0

func (o *StringCommandOption) MarshalJSON() ([]byte, error)

func (*StringCommandOption) Type added in v0.3.0

type SubCommandGroupOption added in v0.3.0

type SubCommandGroupOption struct {
	Name                     string             `json:"name"`
	NameLocalizations        map[Locale]string  `json:"name_localizations,omitempty"`
	Description              string             `json:"description"`
	DescriptionLocalizations map[Locale]string  `json:"description_localizations,omitempty"`
	Required                 bool               `json:"required,omitempty"`
	SubCommands              []SubCommandOption `json:"options,omitempty"`
}

SubCommandGroupOption represents a sub-command group option to an application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups

func (*SubCommandGroupOption) MarshalJSON added in v0.3.0

func (o *SubCommandGroupOption) MarshalJSON() ([]byte, error)

func (*SubCommandGroupOption) Type added in v0.3.0

type SubCommandOption added in v0.3.0

type SubCommandOption struct {
	Name                     string                    `json:"name"`
	NameLocalizations        map[Locale]string         `json:"name_localizations,omitempty"`
	Description              string                    `json:"description"`
	DescriptionLocalizations map[Locale]string         `json:"description_localizations,omitempty"`
	Required                 bool                      `json:"required"`
	Options                  ApplicationCommandOptions `json:"options,omitempty"`
}

SubCommandOption represents a sub-command option to an application command (discord.ApplicationCommand) https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups

func (*SubCommandOption) MarshalJSON added in v0.3.0

func (o *SubCommandOption) MarshalJSON() ([]byte, error)

func (*SubCommandOption) Type added in v0.3.0

type SystemChannelFlags added in v0.3.0

type SystemChannelFlags uint64

SystemChannelFlags represents the channel flags in a guild (discord.Guild) https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags

const (
	SystemChannelFlagsSuppressJoinNotifications SystemChannelFlags = 1 << iota
	SystemChannelFlagsSuppressPremiumSubscriptions
	SystemChannelFlagsSuppressGuildReminderNotification
	SystemChannelFlagsSuppressJoinNotificationReplies
	SystemChannelFlagsSuppressRoleSubscriptionPurchaseNotifications
	SystemChannelFlagsSuppressRoleSubscriptionPurchaseNotificationsReplies
)
const SystemChannelFlagsNone SystemChannelFlags = 0

func ComputeSystemChannelFlags added in v0.6.0

func ComputeSystemChannelFlags(systemChannelFlags ...SystemChannelFlags) SystemChannelFlags

ComputeSystemChannelFlags creates a new system channel flags structure (discord.SystemChannelFlags) from the given channel flags

func (SystemChannelFlags) Add added in v0.5.0

func (f SystemChannelFlags) Add(systemChannelFlags ...SystemChannelFlags) SystemChannelFlags

Add adds the given system channel flags (discord.SystemChannelFlags)

func (SystemChannelFlags) Has added in v0.5.0

func (f SystemChannelFlags) Has(systemChannelFlags ...SystemChannelFlags) bool

Has checks if all the given system channel flags (discord.SystemChannelFlags) are set

func (SystemChannelFlags) HasAny added in v0.5.0

func (f SystemChannelFlags) HasAny(systemChannelFlags ...SystemChannelFlags) bool

HasAny checks if any of the given system channel flags (discord.SystemChannelFlags) is set

func (SystemChannelFlags) HasNot added in v0.5.0

func (f SystemChannelFlags) HasNot(systemChannelFlags ...SystemChannelFlags) bool

HasNot checks if all the given system channel flags (discord.SystemChannelFlags) are set

func (SystemChannelFlags) HasNotAny added in v0.5.0

func (f SystemChannelFlags) HasNotAny(systemChannelFlags ...SystemChannelFlags) bool

HasNotAny checks if any of the given system channel flags (discord.SystemChannelFlags) is not set

func (SystemChannelFlags) Remove added in v0.5.0

func (f SystemChannelFlags) Remove(systemChannelFlags ...SystemChannelFlags) SystemChannelFlags

Remove removes the given system channel flags (discord.SystemChannelFlags)

func (SystemChannelFlags) Toggle added in v0.5.0

func (f SystemChannelFlags) Toggle(systemChannelFlags ...SystemChannelFlags) SystemChannelFlags

Toggle toggles the given system channel flags (discord.SystemChannelFlags)

type Tag added in v0.3.0

type Tag struct {
	ID        Snowflake `json:"id"`
	Name      string    `json:"name"`
	Moderated bool      `json:"moderated"`
	EmojiID   Snowflake `json:"emoji_id,omitempty"`
	EmojiName string    `json:"emoji_name,omitempty"`
}

Tag represents a tag that can be applied to a thread in a forum channel (discord.ChannelTypeGuildForum) https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure

func (*Tag) CreatedAt added in v0.5.0

func (t *Tag) CreatedAt() time.Time

CreatedAt returns the creation time of the tag (discord.Tag)

type Team added in v0.3.0

type Team struct {
	ID          Snowflake    `json:"id"`
	Icon        string       `json:"icon,omitempty"`
	Members     []TeamMember `json:"members"`
	Name        string       `json:"name"`
	OwnerUserID string       `json:"owner_user_id"`
}

Team represents a group of developers on Discord who want to collaborate on applications https://discord.com/developers/docs/topics/teams#data-models-team-object

func (*Team) CreatedAt added in v0.5.0

func (t *Team) CreatedAt() time.Time

CreatedAt returns the creation time of the team (discord.Team)

func (*Team) IconURL added in v0.5.0

func (t *Team) IconURL(asFormat ImageFormat) string

IconURL returns the icon URL of the team (discord.Team)

type TeamMember added in v0.3.0

type TeamMember struct {
	MembershipState MembershipState `json:"membership_state"`
	Permissions     []string        `json:"permissions"`
	TeamID          Snowflake       `json:"team_id"`
	User            *User           `json:"user"`
	Role            TeamRole        `json:"role"`
}

TeamMember represents a member of a Discord team (discord.Team) https://discord.com/developers/docs/topics/teams#data-models-team-member-object

type TeamRole added in v0.7.0

type TeamRole string

TeamRole represents a role member has in a team (discord.Team) https://discord.com/developers/docs/topics/teams#team-member-roles-team-member-role-types

const (
	TeamRoleOwner     TeamRole = ""
	TeamRoleAdmin     TeamRole = "admin"
	TeamRoleDeveloper TeamRole = "developer"
	TeamRoleReadOnly  TeamRole = "read_only"
)

type TextInput added in v0.3.0

type TextInput struct {
	CustomID    string         `json:"custom_id,omitempty"`
	Style       TextInputStyle `json:"style"`
	Label       string         `json:"label"`
	MinLength   int            `json:"min_length,omitempty"`
	MaxLength   int            `json:"max_length,omitempty"`
	Required    bool           `json:"required"`
	Value       string         `json:"value,omitempty"`
	Placeholder string         `json:"placeholder"`
}

TextInput represents an interactive component that render on modals https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure

func (*TextInput) MarshalJSON added in v0.3.0

func (c *TextInput) MarshalJSON() ([]byte, error)

func (*TextInput) Type added in v0.3.0

func (c *TextInput) Type() ComponentType

type TextInputStyle added in v0.3.0

type TextInputStyle int

TextInputStyle represents the style to use for the text input (discord.TextInput) https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles

type ThreadMember added in v0.3.0

type ThreadMember struct {
	ID            Snowflake  `json:"id,omitempty"`
	UserID        Snowflake  `json:"user_id,omitempty"`
	JoinTimestamp *time.Time `json:"join_timestamp"`
	Flags         uint64     `json:"flags"`
	Member        *Member    `json:"member,omitempty"`
}

ThreadMember represents a member that has joined a thread (discord.Channel & discord.ThreadMetadata) https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure

type ThreadMetadata added in v0.3.0

type ThreadMetadata struct {
	Archived            bool       `json:"archived"`
	AutoArchiveDuration int        `json:"auto_archive_duration"`
	ArchiveTimestamp    *time.Time `json:"archive_timestamp"`
	Locked              bool       `json:"locked"`
	Invitable           bool       `json:"invitable,omitempty"`
	CreateTimestamp     time.Time  `json:"create_timestamp,omitempty"`
}

ThreadMetadata represent additional information for thread channels (discord.Channel) https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure

type ThreadType added in v0.4.0

type ThreadType int

ThreadType represents the type of thread https://discord.com/developers/docs/resources/channel#channel-object-channel-types

const (
	ThreadTypePublic ThreadType = 11 + iota
	ThreadTypePrivate
)

type UnavailableGuild added in v0.6.0

type UnavailableGuild struct {
	ID          Snowflake `json:"id"`
	Unavailable bool      `json:"unavailable"`
}

UnavailableGuild represents a guild (discord.Guild) that is currently unavailable https://discord.com/developers/docs/resources/guild#unavailable-guild-object

func (*UnavailableGuild) CreatedAt added in v0.6.0

func (g *UnavailableGuild) CreatedAt() time.Time

CreatedAt returns the creation time of the unavailable guild (discord.UnavailableGuild)

type UnidentifiedApplicationCommandOption added in v0.3.0

type UnidentifiedApplicationCommandOption struct {
	Type ApplicationCommandOptionType `json:"type"`
	// contains filtered or unexported fields
}

UnidentifiedApplicationCommandOption represents an application command option (discord.ApplicationCommandOption) that hasn't had its type identified yet

func (*UnidentifiedApplicationCommandOption) UnmarshalJSON added in v0.3.0

func (o *UnidentifiedApplicationCommandOption) UnmarshalJSON(b []byte) error

type UnidentifiedComponent added in v0.3.0

type UnidentifiedComponent struct {
	Type ComponentType `json:"type"`
	// contains filtered or unexported fields
}

UnidentifiedComponent represents a component (discord.Component) that hasn't had its type identified yet

func (*UnidentifiedComponent) UnmarshalJSON added in v0.3.0

func (c *UnidentifiedComponent) UnmarshalJSON(b []byte) error

type User

type User struct {
	ID         Snowflake `json:"id"`
	Username   string    `json:"username"`
	GlobalName string    `json:"global_name,omitempty"`
	Avatar     string    `json:"avatar"`
	// Deprecated: Will return "0" once a user has migrated to the new usernames
	Discriminator string      `json:"discriminator"`
	PublicFlags   UserFlags   `json:"public_flags,omitempty"`
	Flags         UserFlags   `json:"flags,omitempty"`
	Bot           bool        `json:"bot,omitempty"`
	Banner        string      `json:"banner,omitempty"`
	AccentColor   int         `json:"accent_color,omitempty"`
	Locale        Locale      `json:"locale,omitempty"`
	MFAEnabled    bool        `json:"mfa_enabled,omitempty"`
	PremiumType   PremiumType `json:"premium_type,omitempty"`
	Email         string      `json:"email,omitempty"`
	Verified      bool        `json:"verified,omitempty"`

	// These are undocumented fields, subject to change
	BannerColor       string            `json:"banner_color,omitempty"`
	DisplayName       string            `json:"display_name,omitempty"`
	AvatarDecoration  string            `json:"avatar_decoration,omitempty"`
	PurchasedFlags    PurchasedFlags    `json:"purchased_flags,omitempty"`
	PremiumUsageFlags PremiumUsageFlags `json:"premium_usage_flags,omitempty"`
	LinkedUsers       []interface{}     `json:"linked_users,omitempty"`
	NSFWAllowed       bool              `json:"nsfw_allowed,omitempty"`
	Biography         string            `json:"bio,omitempty"`
	Phone             string            `json:"phone,omitempty"`
}

User represents a Discord user or a Discord bot https://discord.com/developers/docs/resources/user#user-object-user-structure

func (*User) AvatarURL added in v0.5.0

func (u *User) AvatarURL(asFormat ImageFormat) string

AvatarURL returns the avatar URL of the user (discord.User)

func (*User) BannerURL added in v0.5.0

func (u *User) BannerURL(asFormat ImageFormat) string

BannerURL returns the banner URL of the user (discord.User)

func (*User) CreatedAt added in v0.5.0

func (u *User) CreatedAt() time.Time

CreatedAt returns the creation time of the user (discord.User)

func (*User) DefaultAvatarURL added in v0.5.0

func (u *User) DefaultAvatarURL() string

DefaultAvatarURL returns the default avatar URL of the user (discord.User)

func (*User) EffectiveName added in v0.5.0

func (u *User) EffectiveName() string

EffectiveName returns either the global name or the username of the user (discord.User) which is displayed in the client

func (*User) Mention added in v0.6.0

func (u *User) Mention() string

Mention returns the string to mention the user (discord.User)

type UserCommandOption added in v0.3.0

type UserCommandOption struct {
	Name                     string            `json:"name"`
	NameLocalizations        map[Locale]string `json:"name_localizations,omitempty"`
	Description              string            `json:"description"`
	DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
	Required                 bool              `json:"required,omitempty"`
}

UserCommandOption represents an application command option (discord.ApplicationCommandOption) to pass a user (discord.User)

func (*UserCommandOption) MarshalJSON added in v0.3.0

func (o *UserCommandOption) MarshalJSON() ([]byte, error)

func (*UserCommandOption) Type added in v0.3.0

type UserFlags

type UserFlags uint64

UserFlags are the flags a User may have https://discord.com/developers/docs/resources/user#user-object-user-flags

const (
	UserFlagStaff UserFlags = 1 << iota
	UserFlagPartner
	UserFlagHypeSquadEvents
	UserFlagBugHunterLevel1
	UserFlagMfaSms                // Undocumented
	UserFlagPremiumPromoDismissed // Undocumented
	UserFlagHypeSquadBravery
	UserFlagHypeSquadBrilliance
	UserFlagHypeSquadBalance
	UserFlagEarlyNitroSupporter
	UserFlagTeamPseudoUser
	UserFlagInternalApplication     // Undocumented
	UserFlagSystem                  // Undocumented
	UserFlagHasUnreadUrgentMessages // Undocumented
	UserFlagBugHunterLevel2
	UserFlagUnderageDeleted // Undocumented
	UserFlagVerifiedBot
	UserFlagVerifiedBotDeveloper
	UserFlagCertifiedModerator
	UserFlagBotHttpInteractions
	UserFlagLikelySpammer  // Undocumented
	UserFlagDisablePremium // Undocumented
	UserFlagActiveDeveloper
)
const UserFlagNone UserFlags = 0

func ComputeUserFlags added in v0.6.0

func ComputeUserFlags(userFlags ...UserFlags) UserFlags

ComputeUserFlags creates a new user flags structure (discord.UserFlags) from the given user flags

func (UserFlags) Add added in v0.5.0

func (f UserFlags) Add(userFlags ...UserFlags) UserFlags

Add adds the given user flags (discord.UserFlags)

func (UserFlags) Has added in v0.5.0

func (f UserFlags) Has(userFlags ...UserFlags) bool

Has checks if all the given user flags (discord.UserFlags) are set

func (UserFlags) HasAny added in v0.5.0

func (f UserFlags) HasAny(userFlags ...UserFlags) bool

HasAny checks if any of the given user flags (discord.UserFlags) is set

func (UserFlags) HasNot added in v0.5.0

func (f UserFlags) HasNot(userFlags ...UserFlags) bool

HasNot checks if all the given user flags (discord.UserFlags) are not set

func (UserFlags) HasNotAny added in v0.5.0

func (f UserFlags) HasNotAny(userFlags ...UserFlags) bool

HasNotAny checks if any of the given user flags (discord.UserFlags) is not set

func (UserFlags) Remove added in v0.5.0

func (f UserFlags) Remove(userFlags ...UserFlags) UserFlags

Remove removes the given user flags (discord.UserFlags)

func (UserFlags) Toggle added in v0.5.0

func (f UserFlags) Toggle(userFlags ...UserFlags) UserFlags

Toggle toggles the given user flags (discord.UserFlags)

type VideoQualityMode added in v0.3.0

type VideoQualityMode int

VideoQualityMode represents the camera video quality mode of the voice channel (discord.Channel) https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes

const (
	VideoQualityModeAuto VideoQualityMode = 1 + iota
	VideoQualityModeFull
)

type VoiceRegion added in v0.3.0

type VoiceRegion struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Optimal    bool   `json:"optimal"`
	Deprecated bool   `json:"deprecated"`
	Custom     bool   `json:"custom"`
}

VoiceRegion represents an available voice region https://discord.com/developers/docs/resources/voice#voice-region-object-voice-region-structure

type VoiceState added in v0.6.0

type VoiceState struct {
	GuildID                 Snowflake  `json:"guild_id"`
	ChannelID               Snowflake  `json:"channel_id"`
	UserID                  Snowflake  `json:"user_id"`
	Member                  *Member    `json:"member,omitempty"`
	SessionID               string     `json:"session_id"`
	Deaf                    bool       `json:"deaf"`
	Mute                    bool       `json:"mute"`
	SelfDeaf                bool       `json:"self_deaf"`
	SelfMute                bool       `json:"self_mute"`
	SelfStream              bool       `json:"self_stream"`
	SelfVideo               bool       `json:"self_video"`
	Suppress                bool       `json:"suppress"`
	RequestToSpeakTimestamp *time.Time `json:"request_to_speak_timestamp,omitempty"`
}

VoiceState represents a voice state of a user (discord.User) https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure

type Webhook added in v0.3.0

type Webhook struct {
	ID            Snowflake     `json:"id"`
	Type          WebhookType   `json:"type"`
	GuildID       Snowflake     `json:"guild_id,omitempty"`
	ChannelID     Snowflake     `json:"channel_id"`
	User          *User         `json:"user,omitempty"`
	Name          string        `json:"name"`
	Avatar        string        `json:"avatar"`
	Token         string        `json:"token,omitempty"`
	ApplicationID Snowflake     `json:"application_id"`
	SourceGuild   *PartialGuild `json:"source_guild,omitempty"`
	SourceChannel *Channel      `json:"source_channel,omitempty"`
	URL           string        `json:"url,omitempty"`
}

Webhook represents a low-effort way to post messages to channels (discord.Channel). A bot authentication is not required for using them https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure

func (*Webhook) CreatedAt added in v0.5.0

func (w *Webhook) CreatedAt() time.Time

CreatedAt returns the creation date of the webhook (discord.Webhook)

type WebhookType added in v0.3.0

type WebhookType int

WebhookType represents the type of webhook (discord.Webhook) https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types

const (
	WebhookTypeIncoming WebhookType = 1 + iota
	WebhookTypeChannelFollower
	WebhookTypeApplication
)

type WelcomeScreen added in v0.3.0

type WelcomeScreen struct {
	Description     string                 `json:"description"`
	WelcomeChannels []WelcomeScreenChannel `json:"welcome_channels"`
}

WelcomeScreen represents the welcome screen of a community guild (discord.GuildFeatureCommunity), that is shown to new members https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure

type WelcomeScreenChannel added in v0.3.0

type WelcomeScreenChannel struct {
	ChannelID   Snowflake `json:"channel_id"`
	Description string    `json:"description"`
	EmojiID     Snowflake `json:"emoji_id,omitempty"`
	EmojiName   string    `json:"emoji_name,omitempty"`
}

WelcomeScreenChannel represents a channel shown in the welcome screen https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure

type Widget added in v0.3.0

type Widget struct {
	ID            Snowflake `json:"id"`
	Name          string    `json:"name"`
	InstantInvite string    `json:"instant_invite"`
	Channels      []Channel `json:"channels"`
	Members       []Member  `json:"members"`
	PresenceCount int       `json:"presence_count"`
}

Widget represents the guild's (discord.Guild) widget https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure

type WidgetSetting added in v0.3.0

type WidgetSetting struct {
	Enabled   bool      `json:"enabled"`
	ChannelID Snowflake `json:"channel_id"`
}

WidgetSetting represents the channel (discord.Channel) used and whether the widget (discord.Widget) of the guild (discord.Guild) is enabled https://discord.com/developers/docs/resources/guild#guild-widget-settings-object-guild-widget-settings-structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL