Documentation
¶
Index ¶
- Constants
- func AchievementIconURL(appID, achID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
- func ApplicationAssetURL(appID, assetID Snowflake, format ImageFormat, size ImageSize) string
- func ApplicationCoverURL(appID Snowflake, coverHash string, format ImageFormat, size ImageSize) string
- func ApplicationIconURL(appID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
- func AvatarDecorationURL(asset string, size ImageSize) string
- func BitFieldAdd[T BitField](bitfield T, bitmasks ...T) T
- func BitFieldHas[T BitField](bitfield T, bitmasks ...T) bool
- func BitFieldMissing[T BitField](bitfield T, bitmasks ...T) T
- func BitFieldRemove[T BitField](bitfield T, bitmasks ...T) T
- func DefaultUserAvatarURL(index int) string
- func DownloadFile(url, baseName, dir string) (string, error)
- func EmojiURL(emojiID Snowflake, format ImageFormat, size ImageSize) string
- func GuildBannerURL(guildID Snowflake, bannerHash string, format ImageFormat, size ImageSize) string
- func GuildDiscoverySplashURL(guildID Snowflake, discoverySplashHash string, format ImageFormat, ...) string
- func GuildIconURL(guildID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
- func GuildMemberAvatarURL(guildID, userID Snowflake, avatarHash string, format ImageFormat, ...) string
- func GuildMemberBannerURL(guildID, userID Snowflake, bannerHash string, format ImageFormat, ...) string
- func GuildScheduledEventCoverURL(eventID Snowflake, coverHash string, format ImageFormat, size ImageSize) string
- func GuildSplashURL(guildID Snowflake, splashHash string, format ImageFormat, size ImageSize) string
- func GuildTagBadgeURL(guildID Snowflake, badgeHash string, format ImageFormat, size ImageSize) string
- func RoleIconURL(roleID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
- func StickerPackBannerURL(stickerPackBannerAssetID Snowflake, format ImageFormat, size ImageSize) string
- func StickerURL(stickerID Snowflake, format ImageFormat) string
- func StorePageAssetURL(appID, assetID Snowflake, format ImageFormat, size ImageSize) string
- func TeamIconURL(teamID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
- func UserAvatarURL(userID Snowflake, avatarHash string, format ImageFormat, size ImageSize) string
- func UserBannerURL(userID Snowflake, bannerHash string, format ImageFormat, size ImageSize) string
- func WithCacheManager(cacheManager CacheManager) clientOption
- func WithCompression(enabled bool) clientOption
- func WithHandlerExecutionMode(mode HandlerExecutionMode) clientOption
- func WithIdentifyProperties(props IdentifyProperties) clientOption
- func WithIntents(intents ...GatewayIntent) clientOption
- func WithLogger(logger xlog.Logger) clientOption
- func WithRequesterConfig(config RequesterConfig) clientOption
- func WithShardCount(count int) clientOptiondeprecated
- func WithShardManagerConfig(config ShardManagerConfig) clientOption
- func WithShardsIdentifyRateLimiter(rateLimiter ShardsIdentifyRateLimiter) clientOption
- func WithToken(token string) clientOption
- type ActionRowBuilder
- type ActionRowComponent
- type ActiveThreadsResponse
- type AddMemberOptions
- type AddMemberRoleOptions
- type AfkTimeout
- type AnnouncementChannel
- type Application
- type ApplicationCommand
- type ApplicationCommandBase
- func (a *ApplicationCommandBase) CreatedAt() time.Time
- func (a *ApplicationCommandBase) GetApplicationID() Snowflake
- func (a *ApplicationCommandBase) GetContexts() []InteractionContextType
- func (a *ApplicationCommandBase) GetDefaultMemberPermissions() Permissions
- func (a *ApplicationCommandBase) GetGuildID() Snowflake
- func (a *ApplicationCommandBase) GetID() Snowflake
- func (a *ApplicationCommandBase) GetIntegrationTypes() []ApplicationIntegrationType
- func (a *ApplicationCommandBase) GetName() string
- func (a *ApplicationCommandBase) GetNameLocalizations() map[Locale]string
- func (a *ApplicationCommandBase) GetType() ApplicationCommandType
- func (a *ApplicationCommandBase) GetVersion() Snowflake
- func (a *ApplicationCommandBase) IsNSFW() bool
- type ApplicationCommandHandlerType
- type ApplicationCommandInteractionDataFields
- type ApplicationCommandInteractionFields
- type ApplicationCommandOption
- type ApplicationCommandOptionAttachment
- type ApplicationCommandOptionBool
- type ApplicationCommandOptionChannel
- type ApplicationCommandOptionChoiceFloat
- type ApplicationCommandOptionChoiceInteger
- type ApplicationCommandOptionChoiceString
- type ApplicationCommandOptionFloat
- type ApplicationCommandOptionInteger
- type ApplicationCommandOptionMentionable
- type ApplicationCommandOptionRole
- type ApplicationCommandOptionString
- type ApplicationCommandOptionSubCommand
- type ApplicationCommandOptionSubCommandGroup
- type ApplicationCommandOptionType
- type ApplicationCommandOptionUser
- type ApplicationCommandPermissionsUpdateEvent
- type ApplicationCommandType
- type ApplicationEntryPointCommand
- type ApplicationEventWebhookStatus
- type ApplicationFlags
- type ApplicationInstallParams
- type ApplicationIntegrationType
- type ApplicationIntegrationTypeConfiguration
- type ApplicationIntegrationTypesConfig
- type ApplicationMessageCommand
- type ApplicationUserCommand
- type Attachment
- type AttachmentFlags
- type AudioChannel
- type AudioChannelFields
- type AutoArchiveDuration
- type AutoCompleteInteraction
- type AutoModerationActionExecutionEvent
- type AutoModerationRuleCreateEvent
- type AutoModerationRuleDeleteEvent
- type AutoModerationRuleUpdateEvent
- type AvatarDecorationData
- type Ban
- type BanMemberOptions
- type Base64Image
- type BeginGuildPruneOptions
- type BitField
- type Bitrate
- type BulkBanMembersOptions
- type BulkBanResponse
- type ButtonBuilder
- func (b *ButtonBuilder) Build() *ButtonComponent
- func (b *ButtonBuilder) Disable() *ButtonBuilder
- func (b *ButtonBuilder) Enable() *ButtonBuilder
- func (b *ButtonBuilder) Reset()
- func (b *ButtonBuilder) SetCustomID(customID string) *ButtonBuilder
- func (b *ButtonBuilder) SetDisabled(disabled bool) *ButtonBuilder
- func (b *ButtonBuilder) SetLabel(label string) *ButtonBuilder
- func (b *ButtonBuilder) SetSkuID(skuID Snowflake) *ButtonBuilder
- func (b *ButtonBuilder) SetStyle(style ButtonStyle) *ButtonBuilder
- func (b *ButtonBuilder) SetURL(url string) *ButtonBuilder
- type ButtonComponent
- type ButtonStyle
- type CacheFlags
- type CacheManager
- type CategorizedChannel
- type CategorizedChannelFields
- type CategoryChannel
- type Channel
- type ChannelConstraints
- type ChannelCreateEvent
- type ChannelDeleteEvent
- type ChannelFields
- type ChannelFlags
- type ChannelPinsUpdateEvent
- type ChannelPosition
- type ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) AddChannelType(channelType ChannelType) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) Build() *ChannelSelectMenuComponent
- func (b *ChannelSelectMenuBuilder) Reset()
- func (b *ChannelSelectMenuBuilder) SetChannelTypes(types []ChannelType) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) SetCustomID(customID string) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) SetDisabled(disabled bool) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) SetMaxValues(maxValues int) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) SetMinValues(minValues *int) *ChannelSelectMenuBuilder
- func (b *ChannelSelectMenuBuilder) SetPlaceholder(placeholder string) *ChannelSelectMenuBuilder
- type ChannelSelectMenuComponent
- type ChannelType
- type ChannelUpdateEvent
- type ChatInputCommand
- type ChatInputCommandInteraction
- type ChatInputCommandInteractionData
- type ChatInputCommandResolvedInteractionData
- type ChatInputInteractionCommandOption
- type ChoiceBase
- type ChoiceFieldsFloat
- type ChoiceFieldsInteger
- type ChoiceFieldsString
- type ChoiceOptionBase
- type Client
- func (r Client) AddMember(guildID, userID Snowflake, opts AddMemberOptions) result.Result[FullMember]
- func (r Client) AddMemberRole(guildID, userID, roleID Snowflake, opts AddMemberRoleOptions) result.Void
- func (r Client) AddThreadMember(channelID Snowflake, userID Snowflake) result.Void
- func (r Client) BanMember(guildID, userID Snowflake, opts BanMemberOptions) result.Void
- func (r Client) BeginGuildPrune(guildID Snowflake, opts BeginGuildPruneOptions) result.Result[PruneCount]
- func (r Client) BulkBanMembers(guildID Snowflake, opts BulkBanMembersOptions) result.Result[BulkBanResponse]
- func (r Client) CreateApplicationEmoji(applicationID Snowflake, opts CreateApplicationEmojiOptions) result.Result[Emoji]
- func (r Client) CreateChannel(guildID Snowflake, opts CreateChannelOptions) result.Result[GuildChannel]
- func (r Client) CreateChannelInvite(channelID Snowflake, opts CreateChannelInviteOptions) result.Result[Invite]
- func (r Client) CreateGuildEmoji(guildID Snowflake, opts CreateGuildEmojiOptions) result.Result[Emoji]
- func (r Client) CreateRole(guildID Snowflake, opts CreateRoleOptions) result.Result[Role]
- func (r Client) DeleteApplicationEmoji(applicationID, emojiID Snowflake) result.Void
- func (r Client) DeleteChannel(channelID Snowflake, opts DeleteChannelOptions) result.Result[Channel]
- func (r Client) DeleteChannelPermission(channelID Snowflake, overwriteID Snowflake, ...) result.Void
- func (r Client) DeleteGuildEmoji(guildID, emojiID Snowflake, reason string) result.Void
- func (r Client) DeleteGuildIntegration(guildID, integrationID Snowflake, opts DeleteGuildIntegrationOptions) result.Void
- func (r Client) DeleteInvite(code string, opts DeleteInviteOptions) result.Result[Invite]
- func (r Client) DeleteRole(guildID, roleID Snowflake, opts DeleteRoleOptions) result.Void
- func (r Client) DoRequest(req Request) result.Result[io.ReadCloser]
- func (r Client) EditChannelPermissions(channelID Snowflake, overwriteID Snowflake, opts EditChannelPermissionsOptions) result.Void
- func (r Client) FetchApplicationEmoji(applicationID, emojiID Snowflake) result.Result[Emoji]
- func (r Client) FetchChannel(channelID Snowflake) result.Result[Channel]
- func (r Client) FetchChannelInvites(channelID Snowflake) result.Result[[]FullInvite]
- func (r Client) FetchGatewayBot() result.Result[GatewayBot]
- func (r Client) FetchGuild(guildID Snowflake, opts FetchGuildOptions) result.Result[RestGuild]
- func (r Client) FetchGuildBan(guildID, userID Snowflake) result.Result[optional.Option[Ban]]
- func (r Client) FetchGuildBans(guildID Snowflake, opts FetchGuildBansOptions) result.Result[[]Ban]
- func (r Client) FetchGuildChannels(guildID Snowflake) result.Result[[]GuildChannel]
- func (r Client) FetchGuildEmoji(guildID, emojiID Snowflake) result.Result[Emoji]
- func (r Client) FetchGuildIntegrations(guildID Snowflake) result.Result[[]Integration]
- func (r Client) FetchGuildInvites(guildID Snowflake) result.Result[[]FullInvite]
- func (r Client) FetchGuildOnboarding(guildID Snowflake) result.Result[GuildOnboarding]
- func (r Client) FetchGuildPreview(guildID Snowflake) result.Result[GuildPreview]
- func (r Client) FetchGuildPruneCount(guildID Snowflake, opts FetchGuildPruneCountOptions) result.Result[PruneCount]
- func (r Client) FetchGuildVanityURL(guildID Snowflake) result.Result[PartialInvite]
- func (r Client) FetchGuildVoiceRegions(guildID Snowflake) result.Result[[]VoiceRegion]
- func (r Client) FetchGuildWelcomeScreen(guildID Snowflake) result.Result[GuildWelcomeScreen]
- func (r Client) FetchGuildWidget(guildID Snowflake) result.Result[GuildWidget]
- func (r Client) FetchGuildWidgetImage(guildID Snowflake, opts FetchGuildWidgetImageOptions) string
- func (r Client) FetchGuildWidgetSettings(guildID Snowflake) result.Result[GuildWidgetSettings]
- func (r Client) FetchInvite(code string, opts FetchInviteOptions) result.Result[Invite]
- func (r Client) FetchMember(guildID, userID Snowflake) result.Result[FullMember]
- func (r Client) FetchRole(guildID, roleID Snowflake) result.Result[Role]
- func (r Client) FetchRoles(guildID Snowflake) result.Result[[]Role]
- func (r Client) FetchRolesMemberCount(guildID Snowflake) result.Result[map[Snowflake]int]
- func (r Client) FetchThreadMember(channelID Snowflake, userID Snowflake, opts FetchThreadMemberOptions) result.Result[ThreadMember]
- func (r Client) FollowAnnouncementChannel(channelID Snowflake, opts FollowAnnouncementChannelOptions) result.Result[FollowedChannel]
- func (r Client) GroupDMAddRecipient(channelID Snowflake, userID Snowflake, opts GroupDMAddRecipientOptions) result.Void
- func (r Client) GroupDMRemoveRecipient(channelID Snowflake, userID Snowflake) result.Void
- func (r Client) JoinThread(channelID Snowflake) result.Void
- func (r Client) KickMember(guildID, userID Snowflake, opts KickMemberOptions) result.Void
- func (r Client) LeaveThread(channelID Snowflake) result.Void
- func (r Client) ListActiveGuildThreads(guildID Snowflake) result.Result[ActiveThreadsResponse]
- func (r Client) ListApplicationEmojis(applicationID Snowflake) result.Result[[]Emoji]
- func (r Client) ListGuildEmojis(guildID Snowflake) result.Result[[]Emoji]
- func (r Client) ListJoinedPrivateArchivedThreads(channelID Snowflake, opts ListJoinedPrivateArchivedThreadsOptions) result.Result[ListArchivedThreadsResponse]
- func (r Client) ListMembers(guildID Snowflake) result.Result[[]FullMember]
- func (r Client) ListMembersWithOptions(guildID Snowflake, opts ListMembersOptions) result.Result[[]FullMember]
- func (r Client) ListPrivateArchivedThreads(channelID Snowflake, opts ListArchivedThreadsOptions) result.Result[ListArchivedThreadsResponse]
- func (r Client) ListPublicArchivedThreads(channelID Snowflake, opts ListArchivedThreadsOptions) result.Result[ListArchivedThreadsResponse]
- func (r Client) ListThreadMembers(channelID Snowflake, opts ListThreadMembersOptions) result.Result[[]ThreadMember]
- func (r Client) ModifyApplicationEmoji(applicationID, emojiID Snowflake, opts ModifyApplicationEmojiOptions) result.Result[Emoji]
- func (r Client) ModifyChannelPositions(guildID Snowflake, opts ModifyChannelPositionOptions) result.Void
- func (r Client) ModifyCurrentMember(guildID Snowflake, opts ModifyCurrentMemberOptions) result.Result[FullMember]
- func (r Client) ModifyGroupDMChannel(channelID Snowflake, opts ModifyGroupDMOptions) result.Result[*GroupDMChannel]
- func (r Client) ModifyGuild(guildID Snowflake, opts ModifyGuildOptions) result.Result[Guild]
- func (r Client) ModifyGuildChannel(channelID Snowflake, opts ModifyGuildChannelOptions) result.Result[GuildChannel]
- func (r Client) ModifyGuildEmoji(guildID, emojiID Snowflake, opts ModifyGuildEmojiOptions) result.Result[Emoji]
- func (r Client) ModifyGuildIncidentActions(guildID Snowflake, opts ModifyGuildIncidentActionsOptions) result.Result[GuildIncidentsData]
- func (r Client) ModifyGuildOnboarding(guildID Snowflake, opts ModifyGuildOnboardingOptions) result.Result[GuildOnboarding]
- func (r Client) ModifyGuildThread(channelID Snowflake, opts ModifyGuildThreadOptions) result.Result[*ThreadChannel]
- func (r Client) ModifyGuildWelcomeScreen(guildID Snowflake, opts ModifyGuildWelcomeScreenOptions) result.Result[GuildWelcomeScreen]
- func (r Client) ModifyGuildWidget(guildID Snowflake, opts ModifyGuildWidgetOptions) result.Result[GuildWidgetSettings]
- func (r Client) ModifyMember(guildID, userID Snowflake, opts ModifyMemberOptions) result.Result[FullMember]
- func (r Client) ModifyRole(guildID, roleID Snowflake, opts ModifyRoleOptions) result.Result[Role]
- func (r Client) ModifyRolePositions(guildID Snowflake, opts ModifyRolePositionsOptions) result.Result[[]Role]
- func (d Client) OnApplicationCommandPermissionsUpdate(h func(ApplicationCommandPermissionsUpdateEvent))
- func (d Client) OnAutoModerationActionExecution(h func(AutoModerationActionExecutionEvent))
- func (d Client) OnAutoModerationRuleCreate(h func(AutoModerationRuleCreateEvent))
- func (d Client) OnAutoModerationRuleDelete(h func(AutoModerationRuleDeleteEvent))
- func (d Client) OnAutoModerationRuleUpdate(h func(AutoModerationRuleUpdateEvent))
- func (d Client) OnChannelCreate(h func(ChannelCreateEvent))
- func (d Client) OnChannelDelete(h func(ChannelDeleteEvent))
- func (d Client) OnChannelPinsUpdate(h func(ChannelPinsUpdateEvent))
- func (d Client) OnChannelUpdate(h func(ChannelUpdateEvent))
- func (d Client) OnEntitlementCreate(h func(EntitlementCreateEvent))
- func (d Client) OnEntitlementDelete(h func(EntitlementDeleteEvent))
- func (d Client) OnEntitlementUpdate(h func(EntitlementUpdateEvent))
- func (d Client) OnGuildAuditLogEntryCreate(h func(GuildAuditLogEntryCreateEvent))
- func (d Client) OnGuildBanAdd(h func(GuildBanAddEvent))
- func (d Client) OnGuildBanRemove(h func(GuildBanRemoveEvent))
- func (d Client) OnGuildDelete(h func(GuildDeleteEvent))
- func (d Client) OnGuildEmojisUpdate(h func(GuildEmojisUpdateEvent))
- func (d Client) OnGuildIntegrationsUpdate(h func(GuildIntegrationsUpdateEvent))
- func (d Client) OnGuildMemberAdd(h func(GuildMemberAddEvent))
- func (d Client) OnGuildMemberRemove(h func(GuildMemberRemoveEvent))
- func (d Client) OnGuildMemberUpdate(h func(GuildMemberUpdateEvent))
- func (d Client) OnGuildMembersChunk(h func(GuildMembersChunkEvent))
- func (d Client) OnGuildRoleCreate(h func(GuildRoleCreateEvent))
- func (d Client) OnGuildRoleDelete(h func(GuildRoleDeleteEvent))
- func (d Client) OnGuildRoleUpdate(h func(GuildRoleUpdateEvent))
- func (d Client) OnGuildScheduledEventCreate(h func(GuildScheduledEventCreateEvent))
- func (d Client) OnGuildScheduledEventDelete(h func(GuildScheduledEventDeleteEvent))
- func (d Client) OnGuildScheduledEventUpdate(h func(GuildScheduledEventUpdateEvent))
- func (d Client) OnGuildScheduledEventUserAdd(h func(GuildScheduledEventUserAddEvent))
- func (d Client) OnGuildScheduledEventUserRemove(h func(GuildScheduledEventUserRemoveEvent))
- func (d Client) OnGuildSoundboardSoundCreate(h func(GuildSoundboardSoundCreateEvent))
- func (d Client) OnGuildSoundboardSoundDelete(h func(GuildSoundboardSoundDeleteEvent))
- func (d Client) OnGuildSoundboardSoundUpdate(h func(GuildSoundboardSoundUpdateEvent))
- func (d Client) OnGuildSoundboardSoundsUpdate(h func(GuildSoundboardSoundsUpdateEvent))
- func (d Client) OnGuildStickersUpdate(h func(GuildStickersUpdateEvent))
- func (d Client) OnGuildUpdate(h func(GuildUpdateEvent))
- func (d Client) OnIntegrationCreate(h func(IntegrationCreateEvent))
- func (d Client) OnIntegrationDelete(h func(IntegrationDeleteEvent))
- func (d Client) OnIntegrationUpdate(h func(IntegrationUpdateEvent))
- func (d Client) OnInteractionCreate(h func(InteractionCreateEvent))
- func (d Client) OnInviteCreate(h func(InviteCreateEvent))
- func (d Client) OnInviteDelete(h func(InviteDeleteEvent))
- func (d Client) OnMessageCreate(h func(MessageCreateEvent))
- func (d Client) OnMessageDelete(h func(MessageDeleteEvent))
- func (d Client) OnMessageDeleteBulk(h func(MessageDeleteBulkEvent))
- func (d Client) OnMessagePollVoteAdd(h func(MessagePollVoteAddEvent))
- func (d Client) OnMessagePollVoteRemove(h func(MessagePollVoteRemoveEvent))
- func (d Client) OnMessageReactionAdd(h func(MessageReactionAddEvent))
- func (d Client) OnMessageReactionRemove(h func(MessageReactionRemoveEvent))
- func (d Client) OnMessageReactionRemoveAll(h func(MessageReactionRemoveAllEvent))
- func (d Client) OnMessageReactionRemoveEmoji(h func(MessageReactionRemoveEmojiEvent))
- func (d Client) OnMessageUpdate(h func(MessageDeleteEvent))
- func (d Client) OnPresenceUpdate(h func(PresenceUpdateEvent))
- func (d Client) OnSoundboardSounds(h func(SoundboardSoundsEvent))
- func (d Client) OnStageInstanceCreate(h func(StageInstanceCreateEvent))
- func (d Client) OnStageInstanceDelete(h func(StageInstanceDeleteEvent))
- func (d Client) OnStageInstanceUpdate(h func(StageInstanceUpdateEvent))
- func (d Client) OnSubscriptionCreate(h func(SubscriptionCreateEvent))
- func (d Client) OnSubscriptionDelete(h func(SubscriptionDeleteEvent))
- func (d Client) OnSubscriptionUpdate(h func(SubscriptionUpdateEvent))
- func (d Client) OnThreadCreate(h func(ThreadCreateEvent))
- func (d Client) OnThreadDelete(h func(ThreadDeleteEvent))
- func (d Client) OnThreadListSync(h func(ThreadListSyncEvent))
- func (d Client) OnThreadMemberUpdate(h func(ThreadMemberUpdateEvent))
- func (d Client) OnThreadMembersUpdate(h func(ThreadMembersUpdateEvent))
- func (d Client) OnThreadUpdate(h func(ThreadUpdateEvent))
- func (d Client) OnTypingStart(h func(TypingStartEvent))
- func (d Client) OnUserUpdate(h func(UserUpdateEvent))
- func (d Client) OnVoiceChannelEffectSend(h func(VoiceChannelEffectSendEvent))
- func (d Client) OnVoiceServerUpdate(h func(VoiceServerUpdateEvent))
- func (d Client) OnVoiceStateUpdate(h func(VoiceStateUpdateEvent))
- func (d Client) OnWebhooksUpdate(h func(WebhooksUpdateEvent))
- func (r Client) RemoveMemberRole(guildID, userID, roleID Snowflake, opts RemoveMemberRoleOptions) result.Void
- func (r Client) RemoveThreadMember(channelID Snowflake, userID Snowflake) result.Void
- func (r Client) SearchMembers(guildID Snowflake, opts SearchMembersOptions) result.Result[[]FullMember]
- func (c *Client) Shutdown()
- func (c *Client) Start() error
- func (r Client) StartThreadFromMessage(channelID Snowflake, messageID Snowflake, opts StartThreadFromMessageOptions) result.Result[GuildChannel]
- func (r Client) StartThreadWithoutMessage(channelID Snowflake, opts StartThreadWithoutMessageOptions) result.Result[GuildChannel]
- func (r Client) TriggerTypingIndicator(channelID Snowflake) result.Void
- func (r Client) UnbanMember(guildID, userID Snowflake, opts UnbanMemberOptions) result.Void
- type Collectibles
- type Color
- type Component
- type ComponentFields
- type ComponentInteraction
- type ComponentType
- type ContainerBuilder
- func (b *ContainerBuilder) AddComponent(component ContainerSubComponent) *ContainerBuilder
- func (b *ContainerBuilder) Build() *ContainerComponent
- func (b *ContainerBuilder) Reset()
- func (b *ContainerBuilder) SetAccentColor(color Color) *ContainerBuilder
- func (b *ContainerBuilder) SetComponents(components []ContainerSubComponent) *ContainerBuilder
- func (b *ContainerBuilder) SetID(id int) *ContainerBuilder
- func (b *ContainerBuilder) SetSpoiler(spoiler bool) *ContainerBuilder
- type ContainerComponent
- type ContainerSubComponent
- type CreateApplicationEmojiOptions
- type CreateChannelInviteOptions
- type CreateChannelOptions
- type CreateGuildEmojiOptions
- type CreateRoleOptions
- type DMChannel
- type DMChannelFields
- type DefaultReactionEmoji
- type DefaultShardsRateLimiter
- type DeleteChannelOptions
- type DeleteChannelPermissionOptions
- type DeleteGuildIntegrationOptions
- type DeleteInviteOptions
- type DeleteRoleOptions
- type DescriptionConstraints
- type EditChannelPermissionsOptions
- type Embed
- type EmbedAuthor
- type EmbedBuilder
- func (b *EmbedBuilder) AddBlankField(inline bool) *EmbedBuilder
- func (b *EmbedBuilder) AddField(name, value string, inline bool) *EmbedBuilder
- func (b *EmbedBuilder) Build() Embed
- func (b *EmbedBuilder) RemoveField(i int) *EmbedBuilder
- func (b *EmbedBuilder) Reset()
- func (b *EmbedBuilder) SetAuthor(name, url, iconURL string) *EmbedBuilder
- func (b *EmbedBuilder) SetColor(color Color) *EmbedBuilder
- func (b *EmbedBuilder) SetDescription(desc string) *EmbedBuilder
- func (e *EmbedBuilder) SetFields(fields ...EmbedField) *EmbedBuilder
- func (b *EmbedBuilder) SetFooter(text, iconURL string) *EmbedBuilder
- func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetTimestamp(t time.Time) *EmbedBuilder
- func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder
- func (b *EmbedBuilder) SetURL(url string) *EmbedBuilder
- type EmbedField
- type EmbedFooter
- type EmbedImage
- type EmbedProvider
- type EmbedThumbnail
- type EmbedType
- type EmbedVideo
- type Emoji
- type Entitlement
- type EntitlementCreateEvent
- type EntitlementDeleteEvent
- type EntitlementType
- type EntitlementUpdateEvent
- type ExplicitContentFilterLevel
- type FetchGuildBansOptions
- type FetchGuildOptions
- type FetchGuildPruneCountOptions
- type FetchGuildWidgetImageOptions
- type FetchInviteOptions
- type FetchThreadMemberOptions
- type FileBuilder
- type FileComponent
- type FloatConstraints
- type FollowAnnouncementChannelOptions
- type FollowedChannel
- type ForumChannel
- type ForumChannelFields
- type ForumLayout
- type ForumPostsSortOrder
- type ForumTag
- type FullInvite
- type FullMember
- type GatewayBot
- type GatewayCloseEventCode
- type GatewayGuild
- type GatewayIntent
- type GatewayVoiceState
- type GroupDMAddRecipientOptions
- type GroupDMChannel
- type Guild
- func (g *Guild) BannerURL() string
- func (g *Guild) BannerURLWith(format ImageFormat, size ImageSize) string
- func (g *Guild) CreatedAt() time.Time
- func (g *Guild) DiscoverySplashURL() string
- func (g *Guild) DiscoverySplashURLWith(format ImageFormat, size ImageSize) string
- func (g *Guild) IconURL() string
- func (g *Guild) IconURLWith(format ImageFormat, size ImageSize) string
- func (g *Guild) SplashURL() string
- func (g *Guild) SplashURLWith(format ImageFormat, size ImageSize) string
- type GuildAuditLogEntryCreateEvent
- type GuildBanAddEvent
- type GuildBanRemoveEvent
- type GuildChannel
- type GuildChannelFields
- func (c *GuildChannelFields) GetFlags() ChannelFlags
- func (c *GuildChannelFields) GetGuildID() Snowflake
- func (c *GuildChannelFields) GetName() string
- func (c *GuildChannelFields) GetPermissionOverwrites() []PermissionOverwrite
- func (c *GuildChannelFields) GetPosition() int
- func (c *GuildChannelFields) JumpURL() string
- type GuildCreateEvent
- type GuildDeleteEvent
- type GuildEmojisUpdateEvent
- type GuildFeature
- type GuildIncidentsData
- type GuildIntegrationsUpdateEvent
- type GuildInviteFlags
- type GuildMemberAddEvent
- type GuildMemberRemoveEvent
- type GuildMemberUpdateEvent
- type GuildMembersChunkEvent
- type GuildMessageChannel
- type GuildMessageChannelFields
- type GuildOnboarding
- type GuildPreview
- type GuildRoleCreateEvent
- type GuildRoleDeleteEvent
- type GuildRoleUpdateEvent
- type GuildScheduledEvent
- type GuildScheduledEventCreateEvent
- type GuildScheduledEventDeleteEvent
- type GuildScheduledEventEntityType
- type GuildScheduledEventPrivacyLevel
- type GuildScheduledEventUpdateEvent
- type GuildScheduledEventUserAddEvent
- type GuildScheduledEventUserRemoveEvent
- type GuildSoundboardSoundCreateEvent
- type GuildSoundboardSoundDeleteEvent
- type GuildSoundboardSoundUpdateEvent
- type GuildSoundboardSoundsUpdateEvent
- type GuildStickersUpdateEvent
- type GuildUpdateEvent
- type GuildWelcomeChannel
- type GuildWelcomeScreen
- type GuildWidget
- type GuildWidgetSettings
- type GuildWidgetStyle
- type HandlerExecutionMode
- type IdentifyProperties
- type ImageConfig
- type ImageFormat
- type ImageSize
- type InMemoryCacheManager
- func (c *InMemoryCacheManager) CountChannels() int
- func (c *InMemoryCacheManager) CountGuildChannels(guildID Snowflake) int
- func (c *InMemoryCacheManager) CountGuildMembers(guildID Snowflake) int
- func (c *InMemoryCacheManager) CountGuildRoles(guildID Snowflake) int
- func (c *InMemoryCacheManager) CountGuilds() int
- func (c *InMemoryCacheManager) CountMembers() int
- func (c *InMemoryCacheManager) CountMessages() int
- func (c *InMemoryCacheManager) CountRoles() int
- func (c *InMemoryCacheManager) CountUsers() int
- func (c *InMemoryCacheManager) CountVoiceStates() int
- func (c *InMemoryCacheManager) DelChannel(channelID Snowflake) bool
- func (c *InMemoryCacheManager) DelGuild(guildID Snowflake) bool
- func (c *InMemoryCacheManager) DelGuildChannels(guildID Snowflake) bool
- func (c *InMemoryCacheManager) DelGuildMembers(guildID Snowflake) bool
- func (c *InMemoryCacheManager) DelMember(guildID, userID Snowflake) bool
- func (c *InMemoryCacheManager) DelMessage(messageID Snowflake) bool
- func (c *InMemoryCacheManager) DelRole(guildID, roleID Snowflake) bool
- func (c *InMemoryCacheManager) DelRoles(roleIDs ...Snowflake) bool
- func (c *InMemoryCacheManager) DelUser(userID Snowflake) bool
- func (c *InMemoryCacheManager) DelVoiceState(guildID, userID Snowflake) bool
- func (c *InMemoryCacheManager) Flags() CacheFlags
- func (c *InMemoryCacheManager) GetChannel(channelID Snowflake) optional.Option[Channel]
- func (c *InMemoryCacheManager) GetGuild(guildID Snowflake) optional.Option[Guild]
- func (c *InMemoryCacheManager) GetGuildChannels(guildID Snowflake) optional.Option[map[Snowflake]GuildChannel]
- func (c *InMemoryCacheManager) GetGuildMembers(guildID Snowflake) optional.Option[map[Snowflake]Member]
- func (c *InMemoryCacheManager) GetGuildRoles(guildID Snowflake) optional.Option[map[Snowflake]Role]
- func (c *InMemoryCacheManager) GetGuildVoiceStates(guildID Snowflake) optional.Option[map[Snowflake]VoiceState]
- func (c *InMemoryCacheManager) GetMember(guildID, userID Snowflake) optional.Option[Member]
- func (c *InMemoryCacheManager) GetMessage(messageID Snowflake) optional.Option[Message]
- func (c *InMemoryCacheManager) GetRoles(rolesIDs ...Snowflake) map[Snowflake]Role
- func (c *InMemoryCacheManager) GetUser(userID Snowflake) optional.Option[User]
- func (c *InMemoryCacheManager) GetVoiceState(guildID, userID Snowflake) optional.Option[VoiceState]
- func (c *InMemoryCacheManager) HasChannel(channelID Snowflake) bool
- func (c *InMemoryCacheManager) HasGuild(guildID Snowflake) bool
- func (c *InMemoryCacheManager) HasGuildChannels(guildID Snowflake) bool
- func (c *InMemoryCacheManager) HasGuildMembers(guildID Snowflake) bool
- func (c *InMemoryCacheManager) HasGuildRoles(guildID Snowflake) bool
- func (c *InMemoryCacheManager) HasGuildVoiceStates(guildID Snowflake) bool
- func (c *InMemoryCacheManager) HasMember(guildID, userID Snowflake) bool
- func (c *InMemoryCacheManager) HasMessage(messageID Snowflake) bool
- func (c *InMemoryCacheManager) HasRoles(rolesIDs ...Snowflake) bool
- func (c *InMemoryCacheManager) HasUser(userID Snowflake) bool
- func (c *InMemoryCacheManager) HasVoiceState(guildID, userID Snowflake) bool
- func (c *InMemoryCacheManager) PutChannel(channel Channel)
- func (c *InMemoryCacheManager) PutGuild(guild Guild)
- func (c *InMemoryCacheManager) PutMember(member Member)
- func (c *InMemoryCacheManager) PutMessage(message Message)
- func (c *InMemoryCacheManager) PutRole(role Role)
- func (c *InMemoryCacheManager) PutRoles(roles ...Role)
- func (c *InMemoryCacheManager) PutUser(user User)
- func (c *InMemoryCacheManager) PutVoiceState(voiceState VoiceState)
- func (c *InMemoryCacheManager) SetFlags(flags ...CacheFlags)
- type IntegerConstraints
- type Integration
- type IntegrationAccount
- type IntegrationApplication
- type IntegrationCreateEvent
- type IntegrationDeleteEvent
- type IntegrationExpireBehavior
- type IntegrationUpdateEvent
- type Interaction
- type InteractionContextType
- type InteractionCreateEvent
- type InteractionFields
- type InteractionMetadata
- type InteractionType
- type InteractiveComponent
- type InteractiveComponentFields
- type Invite
- type InviteCreateEvent
- type InviteDeleteEvent
- type InviteMetadata
- type InviteTargetType
- type InviteType
- type KickMemberOptions
- type LabelBuilder
- func (b *LabelBuilder) AddComponent(component LabelSubComponent) *LabelBuilder
- func (b *LabelBuilder) Build() *LabelComponent
- func (b *LabelBuilder) Reset()
- func (b *LabelBuilder) SetComponents(components []LabelSubComponent) *LabelBuilder
- func (b *LabelBuilder) SetDescription(description string) *LabelBuilder
- func (b *LabelBuilder) SetID(id int) *LabelBuilder
- func (b *LabelBuilder) SetLabel(label string) *LabelBuilder
- type LabelComponent
- type LabelSubComponent
- type LayoutComponent
- type ListArchivedThreadsOptions
- type ListArchivedThreadsResponse
- type ListJoinedPrivateArchivedThreadsOptions
- type ListMembersOptions
- type ListThreadMembersOptions
- type Locale
- type MFALevel
- type MediaChannel
- type MediaGalleryBuilder
- func (b *MediaGalleryBuilder) AddItem(item MediaGalleryItem) *MediaGalleryBuilder
- func (b *MediaGalleryBuilder) Build() *MediaGalleryComponent
- func (b *MediaGalleryBuilder) Reset()
- func (b *MediaGalleryBuilder) SetID(id int) *MediaGalleryBuilder
- func (b *MediaGalleryBuilder) SetItems(items []MediaGalleryItem) *MediaGalleryBuilder
- type MediaGalleryComponent
- type MediaGalleryItem
- type Member
- func (m *Member) AvatarDecorationURL() string
- func (m *Member) AvatarDecorationURLWith(size ImageSize) string
- func (m *Member) AvatarURL() string
- func (m *Member) AvatarURLWith(format ImageFormat, size ImageSize) string
- func (m *Member) BannerURL() string
- func (m *Member) BannerURLWith(format ImageFormat, size ImageSize) string
- func (m *Member) CreatedAt() time.Time
- func (m *Member) Mention() string
- func (m *Member) String() string
- type MemberFlags
- type MembershipState
- type MentionChannel
- type MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) Build() *MentionableSelectMenuComponent
- func (b *MentionableSelectMenuBuilder) Reset()
- func (b *MentionableSelectMenuBuilder) SetCustomID(customID string) *MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) SetDisabled(disabled bool) *MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) SetMaxValues(maxValues int) *MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) SetMinValues(minValues *int) *MentionableSelectMenuBuilder
- func (b *MentionableSelectMenuBuilder) SetPlaceholder(placeholder string) *MentionableSelectMenuBuilder
- type MentionableSelectMenuComponent
- type Message
- type MessageActivity
- type MessageActivityType
- type MessageApplication
- type MessageCall
- type MessageChannel
- type MessageChannelFields
- type MessageCommandInteraction
- type MessageCommandInteractionData
- type MessageCommandInteractionDataResolved
- type MessageCreateEvent
- type MessageDeleteBulkEvent
- type MessageDeleteEvent
- type MessageFlags
- type MessageNotificationsLevel
- type MessagePollVoteAddEvent
- type MessagePollVoteRemoveEvent
- type MessageReaction
- type MessageReactionAddEvent
- type MessageReactionRemoveAllEvent
- type MessageReactionRemoveEmojiEvent
- type MessageReactionRemoveEvent
- type MessageReference
- type MessageReferenceType
- type MessageSnapshot
- type MessageType
- type MessageUpdateEvent
- type ModalSubmitInteraction
- type ModifyApplicationEmojiOptions
- type ModifyChannelPositionOptions
- type ModifyCurrentMemberOptions
- type ModifyGroupDMOptions
- type ModifyGuildChannelOptions
- type ModifyGuildEmojiOptions
- type ModifyGuildIncidentActionsOptions
- type ModifyGuildOnboardingOptions
- type ModifyGuildOptions
- type ModifyGuildThreadOptions
- type ModifyGuildWelcomeScreenOptions
- type ModifyGuildWidgetOptions
- type ModifyMemberOptions
- type ModifyRoleOptions
- type ModifyRolePositionsOptions
- type NSFWLevel
- type NamedChannel
- type Nameplate
- type Nonce
- type NsfwChannelFields
- type OAuth2Scope
- type OAuth2User
- type OnboardingMode
- type OnboardingPrompt
- type OnboardingPromptOption
- type OptionBase
- type PartialApplication
- type PartialChannel
- type PartialEmoji
- type PartialGuild
- type PartialInvite
- type PartialMember
- func (m *PartialMember) AvatarURL() string
- func (m *PartialMember) AvatarURLWith(format ImageFormat, size ImageSize) string
- func (m *PartialMember) BannerURL() string
- func (m *PartialMember) BannerURLWith(format ImageFormat, size ImageSize) string
- func (m *PartialMember) CreatedAt() time.Time
- func (m *PartialMember) Mention() string
- func (m *PartialMember) String() string
- type PartialMessage
- type PermissionName
- type PermissionOverwrite
- type PermissionOverwriteType
- type Permissions
- func (p *Permissions) Add(perms ...Permissions)
- func (p Permissions) Has(perms ...Permissions) bool
- func (p Permissions) MarshalJSON() ([]byte, error)
- func (p Permissions) Missing(perms ...Permissions) Permissions
- func (p Permissions) Names() []PermissionName
- func (p *Permissions) Remove(perms ...Permissions)
- func (p *Permissions) UnmarshalJSON(data []byte) error
- type PingInteraction
- type Poll
- type PollAnswer
- type PollAnswerCount
- type PollCreateOptions
- type PollLayoutType
- type PollMedia
- type PollResults
- type PositionedChannel
- type PremiumTier
- type PresenceUpdateEvent
- type PromptType
- type PruneCount
- type ReactionCountDetails
- type ReadyEvent
- type RemoveMemberRoleOptions
- type Request
- type RequesterConfig
- type RequiredBase
- type ResolvedChannel
- type ResolvedMember
- type ResolvedMessageChannel
- type ResolvedThread
- type RestGuild
- type Role
- type RoleColors
- type RoleFlags
- type RolePosition
- type RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) Build() *RoleSelectMenuComponent
- func (b *RoleSelectMenuBuilder) Reset()
- func (b *RoleSelectMenuBuilder) SetCustomID(customID string) *RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) SetDisabled(disabled bool) *RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) SetMaxValues(maxValues int) *RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) SetMinValues(minValues *int) *RoleSelectMenuBuilder
- func (b *RoleSelectMenuBuilder) SetPlaceholder(placeholder string) *RoleSelectMenuBuilder
- type RoleSelectMenuComponent
- type RoleSubscriptionData
- type RoleTags
- type SearchMembersOptions
- type SectionAccessoryComponent
- type SectionBuilder
- func (b *SectionBuilder) AddComponent(component SectionSubComponent) *SectionBuilder
- func (b *SectionBuilder) Build() *SectionComponent
- func (b *SectionBuilder) Reset()
- func (b *SectionBuilder) SetAccessory(accessory SectionAccessoryComponent) *SectionBuilder
- func (b *SectionBuilder) SetComponents(components []SectionSubComponent) *SectionBuilder
- func (b *SectionBuilder) SetID(id int) *SectionBuilder
- type SectionComponent
- type SectionSubComponent
- type SelectDefaultValue
- type SelectDefaultValueType
- type SelectOptionStructure
- type SeparatorBuilder
- func (b *SeparatorBuilder) Build() *SeparatorComponent
- func (b *SeparatorBuilder) Reset()
- func (b *SeparatorBuilder) SetDivider(divider bool) *SeparatorBuilder
- func (b *SeparatorBuilder) SetID(id int) *SeparatorBuilder
- func (b *SeparatorBuilder) SetSpacing(spacing SeperatorComponentSpacing) *SeparatorBuilder
- type SeparatorComponent
- type SeperatorComponentSpacing
- type Shard
- type ShardManager
- type ShardManagerConfig
- type ShardsIdentifyRateLimiter
- type Snowflake
- func (s Snowflake) MarshalJSON() ([]byte, error)
- func (s Snowflake) ProcessID() uint64
- func (s Snowflake) Sequence() uint64
- func (s Snowflake) String() string
- func (s Snowflake) Timestamp() time.Time
- func (s Snowflake) UnSet() bool
- func (s *Snowflake) UnmarshalJSON(buf []byte) error
- func (s Snowflake) WorkerID() uint64
- type SnowflakePairKey
- type SoundBoardSound
- type SoundboardSoundsEvent
- type StageInstance
- type StageInstanceCreateEvent
- type StageInstanceDeleteEvent
- type StageInstanceUpdateEvent
- type StagePrivacyLevel
- type StageVoiceChannel
- type StartThreadFromMessageOptions
- type StartThreadWithoutMessageOptions
- type Sticker
- type StickerFormatType
- type StickerItem
- type StickerPack
- type StickerType
- type StringConstraints
- type StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) AddOption(option SelectOptionStructure) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) Build() *StringSelectMenuComponent
- func (b *StringSelectMenuBuilder) Reset()
- func (b *StringSelectMenuBuilder) SetCustomID(customID string) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) SetDisabled(disabled bool) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) SetMaxValues(maxValues int) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) SetMinValues(minValues *int) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) SetOptions(options []SelectOptionStructure) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) SetPlaceholder(placeholder string) *StringSelectMenuBuilder
- func (b *StringSelectMenuBuilder) SetRequired(required bool) *StringSelectMenuBuilder
- type StringSelectMenuComponent
- type SubscriptionCreateEvent
- type SubscriptionDeleteEvent
- type SubscriptionUpdateEvent
- type SystemChannelFlags
- type Team
- type TeamMember
- type TeamRole
- type TextChannel
- type TextDisplayBuilder
- type TextDisplayComponent
- type TextInputBuilder
- func (b *TextInputBuilder) Build() *TextInputComponent
- func (b *TextInputBuilder) Reset()
- func (b *TextInputBuilder) SetCustomID(customID string) *TextInputBuilder
- func (b *TextInputBuilder) SetMaxLength(maxLength int) *TextInputBuilder
- func (b *TextInputBuilder) SetMinLength(minLength *int) *TextInputBuilder
- func (b *TextInputBuilder) SetPlaceholder(placeholder string) *TextInputBuilder
- func (b *TextInputBuilder) SetRequired(required bool) *TextInputBuilder
- func (b *TextInputBuilder) SetStyle(style TextInputStyle) *TextInputBuilder
- func (b *TextInputBuilder) SetValue(value string) *TextInputBuilder
- type TextInputComponent
- type TextInputStyle
- type ThreadChannel
- type ThreadChannelFields
- type ThreadCreateEvent
- type ThreadDeleteEvent
- type ThreadListSyncEvent
- type ThreadMember
- type ThreadMemberFlags
- type ThreadMemberUpdateEvent
- type ThreadMembersUpdateEvent
- type ThreadMetaData
- type ThreadUpdateEvent
- type ThumbnailBuilder
- func (b *ThumbnailBuilder) Build() *ThumbnailComponent
- func (b *ThumbnailBuilder) Reset()
- func (b *ThumbnailBuilder) SetDescription(description string) *ThumbnailBuilder
- func (b *ThumbnailBuilder) SetID(id int) *ThumbnailBuilder
- func (b *ThumbnailBuilder) SetMedia(media UnfurledMediaItem) *ThumbnailBuilder
- func (b *ThumbnailBuilder) SetSpoiler(spoiler bool) *ThumbnailBuilder
- type ThumbnailComponent
- type TopicChannelFields
- type TypingStartEvent
- type UnbanMemberOptions
- type UnfurledMediaItem
- type UnfurledMediaItemLoadingState
- type UpdateSelfUserOptions
- type User
- func (u *User) AvatarDecorationURL() string
- func (u *User) AvatarDecorationURLWith(size ImageSize) string
- func (u *User) AvatarURL() string
- func (u *User) AvatarURLWith(format ImageFormat, size ImageSize) string
- func (u *User) BannerURL() string
- func (u *User) BannerURLWith(format ImageFormat, size ImageSize) string
- func (u *User) CreatedAt() time.Time
- func (u *User) DefaultAvatarIndex() int
- func (u *User) DisplayName() string
- func (u *User) GuildTagBadgeURL() string
- func (u *User) Mention() string
- func (u *User) Tag() string
- type UserCommandInteraction
- type UserCommandInteractionData
- type UserCommandInteractionDataResolved
- type UserFlags
- type UserPremiumType
- type UserPrimaryGuild
- type UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) Build() *UserSelectMenuComponent
- func (b *UserSelectMenuBuilder) Reset()
- func (b *UserSelectMenuBuilder) SetCustomID(customID string) *UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) SetDisabled(disabled bool) *UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) SetMaxValues(maxValues int) *UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) SetMinValues(minValues *int) *UserSelectMenuBuilder
- func (b *UserSelectMenuBuilder) SetPlaceholder(placeholder string) *UserSelectMenuBuilder
- type UserSelectMenuComponent
- type UserUpdateEvent
- type VerificationLevel
- type VideoQualityModes
- type VoiceChannel
- type VoiceChannelEffectSendEvent
- type VoiceRegion
- type VoiceServerUpdateEvent
- type VoiceState
- type VoiceStateUpdateEvent
- type WebhookEventTypes
- type WebhooksUpdateEvent
Constants ¶
const ( // Indicates if an app uses the Auto Moderation API. // // See: https://discord.com/developers/docs/resources/auto-moderation ApplicationFlagAutoModerationRuleCreateBadge = 1 << (iota + 6) // Intent required for bots in 100 or more servers to receive presence_update events // // See: https://discord.com/developers/docs/events/gateway-events#presence-update ApplicationFlagGatewayPresence // Intent required for bots in under 100 servers to receive presence_update events, // found on the Bot page in your app's settings. // // See: https://discord.com/developers/docs/events/gateway-events#presence-update ApplicationFlagGatewayPresenceLimited // Intent required for bots in 100 or more servers to receive member-related // events like guild_member_add. See the list of member-related events under dwaz.GatewayIntentGuildMembers ApplicationFlagGatewayGuildMembers // Intent required for bots in under 100 servers to receive member-related // events like guild_member_add, found on the Bot page in your app's settings. // See the list of member-related events under dwaz.GatewayIntentGuildMembers ApplicationFlagGatewayGuildMemberLimited // Indicates unusual growth of an app that prevents verification. ApplicationFlagVerificationPendingGuildLimit // Indicates if an app is embedded within the Discord client (currently unavailable publicly). ApplicationFlagEmbedded // Intent required for bots in 100 or more servers to receive message content. // // See: https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ ApplicationFlagGatewayMessageContent // Intent required for bots in under 100 servers to receive message content, found on the Bot page in your app's settings. // // See: https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ ApplicationFlagGatewayMessageContentLimited // Indicates if an app has registered global application commands. // // See: https://discord.com/developers/docs/interactions/application-commands ApplicationFlagApplicationCommandBadge )
const ( // ActionRowMaxComponents is the maximum number of interactive components in an ActionRow. ActionRowMaxComponents = 5 // StringSelectMenuMaxOptions is the maximum number of options in a StringSelectMenu. StringSelectMenuMaxOptions = 25 // SectionMinComponents is the minimum number of components in a Section. SectionMinComponents = 1 // SectionMaxComponents is the maximum number of components in a Section. SectionMaxComponents = 3 // MediaGalleryMinItems is the minimum number of items in a MediaGallery. MediaGalleryMinItems = 1 // MediaGalleryMaxItems is the maximum number of items in a MediaGallery. MediaGalleryMaxItems = 10 )
Component limits as defined by Discord's API.
const ( // ComponentTypeActionRow is a container to display a row of interactive components. // // Style: Layout // Usage: Message ComponentTypeActionRow = 1 + iota // ComponentTypeButton represents a button object. // // Style: Interactive // Usage: Message ComponentTypeButton // ComponentTypeStringSelect is a select menu for picking from defined text options. // // Style: Interactive // Usage: Message, Modal ComponentTypeStringSelect // ComponentTypeTextInput is a text input object. // // Style: Interactive // Usage: Modal ComponentTypeTextInput // ComponentTypeUserSelect is a select menu for users. // // Style: Interactive // Usage: Message ComponentTypeUserSelect // ComponentTypeRoleSelect is a select menu for roles. // // Style: Interactive // Usage: Message ComponentTypeRoleSelect // ComponentTypeMentionableSelect is a select menu for mentionables (users and roles). // // Style: Interactive // Usage: Message ComponentTypeMentionableSelect // ComponentTypeChannelSelect is a select menu for channels. // // Style: Interactive // Usage: Message ComponentTypeChannelSelect // ComponentTypeSection is a container to display text alongside an accessory component. // // Style: Layout // Usage: Message ComponentTypeSection // ComponentTypeTextDisplay is a markdown text display component. // // Style: Content // Usage: Message ComponentTypeTextDisplay // ComponentTypeThumbnail is a small image used as an accessory component. // // Style: Content // Usage: Message ComponentTypeThumbnail // ComponentTypeMediaGallery displays images and other media. // // Style: Content // Usage: Message ComponentTypeMediaGallery // ComponentTypeFile displays an attached file. // // Style: Content // Usage: Message ComponentTypeFile // ComponentTypeSeparator adds vertical padding between other components. // // Style: Layout // Usage: Message ComponentTypeSeparator // ComponentTypeContainer visually groups a set of components. // // Style: Layout // Usage: Message ComponentTypeContainer // ComponentTypeLabel associates a label and description with a component. // // Style: Layout // Usage: Modal ComponentTypeLabel )
const ( ImageBaseURL = "https://cdn.discordapp.com/" MediaBaseURL = "https://media.discordapp.net/" )
Base URLs for Discord CDN and media assets.
const ( LIB_NAME = "dwaz" LIB_VERSION = "0.14.5" )
const ( // EmbedTitleMaxLength is the maximum length for an embed title. EmbedTitleMaxLength = 256 // EmbedDescriptionMaxLength is the maximum length for an embed description. EmbedDescriptionMaxLength = 4096 // EmbedFieldsMaxCount is the maximum number of fields in an embed. EmbedFieldsMaxCount = 25 // EmbedFieldNameMaxLength is the maximum length for an embed field name. EmbedFieldNameMaxLength = 256 // EmbedFieldValueMaxLength is the maximum length for an embed field value. EmbedFieldValueMaxLength = 1024 EmbedFooterTextMaxLength = 2048 // EmbedAuthorNameMaxLength is the maximum length for an embed author name. EmbedAuthorNameMaxLength = 256 // EmbedTotalCharacterLimit is the combined character limit across all embed fields. // This includes title, description, field names, field values, footer text, and author name. EmbedTotalCharacterLimit = 6000 )
Embed field limits as defined by Discord's API.
Reference: https://discord.com/developers/docs/resources/channel#embed-limits
Variables ¶
This section is empty.
Functions ¶
func AchievementIconURL ¶
func AchievementIconURL(appID, achID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
func ApplicationAssetURL ¶
func ApplicationAssetURL(appID, assetID Snowflake, format ImageFormat, size ImageSize) string
func ApplicationCoverURL ¶
func ApplicationCoverURL(appID Snowflake, coverHash string, format ImageFormat, size ImageSize) string
func ApplicationIconURL ¶
func ApplicationIconURL(appID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
func AvatarDecorationURL ¶
func BitFieldAdd ¶
func BitFieldAdd[T BitField](bitfield T, bitmasks ...T) T
BitFieldAdd returns a new bitfield with the specified bitmasks set. Each bitmask corresponds to a flag value that will be added (ORed) into the bitfield.
Example:
var flags uint8 = 0 flags = BitFieldAdd(flags, 1, 4) // sets bit 0 and 2 → flags = 5
func BitFieldHas ¶
BitFieldHas reports whether the given bitfield contains all of the specified bitmasks. It returns true if every bitmask is fully present in the bitfield.
Example:
const ( A uint8 = 1 << iota // 0001 B // 0010 C // 0100 ) var flags = A | C // 0101 BitFieldHas(flags, A) // true BitFieldHas(flags, B) // false BitFieldHas(flags, A, C) // true
func BitFieldMissing ¶
func BitFieldMissing[T BitField](bitfield T, bitmasks ...T) T
BitFieldMissing returns a bitfield containing the subset of bitmasks that are not present in the given bitfield. If all specified bitmasks are already set, it returns zero.
Example:
const ( A uint8 = 1 << iota // 0001 B // 0010 C // 0100 ) var flags = A | C // 0101 BitFieldMissing(flags, A, B, C) // 0010 (B is missing) BitFieldMissing(flags, A) // 0000 (A is present) BitFieldMissing(flags, B, C) // 0010 (only B is missing)
func BitFieldRemove ¶
func BitFieldRemove[T BitField](bitfield T, bitmasks ...T) T
BitFieldRemove returns a new bitfield with the specified bitmasks cleared. Each bitmask corresponds to a flag value that will be removed (AND NOTed) from the bitfield.
Example:
var flags uint8 = 5 // 0101 flags = BitFieldRemove(flags, 1) // clears bit 0 → flags = 4
func DefaultUserAvatarURL ¶
func DownloadFile ¶
DownloadFile downloads a file from the given URL and saves it in the specified directory. The filename is derived from baseName and the Content-Type returned by the server. Returns the full path of the saved file.
func GuildBannerURL ¶
func GuildBannerURL(guildID Snowflake, bannerHash string, format ImageFormat, size ImageSize) string
func GuildDiscoverySplashURL ¶
func GuildDiscoverySplashURL(guildID Snowflake, discoverySplashHash string, format ImageFormat, size ImageSize) string
func GuildIconURL ¶
func GuildIconURL(guildID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
func GuildMemberAvatarURL ¶
func GuildMemberAvatarURL(guildID, userID Snowflake, avatarHash string, format ImageFormat, size ImageSize) string
func GuildMemberBannerURL ¶
func GuildMemberBannerURL(guildID, userID Snowflake, bannerHash string, format ImageFormat, size ImageSize) string
func GuildScheduledEventCoverURL ¶
func GuildScheduledEventCoverURL(eventID Snowflake, coverHash string, format ImageFormat, size ImageSize) string
func GuildSplashURL ¶
func GuildSplashURL(guildID Snowflake, splashHash string, format ImageFormat, size ImageSize) string
func GuildTagBadgeURL ¶
func GuildTagBadgeURL(guildID Snowflake, badgeHash string, format ImageFormat, size ImageSize) string
func RoleIconURL ¶
func RoleIconURL(roleID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
func StickerPackBannerURL ¶
func StickerPackBannerURL(stickerPackBannerAssetID Snowflake, format ImageFormat, size ImageSize) string
func StickerURL ¶
func StickerURL(stickerID Snowflake, format ImageFormat) string
func StorePageAssetURL ¶
func StorePageAssetURL(appID, assetID Snowflake, format ImageFormat, size ImageSize) string
func TeamIconURL ¶
func TeamIconURL(teamID Snowflake, iconHash string, format ImageFormat, size ImageSize) string
func UserAvatarURL ¶
func UserAvatarURL(userID Snowflake, avatarHash string, format ImageFormat, size ImageSize) string
func UserBannerURL ¶
func UserBannerURL(userID Snowflake, bannerHash string, format ImageFormat, size ImageSize) string
func WithCacheManager ¶ added in v0.14.4
func WithCacheManager(cacheManager CacheManager) clientOption
WithCacheManager sets a custom CacheManager implementation for your client.
Usage:
y := dwaz.New(dwaz.WithCacheManager(myCacheManager))
Logs fatal and exits if cacheManager is nil.
func WithCompression ¶ added in v0.15.0
func WithCompression(enabled bool) clientOption
WithCompression enables or disables zlib-stream compression for Gateway connections.
When enabled (default), Gateway messages are compressed, reducing bandwidth by 60-80%.
Usage:
dwaz.New(..., dwaz.WithCompression(false)) // disable compression
Default is true (compression enabled).
func WithHandlerExecutionMode ¶ added in v0.15.0
func WithHandlerExecutionMode(mode HandlerExecutionMode) clientOption
WithHandlerExecutionMode sets the execution mode for event handlers.
Usage:
dwaz.New(..., dwaz.WithHandlerExecutionMode(dwaz.HandlerExecutionAsync))
Default is HandlerExecutionSync (sequential).
func WithIdentifyProperties ¶ added in v0.15.0
func WithIdentifyProperties(props IdentifyProperties) clientOption
WithIdentifyProperties sets custom properties for the Identify payload.
Usage:
dwaz.New(..., dwaz.WithIdentifyProperties(dwaz.IdentifyProperties{
OS: "linux",
Browser: "my-bot",
Device: "my-bot",
}))
func WithIntents ¶
func WithIntents(intents ...GatewayIntent) clientOption
WithIntents sets Gateway intents for the client shards.
Usage:
y := dwaz.New(dwaz.WithIntents(GatewayIntentGuilds, GatewayIntentMessageContent))
Also supports bitwise OR usage:
y := dwaz.New(dwaz.WithIntents(GatewayIntentGuilds | GatewayIntentMessageContent))
func WithLogger ¶
WithLogger sets a custom Logger implementation for your client.
Usage:
y := dwaz.New(dwaz.WithLogger(myLogger))
Logs fatal and exits if logger is nil.
func WithRequesterConfig ¶ added in v0.15.0
func WithRequesterConfig(config RequesterConfig) clientOption
WithRequesterConfig sets the configuration for the HTTP requester. Use this to configure a proxy URL or custom HTTP client.
func WithShardCount
deprecated
added in
v0.15.0
func WithShardCount(count int) clientOption
WithShardCount forces a specific number of shards to be used. If not set (0), the recommended shard count from Discord is used.
Deprecated: Use WithShardManagerConfig for more control over sharding.
func WithShardManagerConfig ¶ added in v0.15.0
func WithShardManagerConfig(config ShardManagerConfig) clientOption
WithShardManagerConfig sets the shard manager configuration.
For sharding (multiple shards in one process):
dwaz.WithShardManagerConfig(dwaz.ShardManagerConfig{TotalShards: 4})
For clustering (specific shards per process):
// Process 1:
dwaz.WithShardManagerConfig(dwaz.ShardManagerConfig{TotalShards: 4, ShardIDs: []int{0, 1}})
// Process 2:
dwaz.WithShardManagerConfig(dwaz.ShardManagerConfig{TotalShards: 4, ShardIDs: []int{2, 3}})
func WithShardsIdentifyRateLimiter ¶
func WithShardsIdentifyRateLimiter(rateLimiter ShardsIdentifyRateLimiter) clientOption
WithShardsIdentifyRateLimiter sets a custom ShardsIdentifyRateLimiter implementation for your client.
Usage:
y := dwaz.New(dwaz.WithShardsIdentifyRateLimiter(myRateLimiter))
Logs fatal and exits if the provided rateLimiter is nil.
func WithToken ¶
func WithToken(token string) clientOption
WithToken sets the bot token for your client.
Usage:
y := dwaz.New(dwaz.WithToken("your_bot_token"))
Notes:
- Logs fatal and exits if token is empty or obviously invalid (< 50 chars).
- Removes "Bot " prefix automatically if provided.
Warning: Never share your bot token publicly.
Types ¶
type ActionRowBuilder ¶ added in v0.14.3
type ActionRowBuilder struct {
// contains filtered or unexported fields
}
ButtonBuilder helps build a ButtonComponent with chainable methods.
func NewActionRowBuilder ¶ added in v0.14.3
func NewActionRowBuilder() *ActionRowBuilder
NewActionRowBuilder creates a new ActionRowBuilder instance.
func (*ActionRowBuilder) AddComponent ¶ added in v0.14.3
func (b *ActionRowBuilder) AddComponent(component InteractiveComponent) *ActionRowBuilder
AddComponent add's a component to the action row components.
func (*ActionRowBuilder) Build ¶ added in v0.14.3
func (b *ActionRowBuilder) Build() *ActionRowComponent
Build returns the final ActionRowComponent.
func (*ActionRowBuilder) Reset ¶ added in v0.15.0
func (b *ActionRowBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*ActionRowBuilder) SetComponent ¶ added in v0.14.3
func (b *ActionRowBuilder) SetComponent(components ...InteractiveComponent) *ActionRowBuilder
SetComponent sets the action row components.
type ActionRowComponent ¶ added in v0.14.0
type ActionRowComponent struct {
ComponentFields
// Components is an array of up to 5 interactive button components or a single select component.
//
// Valid components:
// - ButtonComponent (up to 5)
// - StringSelectMenuComponent (1)
// - UserSelectMenuComponent (1)
// - RoleSelectMenuComponent (1)
// - MentionableSelectMenuComponent (1)
// - ChannelSelectMenuComponent (1)
Components []InteractiveComponent `json:"components"`
}
ActionRowComponent is a top-level layout component that organizes interactive components.
It can contain either up to 5 ButtonComponent instances or a single select component (StringSelectMenuComponent, UserSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, or ChannelSelectMenuComponent). In modals, ActionRowComponent with TextInputComponent is deprecated; use LabelComponent instead.
Note:
- Only one type of component (buttons or a single select) can be included at a time.
Reference: https://discord.com/developers/docs/interactions/message-components#action-row
func (*ActionRowComponent) MarshalJSON ¶ added in v0.14.0
func (c *ActionRowComponent) MarshalJSON() ([]byte, error)
func (*ActionRowComponent) UnmarshalJSON ¶ added in v0.14.0
func (c *ActionRowComponent) UnmarshalJSON(buf []byte) error
type ActiveThreadsResponse ¶ added in v0.15.0
type ActiveThreadsResponse struct {
// Threads is a list of active threads.
//
// Note:
// - Threads are ordered by their id, in descending order.
Threads []ThreadChannel `json:"threads"`
// Members is list of a thread member object for each returned thread the current user has joined.
Members []ThreadMember `json:"members"`
}
ActiveThreadsResponse is the response for listing active threads.
Reference: https://discord.com/developers/docs/resources/guild#list-active-guild-threads
type AddMemberOptions ¶ added in v0.15.0
type AddMemberOptions struct {
// AccessToken is the OAuth2 access token for the user you want to add.
// This must have the guilds.join scope.
AccessToken string `json:"access_token"`
// Nick sets the member's initial nickname in the guild.
//
// Requires the PermissionManageNicknames permission.
Nick string `json:"nick,omitempty"`
// Roles is a list of role IDs to assign to the member initially.
//
// Requires the PermissionManageRoles permission.
Roles []Snowflake `json:"roles,omitempty"`
// Mute sets whether the user is muted in voice channels.
//
// Requires the PermissionMuteMember permission.
Mute bool `json:"mute,omitempty"`
// Deaf sets whether the user is deafened in voice channels.
//
// Requires the PermissionDeafenMembers permission.
Deaf bool `json:"deaf,omitempty"`
}
AddMemberOptions contains parameters for adding a user to a guild.
Requires a valid OAuth2 access token with the guilds.join scope.
type AddMemberRoleOptions ¶ added in v0.15.0
type AddMemberRoleOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
AddMemberRoleOptions contains parameters for adding a role to a member.
type AfkTimeout ¶ added in v0.15.0
type AfkTimeout int
const ( AfkTimeout60 AfkTimeout = 60 AfkTimeout300 AfkTimeout = 300 AfkTimeout900 AfkTimeout = 900 AfkTimeout1800 AfkTimeout = 1800 AfkTimeout3600 AfkTimeout = 3600 )
type AnnouncementChannel ¶
type AnnouncementChannel struct {
GuildChannelFields
CategorizedChannelFields
GuildMessageChannelFields
NsfwChannelFields
TopicChannelFields
}
AnnouncementChannel represents an announcement channel.
func (*AnnouncementChannel) MarshalJSON ¶
func (c *AnnouncementChannel) MarshalJSON() ([]byte, error)
type Application ¶
type Application struct {
// ID is the applications's unique Discord snowflake ID.
ID Snowflake `json:"id"`
// Name is the applications's name.
Name string `json:"name"`
// Icon is the application's icon hash.
//
// Optional:
// - May be empty string if no icon.
Icon string `json:"icon"`
// Description is the description of a application.
Description string `json:"description"`
// RPCOrigins is a List of RPC origin URLs, if RPC is enabled.
RPCOrigins []string `json:"rpc_origins"`
// BotPublic When false, only the app owner can add the app to guilds.
BotPublic bool `json:"bot_public"`
// BotRequireCodeGrant When true, the app's bot will only join upon completion
// of the full OAuth2 code grant flow.
BotRequireCodeGrant bool `json:"bot_require_code_grant"`
// Bot is a partial user object for the bot user associated with the app
//
// Optional.
Bot *User `json:"bot"`
// TermsOfServiceURL is the URL of the app's Terms of Service.
TermsOfServiceURL string `json:"terms_of_service_url"`
// PrivacyPolicyURL is the URL of the app's Privacy Policy.
PrivacyPolicyURL string `json:"privacy_policy_url"`
// Owner is a partial user object for the owner of the app.
//
// Optional.
Owner *User `json:"owner,omitempty"`
// VerifyKey is the Hex encoded key for verification in interactions and the GameSDK's GetTicket.
VerifyKey string `json:"verify_key"`
// Team is the team this app belongs to.
//
// Optional:
// - Will be nil if app do not belong to any team.
Team *Team `json:"team"`
// GuildID is the id of the guild associated with the app. For example, a developer support server.
//
// Optional:
// - Will be equal 0 if no associated guild is set.
GuildID Snowflake `json:"guild_id"`
// Guild is a the partial guild associated with the app. For example, a developer support server.
//
// Optional:
// - Will be equal nil if no associated guild is set.
Guild *Guild `json:"guild"`
// PrimarySkuID If this app is a game sold on Discord, this field will
// be the id of the "Game SKU" that is created, if exists
//
// Optional:
// - Will be equal 0 if this app is not a game sold on discord.
PrimarySkuID Snowflake `json:"primary_sku_id"`
// Slug If this app is a game sold on Discord, this field will be the URL slug that links to the store page.
//
// Optional:
// - Will be empty string if this app is not a game sold on discord.
Slug string `json:"slug"`
// CoverImage is the app's default rich presence invite cover image hash.
//
// Optional:
// - Will be empty string if no cover image is set.
CoverImage string `json:"cover_image"`
// Flags are the app's public flags.
Flags ApplicationFlags `json:"flags"`
// ApproximateGuildCount is the approximate count of guilds the app has been added to.
ApproximateGuildCount optional.Option[int] `json:"approximate_guild_count"`
// ApproximateUserInstallCount is the Approximate count of users that have installed
// the app (authorized with application.commands as a scope).
ApproximateUserInstallCount optional.Option[int] `json:"approximate_user_install_count"`
// ApproximateUserAuthorizationCount is the approximate count of users that have OAuth2 authorizations for the app.
ApproximateUserAuthorizationCount optional.Option[int] `json:"approximate_user_authorization_count"`
// RedirectURIs is an array of redirect URIs for the app.
RedirectURIs []string `json:"redirect_uris"`
// RedirectURIs is an array of redirect URIs for the app.
//
// See: https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction
//
// Optional:
// - Will be empty string if not set.
InteractionsEndpointURL string `json:"interactions_endpoint_url"`
// RoleConnectionsVerificationURL is the role connection verification URL for the app.
//
// Optional:
// - Will be empty string if not set.
RoleConnectionsVerificationURL string `json:"role_connections_verification_url"`
// EventWebhooksURL is the event webhooks URL for the app to receive webhook events
//
// See: https://discord.com/developers/docs/events/webhook-events#preparing-for-events
//
// Optional:
// - Will be empty string if not set.
EventWebhooksURL string `json:"event_webhooks_url"`
// EventWebhooksStatus is the app event webhook status.
EventWebhooksStatus ApplicationEventWebhookStatus `json:"event_webhooks_status"`
// EventWebhooksTypes is a list of Webhook event types the app subscribes to.
EventWebhooksTypes []WebhookEventTypes `json:"event_webhooks_types"`
// Tags is a list of tags describing the content and functionality of the app. Max of 5 tags.
Tags []string `json:"tags"`
// InstallParams are the settings for the app's default in-app authorization link, if enabled.
InstallParams *ApplicationInstallParams `json:"install_params"`
// IntegrationTypesConfig are the default scopes and permissions for each supported installation context.
// Value for each key is an integration type configuration object
IntegrationTypesConfig ApplicationIntegrationTypesConfig `json:"integration_types_config"`
// CustomInstallURL is the default custom authorization URL for the app, if enabled.
CustomInstallURL string `json:"custom_install_url"`
}
Application represent a Discord application object.
Reference: https://discord.com/developers/docs/resources/application#application-object
func (*Application) CoverImageURL ¶
func (a *Application) CoverImageURL() string
CoverImageURL returns the URL to the app's cover image.
If the application has a custom cover image set, it returns the URL to that image, otherwise empty string. By default, it uses PNG format.
Example usage:
url := application.CoverImageURL()
func (*Application) CoverImageURLWith ¶
func (a *Application) CoverImageURLWith(format ImageFormat, size ImageSize) string
CoverImageURLWith returns the URL to the app's cover image, allowing explicit specification of image format and size.
If the app has a custom cover image set, it returns the URL to that image (otherwise empty string) using the provided format and size.
Example usage:
url := team.CoverImageURLWith(ImageFormatWebP, ImageSize512)
func (*Application) IconURL ¶
func (a *Application) IconURL() string
IconURL returns the URL to the app's icon image.
If the application has a custom icon set, it returns the URL to that icon, otherwise empty string. By default, it uses PNG format.
Example usage:
url := application.IconURL()
func (*Application) IconURLWith ¶
func (a *Application) IconURLWith(format ImageFormat, size ImageSize) string
IconURLWith returns the URL to the app's icon image, allowing explicit specification of image format and size.
If the app has a custom icon set, it returns the URL to that icon (otherwise empty string) using the provided format and size.
Example usage:
url := team.IconURLWith(ImageFormatWebP, ImageSize512)
type ApplicationCommand ¶
type ApplicationCommand interface {
GetType() ApplicationCommandType
GetID() Snowflake
GetApplicationID() Snowflake
GetGuildID() Snowflake
GetName() string
GetNameLocalizations() map[Locale]string
GetDefaultMemberPermissions() Permissions
GetVersion() Snowflake
CreatedAt() time.Time
IsNSFW() bool
GetIntegrationTypes() []ApplicationIntegrationType
GetContexts() []InteractionContextType
json.Marshaler
}
ApplicationCommand is the interface representing a Discord application command.
This interface can represent any type of command returned by Discord, including slash commands, user commands, message commands, and primary entry point commands.
Use this interface when you want to handle commands generically without knowing the specific concrete type in advance.
You can convert (assert) it to a specific command type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var myCommand ApplicationCommand
switch cmd := myCommand.(type) {
case *ChatInputCommand:
fmt.Println("Slash command:", cmd.Name)
case *ApplicationUserCommand:
fmt.Println("User command:", cmd.Name)
case *ApplicationMessageCommand:
fmt.Println("Message command:", cmd.Name)
default:
fmt.Println("Other command type:", cmd.GetType())
}
func UnmarshalApplicationCommand ¶
func UnmarshalApplicationCommand(buf []byte) (ApplicationCommand, error)
type ApplicationCommandBase ¶
type ApplicationCommandBase struct {
// Type is the type of the command.
Type ApplicationCommandType `json:"type"`
// ID is the unique ID of the command.
ID Snowflake `json:"id"`
// ApplicationID is the ID of the parent application.
ApplicationID Snowflake `json:"application_id"`
// GuildID is the guild ID of the command, if not global.
GuildID Snowflake `json:"guild_id"`
// Name is the name of the command.
//
// Info:
// - Must be 1-32 characters.
// - For CHAT_INPUT commands, must match the regex ^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$ with unicode flag.
// - For USER and MESSAGE commands, may be mixed case and include spaces.
// - Must use lowercase variants of letters when available.
Name string `json:"name"`
// NameLocalizations is a localization dictionary for the name field.
//
// Info:
// - Keys are available locales.
// - Values follow the same restrictions as Name.
NameLocalizations map[Locale]string `json:"name_localizations"`
// DefaultMemberPermissions is the set of permissions required to use the command.
//
// Info:
// - Represented as a bit set.
// - Set to "0" to disable the command for everyone except admins by default.
DefaultMemberPermissions Permissions `json:"default_member_permissions"`
// DefaultPermission indicates whether the command is enabled by default when the app is added to a guild.
//
// Info:
// - Defaults to true.
// - Deprecated; use DefaultMemberPermissions or Contexts instead.
DefaultPermission bool `json:"default_permission"`
// NSFW indicates whether the command is age-restricted.
//
// Info:
// - Defaults to false.
NSFW bool `json:"nsfw"`
// IntegrationTypes is the list of installation contexts where the command is available.
//
// Info:
// - Only for globally-scoped commands.
// - Defaults to the app's configured contexts.
IntegrationTypes []ApplicationIntegrationType `json:"integration_types"`
// Contexts is the list of interaction contexts where the command can be used.
//
// Info:
// - Only for globally-scoped commands.
Contexts []InteractionContextType `json:"contexts"`
// Version is the autoincrementing version identifier updated during substantial record changes.
Version Snowflake `json:"version"`
}
ApplicationCommandBase contains fields common to all application command types.
Reference: https://discord.com/developers/docs/interactions/application-commands#application-command-object
func (*ApplicationCommandBase) CreatedAt ¶
func (a *ApplicationCommandBase) CreatedAt() time.Time
func (*ApplicationCommandBase) GetApplicationID ¶
func (a *ApplicationCommandBase) GetApplicationID() Snowflake
func (*ApplicationCommandBase) GetContexts ¶
func (a *ApplicationCommandBase) GetContexts() []InteractionContextType
func (*ApplicationCommandBase) GetDefaultMemberPermissions ¶
func (a *ApplicationCommandBase) GetDefaultMemberPermissions() Permissions
func (*ApplicationCommandBase) GetGuildID ¶
func (a *ApplicationCommandBase) GetGuildID() Snowflake
GetGuildID returns the guild ID of the command, if it is guild-specific.
Returns:
- The Snowflake ID of the guild if the command is associated with a guild.
- 0 if the command is global (not tied to a specific guild).
func (*ApplicationCommandBase) GetID ¶
func (a *ApplicationCommandBase) GetID() Snowflake
func (*ApplicationCommandBase) GetIntegrationTypes ¶
func (a *ApplicationCommandBase) GetIntegrationTypes() []ApplicationIntegrationType
func (*ApplicationCommandBase) GetName ¶
func (a *ApplicationCommandBase) GetName() string
func (*ApplicationCommandBase) GetNameLocalizations ¶
func (a *ApplicationCommandBase) GetNameLocalizations() map[Locale]string
func (*ApplicationCommandBase) GetType ¶
func (a *ApplicationCommandBase) GetType() ApplicationCommandType
func (*ApplicationCommandBase) GetVersion ¶
func (a *ApplicationCommandBase) GetVersion() Snowflake
func (*ApplicationCommandBase) IsNSFW ¶
func (a *ApplicationCommandBase) IsNSFW() bool
type ApplicationCommandHandlerType ¶
type ApplicationCommandHandlerType int
ApplicationCommandHandlerType represents the handler type for PRIMARY_ENTRY_POINT commands.
const ( // ApplicationCommandHandlerTypeApp indicates the app handles the interaction using an interaction token. ApplicationCommandHandlerTypeApp ApplicationCommandHandlerType = 1 + iota // ApplicationCommandHandlerTypeDiscord indicates Discord handles the interaction by launching an Activity and sending a follow-up message. ApplicationCommandHandlerTypeDiscord )
func (ApplicationCommandHandlerType) Is ¶
func (t ApplicationCommandHandlerType) Is(handlerType ApplicationCommandHandlerType) bool
Is returns true if the command handler's Type matches the provided one.
type ApplicationCommandInteractionDataFields ¶ added in v0.14.0
type ApplicationCommandInteractionDataFields struct {
// ID is the unique ID of the invoked command.
ID Snowflake `json:"id"`
// Type is the type of the invoked command.
Type ApplicationCommandType `json:"type"`
// Name is the name of the invoked command.
Name string `json:"name"`
// GuildID is the ID of the guild the command is registered to.
//
// Optional:
// - Will be 0 for global commands.
GuildID Snowflake `json:"guild_id"`
}
ApplicationCommandInteractionDataFields holds fields common to all application command interaction data.
type ApplicationCommandInteractionFields ¶ added in v0.14.0
type ApplicationCommandInteractionFields struct {
InteractionFields
// Guild is the guild the interaction happened in.
//
// Optional:
// - Will be nil if the interaction occurred in a DM.
Guild *PartialGuild `json:"guild"`
// Channel is the channel the interaction happened in.
Channel ResolvedMessageChannel `json:"channel"`
// Locale is the selected language of the invoking user.
Locale Locale `json:"locale"`
// Member is the guild member data for the invoking user.
//
// Optional:
// - Present when the interaction is invoked in a guild.
Member *ResolvedMember `json:"member"`
// User is the user object for the invoking user, if invoked in a DM.
//
// Optional:
// - Present only when the interaction is invoked in a DM.
User *User `json:"user"`
// AppPermissions is a bitwise set of permissions the app has in the source location of the interaction.
AppPermissions Permissions `json:"app_permissions"`
// Entitlements is a list of entitlements for the invoking user.
Entitlements []Entitlement `json:"entitlement"`
// AuthorizingIntegrationOwners maps installation contexts that the interaction was authorized for
// to related user or guild IDs.
AuthorizingIntegrationOwners map[ApplicationIntegrationType]Snowflake `json:"authorizing_integration_owners"`
// Context indicates where the interaction was triggered from.
Context InteractionContextType `json:"context"`
// AttachmentSizeLimit is the maximum size of attachments in bytes for this interaction.
AttachmentSizeLimit int `json:"attachment_size_limit"`
}
ApplicationCommandInteractionFields holds fields common to all application command interactions.
Reference: https://discord.com/developers/docs/interactions/receiving-and-responding
type ApplicationCommandOption ¶
type ApplicationCommandOption interface {
GetType() ApplicationCommandOptionType
GetName() string
GetDescription() string
json.Marshaler
}
ApplicationCommandOption is the interface representing a Discord application command option.
This interface can represent any type of option returned by Discord, including sub-commands, sub-command groups, strings, integers, booleans, users, channels, roles, mentionables, floats, and attachments.
Use this interface when you want to handle options generically without knowing the specific concrete type in advance.
You can convert (assert) it to a specific option type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var myOption ApplicationCommandOption
switch opt := myOption.(type) {
case *ApplicationCommandOptionString:
fmt.Println("String option:", opt.Name)
case *ApplicationCommandOptionInteger:
fmt.Println("Integer option:", opt.Name)
case *ApplicationCommandOptionSubCommand:
fmt.Println("Sub-command options:", opt.Options)
default:
fmt.Println("Other option type:", opt.GetType())
}
func UnmarshalApplicationCommandOption ¶
func UnmarshalApplicationCommandOption(buf []byte) (ApplicationCommandOption, error)
type ApplicationCommandOptionAttachment ¶
type ApplicationCommandOptionAttachment struct {
OptionBase
RequiredBase
}
ApplicationCommandOptionAttachment represents an attachment option.
func (*ApplicationCommandOptionAttachment) MarshalJSON ¶
func (o *ApplicationCommandOptionAttachment) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionBool ¶
type ApplicationCommandOptionBool struct {
OptionBase
RequiredBase
}
ApplicationCommandOptionBool represents a boolean option.
func (*ApplicationCommandOptionBool) MarshalJSON ¶
func (o *ApplicationCommandOptionBool) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionChannel ¶
type ApplicationCommandOptionChannel struct {
OptionBase
RequiredBase
ChannelConstraints
}
ApplicationCommandOptionChannel represents a channel option.
func (*ApplicationCommandOptionChannel) MarshalJSON ¶
func (o *ApplicationCommandOptionChannel) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionChoiceFloat ¶
type ApplicationCommandOptionChoiceFloat struct {
ChoiceOptionBase
// Value is the float value of the choice.
//
// Info:
// - Must be between -2^53 and 2^53.
Value float64 `json:"value"`
}
ApplicationCommandOptionChoiceFloat represents a choice for float options.
type ApplicationCommandOptionChoiceInteger ¶
type ApplicationCommandOptionChoiceInteger struct {
ChoiceOptionBase
// Value is the integer value of the choice.
//
// Info:
// - Must be between -2^53 and 2^53.
Value int `json:"value"`
}
ApplicationCommandOptionChoiceInteger represents a choice for integer options.
type ApplicationCommandOptionChoiceString ¶
type ApplicationCommandOptionChoiceString struct {
ChoiceOptionBase
// Value is the string value of the choice.
Value string `json:"value"`
}
ApplicationCommandOptionChoiceString represents a choice for string options.
type ApplicationCommandOptionFloat ¶
type ApplicationCommandOptionFloat struct {
OptionBase
RequiredBase
ChoiceBase
ChoiceFieldsFloat
FloatConstraints
}
ApplicationCommandOptionFloat represents a float option.
func (*ApplicationCommandOptionFloat) MarshalJSON ¶
func (o *ApplicationCommandOptionFloat) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionInteger ¶
type ApplicationCommandOptionInteger struct {
OptionBase
RequiredBase
ChoiceBase
ChoiceFieldsInteger
IntegerConstraints
}
ApplicationCommandOptionInteger represents an integer option.
func (*ApplicationCommandOptionInteger) MarshalJSON ¶
func (o *ApplicationCommandOptionInteger) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionMentionable ¶
type ApplicationCommandOptionMentionable struct {
OptionBase
RequiredBase
}
ApplicationCommandOptionMentionable represents a mentionable option.
func (*ApplicationCommandOptionMentionable) MarshalJSON ¶
func (o *ApplicationCommandOptionMentionable) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionRole ¶
type ApplicationCommandOptionRole struct {
OptionBase
RequiredBase
}
ApplicationCommandOptionRole represents a role option.
func (*ApplicationCommandOptionRole) MarshalJSON ¶
func (o *ApplicationCommandOptionRole) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionString ¶
type ApplicationCommandOptionString struct {
OptionBase
RequiredBase
ChoiceBase
ChoiceFieldsString
StringConstraints
}
ApplicationCommandOptionString represents a string option.
func (*ApplicationCommandOptionString) MarshalJSON ¶
func (o *ApplicationCommandOptionString) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionSubCommand ¶
type ApplicationCommandOptionSubCommand struct {
OptionBase
// Options is an array of nested options for the sub-command.
//
// Info:
// - Up to 25 options.
// - These are the parameters of the sub-command.
Options []ApplicationCommandOption `json:"options,omitempty"`
}
ApplicationCommandOptionSubCommand represents a sub-command option.
func (*ApplicationCommandOptionSubCommand) MarshalJSON ¶
func (o *ApplicationCommandOptionSubCommand) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionSubCommandGroup ¶
type ApplicationCommandOptionSubCommandGroup struct {
OptionBase
// Options is an array of sub-commands for the group.
//
// Info:
// - Up to 25 sub-commands.
Options []ApplicationCommandOptionSubCommand `json:"options,omitempty"`
}
ApplicationCommandOptionSubCommandGroup represents a sub-command group option.
func (*ApplicationCommandOptionSubCommandGroup) MarshalJSON ¶
func (o *ApplicationCommandOptionSubCommandGroup) MarshalJSON() ([]byte, error)
type ApplicationCommandOptionType ¶
type ApplicationCommandOptionType int
ApplicationCommandOptionType represents the type of an application command option.
const ( // ApplicationCommandOptionTypeSubCommand is a sub-command option, representing a nested command. ApplicationCommandOptionTypeSubCommand ApplicationCommandOptionType = iota + 1 // ApplicationCommandOptionTypeSubCommandGroup is a group of sub-commands. ApplicationCommandOptionTypeSubCommandGroup // ApplicationCommandOptionTypeString is a string option. ApplicationCommandOptionTypeString // ApplicationCommandOptionTypeInteger is an integer option, supporting values between -2^53 and 2^53. ApplicationCommandOptionTypeInteger // ApplicationCommandOptionTypeBool is a boolean option. ApplicationCommandOptionTypeBool // ApplicationCommandOptionTypeUser is a user option, referencing a Discord user. ApplicationCommandOptionTypeUser // ApplicationCommandOptionTypeChannel is a channel option, including all channel types and categories. ApplicationCommandOptionTypeChannel // ApplicationCommandOptionTypeRole is a role option, referencing a Discord role. ApplicationCommandOptionTypeRole // ApplicationCommandOptionTypeMentionable is a mentionable option, including users and roles. ApplicationCommandOptionTypeMentionable // ApplicationCommandOptionTypeFloat is a float option, supporting any double between -2^53 and 2^53. ApplicationCommandOptionTypeFloat // ApplicationCommandOptionTypeAttachment is an attachment option, referencing an uploaded file. ApplicationCommandOptionTypeAttachment )
func (ApplicationCommandOptionType) Is ¶
func (t ApplicationCommandOptionType) Is(optionType ApplicationCommandOptionType) bool
Is returns true if the option's Type matches the provided one.
type ApplicationCommandOptionUser ¶
type ApplicationCommandOptionUser struct {
OptionBase
RequiredBase
}
ApplicationCommandOptionUser represents a user option.
func (*ApplicationCommandOptionUser) MarshalJSON ¶
func (o *ApplicationCommandOptionUser) MarshalJSON() ([]byte, error)
type ApplicationCommandPermissionsUpdateEvent ¶ added in v0.15.0
type ApplicationCommandPermissionsUpdateEvent struct {
}
ApplicationCommandPermissionsUpdateEvent Application command permission was updated
type ApplicationCommandType ¶
type ApplicationCommandType int
ApplicationCommandType represents the type of an application command.
const ( // ApplicationCommandTypeChatInput is a text-based slash command that shows up when a user types "/". ApplicationCommandTypeChatInput ApplicationCommandType = 1 + iota // ApplicationCommandTypeUser is a UI-based command that shows up when you right-click or tap on a user. ApplicationCommandTypeUser // ApplicationCommandTypeMessage is a UI-based command that shows up when you right-click or tap on a message. ApplicationCommandTypeMessage // ApplicationCommandTypePrimaryEntryPoint is a UI-based command that represents the primary way to invoke an app's Activity. ApplicationCommandTypePrimaryEntryPoint )
func (ApplicationCommandType) Is ¶
func (t ApplicationCommandType) Is(commandType ApplicationCommandType) bool
Is returns true if the command's Type matches the provided one.
type ApplicationEntryPointCommand ¶
type ApplicationEntryPointCommand struct {
ApplicationCommandBase
DescriptionConstraints
// Handler determines whether the interaction is handled by the app's interactions handler or by Discord.
//
// Info:
// - Only applicable for commands with the EMBEDDED flag (i.e., applications with an Activity).
Handler ApplicationCommandHandlerType `json:"handler"`
}
ApplicationEntryPointCommand represents a UI-based command that is the primary way to invoke an app's Activity.
Reference: https://discord.com/developers/docs/interactions/application-commands#application-command-object
func (*ApplicationEntryPointCommand) MarshalJSON ¶
func (c *ApplicationEntryPointCommand) MarshalJSON() ([]byte, error)
type ApplicationEventWebhookStatus ¶
type ApplicationEventWebhookStatus int
ApplicationEventWebhookStatus represent a Discord application application event webhook status.
const ( // Webhook events are disabled by developer. ApplicationEventWebhookStatusDisabled ApplicationEventWebhookStatus = 1 + iota // Webhook events are enabled by developer. ApplicationEventWebhookStatusEnabled // Webhook events are disabled by Discord, usually due to inactivity. ApplicationEventWebhookStatusDisabledByDiscord )
func (ApplicationEventWebhookStatus) Is ¶
func (s ApplicationEventWebhookStatus) Is(status ApplicationEventWebhookStatus) bool
Is returns true if the app webhook event status matches the provided status.
type ApplicationFlags ¶
type ApplicationFlags int
ApplicationFlags represent a Discord application flags.
Reference: https://discord.com/developers/docs/resources/application#application-object-application-flags
func (ApplicationFlags) Has ¶
func (f ApplicationFlags) Has(flags ...ApplicationFlags) bool
Has returns true if all provided flags are set.
type ApplicationInstallParams ¶
type ApplicationInstallParams struct {
// Scopes are scopes to add the application to the server with.
Scopes []OAuth2Scope `json:"scopes"`
// Permissions are permissions to request for the bot role
Permissions Permissions `json:"permissions"`
}
ApplicationInstallParams represent a Discord application install params object.
Reference: https://discord.com/developers/docs/resources/application#install-params-object
type ApplicationIntegrationType ¶
type ApplicationIntegrationType int
ApplicationIntegrationType represent where an app can be installed, also called its supported installation contexts.
See: https://discord.com/developers/docs/resources/application#installation-context
const ( // ApplicationIntegrationTypeGuildInstall if app is installable to servers. ApplicationIntegrationTypeGuildInstall ApplicationIntegrationType = iota // ApplicationIntegrationTypeUserInstall if app is installable to users. ApplicationIntegrationTypeUserInstall )
type ApplicationIntegrationTypeConfiguration ¶
type ApplicationIntegrationTypeConfiguration struct {
// OAuth2InstallParams are the install params for each installation context's default in-app authorization link.
OAuth2InstallParams *ApplicationInstallParams `json:"oauth2_install_params"`
}
ApplicationIntegrationTypeConfiguration object.
type ApplicationIntegrationTypesConfig ¶
type ApplicationIntegrationTypesConfig map[ApplicationIntegrationType]ApplicationIntegrationTypeConfiguration
type ApplicationMessageCommand ¶
type ApplicationMessageCommand struct {
ApplicationCommandBase
}
ApplicationMessageCommand represents a UI-based command that appears when right-clicking or tapping on a message.
Reference: https://discord.com/developers/docs/interactions/application-commands#application-command-object
func (*ApplicationMessageCommand) MarshalJSON ¶
func (c *ApplicationMessageCommand) MarshalJSON() ([]byte, error)
type ApplicationUserCommand ¶
type ApplicationUserCommand struct {
ApplicationCommandBase
}
ApplicationUserCommand represents a UI-based command that appears when right-clicking or tapping on a user.
Reference: https://discord.com/developers/docs/interactions/application-commands#application-command-object
func (*ApplicationUserCommand) MarshalJSON ¶
func (c *ApplicationUserCommand) MarshalJSON() ([]byte, error)
type Attachment ¶
type Attachment struct {
// ID is the unique Discord snowflake ID of this attachment.
ID Snowflake `json:"id,omitempty"`
// Filename is the name of the attached file.
Filename string `json:"filename"`
// Title is the optional title of the attachment.
//
// Optional
// - May be empty string if unset.
Title string `json:"title,omitempty"`
// Description is the optional description of the attachment (max 1024 characters).
//
// Optional:
// - May be empty string if unset.
Description string `json:"description,omitempty"`
// ContentType is the media type (MIME type) of the attachment.
//
// Optional:
// - May be empty string.
ContentType string `json:"content_type,omitempty"`
// Size is the size of the file in bytes.
Size int `json:"size,omitempty"`
// URL is the source URL of the attachment file.
URL string `json:"url,omitempty"`
// ProxyURL is a proxied URL of the attachment file.
ProxyURL string `json:"proxy_url,omitempty"`
// Height is the height of the image file, if applicable.
// - 0 if the attachment is not an image.
Height int `json:"height,omitempty"`
// Width is the width of the image file, if applicable.
// - 0 if the attachment is not an image.
Width int `json:"width,omitempty"`
// Ephemeral indicates whether this attachment is ephemeral.
Ephemeral bool `json:"ephemeral,omitempty"`
// Flags is a bitfield combining attachment flags.
Flags AttachmentFlags `json:"flags,omitempty"`
// DurationSec is the duration of the audio file in seconds, if applicable.
//
// Optional:
// - Present only for audio or voice message attachments.
DurationSec *float64 `json:"duration_secs,omitempty"`
// Waveform is a base64 encoded byte array representing a sampled waveform.
//
// Optional:
// - present only for voice messages.
Waveform *string `json:"waveform,omitempty"`
}
Attachment represents a Discord attachment object.
Reference: https://discord.com/developers/docs/resources/channel#attachment-object
func (*Attachment) CreatedAt ¶
func (a *Attachment) CreatedAt() time.Time
CreatedAt returns the time when this attachment is created.
func (*Attachment) Save ¶
func (a *Attachment) Save(fileName, dir string) (string, error)
Save downloads the attachment from its URL and saves it to disk.
If fileName is not provided (empty string), it saves the file in the given directory using Attachment.Filename
Info:
- The extension is replaced based on the Content-Type of the file.
Example:
err := attachment.Save("myfile", "./downloads")
if err != nil {
// handle error
}
Returns:
- string: full path to the downloaded file.
- error: non-nil if any operation fails.
type AttachmentFlags ¶
type AttachmentFlags int
AttachmentFlags represents bit flags for Discord attachment metadata.
Reference: https://discord.com/developers/docs/resources/channel#attachment-object-attachment-flags
const ( // AttachmentFlagIsRemix means this attachment has been edited using the remix feature on mobile. AttachmentFlagIsRemix AttachmentFlags = 1 << 2 )
type AudioChannel ¶
type AudioChannel interface {
GuildChannel
GuildMessageChannel
GetBitrate() int
GetUserLimit() int
GetRtcRegion() string
}
AudioChannel represents a Discord channel that supports voice or audio functionality.
This interface is used for guild channels that have voice-related features, such as voice channels and stage voice channels. It provides access to audio-specific properties like bitrate, user limit, and RTC region.
Note:
- DM channels (ChannelTypeDM) and Group DM channels (ChannelTypeGroupDM) support audio features like calls, streams, and webcams for users. However, for bots, these channels are treated as text channels, as bots cannot interact with their audio features (e.g., bots cannot initiate calls in them).
Use this interface when you want to handle audio channels generically without knowing the specific concrete type in advance.
You can convert (assert) it to a specific channel type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var ch AudioChannel
// Using a type switch to handle specific channel types
switch c := ch.(type) {
case *VoiceChannel:
fmt.Println("Voice channel bitrate:", c.GetBitrate())
fmt.Println("Voice channel user limit:", c.GetUserLimit())
fmt.Println("Voice channel RTC region:", c.GetRtcRegion())
case *StageVoiceChannel:
fmt.Println("Stage voice channel bitrate:", c.GetBitrate())
fmt.Println("Stage voice channel user limit:", c.GetUserLimit())
fmt.Println("Stage voice channel RTC region:", c.GetRtcRegion())
}
// Using a type assertion to check a specific type
if voiceCh, ok := ch.(*VoiceChannel); ok {
fmt.Println("Voice channel bitrate:", voiceCh.GetBitrate())
}
type AudioChannelFields ¶
type AudioChannelFields struct {
// Bitrate is the bitrate (in bits) of the voice channel.
Bitrate int `json:"bitrate"`
// UserLimit is the user limit of the voice channel.
UserLimit int `json:"user_limit"`
// RtcRegion is the voice region id for the voice channel. Automatic when set to empty string.
RtcRegion string `json:"rtc_region"`
}
AudioChannelFields holds voice-related configuration fields.
func (*AudioChannelFields) GetBitrate ¶
func (c *AudioChannelFields) GetBitrate() int
func (*AudioChannelFields) GetRtcRegion ¶
func (c *AudioChannelFields) GetRtcRegion() string
func (*AudioChannelFields) GetUserLimit ¶
func (c *AudioChannelFields) GetUserLimit() int
type AutoArchiveDuration ¶
type AutoArchiveDuration int
AutoArchiveDuration represents the auto archive duration of a thread channel
Reference: https://discord.com/developers/docs/resources/channel#thread-metadata-object
const ( AutoArchiveDuration1h AutoArchiveDuration = 60 AutoArchiveDuration24h AutoArchiveDuration = 1440 AutoArchiveDuration3d AutoArchiveDuration = 4320 AutoArchiveDuration1w AutoArchiveDuration = 10080 )
func (AutoArchiveDuration) Is ¶
func (d AutoArchiveDuration) Is(duration AutoArchiveDuration) bool
Is returns true if the thread's auto archive duration matches the provided auto archive duration.
type AutoCompleteInteraction ¶
type AutoCompleteInteraction struct {
InteractionFields
}
type AutoModerationActionExecutionEvent ¶ added in v0.15.0
type AutoModerationActionExecutionEvent struct {
}
AutoModerationActionExecutionEvent Auto Moderation rule was triggered and an action was executed
type AutoModerationRuleCreateEvent ¶ added in v0.15.0
type AutoModerationRuleCreateEvent struct {
}
AutoModerationRuleCreateEvent Auto Moderation rule was created
type AutoModerationRuleDeleteEvent ¶ added in v0.15.0
type AutoModerationRuleDeleteEvent struct {
}
AutoModerationRuleDeleteEvent Auto Moderation rule was deleted
type AutoModerationRuleUpdateEvent ¶ added in v0.15.0
type AutoModerationRuleUpdateEvent struct {
}
AutoModerationRuleUpdateEvent Auto Moderation rule was updated
type AvatarDecorationData ¶
type AvatarDecorationData struct {
// Asset is the avatar decoration hash.
Asset string `json:"asset"`
// SkuID is the Discord snowflake ID of the avatar decoration SKU.
SkuID Snowflake `json:"sku_id"`
}
AvatarDecorationData represents avatar decoration info.
Reference: https://discord.com/developers/docs/resources/user#avatar-decoration-object
type Ban ¶ added in v0.15.0
type Ban struct {
// Reason is the reason for the ban.
Reason string `json:"reason,omitempty"`
// User is the banned user.
User User `json:"user"`
}
Ban represents a guild ban.
Reference: https://discord.com/developers/docs/resources/guild#ban-object
type BanMemberOptions ¶ added in v0.15.0
type BanMemberOptions struct {
// DeleteMessageSeconds is the number of seconds to delete messages for, between 0 and 604800 (7 days)
DeleteMessageSeconds int `json:"delete_message_seconds,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
BanMemberOptions contains parameters for banning a guild member.
type Base64Image ¶
type Base64Image = string
Base64Image represents a base64-encoded image data URI string.
func NewImageFile ¶
func NewImageFile(path string) (Base64Image, error)
NewImageFile reads an image file and returns its base64 data URI string.
Example output: "data:image/png;base64,<base64-encoded-bytes>"
type BeginGuildPruneOptions ¶ added in v0.15.0
type BeginGuildPruneOptions struct {
// Pruned is the number of days to count prune for (1-30).
//
// Default 7 if not set.
Days int `json:"days,omitempty"`
// ComputePruneCount is whether pruned is returned, discouraged for large guilds.
ComputePruneCount optional.Option[bool] `json:"compute_prune_count,omitzero"`
// IncludeRoles are the roles to include.
IncludeRoles []Snowflake `json:"include_roles,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
BeginGuildPruneOptions contains parameters for begining guild prune.
type BitField ¶
type BitField interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}
BitField is a type constraint that matches any integer type. It represents a value that can be used as a bitfield to store multiple boolean flags using bitwise operations.
type Bitrate ¶ added in v0.15.0
type Bitrate int
const BitrateMaxForLevel1Guilds Bitrate = 128000
const BitrateMaxForLevel2Guilds Bitrate = 256000
const BitrateMaxForLevel3Guilds Bitrate = 384000
const BitrateMaxForNormalGuilds Bitrate = 96000
const BitrateMaxForStageChannels Bitrate = 64000
const BitrateMin Bitrate = 8000
type BulkBanMembersOptions ¶ added in v0.15.0
type BulkBanMembersOptions struct {
// UserIDs is a list of user ids to ban (max 200).
UserIDs []Snowflake `json:"user_ids"`
// DeleteMessageSeconds is the number of seconds to delete messages for, between 0 and 604800 (7 days).
DeleteMessageSeconds int `json:"delete_message_seconds,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
BulkBanMembersOptions contains parameters for bulk banning guild members.
Reference: https://discord.com/developers/docs/resources/guild#bulk-guild-ban
type BulkBanResponse ¶ added in v0.15.0
type BulkBanResponse struct {
// BannedUsers is a list of user ids, that were successfully banned.
BannedUsers []Snowflake `json:"banned_users"`
// FailedUsers is a list of user ids, that were not banned.
FailedUsers []Snowflake `json:"failed_users"`
}
BulkBanResponse is the response for bulk banning members.
Reference: https://discord.com/developers/docs/resources/guild#bulk-guild-ban
type ButtonBuilder ¶ added in v0.14.3
type ButtonBuilder struct {
// contains filtered or unexported fields
}
ButtonBuilder helps build a ButtonComponent with chainable methods.
func NewButtonBuilder ¶ added in v0.14.3
func NewButtonBuilder() *ButtonBuilder
NewButtonBuilder creates a new ButtonBuilder instance.
func (*ButtonBuilder) Build ¶ added in v0.14.3
func (b *ButtonBuilder) Build() *ButtonComponent
Build returns the final ButtonComponent.
func (*ButtonBuilder) Disable ¶ added in v0.14.3
func (b *ButtonBuilder) Disable() *ButtonBuilder
Disable disables the button.
func (*ButtonBuilder) Enable ¶ added in v0.14.3
func (b *ButtonBuilder) Enable() *ButtonBuilder
Enable enables the button.
func (*ButtonBuilder) Reset ¶ added in v0.15.0
func (b *ButtonBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*ButtonBuilder) SetCustomID ¶ added in v0.14.3
func (b *ButtonBuilder) SetCustomID(customID string) *ButtonBuilder
SetCustomID sets the button custom ID.
func (*ButtonBuilder) SetDisabled ¶ added in v0.14.3
func (b *ButtonBuilder) SetDisabled(disabled bool) *ButtonBuilder
SetDisabled sets the button disabled state.
func (*ButtonBuilder) SetLabel ¶ added in v0.14.3
func (b *ButtonBuilder) SetLabel(label string) *ButtonBuilder
SetLabel sets the button label.
func (*ButtonBuilder) SetSkuID ¶ added in v0.14.3
func (b *ButtonBuilder) SetSkuID(skuID Snowflake) *ButtonBuilder
SetSkuID sets the button Sku ID.
func (*ButtonBuilder) SetStyle ¶ added in v0.14.3
func (b *ButtonBuilder) SetStyle(style ButtonStyle) *ButtonBuilder
SetStyle sets the button style.
func (*ButtonBuilder) SetURL ¶ added in v0.14.3
func (b *ButtonBuilder) SetURL(url string) *ButtonBuilder
SetURL sets the button URL.
type ButtonComponent ¶ added in v0.14.0
type ButtonComponent struct {
InteractiveComponentFields
// Style is the button style, determining its appearance and behavior.
Style ButtonStyle `json:"style"`
// Label is the text that appears on the button.
//
// Note:
// - Max 80 characters.
// - Cannot be set for Premium buttons.
Label string `json:"label,omitempty"`
// Emoji is the emoji that appears on the button.
//
// Note:
// - Cannot be set for Premium buttons.
Emoji *PartialEmoji `json:"emoji,omitempty"`
// SkuID is the identifier for a purchasable SKU, used only for Premium buttons.
//
// Note:
// - Required for Premium buttons.
// - Cannot be set for non-Premium buttons.
SkuID Snowflake `json:"sku_id,omitempty"`
// URL is the URL for Link buttons.
//
// Note:
// - Max 512 characters.
// - Required for Link buttons.
// - Cannot be set for non-Link buttons.
URL string `json:"url,omitempty"`
// Disabled is whether the button is disabled.
//
// Note:
// - Defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
ButtonComponent is an interactive component used in messages, creating clickable elements that users can interact with.
Buttons must be placed inside an ActionRowComponent or a SectionComponent's accessory field. Non-link and non-premium buttons (Primary, Secondary, Success, Danger) send an interaction to the app when clicked. Link and Premium buttons do not send interactions.
Note:
- Non-link and non-premium buttons require a custom_id and cannot have a url or sku_id.
- Link buttons require a url and cannot have a custom_id.
- Premium buttons require a sku_id and cannot have a custom_id, label, url, or emoji.
Reference: https://discord.com/developers/docs/interactions/message-components#button-object
func (*ButtonComponent) MarshalJSON ¶ added in v0.14.0
func (c *ButtonComponent) MarshalJSON() ([]byte, error)
type ButtonStyle ¶ added in v0.14.0
type ButtonStyle int
ButtonStyle represents different styles for interactive buttons, each with specific actions and required fields.
The style determines the button's appearance and behavior, such as triggering interactions or navigating to a URL. Non-link and non-premium buttons (Primary, Secondary, Success, Danger) require a custom_id and send interactions. Link buttons require a url, cannot have a custom_id, and do not send interactions. Premium buttons require a sku_id, cannot have a custom_id, label, url, or emoji, and do not send interactions.
Reference: https://discord.com/developers/docs/interactions/message-components#button-object-button-styles
const ( // ButtonStylePrimary is the most important or recommended action in a group of options. // // Required Field: ButtonComponent.CustomID // Note: Sends an interaction when clicked. ButtonStylePrimary ButtonStyle = iota + 1 // ButtonStyleSecondary represents alternative or supporting actions. // // Required Field: ButtonComponent.CustomID // Note: Sends an interaction when clicked. ButtonStyleSecondary // ButtonStyleSuccess represents positive confirmation or completion actions. // // Required Field: ButtonComponent.CustomID // Note: Sends an interaction when clicked. ButtonStyleSuccess // ButtonStyleDanger represents an action with irreversible consequences. // // Required Field: ButtonComponent.CustomID // Note: Sends an interaction when clicked. ButtonStyleDanger // ButtonStyleLink navigates to a URL. // // Required Field: ButtonComponent.URL // Note: Does not send an interaction when clicked. ButtonStyleLink // ButtonStylePremium represents a purchase action. // // Required Field: ButtonComponent.SkuID // Note: Does not send an interaction when clicked. ButtonStylePremium )
func (ButtonStyle) Is ¶ added in v0.14.0
func (s ButtonStyle) Is(style ButtonStyle) bool
Is returns true if the button style matches the provided one.
type CacheFlags ¶ added in v0.14.3
type CacheFlags int
const ( CacheFlagUsers CacheFlags = 1 << iota CacheFlagGuilds CacheFlagMembers CacheFlagThreadMembers CacheFlagMessages CacheFlagChannels CacheFlagRoles CacheFlagVoiceStates CacheFlagsNone CacheFlags = 0 CacheFlagsAll = CacheFlagUsers | CacheFlagGuilds | CacheFlagMembers | CacheFlagThreadMembers | CacheFlagMessages | CacheFlagChannels | CacheFlagRoles | CacheFlagVoiceStates )
func (CacheFlags) Has ¶ added in v0.14.3
func (f CacheFlags) Has(bits ...CacheFlags) bool
type CacheManager ¶ added in v0.14.3
type CacheManager interface {
Flags() CacheFlags
SetFlags(flags ...CacheFlags)
GetUser(userID Snowflake) optional.Option[User]
GetGuild(guildID Snowflake) optional.Option[Guild]
GetMember(guildID, userID Snowflake) optional.Option[Member]
GetChannel(channelID Snowflake) optional.Option[Channel]
GetMessage(messageID Snowflake) optional.Option[Message]
GetVoiceState(guildID, userID Snowflake) optional.Option[VoiceState]
GetGuildChannels(guildID Snowflake) optional.Option[map[Snowflake]GuildChannel]
GetGuildMembers(guildID Snowflake) optional.Option[map[Snowflake]Member]
GetGuildVoiceStates(guildID Snowflake) optional.Option[map[Snowflake]VoiceState]
GetGuildRoles(guildID Snowflake) optional.Option[map[Snowflake]Role]
GetRoles(rolesIDs ...Snowflake) map[Snowflake]Role
HasUser(userID Snowflake) bool
HasGuild(guildID Snowflake) bool
HasMember(guildID, userID Snowflake) bool
HasChannel(channelID Snowflake) bool
HasMessage(messageID Snowflake) bool
HasVoiceState(guildID, userID Snowflake) bool
HasGuildChannels(guildID Snowflake) bool
HasGuildMembers(guildID Snowflake) bool
HasGuildVoiceStates(guildID Snowflake) bool
HasGuildRoles(guildID Snowflake) bool
HasRoles(rolesIDs ...Snowflake) bool
CountUsers() int
CountGuilds() int
CountMembers() int
CountChannels() int
CountMessages() int
CountVoiceStates() int
CountRoles() int
CountGuildChannels(guildID Snowflake) int
CountGuildMembers(guildID Snowflake) int
CountGuildRoles(guildID Snowflake) int
PutUser(user User)
PutGuild(guild Guild)
PutMember(member Member)
PutChannel(channel Channel)
PutMessage(message Message)
PutVoiceState(voiceState VoiceState)
PutRole(role Role)
PutRoles(roles ...Role)
DelUser(userID Snowflake) bool
DelGuild(guildID Snowflake) bool
DelMember(guildID, userID Snowflake) bool
DelChannel(channelID Snowflake) bool
DelMessage(messageID Snowflake) bool
DelVoiceState(guildID, userID Snowflake) bool
DelGuildChannels(guildID Snowflake) bool
DelGuildMembers(guildID Snowflake) bool
DelRole(guildID, roleID Snowflake) bool
DelRoles(roleIDs ...Snowflake) bool
}
type CategorizedChannel ¶
type CategorizedChannel interface {
NamedChannel
GetParentID() Snowflake
}
CategorizedChannel represents a Discord channel that can be placed under a parent category channel within a guild.
This interface is used for guild channels that can be organized under a category, such as text channels, voice channels, announcement channels, stage voice channels, forum channels, media channels, and thread channels.
Use this interface when you want to handle channels generically by their parent category without knowing the specific concrete type in advance.
You can convert (assert) it to a specific channel type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var ch CategorizedChannel
// Using a type switch to handle specific channel types
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel parent ID:", c.GetParentID())
case *VoiceChannel:
fmt.Println("Voice channel parent ID:", c.GetParentID())
case *ThreadChannel:
fmt.Println("Thread channel parent ID:", c.GetParentID())
default:
fmt.Println("Other categorized channel type:", c.GetType())
}
// Using a type assertion to check a specific type
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel parent ID:", textCh.GetParentID())
}
type CategorizedChannelFields ¶
type CategorizedChannelFields struct {
// ParentID is the id of the parent category for this channel.
//
// Info:
// - Each parent category can contain up to 50 channels.
//
// Optional:
// - May be equal 0 if the channel is not in a category.
ParentID Snowflake `json:"parent_id"`
}
CategorizedChannelFields holds the parent category field for categorized guild channels.
func (*CategorizedChannelFields) GetParentID ¶
func (c *CategorizedChannelFields) GetParentID() Snowflake
type CategoryChannel ¶
type CategoryChannel struct {
GuildChannelFields
}
CategoryChannel represents a guild category channel.
func (*CategoryChannel) MarshalJSON ¶
func (c *CategoryChannel) MarshalJSON() ([]byte, error)
type Channel ¶
type Channel interface {
json.Marshaler
GetID() Snowflake
GetType() ChannelType
CreatedAt() time.Time
Mention() string
}
Channel is the interface representing a Discord channel.
This interface can represent any type of channel returned by Discord, including text channels, voice channels, thread channels, forum channels, etc.
Use this interface when you want to handle channels generically without knowing the specific concrete type in advance.
You can convert (assert) it to a specific channel type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var myChannel Channel
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel name:", c.Name)
case *VoiceChannel:
fmt.Println("Voice channel bitrate:", c.Bitrate)
case *ForumChannel:
fmt.Println("Forum channel tags:", c.AvailableTags)
default:
fmt.Println("Other channel type:", c.GetType())
}
You can also use an if-condition to check a specific type:
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel:", textCh.Name)
}
func UnmarshalChannel ¶
Helper func to Unmarshal any channel type to a Channel interface.
type ChannelConstraints ¶
type ChannelConstraints struct {
// ChannelTypes is an array of channel types that the option is restricted to.
//
// Info:
// - If not specified, includes all channel types and categories.
ChannelTypes []ChannelType `json:"channel_types,omitempty"`
}
ChannelConstraints contains constraints for channel options.
type ChannelCreateEvent ¶ added in v0.15.0
type ChannelCreateEvent struct {
}
ChannelCreateEvent New guild channel created
type ChannelDeleteEvent ¶ added in v0.15.0
type ChannelDeleteEvent struct {
}
ChannelDeleteEvent Channel was deleted
type ChannelFields ¶
type ChannelFields struct {
// ID is the unique Discord snowflake ID of the channel.
ID Snowflake `json:"id"`
// Type is the type of the channel.
Type ChannelType `json:"type"`
}
ChannelFields contains only fields present in all channel types.
Reference: https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
func (*ChannelFields) CreatedAt ¶
func (c *ChannelFields) CreatedAt() time.Time
func (*ChannelFields) GetID ¶
func (c *ChannelFields) GetID() Snowflake
func (*ChannelFields) GetType ¶
func (c *ChannelFields) GetType() ChannelType
func (*ChannelFields) Mention ¶
func (c *ChannelFields) Mention() string
Mention returns a Discord mention string for the channel.
Example output: "<#123456789012345678>"
func (*ChannelFields) String ¶ added in v0.15.0
func (c *ChannelFields) String() string
String implements the fmt.Stringer interface.
type ChannelFlags ¶
type ChannelFlags int
ChannelFlags represents Discord channel flags combined as a bitfield.
Reference: https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
const ( // ChannelFlagPinned indicates that this thread is pinned to the top of its parent // GUILD_FORUM or GUILD_MEDIA channel. // // Applicable only to threads within forum or media channels. ChannelFlagPinned ChannelFlags = 1 << 1 // ChannelFlagRequireTag indicates whether a tag is required to be specified when // creating a thread in a GUILD_FORUM or GUILD_MEDIA channel. // // Tags are specified in the AppliedTags field. ChannelFlagRequireTag ChannelFlags = 1 << 4 // ChannelFlagHideMediaDownloadOptions, when set, hides the embedded media download options // for media channel attachments. // // Available only for media channels. ChannelFlagHideMediaDownloadOptions ChannelFlags = 1 << 15 )
func (ChannelFlags) Has ¶
func (f ChannelFlags) Has(flags ...ChannelFlags) bool
Has returns true if all provided flags are set.
type ChannelPinsUpdateEvent ¶ added in v0.15.0
type ChannelPinsUpdateEvent struct {
}
ChannelPinsUpdateEvent Message was pinned or unpinned
type ChannelPosition ¶ added in v0.15.0
type ChannelPosition struct {
// Channel id
ID Snowflake `json:"id"`
// Position is the sorting position of the channel (channels with the same position are sorted by id).
Position optional.Option[int] `json:"position,omitzero"`
// Syncs the permission overwrites with the new parent, if moving to a new category.
LockPermissions bool `json:"lock_permissions,omitzero"`
// ParentID is the new parent ID for the channel that is moved.
ParentID Snowflake `json:"parent_id,omitempty"`
}
type ChannelSelectMenuBuilder ¶ added in v0.15.0
type ChannelSelectMenuBuilder struct {
// contains filtered or unexported fields
}
ChannelSelectMenuBuilder helps build a ChannelSelectMenuComponent with chainable methods.
func NewChannelSelectMenuBuilder ¶ added in v0.15.0
func NewChannelSelectMenuBuilder() *ChannelSelectMenuBuilder
NewChannelSelectMenuBuilder creates a new ChannelSelectMenuBuilder instance.
func (*ChannelSelectMenuBuilder) AddChannelType ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) AddChannelType(channelType ChannelType) *ChannelSelectMenuBuilder
AddChannelType adds a single channel type.
func (*ChannelSelectMenuBuilder) AddDefaultValue ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *ChannelSelectMenuBuilder
AddDefaultValue adds a single default value.
func (*ChannelSelectMenuBuilder) Build ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) Build() *ChannelSelectMenuComponent
Build returns the final ChannelSelectMenuComponent.
func (*ChannelSelectMenuBuilder) Reset ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*ChannelSelectMenuBuilder) SetChannelTypes ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetChannelTypes(types []ChannelType) *ChannelSelectMenuBuilder
SetChannelTypes sets all channel types at once.
func (*ChannelSelectMenuBuilder) SetCustomID ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetCustomID(customID string) *ChannelSelectMenuBuilder
SetCustomID sets the custom ID.
func (*ChannelSelectMenuBuilder) SetDefaultValues ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *ChannelSelectMenuBuilder
SetDefaultValues sets all default values at once.
func (*ChannelSelectMenuBuilder) SetDisabled ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetDisabled(disabled bool) *ChannelSelectMenuBuilder
SetDisabled sets whether the select menu is disabled.
func (*ChannelSelectMenuBuilder) SetMaxValues ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetMaxValues(maxValues int) *ChannelSelectMenuBuilder
SetMaxValues sets the maximum number of selections.
func (*ChannelSelectMenuBuilder) SetMinValues ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetMinValues(minValues *int) *ChannelSelectMenuBuilder
SetMinValues sets the minimum number of selections.
func (*ChannelSelectMenuBuilder) SetPlaceholder ¶ added in v0.15.0
func (b *ChannelSelectMenuBuilder) SetPlaceholder(placeholder string) *ChannelSelectMenuBuilder
SetPlaceholder sets the placeholder text.
type ChannelSelectMenuComponent ¶ added in v0.14.0
type ChannelSelectMenuComponent struct {
InteractiveComponentFields
// ChannelTypes is an array of channel types to include in the select menu.
//
// Note:
// - Filters the channels shown in the select menu.
ChannelTypes []ChannelType `json:"channel_types,omitempty"`
// Placeholder is the custom placeholder text displayed when no channel is selected.
//
// Note:
// - Maximum of 150 characters.
Placeholder string `json:"placeholder,omitempty"`
// DefaultValues is an array of default channels for the select menu.
//
// Note:
// - Number of default values must be within the range defined by MinValues and MaxValues.
DefaultValues []SelectDefaultValue `json:"default_values,omitempty"`
// MinValues is the minimum number of channels that must be selected.
//
// Note:
// - Defaults to 1.
// - Minimum 0, maximum 25.
MinValues *int `json:"min_values,omitempty"`
// MaxValues is the maximum number of channels that can be selected.
//
// Note:
// - Defaults to 1.
// - Maximum 25.
MaxValues int `json:"max_values,omitempty"`
// Disabled specifies whether the select menu is disabled in a message.
//
// Note:
// - Defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
ChannelSelectMenuComponent represents a channel select menu, an interactive component allowing users to select one or more channels in a message. Options are automatically populated based on the server's available channels and can be filtered by channel types.
It supports both single-select and multi-select behavior, sending an interaction to the application when a user makes their selection(s). ChannelSelectMenuComponent must be placed inside an ActionRowComponent and is only available in messages. An ActionRowComponent containing a ChannelSelectMenuComponent cannot include buttons.
Note:
- Maximum of 25 selections can be allowed (via MaxValues).
- Options are auto-populated by Discord based on server channels, filterable by ChannelTypes.
func (*ChannelSelectMenuComponent) MarshalJSON ¶ added in v0.14.0
func (c *ChannelSelectMenuComponent) MarshalJSON() ([]byte, error)
type ChannelType ¶
type ChannelType int
ChannelType represents Discord channel types.
Reference: https://discord.com/developers/docs/resources/channel#channel-object-channel-types
const ( // GuildText is a text channel within a server. ChannelTypeGuildText ChannelType = 0 // DM is a direct message between users. ChannelTypeDM ChannelType = 1 // GuildVoice is a voice channel within a server. ChannelTypeGuildVoice ChannelType = 2 // GroupDM is a direct message between multiple users. ChannelTypeGroupDM ChannelType = 3 // GuildCategory is an organizational category that contains up to 50 channels. ChannelTypeGuildCategory ChannelType = 4 // GuildAnnouncement is a channel that users can follow and crosspost into their own server (formerly news channels). ChannelTypeGuildAnnouncement ChannelType = 5 // AnnouncementThread is a temporary sub-channel within a GuildAnnouncement channel. ChannelTypeAnnouncementThread ChannelType = 10 // PublicThread is a temporary sub-channel within a GuildText or GuildForum channel. ChannelTypePublicThread ChannelType = 11 // PrivateThread is a temporary sub-channel within a GuildText channel that is only viewable by those invited and those with the MANAGE_THREADS permission. ChannelTypePrivateThread ChannelType = 12 // GuildStageVoice is a voice channel for hosting events with an audience. ChannelTypeGuildStageVoice ChannelType = 13 // GuildDirectory is the channel in a hub containing the listed servers. ChannelTypeGuildDirectory ChannelType = 14 // GuildForum is a channel that can only contain threads. ChannelTypeGuildForum ChannelType = 15 // GuildMedia is a channel that can only contain threads, similar to GuildForum channels. ChannelTypeGuildMedia ChannelType = 16 )
func (ChannelType) Is ¶
func (t ChannelType) Is(channelType ChannelType) bool
Is returns true if the channel's Type matches the provided one.
type ChannelUpdateEvent ¶ added in v0.15.0
type ChannelUpdateEvent struct {
}
ChannelUpdateEvent Channel was updated
type ChatInputCommand ¶
type ChatInputCommand struct {
ApplicationCommandBase
DescriptionConstraints
// Options is an array of parameters for the command.
//
// Info:
// - Maximum of 25 options.
Options []ApplicationCommandOption `json:"options"`
}
ChatInputCommand represents a slash command.
Reference: https://discord.com/developers/docs/interactions/application-commands#application-command-object
func (*ChatInputCommand) MarshalJSON ¶
func (c *ChatInputCommand) MarshalJSON() ([]byte, error)
func (*ChatInputCommand) UnmarshalJSON ¶
func (c *ChatInputCommand) UnmarshalJSON(buf []byte) error
type ChatInputCommandInteraction ¶ added in v0.14.0
type ChatInputCommandInteraction struct {
ApplicationCommandInteractionFields
// Data contains the payload of the interaction specific to chat input commands.
Data ChatInputCommandInteractionData `json:"data"`
}
ChatInputCommandInteraction represents an interaction triggered by a chat input (slash) command.
Reference: https://discord.com/developers/docs/interactions/application-commands
type ChatInputCommandInteractionData ¶ added in v0.14.0
type ChatInputCommandInteractionData struct {
ApplicationCommandInteractionDataFields
// Resolved contains the resolved objects referenced by this command.
Resolved ChatInputCommandResolvedInteractionData `json:"resolved"`
// Options contains the parameters and values provided by the user for this command.
Options []ChatInputInteractionCommandOption `json:"options"`
}
ChatInputCommandInteractionData represents the data payload for a chat input command interaction.
type ChatInputCommandResolvedInteractionData ¶ added in v0.14.0
type ChatInputCommandResolvedInteractionData struct {
// Users is a map of user IDs to User objects referenced by the command.
Users map[Snowflake]User `json:"users"`
// Members is a map of user IDs to partial Member objects for the guild.
Members map[Snowflake]ResolvedMember `json:"members"`
// Roles is a map of role IDs to Role objects referenced by the command.
Roles map[Snowflake]Role `json:"roles"`
// Channels is a map of channel IDs to partial Channel objects referenced by the command.
Channels map[Snowflake]ResolvedChannel `json:"channels"`
// Attachments is a map of attachment IDs to Attachment objects referenced by the command.
Attachments map[Snowflake]Attachment `json:"attachments"`
}
ChatInputCommandResolvedInteractionData represents the resolved data inside Interaction.Data.Resolved for chat input command interactions. This includes users, members, roles, channels, and attachments referenced by the command.
type ChatInputInteractionCommandOption ¶ added in v0.14.0
type ChatInputInteractionCommandOption struct {
// Name is the name of the option as defined in the command.
Name string `json:"name"`
// Type is the type of the option (string, integer, boolean, etc.).
Type ApplicationCommandOptionType `json:"type"`
// Value is the raw JSON value provided by the user for this option.
//
// Note: It's recommended to use the helper methods provided
// (String, Int, Float, Bool, Snowflake) to extract the value.
// These methods will panic if called on a type that doesn't match the
// expected option type, so you must be sure of the type or check the
// Type field before calling. For example, if Type is
// ApplicationCommandOptionTypeString, calling String() is safe.
Value json.RawMessage `json:"value"`
}
ChatInputInteractionCommandOption represents a single option provided by a user when invoking a chat input command (slash command).
func (*ChatInputInteractionCommandOption) Bool ¶ added in v0.14.0
func (o *ChatInputInteractionCommandOption) Bool() bool
Bool returns the option's value as a boolean.
Panics if the underlying JSON value cannot be unmarshaled into a bool. Make sure the option's Type is ApplicationCommandOptionTypeBoolean before calling.
func (*ChatInputInteractionCommandOption) Float ¶ added in v0.14.0
func (o *ChatInputInteractionCommandOption) Float() float64
Float returns the option's value as a float64.
Panics if the underlying JSON value cannot be unmarshaled into a float64. Make sure the option's Type is ApplicationCommandOptionTypeNumber before calling.
func (*ChatInputInteractionCommandOption) Int ¶ added in v0.14.0
func (o *ChatInputInteractionCommandOption) Int() int
Int returns the option's value as an int.
Panics if the underlying JSON value cannot be unmarshaled into an int. Make sure the option's Type is ApplicationCommandOptionTypeInteger before calling.
func (*ChatInputInteractionCommandOption) Snowflake ¶ added in v0.14.0
func (o *ChatInputInteractionCommandOption) Snowflake() Snowflake
Snowflake returns the option's value as a Snowflake.
Panics if the underlying JSON value cannot be unmarshaled into a Snowflake. Make sure the option's Type corresponds to an ID-based option before calling.
func (*ChatInputInteractionCommandOption) String ¶ added in v0.14.0
func (o *ChatInputInteractionCommandOption) String() string
String returns the option's value as a string.
Panics if the underlying JSON value cannot be unmarshaled into a string. Make sure the option's Type is ApplicationCommandOptionTypeString before calling.
type ChoiceBase ¶
type ChoiceBase struct {
// Autocomplete indicates whether autocomplete interactions are enabled for this option.
//
// Info:
// - May not be set to true if choices are present.
// - Options using autocomplete are not confined to only use choices given by the application.
Autocomplete bool `json:"autocomplete,omitempty"`
}
ChoiceBase contains the autocomplete field for choice-based options.
type ChoiceFieldsFloat ¶
type ChoiceFieldsFloat struct {
// Choices is an array of choices for the user to pick from.
//
// Info:
// - Maximum of 25 choices.
Choices []ApplicationCommandOptionChoiceFloat `json:"choices,omitempty"`
}
ChoiceFieldsFloat contains fields for float choice options.
type ChoiceFieldsInteger ¶
type ChoiceFieldsInteger struct {
// Choices is an array of choices for the user to pick from.
//
// Info:
// - Maximum of 25 choices.
Choices []ApplicationCommandOptionChoiceInteger `json:"choices,omitempty"`
}
ChoiceFieldsInteger contains fields for integer choice options.
type ChoiceFieldsString ¶
type ChoiceFieldsString struct {
// Choices is an array of choices for the user to pick from.
//
// Info:
// - Maximum of 25 choices.
Choices []ApplicationCommandOptionChoiceString `json:"choices,omitempty"`
}
ChoiceFieldsString contains fields for string choice options.
type ChoiceOptionBase ¶
type ChoiceOptionBase struct {
// Name is the name of the choice.
//
// Info:
// - Must be 1-100 characters.
Name string `json:"name"`
// NameLocalizations is a localization dictionary for the choice name.
//
// Info:
// - Keys are available locales.
// - Values follow the same restrictions as Name (1-100 characters).
NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
}
ChoiceOptionBase contains fields common to all choice option types.
type Client ¶ added in v0.14.0
type Client struct {
Logger xlog.Logger // logger used throughout the client
CacheManager // CacheManager for caching discord entities
// contains filtered or unexported fields
}
Client manages your Discord connection at a high level, grouping multiple shards together.
It provides:
- Central configuration for your bot token, intents, and logger.
- REST API access via requester.
- Event dispatching via dispatcher.
- Shard management for scalable Gateway connections.
Create a Client using dwaz.New() with desired options, then call Start(). Client manages your Discord connection at a high level, grouping multiple shards together.
It provides:
- Central configuration for your bot token, intents, and logger.
- REST API access via restApi.
- Event dispatching via dispatcher.
- Shard management for scalable Gateway connections.
Create a Client using dwaz.New() with desired options, then call Start().
func New ¶
New creates a new Client instance with provided options.
Example:
y := dwaz.New(
dwaz.WithToken("my_bot_token"),
dwaz.WithIntents(GatewayIntentGuilds, GatewayIntentMessageContent),
dwaz.WithLogger(myLogger),
)
Defaults:
- Logger: stdout logger at Info level.
- Intents: GatewayIntentGuilds | GatewayIntentGuildMessages | GatewayIntentGuildMembers
- Executor: SpawnExecutor (goroutine per task)
func (Client) AddMember ¶ added in v0.15.0
func (r Client) AddMember(guildID, userID Snowflake, opts AddMemberOptions) result.Result[FullMember]
AddMember adds a user to the guild using their OAuth2 access token.
The access token must have the guilds.join scope. If the user is already in the guild, this has no effect.
Note: - The bot must be a member of the guild with PermissionCreateInstantInvite permission. - For guilds with Membership Screening enabled, this endpoint will default to adding new members as pending in the guild member object. Members that are pending will have to complete membership screening before they become full members that can talk.
func (Client) AddMemberRole ¶ added in v0.15.0
func (r Client) AddMemberRole(guildID, userID, roleID Snowflake, opts AddMemberRoleOptions) result.Void
AddMemberRole assigns a role to a member in a guild.
Requires the PermissionManageRoles permission.
func (Client) AddThreadMember ¶ added in v0.15.0
AddThreadMember adds a member to a thread.
func (Client) BanMember ¶ added in v0.15.0
func (r Client) BanMember(guildID, userID Snowflake, opts BanMemberOptions) result.Void
BanMember ban's a guild member.
Requires the PermissionBanMembers permission.
func (Client) BeginGuildPrune ¶ added in v0.15.0
func (r Client) BeginGuildPrune(guildID Snowflake, opts BeginGuildPruneOptions) result.Result[PruneCount]
BeginGuildPrune Begin a prune operation.
Requires the PermissionManageGuild and PermissionKickMembers permission.
func (Client) BulkBanMembers ¶ added in v0.15.0
func (r Client) BulkBanMembers(guildID Snowflake, opts BulkBanMembersOptions) result.Result[BulkBanResponse]
BulkBanMembers bans up to 200 users from a guild.
Reference: https://discord.com/developers/docs/resources/guild#bulk-guild-ban
func (Client) CreateApplicationEmoji ¶ added in v0.15.0
func (r Client) CreateApplicationEmoji(applicationID Snowflake, opts CreateApplicationEmojiOptions) result.Result[Emoji]
CreateApplicationEmoji creates a new emoji for an application.
Emojis and animated emojis have a maximum file size of 256 KiB. Attempting to upload an emoji larger than this limit will fail with an error.
Reference: https://discord.com/developers/docs/resources/emoji#create-application-emoji
func (Client) CreateChannel ¶ added in v0.15.0
func (r Client) CreateChannel(guildID Snowflake, opts CreateChannelOptions) result.Result[GuildChannel]
CreateChannel creates a new channel for the guild.
Requires the PermissionManageChannels permission.
Reference: https://discord.com/developers/docs/resources/guild#create-guild-channel
func (Client) CreateChannelInvite ¶ added in v0.15.0
func (r Client) CreateChannelInvite(channelID Snowflake, opts CreateChannelInviteOptions) result.Result[Invite]
CreateChannelInvite creates a new invite object for the channel.
Note:
- Only usable for guild channels.
Requires the PermissionCreateInstantInvite permission.
func (Client) CreateGuildEmoji ¶ added in v0.15.0
func (r Client) CreateGuildEmoji(guildID Snowflake, opts CreateGuildEmojiOptions) result.Result[Emoji]
CreateGuildEmoji creates a new emoji for the guild.
Requires the PermissionCreateGuildExpressions permission.
Emojis and animated emojis have a maximum file size of 256 KiB. Attempting to upload an emoji larger than this limit will fail with an error.
Reference: https://discord.com/developers/docs/resources/emoji#create-guild-emoji
func (Client) CreateRole ¶ added in v0.15.0
func (r Client) CreateRole(guildID Snowflake, opts CreateRoleOptions) result.Result[Role]
CreateRole creates a new role for the guild.
Requires the PermissionManageRoles permission.
func (Client) DeleteApplicationEmoji ¶ added in v0.15.0
DeleteApplicationEmoji deletes an application emoji.
Reference: https://discord.com/developers/docs/resources/emoji#delete-application-emoji
func (Client) DeleteChannel ¶ added in v0.15.0
func (r Client) DeleteChannel(channelID Snowflake, opts DeleteChannelOptions) result.Result[Channel]
DeleteChannel deletes/Close a channel.
Note:
- For Community guilds, the Rules or Guidelines channelID and the Community Updates channel cannot be deleted.
- Deleting a category does not delete its child channels;
Requires the PermissionManageChannels permission for the guild, or PermissionManageThreads if the channel is a thread.
func (Client) DeleteChannelPermission ¶ added in v0.15.0
func (r Client) DeleteChannelPermission(channelID Snowflake, overwriteID Snowflake, opts DeleteChannelPermissionOptions) result.Void
DeleteChannelPermission deletes a channel permission overwrite for a user or role in a channel.
Note:
- Only usable for guild channels.
Requires the PermissionManageRoles permission.
func (Client) DeleteGuildEmoji ¶ added in v0.15.0
DeleteGuildEmoji deletes the given emoji.
For emojis created by the current user, requires either the PermissionCreateGuildExpressions or PermissionManageGuildExpressions permission. For other emojis, requires the PermissionManageGuildExpressions permission.
Reference: https://discord.com/developers/docs/resources/emoji#delete-guild-emoji
func (Client) DeleteGuildIntegration ¶ added in v0.15.0
func (r Client) DeleteGuildIntegration(guildID, integrationID Snowflake, opts DeleteGuildIntegrationOptions) result.Void
DeleteGuildIntegration deletes the attached integration object for the guild. Deletes any associated webhooks and kicks the associated bot if there is one.
Requires the PermissionManageGuild permission.
func (Client) DeleteInvite ¶ added in v0.15.0
func (r Client) DeleteInvite(code string, opts DeleteInviteOptions) result.Result[Invite]
DeleteInvite deletes an invite.
Requires the PermissionManageChannels permission on the channel this invite belongs to, or PermissionManageGuild to remove any invite across the guild.
func (Client) DeleteRole ¶ added in v0.15.0
func (r Client) DeleteRole(guildID, roleID Snowflake, opts DeleteRoleOptions) result.Void
DeleteRole delete's a guild role.
Requires the PermissionManageRoles permission.
func (Client) DoRequest ¶ added in v0.15.0
func (r Client) DoRequest(req Request) result.Result[io.ReadCloser]
DoRequest executes a request with a raw body and returns the response body as a stream. The caller is responsible for closing the body.
func (Client) EditChannelPermissions ¶ added in v0.15.0
func (r Client) EditChannelPermissions(channelID Snowflake, overwriteID Snowflake, opts EditChannelPermissionsOptions) result.Void
EditChannelPermissions edits the channel permission overwrites for a user or role in a channel.
func (Client) FetchApplicationEmoji ¶ added in v0.15.0
FetchApplicationEmoji retrieves a specific emoji from an application.
Includes the user field.
Reference: https://discord.com/developers/docs/resources/emoji#get-application-emoji
func (Client) FetchChannel ¶ added in v0.14.0
FetchChannel retrieves a channel by its ID.
Returns a Channel interface which can be asserted to specific types.
func (Client) FetchChannelInvites ¶ added in v0.15.0
func (r Client) FetchChannelInvites(channelID Snowflake) result.Result[[]FullInvite]
FetchChannelInvites Returns a list of invite objects for the channel
Note:
- Only usable for guild channels.
Requires the PermissionManageChannels permission.
func (Client) FetchGatewayBot ¶ added in v0.14.0
func (r Client) FetchGatewayBot() result.Result[GatewayBot]
FetchGatewayBot retrieves bot gateway information including recommended shard count and session limits.
func (Client) FetchGuild ¶ added in v0.15.0
func (r Client) FetchGuild(guildID Snowflake, opts FetchGuildOptions) result.Result[RestGuild]
FetchGuild retrieves a guild by its ID.
Reference: https://discord.com/developers/docs/resources/guild#get-guild
func (Client) FetchGuildBan ¶ added in v0.15.0
FetchGuildBan returns a ban object for the given user.
Note: - When the method returns Ok(Some(Ban)), the request succeeded and the user is banned. When it returns Ok(None), the request also succeeded but there is no ban for the given user ID. If the method returns Err(err), the request did not succeed.
Requires the PermissionBanMembers permission.
func (Client) FetchGuildBans ¶ added in v0.15.0
func (r Client) FetchGuildBans(guildID Snowflake, opts FetchGuildBansOptions) result.Result[[]Ban]
FetchGuildBans returns a list of ban objects for the users banned from this guild.
Note: - Provide a user id to before and after for pagination. Users will always be returned in ascending order by 'user.id'. If both before and after are provided, only before is respected.
Requires the PermissionBanMembers permission.
func (Client) FetchGuildChannels ¶ added in v0.15.0
func (r Client) FetchGuildChannels(guildID Snowflake) result.Result[[]GuildChannel]
FetchGuildChannels returns a list of guild channel objects.
Note:
- Does not include threads.
Reference: https://discord.com/developers/docs/resources/guild#get-guild-channels
func (Client) FetchGuildEmoji ¶ added in v0.15.0
FetchGuildEmoji retrieves an emoji object for the given guild and emoji IDs.
Includes the user field if the bot has the PermissionManageGuildExpressions permission, or if the bot created the emoji and has the PermissionCreateGuildExpressions permission.
Reference: https://discord.com/developers/docs/resources/emoji#get-guild-emoji
func (Client) FetchGuildIntegrations ¶ added in v0.15.0
func (r Client) FetchGuildIntegrations(guildID Snowflake) result.Result[[]Integration]
FetchGuildIntegrations returns a list of integration objects for the guild.
Note:
- This endpoint returns a maximum of 50 integrations. If a guild has more integrations, they cannot be accessed.
Requires the PermissionManageGuild permission.
func (Client) FetchGuildInvites ¶ added in v0.15.0
func (r Client) FetchGuildInvites(guildID Snowflake) result.Result[[]FullInvite]
FetchGuildVoiceRegions returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.
Requires the PermissionManageGuild and PermissionKickMembers permission.
func (Client) FetchGuildOnboarding ¶ added in v0.15.0
func (r Client) FetchGuildOnboarding(guildID Snowflake) result.Result[GuildOnboarding]
FetchGuildOnboarding returns the Onboarding object for the guild.
Requires the PermissionManageGuild and PermissionManageRoles permissions.
func (Client) FetchGuildPreview ¶ added in v0.15.0
func (r Client) FetchGuildPreview(guildID Snowflake) result.Result[GuildPreview]
FetchGuildPreview retrieves a guild preview by its ID.
Reference: https://discord.com/developers/docs/resources/guild#get-guild-preview
func (Client) FetchGuildPruneCount ¶ added in v0.15.0
func (r Client) FetchGuildPruneCount(guildID Snowflake, opts FetchGuildPruneCountOptions) result.Result[PruneCount]
FetchGuildPruneCount returns an object with one pruned key indicating the number of members that would be removed in a prune operation.
Requires the PermissionManageGuild and PermissionKickMembers permission.
func (Client) FetchGuildVanityURL ¶ added in v0.15.0
func (r Client) FetchGuildVanityURL(guildID Snowflake) result.Result[PartialInvite]
FetchGuildVanityURL returns a partial invite object for guilds with the feature enabled.
Requires the PermissionManageGuild permission.
func (Client) FetchGuildVoiceRegions ¶ added in v0.15.0
func (r Client) FetchGuildVoiceRegions(guildID Snowflake) result.Result[[]VoiceRegion]
FetchGuildVoiceRegions returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.
func (Client) FetchGuildWelcomeScreen ¶ added in v0.15.0
func (r Client) FetchGuildWelcomeScreen(guildID Snowflake) result.Result[GuildWelcomeScreen]
FetchGuildWelcomeScreen returns the Welcome Screen object for the guild.
Requires the PermissionManageGuild permission.
func (Client) FetchGuildWidget ¶ added in v0.15.0
func (r Client) FetchGuildWidget(guildID Snowflake) result.Result[GuildWidget]
FetchGuildWidget returns the widget for the guild.
func (Client) FetchGuildWidgetImage ¶ added in v0.15.0
func (r Client) FetchGuildWidgetImage(guildID Snowflake, opts FetchGuildWidgetImageOptions) string
FetchGuildWidgetImage returns a URL for a PNG image widget for the guild.
func (Client) FetchGuildWidgetSettings ¶ added in v0.15.0
func (r Client) FetchGuildWidgetSettings(guildID Snowflake) result.Result[GuildWidgetSettings]
FetchGuildWidgetSettings returns a guild widget settings object.
Requires the PermissionManageGuild permission.
func (Client) FetchInvite ¶ added in v0.15.0
func (r Client) FetchInvite(code string, opts FetchInviteOptions) result.Result[Invite]
FetchInvite retrieves a invite by its code.
func (Client) FetchMember ¶ added in v0.15.0
func (r Client) FetchMember(guildID, userID Snowflake) result.Result[FullMember]
FetchMember retrieves a guild member object for the specified user.
func (Client) FetchRole ¶ added in v0.15.0
FetchRole returns a role object for the specified role id.
func (Client) FetchRoles ¶ added in v0.15.0
FetchRoles returns a list of role objects for the guild.
func (Client) FetchRolesMemberCount ¶ added in v0.15.0
FetchRolesMemberCount returns a map of role IDs to the number of members with the role.
Note: - Does not include the @everyone role.
func (Client) FetchThreadMember ¶ added in v0.15.0
func (r Client) FetchThreadMember(channelID Snowflake, userID Snowflake, opts FetchThreadMemberOptions) result.Result[ThreadMember]
FetchThreadMember retrieves a thread member.
func (Client) FollowAnnouncementChannel ¶ added in v0.15.0
func (r Client) FollowAnnouncementChannel(channelID Snowflake, opts FollowAnnouncementChannelOptions) result.Result[FollowedChannel]
FollowAnnouncementChannel follows an Announcement Channel to send messages to a target channel.
Note:
- Only usable for guild channels.
Requires the PermissionManageWebhooks permission in the target channel.
func (Client) GroupDMAddRecipient ¶ added in v0.15.0
func (r Client) GroupDMAddRecipient(channelID Snowflake, userID Snowflake, opts GroupDMAddRecipientOptions) result.Void
GroupDMAddRecipient adds a recipient to a Group DM using their access token.
func (Client) GroupDMRemoveRecipient ¶ added in v0.15.0
GroupDMRemoveRecipient removes a recipient from a Group DM.
func (Client) JoinThread ¶ added in v0.15.0
JoinThread adds the current user to a thread.
func (Client) KickMember ¶ added in v0.15.0
func (r Client) KickMember(guildID, userID Snowflake, opts KickMemberOptions) result.Void
KickMember kicks a member from a guild.
Requires the PermissionKickMembers permission.
func (Client) LeaveThread ¶ added in v0.15.0
LeaveThread removes the current user from a thread.
func (Client) ListActiveGuildThreads ¶ added in v0.15.0
func (r Client) ListActiveGuildThreads(guildID Snowflake) result.Result[ActiveThreadsResponse]
ListActiveGuildThreads returns all active threads in the guild.
Reference: https://discord.com/developers/docs/resources/guild#list-active-guild-threads
func (Client) ListApplicationEmojis ¶ added in v0.15.0
ListApplicationEmojis retrieves all emojis for an application.
Includes a user object for the team member that uploaded the emoji from the app's settings, or for the bot user if uploaded using the API.
Reference: https://discord.com/developers/docs/resources/emoji#list-application-emojis
func (Client) ListGuildEmojis ¶ added in v0.15.0
ListGuildEmojis retrieves a list of emoji objects for the given guild.
Includes user fields if the bot has the PermissionCreateGuildExpressions or PermissionManageGuildExpressions permission.
Reference: https://discord.com/developers/docs/resources/emoji#list-guild-emojis
func (Client) ListJoinedPrivateArchivedThreads ¶ added in v0.15.0
func (r Client) ListJoinedPrivateArchivedThreads(channelID Snowflake, opts ListJoinedPrivateArchivedThreadsOptions) result.Result[ListArchivedThreadsResponse]
ListJoinedPrivateArchivedThreads retrieves a list of private archived threads that the current user has joined.
func (Client) ListMembers ¶ added in v0.15.0
func (r Client) ListMembers(guildID Snowflake) result.Result[[]FullMember]
ListMembers retrieves a paginated list of members in a guild.
Note: - This endpoint is restricted according to whether the GUILD_MEMBERS Privileged Intent is enabled for your application.
func (Client) ListMembersWithOptions ¶ added in v0.15.0
func (r Client) ListMembersWithOptions(guildID Snowflake, opts ListMembersOptions) result.Result[[]FullMember]
ListMembers retrieves a paginated list of members in a guild.
Note: - This endpoint is restricted according to whether the GUILD_MEMBERS Privileged Intent is enabled for your application.
func (Client) ListPrivateArchivedThreads ¶ added in v0.15.0
func (r Client) ListPrivateArchivedThreads(channelID Snowflake, opts ListArchivedThreadsOptions) result.Result[ListArchivedThreadsResponse]
ListPrivateArchivedThreads retrieves a list of private archived threads.
func (Client) ListPublicArchivedThreads ¶ added in v0.15.0
func (r Client) ListPublicArchivedThreads(channelID Snowflake, opts ListArchivedThreadsOptions) result.Result[ListArchivedThreadsResponse]
ListPublicArchivedThreads retrieves a list of public archived threads.
func (Client) ListThreadMembers ¶ added in v0.15.0
func (r Client) ListThreadMembers(channelID Snowflake, opts ListThreadMembersOptions) result.Result[[]ThreadMember]
ListThreadMembers retrieves a list of thread members.
func (Client) ModifyApplicationEmoji ¶ added in v0.15.0
func (r Client) ModifyApplicationEmoji(applicationID, emojiID Snowflake, opts ModifyApplicationEmojiOptions) result.Result[Emoji]
ModifyApplicationEmoji updates an existing application emoji.
Reference: https://discord.com/developers/docs/resources/emoji#modify-application-emoji
func (Client) ModifyChannelPositions ¶ added in v0.15.0
func (r Client) ModifyChannelPositions(guildID Snowflake, opts ModifyChannelPositionOptions) result.Void
ModifyChannelPositions modifies the positions of a set of channel objects for the guild.
Requires the PermissionManageChannels permission.
Reference: https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
func (Client) ModifyCurrentMember ¶ added in v0.15.0
func (r Client) ModifyCurrentMember(guildID Snowflake, opts ModifyCurrentMemberOptions) result.Result[FullMember]
ModifyCurrentMember updates your bot's member properties in a guild.
func (Client) ModifyGroupDMChannel ¶ added in v0.15.0
func (r Client) ModifyGroupDMChannel(channelID Snowflake, opts ModifyGroupDMOptions) result.Result[*GroupDMChannel]
ModifyGroupDMChannel updates a group DM channel's settings.
func (Client) ModifyGuild ¶ added in v0.15.0
func (r Client) ModifyGuild(guildID Snowflake, opts ModifyGuildOptions) result.Result[Guild]
ModifyGuild modifies a guild's settings and returns the updated guild object.
Requires the PermissionManageGuild permission.
Note:
- Attempting to add or remove the GuildFeatureCommunity guild feature requires the PermissionAdministrator permission
Reference: https://discord.com/developers/docs/resources/guild#modify-guild
func (Client) ModifyGuildChannel ¶ added in v0.15.0
func (r Client) ModifyGuildChannel(channelID Snowflake, opts ModifyGuildChannelOptions) result.Result[GuildChannel]
ModifyGuildChannel updates a guild channel's settings.
Requires the PermissionManageChannels permission.
func (Client) ModifyGuildEmoji ¶ added in v0.15.0
func (r Client) ModifyGuildEmoji(guildID, emojiID Snowflake, opts ModifyGuildEmojiOptions) result.Result[Emoji]
ModifyGuildEmoji updates the given emoji.
For emojis created by the current user, requires either the PermissionCreateGuildExpressions or PermissionManageGuildExpressions permission. For other emojis, requires the PermissionManageGuildExpressions permission.
Reference: https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
func (Client) ModifyGuildIncidentActions ¶ added in v0.15.0
func (r Client) ModifyGuildIncidentActions(guildID Snowflake, opts ModifyGuildIncidentActionsOptions) result.Result[GuildIncidentsData]
ModifyGuildIncidentActions modifies the incident actions of the guild.
Requires the PermissionManageGuild permission.
func (Client) ModifyGuildOnboarding ¶ added in v0.15.0
func (r Client) ModifyGuildOnboarding(guildID Snowflake, opts ModifyGuildOnboardingOptions) result.Result[GuildOnboarding]
ModifyGuildOnboarding modifies the onboarding configuration of the guild.
Note:
- Onboarding enforces constraints when enabled. These constraints are that there must be at least 7 Default Channels and at least 5 of them must allow sending messages to the @everyone role. The mode field modifies what is considered when enforcing these constraints.
Requires the PermissionManageGuild and PermissionManageRoles permissions.
func (Client) ModifyGuildThread ¶ added in v0.15.0
func (r Client) ModifyGuildThread(channelID Snowflake, opts ModifyGuildThreadOptions) result.Result[*ThreadChannel]
ModifyGuildThread updates a guild thread channel's settings.
Requires the PermissionManageThreads permission.
func (Client) ModifyGuildWelcomeScreen ¶ added in v0.15.0
func (r Client) ModifyGuildWelcomeScreen(guildID Snowflake, opts ModifyGuildWelcomeScreenOptions) result.Result[GuildWelcomeScreen]
ModifyGuildWelcomeScreen modifies the guild's Welcome Screen.
Requires the PermissionManageGuild permission.
func (Client) ModifyGuildWidget ¶ added in v0.15.0
func (r Client) ModifyGuildWidget(guildID Snowflake, opts ModifyGuildWidgetOptions) result.Result[GuildWidgetSettings]
ModifyGuildWidget modifies a guild widget settings object for the guild.
func (Client) ModifyMember ¶ added in v0.15.0
func (r Client) ModifyMember(guildID, userID Snowflake, opts ModifyMemberOptions) result.Result[FullMember]
ModifyMember updates a member's properties in a guild.
func (Client) ModifyRole ¶ added in v0.15.0
func (r Client) ModifyRole(guildID, roleID Snowflake, opts ModifyRoleOptions) result.Result[Role]
ModifyRole updates a member's properties in a guild.
Requires the PermissionManageRoles permission.
func (Client) ModifyRolePositions ¶ added in v0.15.0
func (r Client) ModifyRolePositions(guildID Snowflake, opts ModifyRolePositionsOptions) result.Result[[]Role]
ModifyRolePositions modifies the positions of a set of roles.
Requires the PermissionManageRoles permission.
func (Client) OnApplicationCommandPermissionsUpdate ¶ added in v0.15.0
func (d Client) OnApplicationCommandPermissionsUpdate(h func(ApplicationCommandPermissionsUpdateEvent))
OnApplicationCommandPermissionsUpdate registers a handler for 'APPLICATION_COMMAND_PERMISSIONS_UPDATE' events.
func (Client) OnAutoModerationActionExecution ¶ added in v0.15.0
func (d Client) OnAutoModerationActionExecution(h func(AutoModerationActionExecutionEvent))
OnAutoModerationActionExecution registers a handler for 'AUTO_MODERATION_ACTION_EXECUTION' events.
func (Client) OnAutoModerationRuleCreate ¶ added in v0.15.0
func (d Client) OnAutoModerationRuleCreate(h func(AutoModerationRuleCreateEvent))
OnAutoModerationRuleCreate registers a handler for 'AUTO_MODERATION_RULE_CREATE' events.
func (Client) OnAutoModerationRuleDelete ¶ added in v0.15.0
func (d Client) OnAutoModerationRuleDelete(h func(AutoModerationRuleDeleteEvent))
OnAutoModerationRuleDelete registers a handler for 'AUTO_MODERATION_RULE_DELETE' events.
func (Client) OnAutoModerationRuleUpdate ¶ added in v0.15.0
func (d Client) OnAutoModerationRuleUpdate(h func(AutoModerationRuleUpdateEvent))
OnAutoModerationRuleUpdate registers a handler for 'AUTO_MODERATION_RULE_UPDATE' events.
func (Client) OnChannelCreate ¶ added in v0.15.0
func (d Client) OnChannelCreate(h func(ChannelCreateEvent))
OnChannelCreate registers a handler for 'CHANNEL_CREATE' events.
func (Client) OnChannelDelete ¶ added in v0.15.0
func (d Client) OnChannelDelete(h func(ChannelDeleteEvent))
OnChannelDelete registers a handler for 'CHANNEL_DELETE' events.
func (Client) OnChannelPinsUpdate ¶ added in v0.15.0
func (d Client) OnChannelPinsUpdate(h func(ChannelPinsUpdateEvent))
OnChannelPinsUpdate registers a handler for 'CHANNEL_PINS_UPDATE' events.
func (Client) OnChannelUpdate ¶ added in v0.15.0
func (d Client) OnChannelUpdate(h func(ChannelUpdateEvent))
OnChannelUpdate registers a handler for 'CHANNEL_UPDATE' events.
func (Client) OnEntitlementCreate ¶ added in v0.15.0
func (d Client) OnEntitlementCreate(h func(EntitlementCreateEvent))
OnEntitlementCreate registers a handler for 'ENTITLEMENT_CREATE' events.
func (Client) OnEntitlementDelete ¶ added in v0.15.0
func (d Client) OnEntitlementDelete(h func(EntitlementDeleteEvent))
OnEntitlementDelete registers a handler for 'ENTITLEMENT_DELETE' events.
func (Client) OnEntitlementUpdate ¶ added in v0.15.0
func (d Client) OnEntitlementUpdate(h func(EntitlementUpdateEvent))
OnEntitlementUpdate registers a handler for 'ENTITLEMENT_UPDATE' events.
func (Client) OnGuildAuditLogEntryCreate ¶ added in v0.15.0
func (d Client) OnGuildAuditLogEntryCreate(h func(GuildAuditLogEntryCreateEvent))
OnGuildAuditLogEntryCreate registers a handler for 'GUILD_AUDIT_LOG_ENTRY_CREATE' events.
func (Client) OnGuildBanAdd ¶ added in v0.15.0
func (d Client) OnGuildBanAdd(h func(GuildBanAddEvent))
OnGuildBanAdd registers a handler for 'GUILD_BAN_ADD' events.
func (Client) OnGuildBanRemove ¶ added in v0.15.0
func (d Client) OnGuildBanRemove(h func(GuildBanRemoveEvent))
OnGuildBanRemove registers a handler for 'GUILD_BAN_REMOVE' events.
func (Client) OnGuildDelete ¶ added in v0.15.0
func (d Client) OnGuildDelete(h func(GuildDeleteEvent))
OnGuildDelete registers a handler for 'GUILD_DELETE' events.
func (Client) OnGuildEmojisUpdate ¶ added in v0.15.0
func (d Client) OnGuildEmojisUpdate(h func(GuildEmojisUpdateEvent))
OnGuildEmojisUpdate registers a handler for 'GUILD_EMOJIS_UPDATE' events.
func (Client) OnGuildIntegrationsUpdate ¶ added in v0.15.0
func (d Client) OnGuildIntegrationsUpdate(h func(GuildIntegrationsUpdateEvent))
OnGuildIntegrationsUpdate registers a handler for 'GUILD_INTEGRATIONS_UPDATE' events.
func (Client) OnGuildMemberAdd ¶ added in v0.15.0
func (d Client) OnGuildMemberAdd(h func(GuildMemberAddEvent))
OnGuildMemberAdd registers a handler for 'GUILD_MEMBER_ADD' events.
func (Client) OnGuildMemberRemove ¶ added in v0.15.0
func (d Client) OnGuildMemberRemove(h func(GuildMemberRemoveEvent))
OnGuildMemberRemove registers a handler for 'GUILD_MEMBER_REMOVE' events.
func (Client) OnGuildMemberUpdate ¶ added in v0.15.0
func (d Client) OnGuildMemberUpdate(h func(GuildMemberUpdateEvent))
OnGuildMemberUpdate registers a handler for 'GUILD_MEMBER_UPDATE' events.
func (Client) OnGuildMembersChunk ¶ added in v0.15.0
func (d Client) OnGuildMembersChunk(h func(GuildMembersChunkEvent))
OnGuildMembersChunk registers a handler for 'GUILD_MEMBERS_CHUNK' events.
func (Client) OnGuildRoleCreate ¶ added in v0.15.0
func (d Client) OnGuildRoleCreate(h func(GuildRoleCreateEvent))
OnGuildRoleCreate registers a handler for 'GUILD_ROLE_CREATE' events.
func (Client) OnGuildRoleDelete ¶ added in v0.15.0
func (d Client) OnGuildRoleDelete(h func(GuildRoleDeleteEvent))
OnGuildRoleDelete registers a handler for 'GUILD_ROLE_DELETE' events.
func (Client) OnGuildRoleUpdate ¶ added in v0.15.0
func (d Client) OnGuildRoleUpdate(h func(GuildRoleUpdateEvent))
OnGuildRoleUpdate registers a handler for 'GUILD_ROLE_UPDATE' events.
func (Client) OnGuildScheduledEventCreate ¶ added in v0.15.0
func (d Client) OnGuildScheduledEventCreate(h func(GuildScheduledEventCreateEvent))
OnGuildScheduledEventCreate registers a handler for 'GUILD_SCHEDULED_EVENT_CREATE' events.
func (Client) OnGuildScheduledEventDelete ¶ added in v0.15.0
func (d Client) OnGuildScheduledEventDelete(h func(GuildScheduledEventDeleteEvent))
OnGuildScheduledEventDelete registers a handler for 'GUILD_SCHEDULED_EVENT_DELETE' events.
func (Client) OnGuildScheduledEventUpdate ¶ added in v0.15.0
func (d Client) OnGuildScheduledEventUpdate(h func(GuildScheduledEventUpdateEvent))
OnGuildScheduledEventUpdate registers a handler for 'GUILD_SCHEDULED_EVENT_UPDATE' events.
func (Client) OnGuildScheduledEventUserAdd ¶ added in v0.15.0
func (d Client) OnGuildScheduledEventUserAdd(h func(GuildScheduledEventUserAddEvent))
OnGuildScheduledEventUserAdd registers a handler for 'GUILD_SCHEDULED_EVENT_USER_ADD' events.
func (Client) OnGuildScheduledEventUserRemove ¶ added in v0.15.0
func (d Client) OnGuildScheduledEventUserRemove(h func(GuildScheduledEventUserRemoveEvent))
OnGuildScheduledEventUserRemove registers a handler for 'GUILD_SCHEDULED_EVENT_USER_REMOVE' events.
func (Client) OnGuildSoundboardSoundCreate ¶ added in v0.15.0
func (d Client) OnGuildSoundboardSoundCreate(h func(GuildSoundboardSoundCreateEvent))
OnGuildSoundboardSoundCreate registers a handler for 'GUILD_SOUNDBOARD_SOUND_CREATE' events.
func (Client) OnGuildSoundboardSoundDelete ¶ added in v0.15.0
func (d Client) OnGuildSoundboardSoundDelete(h func(GuildSoundboardSoundDeleteEvent))
OnGuildSoundboardSoundDelete registers a handler for 'GUILD_SOUNDBOARD_SOUND_DELETE' events.
func (Client) OnGuildSoundboardSoundUpdate ¶ added in v0.15.0
func (d Client) OnGuildSoundboardSoundUpdate(h func(GuildSoundboardSoundUpdateEvent))
OnGuildSoundboardSoundUpdate registers a handler for 'GUILD_SOUNDBOARD_SOUND_UPDATE' events.
func (Client) OnGuildSoundboardSoundsUpdate ¶ added in v0.15.0
func (d Client) OnGuildSoundboardSoundsUpdate(h func(GuildSoundboardSoundsUpdateEvent))
OnGuildSoundboardSoundsUpdate registers a handler for 'GUILD_SOUNDBOARD_SOUNDS_UPDATE' events.
func (Client) OnGuildStickersUpdate ¶ added in v0.15.0
func (d Client) OnGuildStickersUpdate(h func(GuildStickersUpdateEvent))
OnGuildStickersUpdate registers a handler for 'GUILD_STICKERS_UPDATE' events.
func (Client) OnGuildUpdate ¶ added in v0.15.0
func (d Client) OnGuildUpdate(h func(GuildUpdateEvent))
OnGuildUpdate registers a handler for 'GUILD_UPDATE' events.
func (Client) OnIntegrationCreate ¶ added in v0.15.0
func (d Client) OnIntegrationCreate(h func(IntegrationCreateEvent))
OnIntegrationCreate registers a handler for 'INTEGRATION_CREATE' events.
func (Client) OnIntegrationDelete ¶ added in v0.15.0
func (d Client) OnIntegrationDelete(h func(IntegrationDeleteEvent))
OnIntegrationDelete registers a handler for 'INTEGRATION_DELETE' events.
func (Client) OnIntegrationUpdate ¶ added in v0.15.0
func (d Client) OnIntegrationUpdate(h func(IntegrationUpdateEvent))
OnIntegrationUpdate registers a handler for 'INTEGRATION_UPDATE' events.
func (Client) OnInteractionCreate ¶ added in v0.14.0
func (d Client) OnInteractionCreate(h func(InteractionCreateEvent))
OnInteractionCreate registers a handler function for 'INTERACTION_CREATE' events.
func (Client) OnInviteCreate ¶ added in v0.15.0
func (d Client) OnInviteCreate(h func(InviteCreateEvent))
OnInviteCreate registers a handler for 'INVITE_CREATE' events.
func (Client) OnInviteDelete ¶ added in v0.15.0
func (d Client) OnInviteDelete(h func(InviteDeleteEvent))
OnInviteDelete registers a handler for 'INVITE_DELETE' events.
func (Client) OnMessageCreate ¶ added in v0.14.0
func (d Client) OnMessageCreate(h func(MessageCreateEvent))
OnMessageCreate registers a handler function for 'MESSAGE_CREATE' events.
func (Client) OnMessageDelete ¶ added in v0.14.0
func (d Client) OnMessageDelete(h func(MessageDeleteEvent))
OnMessageDelete registers a handler function for 'MESSAGE_DELETE' events.
func (Client) OnMessageDeleteBulk ¶ added in v0.15.0
func (d Client) OnMessageDeleteBulk(h func(MessageDeleteBulkEvent))
OnMessageDeleteBulk registers a handler for 'MESSAGE_DELETE_BULK' events.
func (Client) OnMessagePollVoteAdd ¶ added in v0.15.0
func (d Client) OnMessagePollVoteAdd(h func(MessagePollVoteAddEvent))
OnMessagePollVoteAdd registers a handler for 'MESSAGE_POLL_VOTE_ADD' events.
func (Client) OnMessagePollVoteRemove ¶ added in v0.15.0
func (d Client) OnMessagePollVoteRemove(h func(MessagePollVoteRemoveEvent))
OnMessagePollVoteRemove registers a handler for 'MESSAGE_POLL_VOTE_REMOVE' events.
func (Client) OnMessageReactionAdd ¶ added in v0.15.0
func (d Client) OnMessageReactionAdd(h func(MessageReactionAddEvent))
OnMessageReactionAdd registers a handler for 'MESSAGE_REACTION_ADD' events.
func (Client) OnMessageReactionRemove ¶ added in v0.15.0
func (d Client) OnMessageReactionRemove(h func(MessageReactionRemoveEvent))
OnMessageReactionRemove registers a handler for 'MESSAGE_REACTION_REMOVE' events.
func (Client) OnMessageReactionRemoveAll ¶ added in v0.15.0
func (d Client) OnMessageReactionRemoveAll(h func(MessageReactionRemoveAllEvent))
OnMessageReactionRemoveAll registers a handler for 'MESSAGE_REACTION_REMOVE_ALL' events.
func (Client) OnMessageReactionRemoveEmoji ¶ added in v0.15.0
func (d Client) OnMessageReactionRemoveEmoji(h func(MessageReactionRemoveEmojiEvent))
OnMessageReactionRemoveEmoji registers a handler for 'MESSAGE_REACTION_REMOVE_EMOJI' events.
func (Client) OnMessageUpdate ¶ added in v0.14.3
func (d Client) OnMessageUpdate(h func(MessageDeleteEvent))
OnMessageUpdate registers a handler function for 'MESSAGE_UPDATE' events.
func (Client) OnPresenceUpdate ¶ added in v0.15.0
func (d Client) OnPresenceUpdate(h func(PresenceUpdateEvent))
OnPresenceUpdate registers a handler for 'PRESENCE_UPDATE' events.
func (Client) OnSoundboardSounds ¶ added in v0.15.0
func (d Client) OnSoundboardSounds(h func(SoundboardSoundsEvent))
OnSoundboardSounds registers a handler for 'SOUNDBOARD_SOUNDS' events.
func (Client) OnStageInstanceCreate ¶ added in v0.15.0
func (d Client) OnStageInstanceCreate(h func(StageInstanceCreateEvent))
OnStageInstanceCreate registers a handler for 'STAGE_INSTANCE_CREATE' events.
func (Client) OnStageInstanceDelete ¶ added in v0.15.0
func (d Client) OnStageInstanceDelete(h func(StageInstanceDeleteEvent))
OnStageInstanceDelete registers a handler for 'STAGE_INSTANCE_DELETE' events.
func (Client) OnStageInstanceUpdate ¶ added in v0.15.0
func (d Client) OnStageInstanceUpdate(h func(StageInstanceUpdateEvent))
OnStageInstanceUpdate registers a handler for 'STAGE_INSTANCE_UPDATE' events.
func (Client) OnSubscriptionCreate ¶ added in v0.15.0
func (d Client) OnSubscriptionCreate(h func(SubscriptionCreateEvent))
OnSubscriptionCreate registers a handler for 'SUBSCRIPTION_CREATE' events.
func (Client) OnSubscriptionDelete ¶ added in v0.15.0
func (d Client) OnSubscriptionDelete(h func(SubscriptionDeleteEvent))
OnSubscriptionDelete registers a handler for 'SUBSCRIPTION_DELETE' events.
func (Client) OnSubscriptionUpdate ¶ added in v0.15.0
func (d Client) OnSubscriptionUpdate(h func(SubscriptionUpdateEvent))
OnSubscriptionUpdate registers a handler for 'SUBSCRIPTION_UPDATE' events.
func (Client) OnThreadCreate ¶ added in v0.15.0
func (d Client) OnThreadCreate(h func(ThreadCreateEvent))
OnThreadCreate registers a handler for 'THREAD_CREATE' events.
func (Client) OnThreadDelete ¶ added in v0.15.0
func (d Client) OnThreadDelete(h func(ThreadDeleteEvent))
OnThreadDelete registers a handler for 'THREAD_DELETE' events.
func (Client) OnThreadListSync ¶ added in v0.15.0
func (d Client) OnThreadListSync(h func(ThreadListSyncEvent))
OnThreadListSync registers a handler for 'THREAD_LIST_SYNC' events.
func (Client) OnThreadMemberUpdate ¶ added in v0.15.0
func (d Client) OnThreadMemberUpdate(h func(ThreadMemberUpdateEvent))
OnThreadMemberUpdate registers a handler for 'THREAD_MEMBER_UPDATE' events.
func (Client) OnThreadMembersUpdate ¶ added in v0.15.0
func (d Client) OnThreadMembersUpdate(h func(ThreadMembersUpdateEvent))
OnThreadMembersUpdate registers a handler for 'THREAD_MEMBERS_UPDATE' events.
func (Client) OnThreadUpdate ¶ added in v0.15.0
func (d Client) OnThreadUpdate(h func(ThreadUpdateEvent))
OnThreadUpdate registers a handler for 'THREAD_UPDATE' events.
func (Client) OnTypingStart ¶ added in v0.15.0
func (d Client) OnTypingStart(h func(TypingStartEvent))
OnTypingStart registers a handler for 'TYPING_START' events.
func (Client) OnUserUpdate ¶ added in v0.15.0
func (d Client) OnUserUpdate(h func(UserUpdateEvent))
OnUserUpdate registers a handler for 'USER_UPDATE' events.
func (Client) OnVoiceChannelEffectSend ¶ added in v0.15.0
func (d Client) OnVoiceChannelEffectSend(h func(VoiceChannelEffectSendEvent))
OnVoiceChannelEffectSend registers a handler for 'VOICE_CHANNEL_EFFECT_SEND' events.
func (Client) OnVoiceServerUpdate ¶ added in v0.15.0
func (d Client) OnVoiceServerUpdate(h func(VoiceServerUpdateEvent))
OnVoiceServerUpdate registers a handler for 'VOICE_SERVER_UPDATE' events.
func (Client) OnVoiceStateUpdate ¶ added in v0.14.3
func (d Client) OnVoiceStateUpdate(h func(VoiceStateUpdateEvent))
OnVoiceStateUpdate registers a handler function for 'VOICE_STATE_UPDATE' events.
func (Client) OnWebhooksUpdate ¶ added in v0.15.0
func (d Client) OnWebhooksUpdate(h func(WebhooksUpdateEvent))
OnWebhooksUpdate registers a handler for 'WEBHOOKS_UPDATE' events.
func (Client) RemoveMemberRole ¶ added in v0.15.0
func (r Client) RemoveMemberRole(guildID, userID, roleID Snowflake, opts RemoveMemberRoleOptions) result.Void
RemoveMemberRole unassigns a role from a member in a guild.
Requires the PermissionManageRoles permission.
func (Client) RemoveThreadMember ¶ added in v0.15.0
RemoveThreadMember removes a member from a thread.
Requires the PermissionManageThreads permission, or the creator of the thread if it is a 'PrivateThread'.
func (Client) SearchMembers ¶ added in v0.15.0
func (r Client) SearchMembers(guildID Snowflake, opts SearchMembersOptions) result.Result[[]FullMember]
SearchMembers returns a list of guild member objects whose username or nickname starts with a provided string.
func (*Client) Shutdown ¶ added in v0.14.0
func (c *Client) Shutdown()
Shutdown cleanly shuts down the Client.
It:
- Logs shutdown message.
- Shuts down the REST API client (closes idle connections).
- Shuts down all managed shards via ShardManager.
func (*Client) Start ¶ added in v0.14.0
Start initializes and connects all shards for the client.
It performs the following steps:
- Retrieves Gateway information from Discord.
- Creates and connects shards with appropriate rate limiting.
- Starts listening to Gateway events.
The lifetime of the client is controlled by the provided context `ctx`:
- If `ctx` is `nil` or `context.Background()`, Start will block forever, running the client until the program exits or Shutdown is called externally.
- If `ctx` is cancellable (e.g., created via context.WithCancel or context.WithTimeout), the client will run until the context is cancelled or times out. When the context is done, the client will shutdown gracefully and Start will return.
This design gives you full control over the client's lifecycle. For typical usage where you want the bot to run continuously, simply pass `nil` as the context (recommended for beginners).
Example usage:
// Run the client indefinitely (blocks forever)
err := client.Start(nil)
// Run the client with manual cancellation control
ctx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(time.Hour)
cancel() // stops the client after 1 hour
}()
err := client.Start(ctx)
Returns an error if Gateway information retrieval or shard connection fails. Start initializes and connects all shards for the client.
It performs the following steps:
- Retrieves Gateway information from Discord.
- Creates and connects shards with appropriate rate limiting.
- Starts listening to Gateway events.
The lifetime of the client is controlled by the provided context `ctx`:
- If `ctx` is `nil` or `context.Background()`, Start will block forever, running the client until the program exits or Shutdown is called externally.
- If `ctx` is cancellable (e.g., created via context.WithCancel or context.WithTimeout), the client will run until the context is cancelled or times out. When the context is done, the client will shutdown gracefully and Start will return.
This design gives you full control over the client's lifecycle. For typical usage where you want the bot to run continuously, simply pass `nil` as the context (recommended for beginners).
Example usage:
// Run the client indefinitely (blocks forever)
err := client.Start(nil)
// Run the client with manual cancellation control
ctx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(time.Hour)
cancel() // stops the client after 1 hour
}()
err := client.Start(ctx)
Returns an error if Gateway information retrieval or shard connection fails.
func (Client) StartThreadFromMessage ¶ added in v0.15.0
func (r Client) StartThreadFromMessage(channelID Snowflake, messageID Snowflake, opts StartThreadFromMessageOptions) result.Result[GuildChannel]
StartThreadFromMessage creates a new thread from an existing message.
Note:
When called on a 'GuildText' channel, creates a 'PublicThread'. When called on a 'GuildAnnouncement' channel, creates a 'AnnouncementThread'. Does not work on a 'GuildForum' or a 'GuildMedia' channel.
The id of the created thread will be the same as the id of the source message, and as such a message can only have a single thread created from it.
Requires the PermissionManageWebhooks permission in the target channel.
func (Client) StartThreadWithoutMessage ¶ added in v0.15.0
func (r Client) StartThreadWithoutMessage(channelID Snowflake, opts StartThreadWithoutMessageOptions) result.Result[GuildChannel]
StartThreadWithoutMessage creates a new thread.
func (Client) TriggerTypingIndicator ¶ added in v0.15.0
TriggerTypingIndicator posts a typing indicator for the specified channel.
Note:
- The typing indicator expires after 10 seconds.
func (Client) UnbanMember ¶ added in v0.15.0
func (r Client) UnbanMember(guildID, userID Snowflake, opts UnbanMemberOptions) result.Void
UnbanMember removes the ban for a user.
Requires the PermissionBanMembers permission.
type Collectibles ¶
type Collectibles struct {
// Nameplate is the user's nameplate collectible data.
//
// Optional:
// - May be nil if the user has no nameplate collectible.
Nameplate *Nameplate `json:"nameplate,omitempty"`
}
Collectibles represents collectibles the user owns, excluding avatar decorations and profile effects.
Reference: https://discord.com/developers/docs/resources/user#collectibles
type Color ¶
type Color int64
Color represents an RGB color encoded as an integer (e.g. 0xRRGGBB).
It is typically used to represent Discord embed colors or other hex color values.
const ( ColorWhite Color = 0xFFFFFF ColorDiscordWhite Color = 0xFFFFFE ColorLightGray Color = 0xC0C0C0 ColorGray Color = 0x808080 ColorDarkGray Color = 0x404040 ColorBlack Color = 0x000000 ColorDiscordBlack Color = 0x000001 ColorRed Color = 0xFF0000 ColorPink Color = 0xFFAFAF ColorOrange Color = 0xFFC800 ColorYellow Color = 0xFFFF00 ColorGreen Color = 0x00FF00 ColorMagenta Color = 0xFF00FF ColorCyan Color = 0x00FFFF ColorBlue Color = 0x0000FF ColorLightSeaGreen Color = 0x1ABC9C ColorMediumSeaGreen Color = 0x2ECC71 ColorSummerSky Color = 0x3498DB ColorDeepLilac Color = 0x9B59B6 ColorRuby Color = 0xE91E63 ColorMoonYellow Color = 0xF1C40F ColorTahitiGold Color = 0xE67E22 ColorCinnabar Color = 0xE74C3C ColorSubmarine Color = 0x95A5A6 ColorBlueAquamarine Color = 0x607D8B ColorDeepSea Color = 0x11806A ColorSeaGreen Color = 0x1F8B4C ColorEndeavour Color = 0x206694 ColorVividViolet Color = 0x71368A ColorJazzberryJam Color = 0xAD1457 ColorDarkGoldenrod Color = 0xC27C0E ColorRust Color = 0xA84300 ColorBrown Color = 0x992D22 ColorGrayChateau Color = 0x979C9F ColorBismark Color = 0x546E7A ColorStiBlue Color = 0x0E4BEF ColorWrxBlue Color = 0x00247D ColorRallyartCrimson Color = 0xE60012 ColorLime Color = 0x00FF00 ColorForestGreen Color = 0x228B22 ColorCadmiumGreen Color = 0x097969 ColorAquamarine Color = 0x7FFFD4 ColorBlueGreen Color = 0x088F8F ColorRaspberry Color = 0xE30B5C ColorScarletRed Color = 0xFF2400 ColorNight Color = 0x0C090A ColorCharcoal Color = 0x34282C ColorOil Color = 0x3B3131 ColorLightBlack Color = 0x454545 ColorBlackCat Color = 0x413839 ColorIridium Color = 0x3D3C3A ColorBlackEel Color = 0x463E3F ColorBlackCow Color = 0x4C4646 ColorGrayWolf Color = 0x504A4B ColorGreyWolf Color = 0x504A4B ColorVampireGray Color = 0x565051 ColorVampireGrey Color = 0x565051 ColorIronGray Color = 0x52595D ColorIronGrey Color = 0x52595D ColorGrayDolphin Color = 0x5C5858 ColorGreyDolphin Color = 0x5C5858 ColorCarbonGray Color = 0x625D5D ColorCarbonGrey Color = 0x625D5D ColorAshGray Color = 0x666362 ColorAshGrey Color = 0x666362 ColorDimGray Color = 0x696969 ColorDimGrey Color = 0x696969 ColorNardoGray Color = 0x686A6C ColorNardoGrey Color = 0x686A6C ColorCloudyGray Color = 0x6D6968 ColorCloudyGrey Color = 0x6D6968 ColorSmokeyGray Color = 0x726E6D ColorSmokeyGrey Color = 0x726E6D ColorAlienGray Color = 0x736F6E ColorAlienGrey Color = 0x736F6E ColorSonicSilver Color = 0x757575 ColorPlatinumGray Color = 0x797979 ColorPlatinumGrey Color = 0x797979 ColorGranite Color = 0x837E7C ColorBattleshipGray Color = 0x848482 ColorBattleshipGrey Color = 0x848482 ColorGunmetalGray Color = 0x8D918D ColorGunmetalGrey Color = 0x8D918D ColorGrayCloud Color = 0xB6B6B4 ColorGreyCloud Color = 0xB6B6B4 ColorSilver Color = 0xC0C0C0 ColorPaleSilver Color = 0xC9C0BB ColorGrayGoose Color = 0xD1D0CE ColorGreyGoose Color = 0xD1D0CE ColorPlatinumSilver Color = 0xCECECE ColorSilverWhite Color = 0xDADBDD ColorGainsboro Color = 0xDCDCDC ColorPlatinum Color = 0xE5E4E2 ColorMetallicSilver Color = 0xBCC6CC ColorBlueGray Color = 0x98AFC7 ColorBlueGrey Color = 0x98AFC7 ColorRomanSilver Color = 0x838996 ColorLightSlateGray Color = 0x778899 ColorLightSlateGrey Color = 0x778899 ColorSlateGray Color = 0x708090 ColorSlateGrey Color = 0x708090 ColorRatGray Color = 0x6D7B8D ColorSlateGraniteGray Color = 0x657383 ColorSlateGraniteGrey Color = 0x657383 ColorJetGray Color = 0x616D7E ColorJetGrey Color = 0x616D7E ColorMistBlue Color = 0x646D7E ColorMarbleBlue Color = 0x566D7E ColorSlateBlueGrey Color = 0x737CA1 ColorSlateBlueGray Color = 0x737CA1 ColorLightPurpleBlue Color = 0x728FCE ColorAzureBlue Color = 0x4863A0 ColorBlueJay Color = 0x2B547E ColorCharcoalBlue Color = 0x36454F ColorDarkBlueGrey Color = 0x29465B ColorDarkSlate Color = 0x2B3856 ColorDeepSeaBlue Color = 0x123456 ColorNightBlue Color = 0x151B54 ColorMidnightBlue Color = 0x191970 ColorDenimDarkBlue Color = 0x151B8D ColorDarkBlue Color = 0x00008B ColorLapisBlue Color = 0x15317E ColorNewMidnightBlue Color = 0x0000A0 ColorEarthBlue Color = 0x0000A5 ColorCobaltBlue Color = 0x0020C2 ColorMediumBlue Color = 0x0000CD ColorBlueberryBlue Color = 0x0041C2 ColorCanaryBlue Color = 0x2916F5 ColorSamcoBlue Color = 0x0002FF ColorBrightBlue Color = 0x0909FF ColorBlueOrchid Color = 0x1F45FC ColorSapphireBlue Color = 0x2554C7 ColorBlueEyes Color = 0x1569C7 ColorBalloonBlue Color = 0x2B60DE ColorRoyalBlue Color = 0x4169E1 ColorOceanBlue Color = 0x2B65EC ColorBlueRibbon Color = 0x306EFF ColorBlueDress Color = 0x157DEC ColorNeonBlue Color = 0x1589FF ColorDodgerBlue Color = 0x1E90FF ColorGlacialBlueIce Color = 0x368BC1 ColorSteelBlue Color = 0x4682B4 ColorSilkBlue Color = 0x488AC7 ColorWindowsBlue Color = 0x357EC7 ColorBlueIvy Color = 0x3090C7 ColorBlueKoi Color = 0x659EC7 ColorColumbiaBlue Color = 0x87AFC7 ColorBabyBlue Color = 0x95B9C7 ColorCornflowerBlue Color = 0x6495ED ColorSkyBlueDress Color = 0x6698FF ColorIceberg Color = 0x56A5EC ColorButterflyBlue Color = 0x38ACEC ColorDeepSkyBlue Color = 0x00BFFF ColorMiddayBlue Color = 0x3BB9FF ColorCrystalBlue Color = 0x5CB3FF ColorDenimBlue Color = 0x79BAEC ColorDaySkyBlue Color = 0x82CAFF ColorLightSkyBlue Color = 0x87CEFA ColorSkyBlue Color = 0x87CEEB ColorJeansBlue Color = 0xA0CFEC ColorBlueAngel Color = 0xB7CEEC ColorPastelBlue Color = 0xB4CFEC ColorLightDayBlue Color = 0xADDFFF ColorSeaBlue Color = 0xC2DFFF ColorHeavenlyBlue Color = 0xC6DEFF ColorRobinEggBlue Color = 0xBDEDFF ColorPowderBlue Color = 0xB0E0E6 ColorCoralBlue Color = 0xAFDCEC ColorLightBlue Color = 0xADD8E6 ColorLightSteelBlue Color = 0xB0CFDE ColorGulfBlue Color = 0xC9DFEC ColorPastelLightBlue Color = 0xD5D6EA ColorLavenderBlue Color = 0xE3E4FA ColorWhiteBlue Color = 0xDBE9FA ColorLavender Color = 0xE6E6FA ColorWater Color = 0xEBF4FA ColorAliceBlue Color = 0xF0F8FF ColorGhostWhite Color = 0xF8F8FF ColorAzure Color = 0xF0FFFF ColorLightCyan Color = 0xE0FFFF ColorLightSlate Color = 0xCCFFFF ColorElectricBlue Color = 0x9AFEFF ColorTronBlue Color = 0x7DFDFE ColorBlueZircon Color = 0x57FEFF ColorAqua Color = 0x00FFFF ColorBrightCyan Color = 0x0AFFFF ColorCeleste Color = 0x50EBEC ColorBlueDiamond Color = 0x4EE2EC ColorBrightTurquoise Color = 0x16E2F5 ColorBlueLagoon Color = 0x8EEBEC ColorPaleTurquoise Color = 0xAFEEEE ColorPaleBlueLily Color = 0xCFECEC ColorLightTeal Color = 0xB3D9D9 ColorTiffanyBlue Color = 0x81D8D0 ColorBlueHosta Color = 0x77BFC7 ColorCyanOpaque Color = 0x92C7C7 ColorNorthernLightsBlue Color = 0x78C7C7 ColorMediumAquamarine Color = 0x66CDAA ColorMagicMint Color = 0xAAF0D1 ColorLightAquamarine Color = 0x93FFE8 ColorBrightTeal Color = 0x01F9C6 ColorTurquoise Color = 0x40E0D0 ColorMediumTurquoise Color = 0x48D1CC ColorDeepTurquoise Color = 0x48CCCD ColorJellyfish Color = 0x46C7C7 ColorBlueTurquoise Color = 0x43C6DB ColorDarkTurquoise Color = 0x00CED1 ColorMacawBlueGreen Color = 0x43BFC7 ColorSeafoamGreen Color = 0x3EA99F ColorCadetBlue Color = 0x5F9EA0 ColorBlueChill Color = 0x3B9C9C ColorDarkCyan Color = 0x008B8B ColorTealGreen Color = 0x00827F ColorTeal Color = 0x008080 ColorTealBlue Color = 0x007C80 ColorMediumTeal Color = 0x045F5F ColorDarkTeal Color = 0x045D5D ColorDeepTeal Color = 0x033E3E ColorDarkSlateGray Color = 0x25383C ColorDarkSlateGrey Color = 0x25383C ColorGunmetal Color = 0x2C3539 ColorBlueMossGreen Color = 0x3C565B ColorBeetleGreen Color = 0x4C787E ColorGrayishTurquoise Color = 0x5E7D7E ColorGreenishBlue Color = 0x307D7E ColorAquamarineStone Color = 0x348781 ColorSeaTurtleGreen Color = 0x438D80 ColorDullSeaGreen Color = 0x4E8975 ColorDarkGreenBlue Color = 0x1F6357 ColorDeepSeaGreen Color = 0x306754 ColorBottleGreen Color = 0x006A4E ColorElfGreen Color = 0x1B8A6B ColorDarkMint Color = 0x31906E ColorJade Color = 0x00A36C ColorEarthGreen Color = 0x34A56F ColorChromeGreen Color = 0x1AA260 ColorEmerald Color = 0x50C878 ColorMint Color = 0x3EB489 ColorMetallicGreen Color = 0x7C9D8E ColorCamouflageGreen Color = 0x78866B ColorSageGreen Color = 0x848B79 ColorHazelGreen Color = 0x617C58 ColorVenomGreen Color = 0x728C00 ColorOliveDrab Color = 0x6B8E23 ColorOlive Color = 0x808000 ColorDarkOliveGreen Color = 0x556B2F ColorMilitaryGreen Color = 0x4E5B31 ColorGreenLeaves Color = 0x3A5F0B ColorArmyGreen Color = 0x4B5320 ColorFernGreen Color = 0x667C26 ColorFallForestGreen Color = 0x4E9258 ColorIrishGreen Color = 0x08A04B ColorPineGreen Color = 0x387C44 ColorMediumForestGreen Color = 0x347235 ColorJungleGreen Color = 0x347C2C ColorCactusGreen Color = 0x227442 ColorDarkGreen Color = 0x006400 ColorDeepGreen Color = 0x056608 ColorDeepEmeraldGreen Color = 0x046307 ColorHunterGreen Color = 0x355E3B ColorDarkForestGreen Color = 0x254117 ColorLotusGreen Color = 0x004225 ColorSeaweedGreen Color = 0x437C17 ColorShamrockGreen Color = 0x347C17 ColorGreenOnion Color = 0x6AA121 ColorMossGreen Color = 0x8A9A5B ColorGrassGreen Color = 0x3F9B0B ColorGreenPepper Color = 0x4AA02C ColorDarkLimeGreen Color = 0x41A317 ColorParrotGreen Color = 0x12AD2B ColorCloverGreen Color = 0x3EA055 ColorDinosaurGreen Color = 0x73A16C ColorGreenSnake Color = 0x6CBB3C ColorAlienGreen Color = 0x6CC417 ColorGreenApple Color = 0x4CC417 ColorLimeGreen Color = 0x32CD32 ColorPeaGreen Color = 0x52D017 ColorKellyGreen Color = 0x4CC552 ColorZombieGreen Color = 0x54C571 ColorGreenPeas Color = 0x89C35C ColorDollarBillGreen Color = 0x85BB65 ColorFrogGreen Color = 0x99C68E ColorTurquoiseGreen Color = 0xA0D6B4 ColorDarkSeaGreen Color = 0x8FBC8F ColorBasilGreen Color = 0x829F82 ColorGrayGreen Color = 0xA2AD9C ColorIguanaGreen Color = 0x9CB071 ColorCitronGreen Color = 0x8FB31D ColorAcidGreen Color = 0xB0BF1A ColorAvocadoGreen Color = 0xB2C248 ColorPistachioGreen Color = 0x9DC209 ColorSaladGreen Color = 0xA1C935 ColorYellowGreen Color = 0x9ACD32 ColorPastelGreen Color = 0x77DD77 ColorHummingbirdGreen Color = 0x7FE817 ColorNebulaGreen Color = 0x59E817 ColorStoplightGoGreen Color = 0x57E964 ColorNeonGreen Color = 0x16F529 ColorJadeGreen Color = 0x5EFB6E ColorLimeMintGreen Color = 0x36F57F ColorSpringGreen Color = 0x00FF7F ColorMediumSpringGreen Color = 0x00FA9A ColorEmeraldGreen Color = 0x5FFB17 ColorLawnGreen Color = 0x7CFC00 ColorBrightGreen Color = 0x66FF00 ColorChartreuse Color = 0x7FFF00 ColorYellowLawnGreen Color = 0x87F717 ColorAloeVeraGreen Color = 0x98F516 ColorDullGreenYellow Color = 0xB1FB17 ColorLemonGreen Color = 0xADF802 ColorGreenYellow Color = 0xADFF2F ColorChameleonGreen Color = 0xBDF516 ColorNeonYellowGreen Color = 0xDAEE01 ColorYellowGreenGrosbeak Color = 0xE2F516 ColorTeaGreen Color = 0xCCFB5D ColorSlimeGreen Color = 0xBCE954 ColorAlgaeGreen Color = 0x64E986 ColorLightGreen Color = 0x90EE90 ColorDragonGreen Color = 0x6AFB92 ColorPaleGreen Color = 0x98FB98 ColorMintGreen Color = 0x98FF98 ColorGreenThumb Color = 0xB5EAAA ColorOrganicBrown Color = 0xE3F9A6 ColorLightJade Color = 0xC3FDB8 ColorLightMintGreen Color = 0xC2E5D3 ColorLightRoseGreen Color = 0xDBF9DB ColorChromeWhite Color = 0xE8F1D4 ColorHoneydew Color = 0xF0FFF0 ColorMintCream Color = 0xF5FFFA ColorLemonChiffon Color = 0xFFFACD ColorParchment Color = 0xFFFFC2 ColorCream Color = 0xFFFFCC ColorCreamWhite Color = 0xFFFDD0 ColorLightGoldenrodYellow Color = 0xFAFAD2 ColorLightYellow Color = 0xFFFFE0 ColorBeige Color = 0xF5F5DC ColorCornsilk Color = 0xFFF8DC ColorBlonde Color = 0xFBF6D9 ColorChampagne Color = 0xF7E7CE ColorAntiqueWhite Color = 0xFAEBD7 ColorPapayaWhip Color = 0xFFEFD5 ColorBlanchedAlmond Color = 0xFFEBCD ColorBisque Color = 0xFFE4C4 ColorWheat Color = 0xF5DEB3 ColorMoccasin Color = 0xFFE4B5 ColorPeach Color = 0xFFE5B4 ColorLightOrange Color = 0xFED8B1 ColorPeachPuff Color = 0xFFDAB9 ColorCoralPeach Color = 0xFBD5AB ColorGoldenBlonde Color = 0xFBE7A1 ColorGoldenSilk Color = 0xF3E3C3 ColorDarkBlonde Color = 0xF0E2B6 ColorLightGold Color = 0xF1E5AC ColorVanilla Color = 0xF3E5AB ColorTanBrown Color = 0xECE5B6 ColorDirtyWhite Color = 0xE8E4C9 ColorPaleGoldenrod Color = 0xEEE8AA ColorKhaki Color = 0xF0E68C ColorCardboardBrown Color = 0xEDDA74 ColorHarvestGold Color = 0xEDE275 ColorSunYellow Color = 0xFFE87C ColorCornYellow Color = 0xFFF380 ColorPastelYellow Color = 0xFAF884 ColorNeonYellow Color = 0xFFFF33 ColorCanaryYellow Color = 0xFFEF00 ColorBananaYellow Color = 0xF5E216 ColorMustardYellow Color = 0xFFDB58 ColorGoldenYellow Color = 0xFFDF00 ColorBoldYellow Color = 0xF9DB24 ColorRubberDuckyYellow Color = 0xFFD801 ColorGold Color = 0xFFD700 ColorBrightGold Color = 0xFDD017 ColorChromeGold Color = 0xFFCE44 ColorGoldenBrown Color = 0xEAC117 ColorDeepYellow Color = 0xF6BE00 ColorMacaroniAndCheese Color = 0xF2BB66 ColorSaffron Color = 0xFBB917 ColorNeonGold Color = 0xFDBD01 ColorBeer Color = 0xFBB117 ColorYellowOrange Color = 0xFFAE42 ColorOrangeYellow Color = 0xFFAE42 ColorCantaloupe Color = 0xFFA62F ColorCheeseOrange Color = 0xFFA600 ColorBrownSand Color = 0xEE9A4D ColorSandyBrown Color = 0xF4A460 ColorBrownSugar Color = 0xE2A76F ColorCamelBrown Color = 0xC19A6B ColorDeerBrown Color = 0xE6BF83 ColorBurlyWood Color = 0xDEB887 ColorTan Color = 0xD2B48C ColorLightFrenchBeige Color = 0xC8AD7F ColorSand Color = 0xC2B280 ColorSage Color = 0xBCB88A ColorFallLeafBrown Color = 0xC8B560 ColorGingerBrown Color = 0xC9BE62 ColorBronzeGold Color = 0xC9AE5D ColorDarkKhaki Color = 0xBDB76B ColorOliveGreen Color = 0xBAB86C ColorBrass Color = 0xB5A642 ColorCookieBrown Color = 0xC7A317 ColorMetallicGold Color = 0xD4AF37 ColorBeeYellow Color = 0xE9AB17 ColorSchoolBusYellow Color = 0xE8A317 ColorGoldenrod Color = 0xDAA520 ColorOrangeGold Color = 0xD4A017 ColorCaramel Color = 0xC68E17 ColorCinnamon Color = 0xC58917 ColorPeru Color = 0xCD853F ColorBronze Color = 0xCD7F32 ColorTigerOrange Color = 0xC88141 ColorCopper Color = 0xB87333 ColorDarkGold Color = 0xAA6C39 ColorMetallicBronze Color = 0xA97142 ColorDarkAlmond Color = 0xAB784E ColorWood Color = 0x966F33 ColorOakBrown Color = 0x806517 ColorAntiqueBronze Color = 0x665D1E ColorHazel Color = 0x8E7618 ColorDarkYellow Color = 0x8B8000 ColorDarkMoccasin Color = 0x827839 ColorKhakiGreen Color = 0x8A865D ColorMillenniumJade Color = 0x93917C ColorDarkBeige Color = 0x9F8C76 ColorBulletShell Color = 0xAF9B60 ColorArmyBrown Color = 0x827B60 ColorSandstone Color = 0x786D5F ColorTaupe Color = 0x483C32 ColorMocha Color = 0x493D26 ColorMilkChocolate Color = 0x513B1C ColorGrayBrown Color = 0x3D3635 ColorDarkCoffee Color = 0x3B2F2F ColorOldBurgundy Color = 0x43302E ColorWesternCharcoal Color = 0x49413F ColorBakersBrown Color = 0x5C3317 ColorDarkBrown Color = 0x654321 ColorSepiaBrown Color = 0x704214 ColorDarkBronze Color = 0x804A00 ColorCoffee Color = 0x6F4E37 ColorBrownBear Color = 0x835C3B ColorRedDirt Color = 0x7F5217 ColorSepia Color = 0x7F462C ColorSienna Color = 0xA0522D ColorSaddleBrown Color = 0x8B4513 ColorDarkSienna Color = 0x8A4117 ColorSangria Color = 0x7E3817 ColorBloodRed Color = 0x7E3517 ColorChestnut Color = 0x954535 ColorCoralBrown Color = 0x9E4638 ColorChestnutRed Color = 0xC34A2C ColorMahogany Color = 0xC04000 ColorRedGold Color = 0xEB5406 ColorRedFox Color = 0xC35817 ColorDarkBisque Color = 0xB86500 ColorLightBrown Color = 0xB5651D ColorPetraGold Color = 0xB76734 ColorCopperRed Color = 0xCB6D51 ColorOrangeSalmon Color = 0xC47451 ColorChocolate Color = 0xD2691E ColorSedona Color = 0xCC6600 ColorPapayaOrange Color = 0xE56717 ColorHalloweenOrange Color = 0xE66C2C ColorNeonOrange Color = 0xFF6700 ColorBrightOrange Color = 0xFF5F1F ColorPumpkinOrange Color = 0xF87217 ColorCarrotOrange Color = 0xF88017 ColorDarkOrange Color = 0xFF8C00 ColorConstructionConeOrange Color = 0xF87431 ColorIndianSaffron Color = 0xFF7722 ColorSunriseOrange Color = 0xE67451 ColorMangoOrange Color = 0xFF8040 ColorCoral Color = 0xFF7F50 ColorBasketBallOrange Color = 0xF88158 ColorLightSalmonRose Color = 0xF9966B ColorLightSalmon Color = 0xFFA07A ColorDarkSalmon Color = 0xE9967A ColorTangerine Color = 0xE78A61 ColorLightCopper Color = 0xDA8A67 ColorSalmonPink Color = 0xFF8674 ColorSalmon Color = 0xFA8072 ColorPeachPink Color = 0xF98B88 ColorLightCoral Color = 0xF08080 ColorPastelRed Color = 0xF67280 ColorPinkCoral Color = 0xE77471 ColorBeanRed Color = 0xF75D59 ColorValentineRed Color = 0xE55451 ColorIndianRed Color = 0xCD5C5C ColorTomato Color = 0xFF6347 ColorShockingOrange Color = 0xE55B3C ColorOrangeRed Color = 0xFF4500 ColorNeonRed Color = 0xFD1C03 ColorRubyRed Color = 0xF62217 ColorFerrariRed Color = 0xF70D1A ColorFireEngineRed Color = 0xF62817 ColorLavaRed Color = 0xE42217 ColorLoveRed Color = 0xE41B17 ColorGrapefruit Color = 0xDC381F ColorCherryRed Color = 0xC24641 ColorChilliPepper Color = 0xC11B17 ColorFireBrick Color = 0xB22222 ColorTomatoSauceRed Color = 0xB21807 ColorCarbonRed Color = 0xA70D2A ColorCranberry Color = 0x9F000F ColorSaffronRed Color = 0x931314 ColorCrimsonRed Color = 0x990000 ColorRedWine Color = 0x990012 ColorWineRed Color = 0x990012 ColorDarkRed Color = 0x8B0000 ColorMaroon Color = 0x800000 ColorBurgundy Color = 0x8C001A ColorVermilion Color = 0x7E191B ColorDeepRed Color = 0x800517 ColorRedBlood Color = 0x660000 ColorBloodNight Color = 0x551606 ColorDarkScarlet Color = 0x560319 ColorBlackBean Color = 0x3D0C02 ColorChocolateBrown Color = 0x3F000F ColorMidnight Color = 0x2B1B17 ColorPurpleLily Color = 0x550A35 ColorPurpleMaroon Color = 0x810541 ColorPlumPie Color = 0x7D0541 ColorPlumVelvet Color = 0x7D0552 ColorDarkRaspberry Color = 0x872657 ColorVelvetMaroon Color = 0x7E354D ColorRosyFinch Color = 0x7F4E52 ColorDullPurple Color = 0x7F525D ColorPuce Color = 0x7F5A58 ColorRoseDust Color = 0x997070 ColorPastelBrown Color = 0xB1907F ColorRosyPink Color = 0xB38481 ColorRosyBrown Color = 0xBC8F8F ColorKhakiRose Color = 0xC5908E ColorLipstickPink Color = 0xC48793 ColorPinkBrown Color = 0xC48189 ColorOldRose Color = 0xC08081 ColorDustyPink Color = 0xD58A94 ColorPinkDaisy Color = 0xE799A3 ColorRose Color = 0xE8ADAA ColorDustyRose Color = 0xC9A9A6 ColorSilverPink Color = 0xC4AEAD ColorGoldPink Color = 0xE6C7C2 ColorRoseGold Color = 0xECC5C0 ColorDeepPeach Color = 0xFFCBA4 ColorPastelOrange Color = 0xF8B88B ColorDesertSand Color = 0xEDC9AF ColorUnbleachedSilk Color = 0xFFDDCA ColorPigPink Color = 0xFDD7E4 ColorPalePink Color = 0xF2D4D7 ColorBlush Color = 0xFFE6E8 ColorMistyRose Color = 0xFFE4E1 ColorPinkBubbleGum Color = 0xFFDFDD ColorLightRose Color = 0xFBCFCD ColorLightRed Color = 0xFFCCCB ColorWarmPink Color = 0xF6C6BD ColorDeepRose Color = 0xFBBBB9 ColorLightPink Color = 0xFFB6C1 ColorSoftPink Color = 0xFFB8BF ColorDonutPink Color = 0xFAAFBE ColorBabyPink Color = 0xFAAFBA ColorFlamingoPink Color = 0xF9A7B0 ColorPastelPink Color = 0xFEA3AA ColorRosePink Color = 0xE7A1B0 ColorPinkRose Color = 0xE7A1B0 ColorCadillacPink Color = 0xE38AAE ColorCarnationPink Color = 0xF778A1 ColorPastelRose Color = 0xE5788F ColorBlushRed Color = 0xE56E94 ColorPaleVioletRed Color = 0xDB7093 ColorPurplePink Color = 0xD16587 ColorTulipPink Color = 0xC25A7C ColorBashfulPink Color = 0xC25283 ColorDarkPink Color = 0xE75480 ColorDarkHotPink Color = 0xF660AB ColorHotPink Color = 0xFF69B4 ColorWatermelonPink Color = 0xFC6C85 ColorVioletRed Color = 0xF6358A ColorHotDeepPink Color = 0xF52887 ColorBrightPink Color = 0xFF007F ColorDeepPink Color = 0xFF1493 ColorNeonPink Color = 0xF535AA ColorChromePink Color = 0xFF33AA ColorNeonHotPink Color = 0xFD349C ColorPinkCupcake Color = 0xE45E9D ColorRoyalPink Color = 0xE759AC ColorDimorphothecaMagenta Color = 0xE3319D ColorPinkLemonade Color = 0xE4287C ColorRedPink Color = 0xFA2A55 ColorCrimson Color = 0xDC143C ColorBrightMaroon Color = 0xC32148 ColorRoseRed Color = 0xC21E56 ColorRoguePink Color = 0xC12869 ColorBurntPink Color = 0xC12267 ColorPinkViolet Color = 0xCA226B ColorMagentaPink Color = 0xCC338B ColorMediumVioletRed Color = 0xC71585 ColorDarkCarnationPink Color = 0xC12283 ColorRaspberryPurple Color = 0xB3446C ColorPinkPlum Color = 0xB93B8F ColorOrchid Color = 0xDA70D6 ColorDeepMauve Color = 0xDF73D4 ColorViolet Color = 0xEE82EE ColorFuchsiaPink Color = 0xFF77FF ColorBrightNeonPink Color = 0xF433FF ColorFuchsia Color = 0xFF00FF ColorCrimsonPurple Color = 0xE238EC ColorHeliotropePurple Color = 0xD462FF ColorTyrianPurple Color = 0xC45AEC ColorMediumOrchid Color = 0xBA55D3 ColorPurpleFlower Color = 0xA74AC7 ColorOrchidPurple Color = 0xB048B5 ColorRichLilac Color = 0xB666D2 ColorPastelViolet Color = 0xD291BC ColorMauveTaupe Color = 0x915F6D ColorViolaPurple Color = 0x7E587E ColorEggplant Color = 0x614051 ColorPlumPurple Color = 0x583759 ColorGrape Color = 0x5E5A80 ColorSlateBlue Color = 0x6A5ACD ColorBlueLotus Color = 0x6960EC ColorBlurple Color = 0x5865F2 ColorLightSlateBlue Color = 0x736AFF ColorMediumSlateBlue Color = 0x7B68EE ColorPeriwinklePurple Color = 0x7575CF ColorVeryPeri Color = 0x6667AB ColorBrightGrape Color = 0x6F2DA8 ColorPurpleAmethyst Color = 0x6C2DC7 ColorBrightPurple Color = 0x6A0DAD ColorDeepPeriwinkle Color = 0x5453A6 ColorDarkSlateBlue Color = 0x483D8B ColorPurpleHaze Color = 0x4E387E ColorPurpleIris Color = 0x571B7E ColorDarkPurple Color = 0x4B0150 ColorDeepPurple Color = 0x36013F ColorMidnightPurple Color = 0x2E1A47 ColorPurpleMonster Color = 0x461B7E ColorIndigo Color = 0x4B0082 ColorBlueWhale Color = 0x342D7E ColorRebeccaPurple Color = 0x663399 ColorPurpleJam Color = 0x6A287E ColorDarkMagenta Color = 0x8B008B ColorPurple Color = 0x800080 ColorFrenchLilac Color = 0x86608E ColorDarkOrchid Color = 0x9932CC ColorDarkViolet Color = 0x9400D3 ColorPurpleViolet Color = 0x8D38C9 ColorJasminePurple Color = 0xA23BEC ColorPurpleDaffodil Color = 0xB041FF ColorClematisViolet Color = 0x842DCE ColorBlueViolet Color = 0x8A2BE2 ColorPurpleSageBush Color = 0x7A5DC7 ColorLovelyPurple Color = 0x7F38EC ColorNeonPurple Color = 0x9D00FF ColorPurplePlum Color = 0x8E35EF ColorAztechPurple Color = 0x893BFF ColorMediumPurple Color = 0x9370DB ColorLightPurple Color = 0x8467D7 ColorCrocusPurple Color = 0x9172EC ColorPurpleMimosa Color = 0x9E7BFF ColorPeriwinkle Color = 0xCCCCFF ColorPaleLilac Color = 0xDCD0FF ColorLavenderPurple Color = 0x967BB6 ColorRosePurple Color = 0xB09FCA ColorLilac Color = 0xC8A2C8 ColorMauve Color = 0xE0B0FF ColorBrightLilac Color = 0xD891EF ColorPurpleDragon Color = 0xC38EC7 ColorPlum Color = 0xDDA0DD ColorBlushPink Color = 0xE6A9EC ColorPastelPurple Color = 0xF2A2E8 ColorBlossomPink Color = 0xF9B7FF ColorWisteriaPurple Color = 0xC6AEC7 ColorPurpleThistle Color = 0xD2B9D3 ColorThistle Color = 0xD8BFD8 ColorPurpleWhite Color = 0xDFD3E3 ColorPeriwinklePink Color = 0xE9CFEC ColorCottonCandy Color = 0xFCDFFF ColorLavenderPinocchio Color = 0xEBDDE2 ColorDarkWhite Color = 0xE1D9D1 ColorAshWhite Color = 0xE9E4D4 ColorWhiteChocolate Color = 0xEDE6D6 ColorSoftIvory Color = 0xFAF0DD ColorOffWhite Color = 0xF8F0E3 ColorPearlWhite Color = 0xF8F6F0 ColorRedWhite Color = 0xF3E8EA ColorLavenderBlush Color = 0xFFF0F5 ColorPearl Color = 0xFDEEF4 ColorEggShell Color = 0xFFF9E3 ColorOldLace Color = 0xFEF0E3 ColorLinen Color = 0xFAF0E6 ColorSeaShell Color = 0xFFF5EE ColorBoneWhite Color = 0xF9F6EE ColorRice Color = 0xFAF5EF ColorFloralWhite Color = 0xFFFAF0 ColorIvory Color = 0xFFFFF0 ColorWhiteGold Color = 0xFFFFF4 ColorLightWhite Color = 0xFFFFF7 ColorWhiteSmoke Color = 0xF5F5F5 ColorCotton Color = 0xFBFBF9 ColorSnow Color = 0xFFFAFA ColorMilkWhite Color = 0xFEFCFF ColorHalfWhite Color = 0xFFFEFA )
NOTE:: These color constants are copied from the DPP library (Discord++), a popular C++ Discord library.
Check it out here: https://github.com/brainboxdotcc/DPP
func ParseColor ¶
ParseColor parses a hex color string "#RRGGBB" (or without "#") and returns it as Color.
Usage example:
color, err := ParseColor("#1ABC9C")
if err != nil {
// handle error
}
fmt.Println(color) // prints: 1756092
Returns:
- Color: parsed color value.
- error: if parsing fails or input is invalid.
type Component ¶ added in v0.14.0
type Component interface {
GetID() int
GetType() ComponentType
json.Marshaler
}
Component is an interface for all kind of components.
ActionRowComponent, ButtonComponent StringSelectMenuComponent, TextInputComponent UserSelectMenuComponent, RoleSelectMenuComponent MentionableSelectMenuComponent, ChannelSelectMenuComponent SectionComponent, TextDisplayComponent ThumbnailComponent, MediaGalleryComponent FileComponent, SeparatorComponent ContainerComponent, UnknownComponent
func UnmarshalComponent ¶ added in v0.14.0
type ComponentFields ¶ added in v0.14.0
type ComponentFields struct {
// ID is an optional 32-bit integer identifier for the component, unique within the message.
//
// Note:
// - If not specified or set to 0, the API generates a sequential ID.
// - Generated IDs do not conflict with other defined IDs in the message.
ID int `json:"id,omitempty"`
// Type is the type of the component.
Type ComponentType `json:"type"`
}
ComponentFields holds common fields for all components.
All components include a type field indicating the component type and an optional id field for identification in interaction responses. The id is a 32-bit integer, unique within the message, and is generated sequentially by the API if not specified. If set to 0, it is treated as empty and replaced by the API. The API ensures generated IDs do not conflict with other defined IDs in the message.
Reference: https://discord.com/developers/docs/interactions/message-components#component-object
func (*ComponentFields) GetID ¶ added in v0.14.0
func (c *ComponentFields) GetID() int
func (*ComponentFields) GetType ¶ added in v0.14.0
func (c *ComponentFields) GetType() ComponentType
type ComponentInteraction ¶
type ComponentInteraction struct {
InteractionFields
}
TODO: continue the three interactions under this comment.
type ComponentType ¶ added in v0.14.0
type ComponentType int
ComponentType represents the type of a Discord component.
Reference: https://discord.com/developers/docs/interactions/message-components#component-object-component-types
func (ComponentType) Is ¶ added in v0.14.0
func (t ComponentType) Is(componentType ComponentType) bool
Is returns true if the component's Type matches the provided one.
type ContainerBuilder ¶ added in v0.15.0
type ContainerBuilder struct {
// contains filtered or unexported fields
}
ContainerBuilder helps build a ContainerComponent with chainable methods.
func NewContainerBuilder ¶ added in v0.15.0
func NewContainerBuilder() *ContainerBuilder
NewContainerBuilder creates a new ContainerBuilder instance.
func (*ContainerBuilder) AddComponent ¶ added in v0.15.0
func (b *ContainerBuilder) AddComponent(component ContainerSubComponent) *ContainerBuilder
AddComponent adds a single component.
func (*ContainerBuilder) Build ¶ added in v0.15.0
func (b *ContainerBuilder) Build() *ContainerComponent
Build returns the final ContainerComponent.
func (*ContainerBuilder) Reset ¶ added in v0.15.0
func (b *ContainerBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*ContainerBuilder) SetAccentColor ¶ added in v0.15.0
func (b *ContainerBuilder) SetAccentColor(color Color) *ContainerBuilder
SetAccentColor sets the accent color.
func (*ContainerBuilder) SetComponents ¶ added in v0.15.0
func (b *ContainerBuilder) SetComponents(components []ContainerSubComponent) *ContainerBuilder
SetComponents sets all components at once.
func (*ContainerBuilder) SetID ¶ added in v0.15.0
func (b *ContainerBuilder) SetID(id int) *ContainerBuilder
SetID sets the component ID.
func (*ContainerBuilder) SetSpoiler ¶ added in v0.15.0
func (b *ContainerBuilder) SetSpoiler(spoiler bool) *ContainerBuilder
SetSpoiler sets whether the container is a spoiler.
type ContainerComponent ¶ added in v0.14.0
type ContainerComponent struct {
ComponentFields
// Components is an array of child components encapsulated within the container.
//
// Valid components:
// - ActionRowComponent
// - TextDisplayComponent
// - SectionComponent
// - MediaGalleryComponent
// - SeparatorComponent
// - FileComponent
Components []ContainerSubComponent `json:"components"`
// AccentColor is an optional RGB color for the accent bar on the container.
//
// Note:
// - Represented as an integer (0x000000 to 0xFFFFFF).
AccentColor Color `json:"accent_color,omitempty"`
// Spoiler indicates whether the container content should be blurred out as a spoiler.
//
// Note:
// - Defaults to false.
Spoiler bool `json:"spoiler,omitempty"`
}
ContainerComponent is a top-level layout component that visually encapsulates a collection of child components with an optional customizable accent color bar.
It is used to group components in messages, providing a visual container with an optional colored accent. Containers require the IS_COMPONENTS_V2 message flag (1 << 15) to be set when sending the message.
Note:
- Only available in messages.
- Requires the IS_COMPONENTS_V2 message flag (1 << 15).
- The accent_color is an optional RGB color value (0x000000 to 0xFFFFFF).
- The spoiler field defaults to false, indicating whether the container content is blurred out.
Reference: https://discord.com/developers/docs/components/reference#container
func (*ContainerComponent) MarshalJSON ¶ added in v0.14.0
func (c *ContainerComponent) MarshalJSON() ([]byte, error)
func (*ContainerComponent) UnmarshalJSON ¶ added in v0.14.0
func (c *ContainerComponent) UnmarshalJSON(buf []byte) error
type ContainerSubComponent ¶ added in v0.14.0
type ContainerSubComponent interface {
Component
}
ContainerSubComponent is an interface for all components that can be present in a ContainerComponent.
ActionRowComponent, TextDisplayComponent, MediaGalleryComponent, SeparatorComponent, FileComponent
type CreateApplicationEmojiOptions ¶ added in v0.15.0
type CreateApplicationEmojiOptions struct {
// Name is the name of the emoji.
Name string `json:"name"`
// Image is the emoji image data.
// Emojis and animated emojis have a maximum file size of 256 KiB.
Image Base64Image `json:"image"`
}
CreateApplicationEmojiOptions contains parameters for creating a new application emoji.
Reference: https://discord.com/developers/docs/resources/emoji#create-application-emoji-json-params
type CreateChannelInviteOptions ¶ added in v0.15.0
type CreateChannelInviteOptions struct {
// MaxAge is the duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days).
MaxAge optional.Option[int] `json:"max_age,omitzero"`
// MaxUses is the max number of uses or 0 for unlimited. between 0 and 100.
MaxUses int `json:"max_uses,omitempty"`
// Temporary is whether this invite only grants temporary membership.
Temporary bool `json:"temporary,omitempty"`
// Unique if true, don't try to reuse a similar invite (useful for creating many unique one time use invites)
Unique bool `json:"unique,omitzero"`
// TargetType is the type of target for this voice channel invite.
TargetType InviteTargetType `json:"target_type,omitzero"`
// TargetUserID is the id of the user whose stream to display for this invite,
// required if TargetType is InviteTargetTypeStream, the user must be streaming in the channel.
TargetUserID Snowflake `json:"target_user_id,omitempty"`
// TargetApplicationID is the id of the embedded application to open for this invite,
// required if TargetType is InviteTargetTypeEmbeddedApplication, the application must have the EMBEDDED flag.
TargetApplicationID Snowflake `json:"target_application_id,omitempty"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
CreateChannelInviteOptions contains parameters for creating a new invite for a channel.
type CreateChannelOptions ¶ added in v0.15.0
type CreateChannelOptions struct {
// Name is the channel's name (1-100 characters).
//
// Applies to All Channels.
Name string `json:"name"`
// Type specifies the type of channel to create.
//
// Note:
// - Defaults to ChannelTypeGuildText if unset.
//
// Applies to All Channels.
Type ChannelType `json:"type"`
// Topic is a description of the channel (0-1024 characters).
//
// Note:
// - This field is optional.
//
// Applies to Channels of Type: Text, Announcement, Forum, Media.
Topic string `json:"topic,omitempty"`
// Bitrate sets the audio quality for voice or stage channels (in bits, minimum 8000).
//
// Note:
// - This field is ignored for non-voice channels.
//
// Applies to Channels of Type: Voice, Stage.
Bitrate Bitrate `json:"bitrate,omitempty"`
// UserLimit caps the number of users in a voice or stage channel (0 for unlimited, 1-99 for a limit).
//
// Note:
// - Set to 0 to allow unlimited users.
//
// Applies to Channels of Type: Voice, Stage.
UserLimit int `json:"user_limit,omitempty"`
// RateLimitPerUser sets the seconds a user must wait before sending another message (0-21600).
//
// Note:
// - Bots and users with manage_messages or manage_channel permissions are unaffected.
//
// Applies to Channels of Type: Text, Voice, Stage, Forum, Media.
RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
// Position determines the channel’s position in the server’s channel list (lower numbers appear higher).
//
// Note:
// - Channels with the same position are sorted by their internal ID.
//
// Applies to All Channels.
Position optional.Option[int] `json:"position,omitzero"`
// PermissionOverwrites defines custom permissions for specific roles or users.
//
// Applies to All Channels.
PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites,omitempty"`
// ParentID is the ID of the category to nest the channel under.
//
// Applies to Channels of Type: Text, Voice, Announcement, Stage, Forum, Media.
ParentID Snowflake `json:"parent_id,omitempty"`
// Nsfw marks the channel as Not Safe For Work, restricting it to 18+ users.
//
// Note:
// - Set to true to enable the age restriction.
//
// Applies to Channels of Type: Text, Voice, Announcement, Stage, Forum.
Nsfw bool `json:"nsfw,omitempty"`
// RTCRegion sets the channel voice region id of the voice or stage channel.
//
// Applies to Channels of Type: Voice, Stage.
RTCRegion string `json:"rtc_region,omitempty"`
// VideoQualityMode sets the camera video quality for voice or stage channels.
//
// Applies to Channels of Type: Voice, Stage.
VideoQualityMode VideoQualityModes `json:"video_quality_mode,omitempty"`
// DefaultAutoArchiveDuration sets the default time (in minutes) before threads are archived.
//
// Applies to Channels of Type: Text, Announcement, Forum, Media.
DefaultAutoArchiveDuration AutoArchiveDuration `json:"default_auto_archive_duration,omitempty"`
// DefaultReactionEmoji is the default emoji for the add reaction button on threads.
//
// Applies to Channels of Type: Forum, Media.
DefaultReactionEmoji optional.Option[DefaultReactionEmoji] `json:"default_reaction_emoji,omitzero"`
// AvailableTags lists tags that can be applied to threads for organization.
//
// Note:
// - This field defines tags users can select for threads.
//
// Applies to Channels of Type: Forum, Media.
AvailableTags []ForumTag `json:"available_tags,omitempty"`
// DefaultSortOrder sets how threads are sorted by default.
//
// Note:
// - Valid options are defined in ForumPostsSortOrder.
//
// Applies to Channels of Type: Forum, Media.
DefaultSortOrder optional.Option[ForumPostsSortOrder] `json:"default_sort_order,omitzero"`
// DefaultForumLayout sets the default view for forum posts.
//
// Applies to Channels of Type: Forum.
DefaultForumLayout ForumLayout `json:"default_forum_layout,omitempty"`
// DefaultThreadRateLimitPerUser sets the default slow mode for messages in new threads.
//
// Note:
// - This value is copied to new threads at creation and does not update live.
//
// Applies to Channels of Type: Text, Announcement, Forum, Media.
DefaultThreadRateLimitPerUser int `json:"default_thread_rate_limit_per_user,omitzero"`
// Reason specifies the audit log reason for creating the channel.
Reason string `json:"-"`
}
CreateChannelOptions defines the configuration for creating a new Discord guild channel.
Note:
- This struct configures properties for a new channel, such as text, voice, or forum.
- Only set fields applicable to the channel type to avoid errors.
Reference: https://discord.com/developers/docs/resources/guild#create-guild-channel-json-params
type CreateGuildEmojiOptions ¶ added in v0.15.0
type CreateGuildEmojiOptions struct {
// Name is the name of the emoji.
Name string `json:"name"`
// Image is the emoji image data.
// Emojis and animated emojis have a maximum file size of 256 KiB.
Image Base64Image `json:"image"`
// Roles are the roles allowed to use this emoji.
Roles []Snowflake `json:"roles,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
CreateGuildEmojiOptions contains parameters for creating a new guild emoji.
Reference: https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
type CreateRoleOptions ¶ added in v0.15.0
type CreateRoleOptions struct {
// Name is the channel's name (max 100 characters).
//
// Default to "new role" if unspesified.
Name string `json:"name,omitempty"`
// Permissions is the permission to set for the role.
Permissions Permissions `json:"permissions,omitempty"`
// Colors are the colors to set for the role.
Colors RoleColors `json:"colors"`
// Hoist is whether the role should be displayed separately in the sidebar.
Hoist bool `json:"hoist,omitempty"`
// Mentionable is whether the role should be displayed separately in the sidebar.
Mentionable bool `json:"mentionable,omitempty"`
// Icon is the role's icon image (if the guild has the GuildFeatureRoleIcons feature).
Icon Base64Image `json:"icon,omitempty"`
// UnicodeEmoji is the role's unicode emoji as a standard emoji (if the guild has the GuildFeatureRoleIcons feature).
UnicodeEmoji string `json:"unicode_emoji,omitempty"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
CreateRoleOptions defines the configuration for creating a new Discord guild role.
type DMChannel ¶
type DMChannel struct {
DMChannelFields
// Recipients is the list of users participating in the group DM channel.
//
// Info:
// - Contains the users involved in the group DM, excluding the current user or bot.
Recipients []User `json:"recipients"`
}
ThreadChannel represents a DM channel between the currect user and other user.
func (*DMChannel) MarshalJSON ¶
type DMChannelFields ¶
type DMChannelFields struct {
ChannelFields
MessageChannelFields
}
DMChannelFields contains fields common to DM and Group DM channels.
type DefaultReactionEmoji ¶
type DefaultReactionEmoji struct {
// EmojiID is the ID of a guild's custom emoji.
//
// Optional:
// - May be equal to 0.
//
// Info:
// - If 0, EmojiName will be set instead.
EmojiID Snowflake `json:"emoji_id"`
// EmojiName is the Unicode character of the emoji.
//
// Optional:
// - May be empty string.
//
// Info:
// - If empty, EmojiID will be set instead.
EmojiName string `json:"emoji_name"`
}
DefaultReactionEmoji represents a default reaction emoji for forum channels.
type DefaultShardsRateLimiter ¶
type DefaultShardsRateLimiter struct {
// contains filtered or unexported fields
}
DefaultShardsRateLimiter implements a simple token bucket rate limiter using a buffered channel of tokens.
The capacity and refill interval control the max burst and rate.
func NewDefaultShardsRateLimiter ¶
func NewDefaultShardsRateLimiter(r int, interval time.Duration) *DefaultShardsRateLimiter
NewDefaultShardsRateLimiter creates a new token bucket rate limiter.
r specifies the maximum burst tokens allowed. interval specifies how frequently tokens are refilled.
func (*DefaultShardsRateLimiter) Wait ¶
func (rl *DefaultShardsRateLimiter) Wait()
Wait blocks until a token is available for sending Identify.
type DeleteChannelOptions ¶ added in v0.15.0
type DeleteChannelOptions struct {
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
DeleteChannelOptions contains parameters for deleting a channel, or closing a private message.
type DeleteChannelPermissionOptions ¶ added in v0.15.0
type DeleteChannelPermissionOptions struct {
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
DeleteChannelPermissionOptions contains parameters for deleting a channel permission.
type DeleteGuildIntegrationOptions ¶ added in v0.15.0
type DeleteGuildIntegrationOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
DeleteGuildIntegrationOptions contains parameters for deleting a guild integration.
type DeleteInviteOptions ¶ added in v0.15.0
type DeleteInviteOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
DeleteInviteOptions contains parameters for deleting invite.
type DeleteRoleOptions ¶ added in v0.15.0
type DeleteRoleOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
DeleteRoleOptions contains parameters for deleting a guild role.
type DescriptionConstraints ¶
type DescriptionConstraints struct {
// Description is the description of the command.
//
// Info:
// - Must be 1-100 characters.
Description string `json:"description"`
// DescriptionLocalizations is a localization dictionary for the description field.
//
// Info:
// - Keys are available locales.
// - Values follow the same restrictions as Description (1-100 characters).
DescriptionLocalizations map[Locale]string `json:"description_localizations"`
}
DescriptionConstraints contains description fields for application commands.
type EditChannelPermissionsOptions ¶ added in v0.15.0
type EditChannelPermissionsOptions struct {
// Allow is the permissions to allow for the overwite.
Allow optional.Option[Permissions] `json:"allow,omitzero"`
// Deny is the permissions to deny for the overwite.
Deny optional.Option[Permissions] `json:"deny,omitzero"`
// Type is the type of the overwite.
Type PermissionOverwriteType `json:"type"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
EditChannelPermissionsOptions contains parameters for updating a channel overwrite permissions.
type Embed ¶
type Embed struct {
// Title is the title of the embed.
//
// Optional, max 256 characters, empty string if not set.
Title string `json:"title,omitempty"`
// Type is the type of the embed.
//
// Optional, always "rich" for webhook embeds.
Type EmbedType `json:"type,omitempty"`
// Description is the description text of the embed.
//
// Optional, max 4096 characters, empty string if not set.
Description string `json:"description,omitempty"`
// URL is the URL of the embed.
//
// Optional, empty string if not set.
URL string `json:"url,omitempty"`
// Timestamp is the timestamp of the embed content in ISO8601 format.
//
// Optional, zero value if not set.
Timestamp *time.Time `json:"timestamp,omitzero"`
// Color is the color code of the embed (decimal integer).
//
// Optional, 0 if not set.
Color Color `json:"color,omitempty"`
//
// Optional, may be nil if not set.
Footer *EmbedFooter `json:"footer,omitempty"`
// Image contains image information.
//
// Optional, may be nil if not set.
Image *EmbedImage `json:"image,omitempty"`
// Thumbnail contains thumbnail information.
//
// Optional, may be nil if not set.
Thumbnail *EmbedThumbnail `json:"thumbnail,omitempty"`
// Video contains video information.
//
// Optional, may be nil if not set.
Video *EmbedVideo `json:"video,omitempty"`
// Provider contains provider information.
//
// Optional, may be nil if not set.
Provider *EmbedProvider `json:"provider,omitempty"`
// Author contains author information.
//
// Optional, may be nil if not set.
// author.name max 256 characters
Author *EmbedAuthor `json:"author,omitempty"`
// Fields contains an array of embed fields.
//
// Optional, max 25 fields.
// field.name max 256 characters, field.value max 1024 characters
Fields []EmbedField `json:"fields,omitempty"`
}
Embed represents a Discord embed object.
Reference: https://discord.com/developers/docs/resources/channel#embed-object
Limits:
- The combined sum of characters in all title, description, field.name, field.value, footer.text, and author.name fields across all embeds in a message must not exceed 6000.
func (*Embed) Builder ¶
func (e *Embed) Builder() EmbedBuilder
Builder returns a new EmbedBuilder initialized with a copy of the current embed.
type EmbedAuthor ¶
type EmbedAuthor struct {
// Name is the name of the author.
//
// Always present, max 256 characters.
Name string `json:"name"`
// URL is the URL of the author.
//
// Optional, may be empty string if not set.
URL string `json:"url,omitempty"`
// IconURL is the URL of the author icon.
//
// Optional, may be empty string if not set.
IconURL string `json:"icon_url,omitempty"`
// ProxyIconURL is a proxied URL of the author icon.
//
// Optional, may be empty string if not set.
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}
EmbedAuthor represents the author object of an embed.
Limits: - name max 256 characters
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
type EmbedBuilder ¶
type EmbedBuilder struct {
// contains filtered or unexported fields
}
EmbedBuilder helps build an Embed with chainable methods.
func NewEmbedBuilder ¶
func NewEmbedBuilder() *EmbedBuilder
NewEmbedBuilder creates a new EmbedBuilder instance.
func (*EmbedBuilder) AddBlankField ¶ added in v0.15.0
func (b *EmbedBuilder) AddBlankField(inline bool) *EmbedBuilder
AddBlankField appends a blank field to the embed fields slice.
func (*EmbedBuilder) AddField ¶
func (b *EmbedBuilder) AddField(name, value string, inline bool) *EmbedBuilder
AddField appends a field to the embed fields slice.
func (*EmbedBuilder) Build ¶
func (b *EmbedBuilder) Build() Embed
Build returns the final Embed object ready to send.
func (*EmbedBuilder) RemoveField ¶
func (b *EmbedBuilder) RemoveField(i int) *EmbedBuilder
RemoveField removes a field from the EmbedBuilder
func (*EmbedBuilder) Reset ¶ added in v0.15.0
func (b *EmbedBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*EmbedBuilder) SetAuthor ¶
func (b *EmbedBuilder) SetAuthor(name, url, iconURL string) *EmbedBuilder
SetAuthor sets the embed author name and optional URL/icon.
func (*EmbedBuilder) SetColor ¶
func (b *EmbedBuilder) SetColor(color Color) *EmbedBuilder
SetColor sets the embed color.
func (*EmbedBuilder) SetDescription ¶
func (b *EmbedBuilder) SetDescription(desc string) *EmbedBuilder
SetDescription sets the embed description (max 4096 chars).
func (*EmbedBuilder) SetFields ¶
func (e *EmbedBuilder) SetFields(fields ...EmbedField) *EmbedBuilder
SetFields sets all embed fields at once.
func (*EmbedBuilder) SetFooter ¶
func (b *EmbedBuilder) SetFooter(text, iconURL string) *EmbedBuilder
SetFooter sets the embed footer text and optional icon URL.
func (*EmbedBuilder) SetImage ¶
func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder
SetImage sets the embed image URL.
func (*EmbedBuilder) SetThumbnail ¶
func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder
SetThumbnail sets the embed thumbnail URL.
func (*EmbedBuilder) SetTimestamp ¶
func (b *EmbedBuilder) SetTimestamp(t time.Time) *EmbedBuilder
SetTimestamp sets the embed timestamp.
func (*EmbedBuilder) SetTitle ¶
func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder
SetTitle sets the embed title (max 256 chars).
func (*EmbedBuilder) SetURL ¶
func (b *EmbedBuilder) SetURL(url string) *EmbedBuilder
SetURL sets the embed SetURL.
type EmbedField ¶
type EmbedField struct {
// Name is the name of the field.
//
// Always present, max 256 characters.
Name string `json:"name"`
// Value is the value of the field.
//
// Always present, max 1024 characters.
Value string `json:"value"`
// Inline indicates whether this field should display inline.
//
// Optional, false if not set.
Inline bool `json:"inline,omitempty"`
}
EmbedField represents a field object in an embed.
Limits: - name max 256 characters - value max 1024 characters
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
type EmbedFooter ¶
type EmbedFooter struct {
//
// Always present, max 2048 characters.
Text string `json:"text"`
//
// Optional, may be empty string if not set.
IconURL string `json:"icon_url,omitempty"`
//
// Optional, may be empty string if not set.
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}
EmbedFooter represents the footer object of an embed.
Limits: - text max 2048 characters
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
type EmbedImage ¶
type EmbedImage struct {
// URL is the source URL of the image.
//
// Always present. Supports only http(s) and attachments.
URL string `json:"url"`
// ProxyURL is a proxied URL of the image.
//
// Optional, may be empty string if not set.
ProxyURL string `json:"proxy_url,omitempty"`
// Height is the height of the image.
//
// Optional, 0 if not set.
Height int `json:"height,omitempty"`
// Width is the width of the image.
//
// Optional, 0 if not set.
Width int `json:"width,omitempty"`
}
EmbedImage represents the image object of an embed.
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
type EmbedProvider ¶
type EmbedProvider struct {
// Name is the name of the provider.
//
// Optional, may be empty string if not set.
Name string `json:"name,omitempty"`
// URL is the URL of the provider.
//
// Optional, may be empty string if not set.
URL string `json:"url,omitempty"`
}
EmbedProvider represents the provider object of an embed.
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure
type EmbedThumbnail ¶
type EmbedThumbnail struct {
// URL is the source URL of the thumbnail.
//
// Always present. Supports only http(s) and attachments.
URL string `json:"url"`
// ProxyURL is a proxied URL of the thumbnail.
//
// Optional, may be empty string if not set.
ProxyURL string `json:"proxy_url,omitempty"`
// Height is the height of the thumbnail.
//
// Optional, 0 if not set.
Height int `json:"height,omitempty"`
// Width is the width of the thumbnail.
//
// Optional, 0 if not set.
Width int `json:"width,omitempty"`
}
EmbedThumbnail represents the thumbnail object of an embed.
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
type EmbedVideo ¶
type EmbedVideo struct {
// URL is the source URL of the video.
//
// Optional, may be empty string if not set.
URL string `json:"url,omitempty"`
// ProxyURL is a proxied URL of the video.
//
// Optional, may be empty string if not set.
ProxyURL string `json:"proxy_url,omitempty"`
// Height is the height of the video.
//
// Optional, 0 if not set.
Height int `json:"height,omitempty"`
// Width is the width of the video.
//
// Optional, 0 if not set.
Width int `json:"width,omitempty"`
}
EmbedVideo represents the video object of an embed.
Reference: https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
type Emoji ¶
type Emoji struct {
// ID is the unique Discord snowflake ID of the emoji.
//
// Optional:
// - May zero for unicode emojis
ID Snowflake `json:"id,omitempty"`
// Name is the emoji's name.
//
// Optional:
// - May be empty in deleted emojis.
Name string `json:"name,omitempty"`
// Roles is a list of role IDs allowed to use this emoji.
Roles []Snowflake `json:"roles,omitempty"`
// RequireColons indicates whether the emoji must be wrapped in colons to be used.
RequireColons bool `json:"require_colons,omitempty"`
// Managed indicates whether the emoji is managed by an integration.
Managed bool `json:"managed,omitempty"`
// Animated indicates whether the emoji is an animated emoji (.gif).
Animated bool `json:"animated,omitempty"`
// Available indicates whether the emoji can currently be used.
Available bool `json:"available,omitempty"`
}
Emoji represents a custom emoji object used within a Discord guild.
Reference: https://discord.com/developers/docs/resources/emoji#emoji-object
func ParseEmoji ¶ added in v0.15.0
ParseEmoji parses a Discord emoji mention string into an Emoji object.
Supports:
- Custom emojis: <:name:id> or <a:name:id>
- Unicode emojis: just the string
func (*Emoji) Mention ¶
Mention returns a Discord mention string for the emoji.
Example output: "<:sliming:123456789012345678>"
type Entitlement ¶
type Entitlement struct {
// ID is the unique identifier of the entitlement.
ID Snowflake `json:"id"`
// SkuID is the ID of the SKU associated with this entitlement.
SkuID Snowflake `json:"sku_id"`
// ApplicationID is the ID of the application this entitlement belongs to.
ApplicationID Snowflake `json:"application_id"`
// UserID is the id of the user that is granted access to the entitlement's SKU.
//
// Optional:
// - Will be 0 if the entitlement is not associated with a specific user.
UserID Snowflake `json:"user_id"`
// Type is the type of entitlement.
Type EntitlementType `json:"type"`
// Deleted indicates whether the entitlement has been deleted.
Deleted bool `json:"deleted"`
// StartsAt is the start date at which the entitlement is valid.
//
// Optional.
StartsAt *time.Time `json:"starts_at"`
// EndsAt is the optional date at which the entitlement is no longer valid.
//
// Optional.
EndsAt *time.Time `json:"ends_at"`
// GuildID is the id of the guild that is granted access to the entitlement's SKU.
//
// Optional:
// - Will be 0 if the entitlement is not associated with a guild.
GuildID Snowflake `json:"guild_id"`
// Consumed indicates whether the entitlement for a consumable item has been consumed.
//
// Optional:
// - Will be null for non-consumable entitlements.
Consumed *bool `json:"consumed"`
}
Entitlement represents a Discord Entitlement.
Reference: https://discord.com/developers/docs/resources/entitlement#entitlement-object
type EntitlementCreateEvent ¶ added in v0.15.0
type EntitlementCreateEvent struct {
}
EntitlementCreateEvent Entitlement was created
type EntitlementDeleteEvent ¶ added in v0.15.0
type EntitlementDeleteEvent struct {
}
EntitlementDeleteEvent Entitlement was deleted
type EntitlementType ¶
type EntitlementType int
EntitlementType represents the type of an entitlement in Discord.
Reference: https://discord.com/developers/docs/resources/entitlement#entitlement-object-entitlement-types
const ( // EntitlementTypePurchase indicates the entitlement was purchased by the user. EntitlementTypePurchase EntitlementType = 1 + iota // EntitlementTypePremiumSubscription indicates the entitlement is for a Discord Nitro subscription. EntitlementTypePremiumSubscription // EntitlementTypeDeveloperGift indicates the entitlement was gifted by a developer. EntitlementTypeDeveloperGift // EntitlementTypeTestModePurchase indicates the entitlement was purchased by a developer in application test mode. EntitlementTypeTestModePurchase // EntitlementTypeFreePurchase indicates the entitlement was granted when the SKU was free. EntitlementTypeFreePurchase // EntitlementTypeUserGift indicates the entitlement was gifted by another user. EntitlementTypeUserGift // EntitlementTypePremiumPurchase indicates the entitlement was claimed for free by a Nitro subscriber. EntitlementTypePremiumPurchase // EntitlementTypeApplicationSubscription indicates the entitlement was purchased as an app subscription. EntitlementTypeApplicationSubscription )
func (EntitlementType) Is ¶
func (t EntitlementType) Is(entitlementType EntitlementType) bool
Is returns true if the entitlement's Type matches the provided one.
type EntitlementUpdateEvent ¶ added in v0.15.0
type EntitlementUpdateEvent struct {
}
EntitlementUpdateEvent Entitlement was updated or renewed
type ExplicitContentFilterLevel ¶
type ExplicitContentFilterLevel int
ExplicitContentFilterLevel represents the explicit content filter level on a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
const ( // Media content will not be scanned. ExplicitContentFilterLevelDisabled ExplicitContentFilterLevel = iota // Media content sent by members without roles will be scanned. ExplicitContentFilterLevelMembersWithoutRoles // Media content sent by all members will be scanned ExplicitContentFilterLevelAllMembers )
func (ExplicitContentFilterLevel) Is ¶ added in v0.14.0
func (l ExplicitContentFilterLevel) Is(level ExplicitContentFilterLevel) bool
Is returns true if the explicit content level matches the provided one.
type FetchGuildBansOptions ¶ added in v0.15.0
type FetchGuildBansOptions struct {
// Limit is the number of users to return (up to maximum 1000)
//
// Default to 1000 if not spesified
Limit int `json:"limit,omitempty"`
// Before consider only users before given user id.
Before Snowflake `json:"before,omitempty"`
// After consider only users after given user id.
After Snowflake `json:"after,omitempty"`
}
FetchGuildBansOptions contains parameters for fetching guild bans.
Reference: https://discord.com/developers/docs/resources/guild#get-guild-bans
type FetchGuildOptions ¶ added in v0.15.0
type FetchGuildOptions struct {
// When 'true', will return approximate member and presence counts for the guild
WithCounts bool `json:"with_counts,omitempty"`
}
FetchGuildOptions contains parameters for fetching a guild.
type FetchGuildPruneCountOptions ¶ added in v0.15.0
type FetchGuildPruneCountOptions struct {
// Pruned is the number of days to count prune for (1-30).
Days int `json:"days,omitempty"`
// By default, prune will not remove users with roles. You can optionally include specific roles in your prune by them in this field.
// Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.
IncludeRoles []Snowflake `json:"include_roles,omitempty"`
}
PruneCount contains parameters for fetching guild prune count.
type FetchGuildWidgetImageOptions ¶ added in v0.15.0
type FetchGuildWidgetImageOptions struct {
// Style is the style of the widget image returned.
Style GuildWidgetStyle `json:"style,omitempty"`
}
FetchGuildWidgetImageOptions contains parameters for fetching guild widget image.
Reference: https://discord.com/developers/docs/resources/guild#get-guild-widget-image
type FetchInviteOptions ¶ added in v0.15.0
type FetchInviteOptions struct {
// WithCounts is whether the invite should contain approximate member counts.
WithCounts bool `json:"with_counts"`
// GuildScheduledEventID is the guild scheduled event to include with the invite.
GuildScheduledEventID Snowflake `json:"guild_scheduled_event_id,omitempty"`
}
FetchInviteOptions contains parameters for fetching a invite.
type FetchThreadMemberOptions ¶ added in v0.15.0
type FetchThreadMemberOptions struct {
// WithMember is whether to include a guild member object for the thread member.
WithMember bool `json:"member,omitempty"`
}
FetchThreadMemberOptions contains parameters for fetching a thread member.
type FileBuilder ¶ added in v0.15.0
type FileBuilder struct {
// contains filtered or unexported fields
}
FileBuilder helps build a FileComponent with chainable methods.
func NewFileBuilder ¶ added in v0.15.0
func NewFileBuilder() *FileBuilder
NewFileBuilder creates a new FileBuilder instance.
func (*FileBuilder) Build ¶ added in v0.15.0
func (b *FileBuilder) Build() *FileComponent
Build returns the final FileComponent.
func (*FileBuilder) Reset ¶ added in v0.15.0
func (b *FileBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*FileBuilder) SetFile ¶ added in v0.15.0
func (b *FileBuilder) SetFile(file UnfurledMediaItem) *FileBuilder
SetFile sets the file media item.
func (*FileBuilder) SetID ¶ added in v0.15.0
func (b *FileBuilder) SetID(id int) *FileBuilder
SetID sets the component ID.
func (*FileBuilder) SetSpoiler ¶ added in v0.15.0
func (b *FileBuilder) SetSpoiler(spoiler bool) *FileBuilder
SetSpoiler sets whether the file is a spoiler.
type FileComponent ¶ added in v0.14.0
type FileComponent struct {
ComponentFields
// File is an unfurled media item that only supports attachment references using the attachment://filename syntax.
File UnfurledMediaItem `json:"file"`
// Spoiler is whether the media should be a spoiler (or blurred out). Defaults to false.
Spoiler bool `json:"spoiler,omitempty"`
// Name is the name of the file. This field is ignored and provided by the API as part of the response.
Name string `json:"name,omitempty"`
// Size is the size of the file in bytes. This field is ignored and provided by the API as part of the response.
Size int `json:"size,omitempty"`
}
FileComponent is a top-level content component that displays an uploaded file as an attachment to the message.
Each file component can only display one attached file, but multiple files can be uploaded and added to different file components within a payload. The file must use the attachment://filename syntax in the unfurled media item. File components require the IS_COMPONENTS_V2 message flag (1 << 15) to be set when sending the message.
Note:
- Only available in messages.
- Requires the IS_COMPONENTS_V2 message flag (1 << 15).
- Only supports attachment references using the attachment://filename syntax.
Reference: https://discord.com/developers/docs/components/reference#file
func (*FileComponent) MarshalJSON ¶ added in v0.14.0
func (c *FileComponent) MarshalJSON() ([]byte, error)
type FloatConstraints ¶
type FloatConstraints struct {
// MinValue is the minimum value permitted for the float.
//
// Info:
// - Must be between -2^53 and 2^53.
//
// Optional:
// - May be nil if no minimum value is specified.
MinValue *float64 `json:"min_value,omitempty"`
// MaxValue is the maximum value permitted for the float.
//
// Info:
// - Must be between -2^53 and 2^53.
//
// Optional:
// - May be nil if no maximum value is specified.
MaxValue *float64 `json:"max_value,omitempty"`
}
FloatConstraints contains constraints for float options.
type FollowAnnouncementChannelOptions ¶ added in v0.15.0
type FollowAnnouncementChannelOptions struct {
// WebhookChannelID is the id of target channel.
WebhookChannelID Snowflake `json:"webhook_channel_id"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
FollowAnnouncementChannelOptions contains parameters for following a Announcement channel.
type FollowedChannel ¶ added in v0.15.0
type FollowedChannel struct {
// ChannelID is the source channel id.
ChannelID Snowflake `json:"channel_id"`
// WebhookID is the created target webhook id.
WebhookID Snowflake `json:"webhook_id"`
}
FollowedChannel represents a channel that is followed.
func (*FollowedChannel) CreatedAt ¶ added in v0.15.0
func (c *FollowedChannel) CreatedAt() time.Time
func (*FollowedChannel) FollowedAt ¶ added in v0.15.0
func (c *FollowedChannel) FollowedAt() time.Time
func (*FollowedChannel) Mention ¶ added in v0.15.0
func (c *FollowedChannel) Mention() string
Mention returns a Discord mention string for the channel.
Example output: "<#123456789012345678>"
func (*FollowedChannel) String ¶ added in v0.15.0
func (c *FollowedChannel) String() string
String implements the fmt.Stringer interface.
type ForumChannel ¶
type ForumChannel struct {
GuildChannelFields
CategorizedChannelFields
GuildMessageChannelFields
NsfwChannelFields
TopicChannelFields
ForumChannelFields
}
ForumChannel represents a guild forum channel.
func (*ForumChannel) MarshalJSON ¶
func (c *ForumChannel) MarshalJSON() ([]byte, error)
type ForumChannelFields ¶
type ForumChannelFields struct {
// AvailableTags is the set of tags that can be used in this channel.
AvailableTags []ForumTag `json:"available_tags"`
// DefaultReactionEmoji specifies the emoji used as the default way to react to a forum post.
DefaultReactionEmoji DefaultReactionEmoji `json:"default_reaction_emoji"`
// DefaultSortOrder is the default sort order type used to order posts
// in GuildForum and GuildMedia channels. Defaults to PostsSortOrderLatestActivity.
DefaultSortOrder ForumPostsSortOrder `json:"default_sort_order"`
// DefaultForumLayout is the default forum layout view used to display posts
// in GuildForum channels. Defaults to ForumLayoutNotSet.
DefaultForumLayout ForumLayout `json:"default_forum_layout"`
}
ForumChannelFields holds forum and media channel specific fields.
type ForumLayout ¶
type ForumLayout int
ForumLayout defines the layout type used to place posts in forum/media channels.
Reference: https://discord.com/developers/docs/resources/channel#channel-object-forum-layout-types
const ( // ForumLayoutNotSet indicates no default has been set for forum channel. ForumLayoutNotSet ForumLayout = 0 // ForumLayoutListView displays posts as a list. ForumLayoutListView ForumLayout = 1 // ForumLayoutGalleryView displays posts as a collection of tiles. ForumLayoutGalleryView ForumLayout = 2 )
func (ForumLayout) Is ¶
func (t ForumLayout) Is(layoutType ForumLayout) bool
Is returns true if the channel's PostsLayout type matches the provided one.
type ForumPostsSortOrder ¶
type ForumPostsSortOrder int
ForumPostsSortOrder defines the sort order type used to order posts in forum/media channels.
Reference: https://discord.com/developers/docs/resources/channel#channel-object-sort-order-types
const ( // ForumPostsSortOrderLatestActivity sorts posts by latest activity (default). ForumPostsSortOrderLatestActivity ForumPostsSortOrder = 0 // ForumPostsSortOrderCreationDate sorts posts by creation time (most recent to oldest). ForumPostsSortOrderCreationDate ForumPostsSortOrder = 1 )
func (ForumPostsSortOrder) Is ¶
func (t ForumPostsSortOrder) Is(sortOrderType ForumPostsSortOrder) bool
Is returns true if the channel's SortOrder type matches the provided one.
type ForumTag ¶
type ForumTag struct {
// ID is the id of the tag.
ID Snowflake `json:"id"`
// Name is the name of the tag (0-20 characters).
Name string `json:"name"`
// Moderated indicates whether this tag can only be added to or removed from
// threads by a member with the ManageThreads permission.
Moderated bool `json:"moderated"`
// EmojiID is the ID of a guild's custom emoji.
//
// Optional:
// - May be equal 0.
//
// Note:
// - If EmojiName is empty (not set), then EmojiID must be set (non-zero).
EmojiID Snowflake `json:"emoji_id,omitempty"`
// EmojiName is the Unicode character of the emoji.
//
// Optional:
// - May be empty string.
//
// Note:
// - If EmojiName is empty (not set), then EmojiID must be set (non-zero).
EmojiName string `json:"emoji_name,omitempty"`
}
ForumTag represents a tag that can be applied to a thread in a GuildForum or GuildMedia channel.
Reference: https://discord.com/developers/docs/resources/channel#forum-tag-object
type FullInvite ¶ added in v0.15.0
type FullInvite struct {
Invite
InviteMetadata
}
type FullMember ¶ added in v0.15.0
type FullMember struct {
Member
// User contains the member's global Discord user information.
User User `json:"user"`
}
FullMember represents a complete guild member with their associated user information.
This extends Member with the full User object, combining both guild-specific data (roles, nickname) and global user data (username, avatar).
func (*FullMember) AvatarURL ¶ added in v0.15.0
func (m *FullMember) AvatarURL() string
AvatarURL returns the URL to the members's avatar image.
If the member has a custom avatar set, it returns the URL to that avatar. Otherwise it returns their global user avatar URL, By default, it uses GIF format if the avatar is animated, otherwise PNG.
Example usage:
url := member.AvatarURL()
func (*FullMember) AvatarURLWith ¶ added in v0.15.0
func (m *FullMember) AvatarURLWith(format ImageFormat, size ImageSize) string
AvatarURLWith returns the URL to the member's avatar image, allowing explicit specification of image format and size.
If the user has a custom avatar set, it returns the URL to that avatar. Otherwise it returns their global user avatar URL using the provided format and size.
Example usage:
url := member.AvatarURLWith(ImageFormatWebP, ImageSize512)
func (*FullMember) BannerURL ¶ added in v0.15.0
func (m *FullMember) BannerURL() string
BannerURL returns the URL to the member's banner image.
If the member has a custom banner set, it returns the URL to that banner. Otherwise it returns their global user banner URL, By default, it uses GIF format if the banner is animated, otherwise PNG.
Example usage:
url := member.BannerURL()
func (*FullMember) BannerURLWith ¶ added in v0.15.0
func (m *FullMember) BannerURLWith(format ImageFormat, size ImageSize) string
BannerURLWith returns the URL to the member's banner image, allowing explicit specification of image format and size.
If the user has a custom banner set, it returns the URL to that avatar. Otherwise it returns their global user banner URL using the provided format and size.
Example usage:
url := member.BannerURLWith(ImageFormatWebP, ImageSize512)
func (*FullMember) DisplayName ¶ added in v0.15.0
func (m *FullMember) DisplayName() string
DisplayName returns the member's nickname if set, otherwise it returns their global display name if set, otherwise it falls back to their username.
- Nickname: a guild-specific name set by the user or server mods. - Globalname: the name shown across Discord (can differ from username). - Username: the original account username.
Example usage:
name := member.DisplayName()
type GatewayBot ¶
type GatewayBot struct {
// WSS URL that can be used for connecting to the Gateway
URL string `json:"url"`
// Recommended number of shards to use when connecting
Shards int `json:"shards"`
// Information on the current session start limit
SessionStartLimit struct {
Total int `json:"total"`
Remaining int `json:"remaining"`
ResetAfter int `json:"reset_after"`
MaxConcurrency int `json:"max_concurrency"`
} `json:"session_start_limit"`
}
GatewayBot is Discord Gateway Bot.
type GatewayCloseEventCode ¶
type GatewayCloseEventCode int
GatewayCloseEventCode represents Discord Gateway close event codes.
const ( // UnknownError // // - Explanation: We're not sure what went wrong. Try reconnecting? // - Reconnect: true. GatewayCloseEventCodeUnknownError GatewayCloseEventCode = 4000 // UnknownOpcode // // - Explanation: You sent an invalid Gateway opcode or an invalid payload for an opcode. Don't do that! // - Reconnect: true. GatewayCloseEventCodeUnknownOpcode GatewayCloseEventCode = 4001 // DecodeError // // - Explanation: You sent an invalid payload to Discord. Don't do that! // - Reconnect: true. GatewayCloseEventCodeDecodeError GatewayCloseEventCode = 4002 // NotAuthenticated // // - Explanation: You sent a payload prior to identifying, or this session has been invalidated. // - Reconnect: true. GatewayCloseEventCodeNotAuthenticated GatewayCloseEventCode = 4003 // AuthenticationFailed // // - Explanation: The account token sent with your identify payload is incorrect. // - Reconnect: false. GatewayCloseEventCodeAuthenticationFailed GatewayCloseEventCode = 4004 // AlreadyAuthenticated // // - Explanation: You sent more than one identify payload. Don't do that! // - Reconnect: true. GatewayCloseEventCodeAlreadyAuthenticated GatewayCloseEventCode = 4005 // InvalidSeq // // - Explanation: The sequence sent when resuming the session was invalid. Reconnect and start a new session. // - Reconnect: true. GatewayCloseEventCodeInvalidSeq GatewayCloseEventCode = 4007 // RateLimited // // - Explanation: You're sending payloads too quickly. Slow down! You will be disconnected on receiving this. // - Reconnect: true. GatewayCloseEventCodeRateLimited GatewayCloseEventCode = 4008 // SessionTimedOut // // - Explanation: Your session timed out. Reconnect and start a new one. // - Reconnect: true. GatewayCloseEventCodeSessionTimedOut GatewayCloseEventCode = 4009 // InvalidShard // // - Explanation: You sent an invalid shard when identifying. // - Reconnect: false. GatewayCloseEventCodeInvalidShard GatewayCloseEventCode = 4010 // ShardingRequired // // - Explanation: The session would have handled too many guilds - sharding is required. // - Reconnect: false. GatewayCloseEventCodeShardingRequired GatewayCloseEventCode = 4011 // InvalidAPIVersion // // - Explanation: You sent an invalid version for the gateway. // - Reconnect: false. GatewayCloseEventCodeInvalidAPIVersion GatewayCloseEventCode = 4012 // InvalidIntents // // - Explanation: You sent an invalid intent for a Gateway Intent. You may have incorrectly calculated the bitwise value. // - Reconnect: false. GatewayCloseEventCodeInvalidIntents GatewayCloseEventCode = 4013 // DisallowedIntents // // - Explanation: You sent a disallowed intent for a Gateway Intent. You may have tried to specify an intent you are not approved for. // - Reconnect: false. GatewayCloseEventCodeDisallowedIntents GatewayCloseEventCode = 4014 )
type GatewayGuild ¶
type GatewayGuild struct {
RestGuild
// Large if true this is considered a large guild.
Large bool `json:"large"`
// MemberCount is the total number of members in this guild.
MemberCount int `json:"member_count"`
// VoiceStates is the states of members currently in voice channels; lacks the GuildID key.
VoiceStates []VoiceState `json:"voice_states"`
// Members is a slice of the Users in the guild.
Members []FullMember `json:"members"`
// Channels is a slice of the Channels in the guild.
Channels []GuildChannel `json:"channels"`
// Threads are all active threads in the guild that current user has permission to view.
Threads []ThreadChannel `json:"threads"`
// StageInstances is a slice of the Stage instances in the guild.
StageInstances []StageInstance `json:"stage_instances"`
// SoundboardSounds is a slice of the Soundboard sounds in the guild.
SoundboardSounds []SoundBoardSound `json:"soundboard_sounds"`
}
RestGuild represents a guild object returned by the Discord gateway. It embeds RestGuild and adds additional fields provided in the gateway.
Reference: https://discord.com/developers/docs/events/gateway-events#guild-create
func (*GatewayGuild) UnmarshalJSON ¶
func (g *GatewayGuild) UnmarshalJSON(buf []byte) error
UnmarshalJSON implements json.Unmarshaler for GatewayGuild.
type GatewayIntent ¶
type GatewayIntent uint32
GatewayIntent represents Discord Gateway Intents.
Intents are bit flags that specify which events your bot receives over the WebSocket connection. Combine multiple intents using bitwise OR (|).
Example:
intents := GatewayIntent_Guilds | GatewayIntent_GuildMessages
const ( // Guilds includes: // GuildCreate, GuildUpdate, GuildDelete // GuildRoleCreate, GuildRoleUpdate, GuildRoleDelete // ChannelCreate, ChannelUpdate, ChannelDelete, ChannelPinsUpdate // ThreadCreate, ThreadUpdate, ThreadDelete, ThreadListSync // ThreadMemberUpdate, ThreadMembersUpdate // StageInstanceCreate, StageInstanceUpdate, StageInstanceDelete GatewayIntentGuilds GatewayIntent = 1 << 0 // GuildMembers includes: // GuildMemberAdd, GuildMemberUpdate, GuildMemberRemove // ThreadMembersUpdate GatewayIntentGuildMembers GatewayIntent = 1 << 1 // GuildModeration includes: // GuildAuditLogEntryCreate, GuildBanAdd, GuildBanRemove GatewayIntentGuildModeration GatewayIntent = 1 << 2 // GuildExpressions includes: // GuildEmojisUpdate, GuildStickersUpdate // GuildSoundboardSoundCreate, GuildSoundboardSoundUpdate, GuildSoundboardSoundDelete // GuildSoundboardSoundsUpdate GatewayIntentGuildExpressions GatewayIntent = 1 << 3 // GuildIntegrations includes: // GuildIntegrationsUpdate, IntegrationCreate, IntegrationUpdate, IntegrationDelete GatewayIntentGuildIntegrations GatewayIntent = 1 << 4 // GuildWebhooks includes: // WebhooksUpdate GatewayIntentGuildWebhooks GatewayIntent = 1 << 5 // GuildInvites includes: // InviteCreate, InviteDelete GatewayIntentGuildInvites GatewayIntent = 1 << 6 // GuildVoiceStates includes: // VoiceChannelEffectSend, VoiceStateUpdate GatewayIntentGuildVoiceStates GatewayIntent = 1 << 7 // GuildPresences includes: // PresenceUpdate GatewayIntentGuildPresences GatewayIntent = 1 << 8 // GuildMessages includes: // MessageCreate, MessageUpdate, MessageDelete, MessageDeleteBulk GatewayIntentGuildMessages GatewayIntent = 1 << 9 // GuildMessageReactions includes: // MessageReactionAdd, MessageReactionRemove, MessageReactionRemoveAll, MessageReactionRemoveEmoji GatewayIntentGuildMessageReactions GatewayIntent = 1 << 10 // GuildMessageTyping includes: // TypingStart GatewayIntentGuildMessageTyping GatewayIntent = 1 << 11 // DirectMessages includes: // MessageCreate, MessageUpdate, MessageDelete, ChannelPinsUpdate GatewayIntentDirectMessages GatewayIntent = 1 << 12 // DirectMessageReactions includes: // MessageReactionAdd, MessageReactionRemove, MessageReactionRemoveAll, MessageReactionRemoveEmoji GatewayIntentDirectMessageReactions GatewayIntent = 1 << 13 // DirectMessageTyping includes: // TypingStart GatewayIntentDirectMessageTyping GatewayIntent = 1 << 14 // MessageContent enables access to message content in events. GatewayIntentMessageContent GatewayIntent = 1 << 15 // GuildScheduledEvents includes: // GuildScheduledEventCreate, GuildScheduledEventUpdate, GuildScheduledEventDelete // GuildScheduledEventUserAdd, GuildScheduledEventUserRemove GatewayIntentGuildScheduledEvents GatewayIntent = 1 << 16 // AutoModerationConfiguration includes: // AutoModerationRuleCreate, AutoModerationRuleUpdate, AutoModerationRuleDelete GatewayIntentAutoModerationConfiguration GatewayIntent = 1 << 20 // AutoModerationExecution includes: // AutoModerationActionExecution GatewayIntentAutoModerationExecution GatewayIntent = 1 << 21 // GuildMessagePolls includes: // MessagePollVoteAdd, MessagePollVoteRemove GatewayIntentGuildMessagePolls GatewayIntent = 1 << 24 // DirectMessagePolls includes: // MessagePollVoteAdd, MessagePollVoteRemove GatewayIntentDirectMessagePolls GatewayIntent = 1 << 25 )
type GatewayVoiceState ¶ added in v0.15.0
type GatewayVoiceState struct {
VoiceState
Member FullMember `json:"member"`
}
type GroupDMAddRecipientOptions ¶ added in v0.15.0
type GroupDMAddRecipientOptions struct {
// AccessToken is the access token of a user that has granted your app the 'gdm.join' scope.
AccessToken string `json:"access_token"`
// Nick is the nickname of the user being added.
Nick string `json:"nick,omitempty"`
}
GroupDMAddRecipientOptions contains parameters for adding a recipient to a group dm channel.
type GroupDMChannel ¶
type GroupDMChannel struct {
DMChannelFields
// Icon is the custom icon for the group DM channel.
//
// Optional:
// - Will be empty string if no icon.
Icon string `json:"icon"`
}
ThreadChannel represents a DM channel between the currect user and other user.
func (*GroupDMChannel) MarshalJSON ¶
func (c *GroupDMChannel) MarshalJSON() ([]byte, error)
type Guild ¶
type Guild struct {
// ID is the guild's unique Discord snowflake ID.
ID Snowflake `json:"id"`
Unavailable bool `json:"unavailable"`
// Name is the guild's name.
Name string `json:"name"`
// Description is the description of a guild.
//
// Optional:
// - May be empty string if no description is set.
Description string `json:"description"`
// Icon is the guild's icon hash.
//
// Optional:
// - May be empty string if no icon.
Icon string `json:"icon"`
// Splash is the guild's splash hash.
//
// Optional:
// - May be empty string if no splash.
Splash string `json:"splash"`
// DiscoverySplash is the guild's discovery splash hash.
//
// Optional:
// - May be empty string if no discovery splash.
DiscoverySplash string `json:"discovery_splash"`
// OwnerID is the guild's owner id.
OwnerID Snowflake `json:"owner_id"`
// AfkChannelID is the guild's afk channel id.
//
// Optional:
// - May be equal to 0 if no Afk channel is set.
AfkChannelID Snowflake `json:"afk_channel_id"`
// AfkTimeout is the afk timeout in seconds.
AfkTimeout int `json:"afk_timeout"`
// WidgetEnabled is whether the server widget is enabled.
WidgetEnabled bool `json:"widget_enabled"`
// WidgetChannelID is the channel id that the widget will generate an invite to, or 0 if set to no invite.
//
// Optional:
// - May be equal to 0 if no widget channel is set.
WidgetChannelID Snowflake `json:"widget_channel_id"`
// VerificationLevel is the verification level required for the guild.
VerificationLevel VerificationLevel `json:"verification_level"`
// DefaultMessageNotifications is the default message notifications level.
DefaultMessageNotifications MessageNotificationsLevel `json:"default_message_notifications"`
// ExplicitContentFilter is the explicit content filter level.
ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"`
// Features is the enabled guild features.
Features []GuildFeature `json:"features"`
// MFALevel is the required MFA level for the guild
MFALevel MFALevel `json:"mfa_level"`
// SystemChannelID is the guild's system channel id.
//
// Optional:
// - May be equal to 0 if no system channel is set.
SystemChannelID Snowflake `json:"system_channel_id"`
// SystemChannelFlags is the system channel flags on this guild.
SystemChannelFlags SystemChannelFlags `json:"system_channel_flags"`
// RulesChannelID is the guild's rules channel id.
//
// Optional:
// - May be equal to 0 if no rules channel is set.
RulesChannelID Snowflake `json:"rules_channel_id"`
// MaxPresences is the maximum number of presences for the guild.
//
// Optional:
// - Always not present, apart from the largest of guilds.
MaxPresences optional.Option[int] `json:"max_presences"`
// MaxMembers is the maximum number of members for the guild.
MaxMembers int `json:"max_members"`
// VanityURLCode is the vanity url code for the guild
//
// Optional:
// - May be empty string if no vanity url code is set.
VanityURLCode string `json:"vanity_url_code"`
// Banner is the guild's banner hash.
//
// Optional:
// - May be empty string if no banner is set.
Banner string `json:"banner"`
// PremiumTier is premium tier of this guild (Server Boost level).
PremiumTier PremiumTier `json:"premium_tier"`
// PremiumSubscriptionCount is the number of boosts this guild currently has.
PremiumSubscriptionCount int `json:"premium_subscription_count"`
// PreferredLocale is the preferred locale of a Community guild;
// used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
PreferredLocale Locale `json:"preferred_locale"`
// PublicUpdatesChannelID is the id of the channel where admins and moderators
// of Community guilds receive notices from Discord
//
// Optional:
// - May be equal to 0 if no public updates channel is set.
PublicUpdatesChannelID Snowflake `json:"public_updates_channel_id"`
// MaxVideoChannelUsers is the maximum amount of users in a video channel.
MaxVideoChannelUsers int `json:"max_video_channel_users"`
// MaxStageVideoChannelUsers is the maximum amount of users in a stage video channel.
MaxStageVideoChannelUsers int `json:"max_stage_video_channel_users"`
// WelcomeScreen is the welcome screen of a Community guild, shown to new members.
WelcomeScreen GuildWelcomeScreen `json:"welcome_screen"`
// NSFWLevel is the guild NSFW level.
NSFWLevel NSFWLevel `json:"nsfw_level"`
// PremiumProgressBarEnabled is whether the guild has the boost progress bar enabled.
PremiumProgressBarEnabled bool `json:"premium_progress_bar_enabled"`
// SafetyAlertsChannelID is the id of the channel where admins and moderators
// of Community guilds receive safety alerts from Discord.
//
// Optional:
// - May be equal to 0 if no safety alerts channel is set.
SafetyAlertsChannelID Snowflake `json:"safety_alerts_channel_id"`
// IncidentsData is the incidents data for this guild.
//
// Optional:
// - May be nil if guild has no incidents data.
IncidentsData *GuildIncidentsData `json:"incidents_data"`
}
Guild represent a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild
func (*Guild) BannerURL ¶
BannerURL returns the URL to the guild's banner image.
If the guild has a custom banner set, it returns the URL to that banner, otherwise empty string. By default, it uses GIF format if the banner is animated, otherwise PNG.
Example usage:
url := guild.BannerURL()
func (*Guild) BannerURLWith ¶
func (g *Guild) BannerURLWith(format ImageFormat, size ImageSize) string
BannerURLWith returns the URL to the guild's banner image, allowing explicit specification of image format and size.
If the guild has a custom banner set, it returns the URL to that banner (otherwise empty string) using the provided format and size.
Example usage:
url := guild.BannerURLWith(ImageFormatWebP, ImageSize512)
func (*Guild) DiscoverySplashURL ¶
DiscoverySplashURL returns the URL to the guild's discovery splash image.
If the guild has a discovery splash image set, it returns the URL to that image, Otherwise empty string, By default it uses PNG.
Example usage:
url := guild.DiscoverySplashURL()
func (*Guild) DiscoverySplashURLWith ¶
func (g *Guild) DiscoverySplashURLWith(format ImageFormat, size ImageSize) string
DiscoverySplashURLWith returns the URL to the guild's discovery splash image, allowing explicit specification of image format and size.
If the guild has a discovery splash image set, it returns the URL to that image (otherwise empty string). using the provided format and size.
Example usage:
url := guild.DiscoverySplashURLWith(ImageFormatWebP, ImageSize512)
func (*Guild) IconURL ¶
IconURL returns the URL to the guild's icon image.
If the guild has a custom icon set, it returns the URL to that icon, otherwise empty string. By default, it uses GIF format if the icon is animated, otherwise PNG.
Example usage:
url := guild.IconURL()
func (*Guild) IconURLWith ¶
func (g *Guild) IconURLWith(format ImageFormat, size ImageSize) string
IconURLWith returns the URL to the guild's icon image, allowing explicit specification of image format and size.
If the guild has a custom icon set, it returns the URL to that icon (otherwise empty string) using the provided format and size.
Example usage:
url := guild.IconURLWith(ImageFormatWebP, ImageSize512)
func (*Guild) SplashURL ¶
SplashURL returns the URL to the guild's splash image.
If the guild has a splash image set, it returns the URL to that image, Otherwise empty string, By default it uses PNG.
Example usage:
url := guild.SplashURL()
func (*Guild) SplashURLWith ¶
func (g *Guild) SplashURLWith(format ImageFormat, size ImageSize) string
SplashURLWith returns the URL to the guild's splash image, allowing explicit specification of image format and size.
If the guild has a splash image set, it returns the URL to that image (otherwise empty string). using the provided format and size.
Example usage:
url := guild.SplashURLWith(ImageFormatWebP, ImageSize512)
type GuildAuditLogEntryCreateEvent ¶ added in v0.15.0
type GuildAuditLogEntryCreateEvent struct {
}
GuildAuditLogEntryCreateEvent A guild audit log entry was created
type GuildBanAddEvent ¶ added in v0.15.0
type GuildBanAddEvent struct {
}
GuildBanAddEvent User was banned from a guild
type GuildBanRemoveEvent ¶ added in v0.15.0
type GuildBanRemoveEvent struct {
}
GuildBanRemoveEvent User was unbanned from a guild
type GuildChannel ¶
type GuildChannel interface {
Channel
NamedChannel
GetGuildID() Snowflake
GetPermissionOverwrites() []PermissionOverwrite
GetFlags() ChannelFlags
JumpURL() string
}
GuildChannel represents a guild-specific Discord channel.
This interface extends the Channel interface and adds guild-specific fields, such as the guild ID, channel name, permission overwrites, flags, and jump URL.
Use this interface when you want to handle guild channels generically without knowing the specific concrete type (TextChannel, VoiceChannel, ForumChannel, etc.).
You can convert (assert) it to a specific guild channel type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var myGuildChannel GuildChannel
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel name:", c.Name)
case *VoiceChannel:
fmt.Println("Voice channel bitrate:", c.Bitrate)
case *ForumChannel:
fmt.Println("Forum channel tags:", c.AvailableTags)
default:
fmt.Println("Other guild channel type:", c.GetType())
}
You can also use an if-condition to check a specific type:
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel:", textCh.Name)
}
type GuildChannelFields ¶
type GuildChannelFields struct {
ChannelFields
// GuildID is the id of the guild.
GuildID Snowflake `json:"guild_id"`
// Name is the name of the channel.
//
// Info:
// - can be 1 to 100 characters.
Name string `json:"name,omitempty"`
// Position is the sorting position of the channel.
Position int `json:"position,omitempty"`
// PermissionOverwrites are explicit permission overwrites for members and roles.
PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites,omitempty"`
// Flags are combined channel flags.
Flags ChannelFlags `json:"flags,omitempty"`
}
GuildChannelFields embeds BaseChannel and adds fields common to guild channels except threads.
Used by guild-specific channel types like TextChannel, VoiceChannel, ForumChannel, etc.
func (*GuildChannelFields) GetFlags ¶
func (c *GuildChannelFields) GetFlags() ChannelFlags
func (*GuildChannelFields) GetGuildID ¶
func (c *GuildChannelFields) GetGuildID() Snowflake
func (*GuildChannelFields) GetName ¶
func (c *GuildChannelFields) GetName() string
func (*GuildChannelFields) GetPermissionOverwrites ¶
func (c *GuildChannelFields) GetPermissionOverwrites() []PermissionOverwrite
func (*GuildChannelFields) GetPosition ¶
func (c *GuildChannelFields) GetPosition() int
func (*GuildChannelFields) JumpURL ¶
func (c *GuildChannelFields) JumpURL() string
type GuildCreateEvent ¶ added in v0.15.0
type GuildCreateEvent struct {
ShardsID int // shard that dispatched this event
Guild GatewayGuild
}
GuildCreateEvent Guild was created
type GuildDeleteEvent ¶ added in v0.15.0
type GuildDeleteEvent struct {
}
GuildDeleteEvent Guild became unavailable, or user left/was removed from a guild
type GuildEmojisUpdateEvent ¶ added in v0.15.0
type GuildEmojisUpdateEvent struct {
}
GuildEmojisUpdateEvent Guild emojis were updated
type GuildFeature ¶
type GuildFeature string
GuildFeature represents the features of a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-guild-features
const ( // Guild has access to set an animated guild banner image. GuildFeatureAnimatedBanner GuildFeature = "ANIMATED_BANNER" // Guild has access to set an animated guild icon. GuildFeatureAnimatedIcon GuildFeature = "ANIMATED_ICON" // Guild is using the old permissions configuration behavior. // // Reference: https://discord.com/developers/docs/change-log#upcoming-application-command-permission-changes GuildFeatureAPPLICATION_COMMAND_PERMISSIONS_V2 GuildFeature = "APPLICATION_COMMAND_PERMISSIONS_V2" // guild has set up auto moderation rules GuildFeatureAutoModeration GuildFeature = "AUTO_MODERATION" // Guild has access to set a guild banner image. GuildFeatureBanner GuildFeature = "BANNER" // Guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates. GuildFeatureCommunity GuildFeature = "COMMUNITY" // Guild has enabled monetization GuildFeatureCreatorMonetizableProvisional GuildFeature = "CREATOR_MONETIZABLE_PROVISIONAL" // Guild has enabled the role subscription promo page. GuildFeatureCreatorStorePage GuildFeature = "CREATOR_STORE_PAGE" // Guild has been set as a support server on the App Directory. GuildFeatureDeveloperSupportServer GuildFeature = "DEVELOPER_SUPPORT_SERVER" // Guild is able to be discovered in the directory. GuildFeatureDiscoverable GuildFeature = "DISCOVERABLE" // Guild is able to be featured in the directory. GuildFeatureFeaturable GuildFeature = "FEATURABLE" // Guild has paused invites, preventing new users from joining. GuildFeatureInvitesDisabled GuildFeature = "INVITES_DISABLED" // Guild has access to set an invite splash background. GuildFeatureInviteSplash GuildFeature = "INVITE_SPLASH" // Guild has enabled Membership Screening. // // Reference: https://discord.com/developers/docs/resources/guild#membership-screening-object GuildFeatureMemberVerificationGateEnabled GuildFeature = "MEMBER_VERIFICATION_GATE_ENABLED" // Guild has increased custom soundboard sound slots. GuildFeatureMoreSoundboard GuildFeature = "MORE_SOUNDBOARD" // Guild has increased custom sticker slots. GuildFeatureMoreStickers GuildFeature = "MORE_STICKERS" // Guild has access to create announcement channels. GuildFeatureNews GuildFeature = "NEWS" // Guild is partnered. GuildFeaturePartnered GuildFeature = "PARTNERED" // Guild can be previewed before joining via Membership Screening or the directory. GuildFeaturePreviewEnabled GuildFeature = "PREVIEW_ENABLED" // Guild has disabled alerts for join raids in the configured safety alerts channel GuildFeatureRaidAlertsDisabled GuildFeature = "RAID_ALERTS_DISABLED" // Guild is able to set role icons. GuildFeatureRoleIcons GuildFeature = "ROLE_ICONS" // Guild has role subscriptions that can be purchased. GuildFeatureRoleSubscriptionsAvailableForPurchase GuildFeature = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" // Guild has enabled role subscriptions. GuildFeatureRoleSubscriptionsEnabled GuildFeature = "ROLE_SUBSCRIPTIONS_ENABLED" // Guild has created soundboard sounds. GuildFeatureSoundboard GuildFeature = "SOUNDBOARD" // Guild has enabled ticketed events. GuildFeatureTicketedEventsEnabled GuildFeature = "TICKETED_EVENTS_ENABLED" // Guild has access to set a vanity URL. GuildFeatureVanityURL GuildFeature = "VANITY_URL" // Guild is verified. GuildFeatureVerified GuildFeature = "VERIFIED" // Guild has access to set 384kbps bitrate in voice (previously VIP voice servers). GuildFeatureVipRegions GuildFeature = "VIP_REGIONS" // Guild has enabled the welcome screen. GuildFeatureWelcomeScreenEnabled GuildFeature = "WELCOME_SCREEN_ENABLED" // Guild has access to guest invites. GuildFeatureGuestsEnabled GuildFeature = "GUESTS_ENABLED" // Guild has access to set guild tags. GuildFeatureGuildTags GuildFeature = "GUILD_TAGS" // Guild is able to set gradient colors to roles. GuildFeatureEnhancedRoleColors GuildFeature = "ENHANCED_ROLE_COLORS" )
const ( // Shield style widget with Discord icon and guild members online count GuildWidgetStyleShield GuildFeature = "shield" // Large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget GuildWidgetStyleBanner1 GuildFeature = "banner1" // Smaller widget style with guild icon, name and online count. Split on the right with Discord logo GuildWidgetStyleBanner2 GuildFeature = "banner2" // Large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right GuildWidgetStyleBanner3 GuildFeature = "banner3" // large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget // and a "JOIN MY SERVER" button at the bottom GuildWidgetStyleBanner4 GuildFeature = "banner4" )
type GuildIncidentsData ¶
type GuildIncidentsData struct {
// InvitesDisabledUntil is when invites get enabled again,
InvitesDisabledUntil optional.Option[time.Time] `json:"invites_disabled_until,omitzero"`
// DMsDisabledUntil is when direct messages get enabled again.
DMsDisabledUntil optional.Option[time.Time] `json:"dms_disabled_until,omitzero"`
// DMSpamDetectedAt is when the dm spam was detected.
DMSpamDetectedAt optional.Option[time.Time] `json:"dm_spam_detected_at,omitzero"`
// RaidDetectedAt is when the raid was detected.
RaidDetectedAt optional.Option[time.Time] `json:"raid_detected_at,omitzero"`
}
GuildIncidentsData represent incidents data of a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#incidents-data-object
type GuildIntegrationsUpdateEvent ¶ added in v0.15.0
type GuildIntegrationsUpdateEvent struct {
}
GuildIntegrationsUpdateEvent Guild integration was updated
type GuildInviteFlags ¶ added in v0.15.0
type GuildInviteFlags int
GuildInviteFlags represents invite flags.
Reference: https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
const ( // GuildInviteFlagsIsGuestInvite indicates that this invite is a guest invite for a voice channel GuildInviteFlagsIsGuestInvite GuildInviteFlags = 1 << 0 )
func (GuildInviteFlags) Has ¶ added in v0.15.0
func (f GuildInviteFlags) Has(flags ...GuildInviteFlags) bool
Has returns true if all provided flags are set.
type GuildMemberAddEvent ¶ added in v0.15.0
type GuildMemberAddEvent struct {
}
GuildMemberAddEvent New user joined a guild
type GuildMemberRemoveEvent ¶ added in v0.15.0
type GuildMemberRemoveEvent struct {
}
GuildMemberRemoveEvent User was removed from a guild
type GuildMemberUpdateEvent ¶ added in v0.15.0
type GuildMemberUpdateEvent struct {
}
GuildMemberUpdateEvent Guild member was updated
type GuildMembersChunkEvent ¶ added in v0.15.0
type GuildMembersChunkEvent struct {
}
GuildMembersChunkEvent Response to Request Guild Members
type GuildMessageChannel ¶
type GuildMessageChannel interface {
GuildChannel
MessageChannel
GetRateLimitPerUser() time.Duration
}
GuildMessageChannel represents a Discord text channel.
This interface extends the Channel interface and adds text-channel-specific fields, such as the ID of the last message and the rate limit (slowmode) per user.
Use this interface when you want to handle text channels specifically.
You can convert (assert) it to a concrete type using a type assertion or type switch:
Example usage:
var ch GuildMessageChannel
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel name:", c.GetName())
fmt.Println("Last message ID:", c.GetLastMessageID())
fmt.Println("Rate limit per user:", c.GetRateLimitPerUser())
case *VoiceChannel:
fmt.Println("Voiec channel name:", c.GetName())
fmt.Println("Last message ID:", c.GetLastMessageID())
fmt.Println("Rate limit per user:", c.GetRateLimitPerUser())
default:
fmt.Println("Other text channel type:", c.GetType())
}
You can also use an if-condition to check a specific type:
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel:", textCh.GetName())
}
type GuildMessageChannelFields ¶
type GuildMessageChannelFields struct {
MessageChannelFields
// RateLimitPerUser is the amount of seconds a user has to wait before sending another message.
// Bots, as well as users with the permission manageMessages or manageChannel, are unaffected.
RateLimitPerUser time.Duration `json:"rate_limit_per_user"`
}
GuildMessageChannelFields holds fields related to text-based features like messaging.
func (*GuildMessageChannelFields) GetRateLimitPerUser ¶
func (t *GuildMessageChannelFields) GetRateLimitPerUser() time.Duration
type GuildOnboarding ¶ added in v0.15.0
type GuildOnboarding struct {
// GuildID is the ID of the guild this onboarding is part of.
GuildID Snowflake `json:"guild_id"`
// Prompts are the prompts shown during onboarding.
Prompts []OnboardingPrompt `json:"prompts"`
// DefaultChannelIDs are the channel IDs that members get opted into automatically.
DefaultChannelIDs []Snowflake `json:"default_channel_ids"`
// Enabled is whether onboarding is enabled in the guild.
Enabled bool `json:"enabled"`
// Mode is the current mode of onboarding.
Mode OnboardingMode `json:"mode"`
}
Reference: https://discord.com/developers/docs/resources/guild#guild-onboarding-object
type GuildPreview ¶ added in v0.15.0
type GuildPreview struct {
// ID is the guild id.
ID Snowflake `json:"id"`
// Name is the guild name (2-100 characters).
Name string `json:"name"`
// Icon is the icon hash.
Icon string `json:"icon,omitempty"`
// Splash is the splash hash.
Splash string `json:"splash,omitempty"`
// DiscoverySplash is the discovery splash hash.
DiscoverySplash string `json:"discovery_splash,omitempty"`
// Emojis are the custom guild emojis.
Emojis []Emoji `json:"emojis"`
// Features are the enabled guild features.
Features []GuildFeature `json:"features"`
// ApproximateMemberCount is the approximate number of members in this guild.
ApproximateMemberCount int `json:"approximate_member_count"`
// ApproximatePresenceCount is the approximate number of online members in this guild.
ApproximatePresenceCount int `json:"approximate_presence_count"`
// Description is the description for the guild.
Description string `json:"description,omitempty"`
// Stickers are the custom guild stickers.
Stickers []Sticker `json:"stickers"`
}
GuildPreview represents a preview of a guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-preview-object
type GuildRoleCreateEvent ¶ added in v0.15.0
type GuildRoleCreateEvent struct {
}
GuildRoleCreateEvent Guild role was created
type GuildRoleDeleteEvent ¶ added in v0.15.0
type GuildRoleDeleteEvent struct {
}
GuildRoleDeleteEvent Guild role was deleted
type GuildRoleUpdateEvent ¶ added in v0.15.0
type GuildRoleUpdateEvent struct {
}
GuildRoleUpdateEvent Guild role was updated
type GuildScheduledEvent ¶ added in v0.15.0
type GuildScheduledEvent struct {
// ID is the id of the scheduled event.
ID Snowflake `json:"id"`
// GuildID is the guild id which the scheduled event belongs to.
GuildID Snowflake `json:"guild_id"`
// ChannelID is the channel id in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL
ChannelID Snowflake `json:"channel_id"`
}
GuildScheduledEvent is a representation of a scheduled event in a guild.
type GuildScheduledEventCreateEvent ¶ added in v0.15.0
type GuildScheduledEventCreateEvent struct {
}
GuildScheduledEventCreateEvent Guild scheduled event was created
type GuildScheduledEventDeleteEvent ¶ added in v0.15.0
type GuildScheduledEventDeleteEvent struct {
}
GuildScheduledEventDeleteEvent Guild scheduled event was deleted
type GuildScheduledEventEntityType ¶ added in v0.15.0
type GuildScheduledEventEntityType int
GuildScheduledEventEntityType represents invite target types.
Reference: https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
const ( GuildScheduledEventEntityTypeStageInstance GuildScheduledEventEntityType = 1 GuildScheduledEventEntityTypeVoice GuildScheduledEventEntityType = 2 GuildScheduledEventEntityTypeExternal GuildScheduledEventEntityType = 3 )
func (GuildScheduledEventEntityType) Is ¶ added in v0.15.0
func (t GuildScheduledEventEntityType) Is(typ GuildScheduledEventEntityType) bool
Is returns true if the fuild scheduled event entity's Type matches the provided one.
type GuildScheduledEventPrivacyLevel ¶ added in v0.15.0
type GuildScheduledEventPrivacyLevel int
GuildScheduledEventPrivacyLevel represents Guild Scheduled Event Privacy Levels types.
Reference: https://discord.com/developers/docs/resources/invite#invite-object-invite-types
const ( // The scheduled event is only accessible to guild members. GuildScheduledEventPrivacyLevelGuildOnly GuildScheduledEventPrivacyLevel = 2 )
func (GuildScheduledEventPrivacyLevel) Is ¶ added in v0.15.0
func (l GuildScheduledEventPrivacyLevel) Is(privacyLevel GuildScheduledEventPrivacyLevel) bool
Is returns true if the guild scheduled event's level matches the provided one.
type GuildScheduledEventUpdateEvent ¶ added in v0.15.0
type GuildScheduledEventUpdateEvent struct {
}
GuildScheduledEventUpdateEvent Guild scheduled event was updated
type GuildScheduledEventUserAddEvent ¶ added in v0.15.0
type GuildScheduledEventUserAddEvent struct {
}
GuildScheduledEventUserAddEvent User subscribed to a guild scheduled event
type GuildScheduledEventUserRemoveEvent ¶ added in v0.15.0
type GuildScheduledEventUserRemoveEvent struct {
}
GuildScheduledEventUserRemoveEvent User unsubscribed from a guild scheduled event
type GuildSoundboardSoundCreateEvent ¶ added in v0.15.0
type GuildSoundboardSoundCreateEvent struct {
}
GuildSoundboardSoundCreateEvent Guild soundboard sound was created
type GuildSoundboardSoundDeleteEvent ¶ added in v0.15.0
type GuildSoundboardSoundDeleteEvent struct {
}
GuildSoundboardSoundDeleteEvent Guild soundboard sound was deleted
type GuildSoundboardSoundUpdateEvent ¶ added in v0.15.0
type GuildSoundboardSoundUpdateEvent struct {
}
GuildSoundboardSoundUpdateEvent Guild soundboard sound was updated
type GuildSoundboardSoundsUpdateEvent ¶ added in v0.15.0
type GuildSoundboardSoundsUpdateEvent struct {
}
GuildSoundboardSoundsUpdateEvent Guild soundboard sounds were updated
type GuildStickersUpdateEvent ¶ added in v0.15.0
type GuildStickersUpdateEvent struct {
}
GuildStickersUpdateEvent Guild stickers were updated
type GuildUpdateEvent ¶ added in v0.15.0
type GuildUpdateEvent struct {
}
GuildUpdateEvent Guild was updated
type GuildWelcomeChannel ¶
type GuildWelcomeChannel struct {
// ChannelID is the channel's id.
ChannelID Snowflake `json:"channel_id"`
// Description is the description shown for the channel.
Description string `json:"description"`
// EmojiID is the emoji id, if the emoji is custom
//
// Optional:
// - May be equal to 0 if no emoji is set.
// - May be equal to 0 if the emoji is set but its a unicode emoji.
EmojiID Snowflake `json:"emoji_id,omitempty"`
// EmojiID is the emoji name if custom, the unicode character if standard, or empty string if no emoji is set
//
// Optional:
// - May be empty string if no emoji is set.
EmojiName string `json:"emoji_name,omitempty"`
}
GuildWelcomeChannel is one of the channels in a GuildWelcomeScreen
func (*GuildWelcomeChannel) Mention ¶
func (c *GuildWelcomeChannel) Mention() string
Mention returns a Discord mention string for the channel.
Example output: "<#123456789012345678>"
func (*GuildWelcomeChannel) String ¶ added in v0.15.0
func (c *GuildWelcomeChannel) String() string
String implements the fmt.Stringer interface.
type GuildWelcomeScreen ¶
type GuildWelcomeScreen struct {
// Description is the server description shown in the welcome screen.
Description string `json:"description,omitempty"`
// WelcomeChannels is the channels shown in the welcome screen,
//
// Note:
// - Can be up to 5 channels.
WelcomeChannels []GuildWelcomeChannel `json:"welcome_channels"`
}
GuildWelcomeScreen is the Welcome Screen of a Guild
Reference: https://discord.com/developers/docs/resources/guild#welcome-screen-object
type GuildWidget ¶ added in v0.15.0
type GuildWidget struct {
// ID is the guild id.
ID Snowflake `json:"id"`
// Name is the guild name.
Name string `json:"name"`
// InstantInvite is the instant invite for the guilds specified widget invite channel.
InstantInvite string `json:"instant_invite,omitempty"`
// Channels are the voice and stage channels which are accessible by @everyone.
Channels []Channel `json:"channels"`
// Members are the special widget user objects.
Members []User `json:"members"`
// PresenceCount is the number of online members in this guild.
PresenceCount int `json:"presence_count"`
}
GuildWidget represents a guild widget.
Reference: https://discord.com/developers/docs/resources/guild#guild-widget-object
type GuildWidgetSettings ¶ added in v0.15.0
type GuildWidgetSettings struct {
// Enabled is whether the widget is enabled.
Enabled bool `json:"enabled"`
// ChannelID is the widget channel id.
ChannelID optional.Option[Snowflake] `json:"channel_id,omitzero"`
}
GuildWidgetSettings represents a guild widget settings.
Reference: https://discord.com/developers/docs/resources/guild#guild-widget-settings-object
type GuildWidgetStyle ¶ added in v0.15.0
type GuildWidgetStyle string
GuildFeature represents the style of a Discord guild widget.
Reference: https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
type HandlerExecutionMode ¶ added in v0.15.0
type HandlerExecutionMode int
HandlerExecutionMode defines how event handlers are executed.
const ( // HandlerExecutionSync runs all handlers for an event sequentially in the dispatch goroutine. HandlerExecutionSync HandlerExecutionMode = iota // HandlerExecutionAsync runs each handler for an event in a separate goroutine/task using the executor. HandlerExecutionAsync )
type IdentifyProperties ¶ added in v0.15.0
type IdentifyProperties struct {
OS string `json:"os"`
Browser string `json:"browser"`
Device string `json:"device"`
}
ShardManagerConfig configures how shards are managed.
For sharding (multiple shards in one process):
config := ShardManagerConfig{TotalShards: 4} // manages shards 0-3
For clustering (specific shards per process):
// Process 1:
config := ShardManagerConfig{TotalShards: 4, ShardIDs: []int{0, 1}}
// Process 2:
config := ShardManagerConfig{TotalShards: 4, ShardIDs: []int{2, 3}}
IdentifyProperties configures the "properties" field in the Identify payload.
type ImageConfig ¶
type ImageConfig struct {
Format ImageFormat
Size ImageSize
}
ImageConfig holds configuration for image format and size.
type ImageFormat ¶
type ImageFormat string
ImageFormat defines all possible image formats supported by Discord endpoints.
const ( ImageFormatDefault ImageFormat = ".gif" ImageFormatPNG ImageFormat = ".png" ImageFormatJPEG ImageFormat = ".jpeg" ImageFormatWebP ImageFormat = ".webp" ImageFormatGIF ImageFormat = ".gif" ImageFormatAVIF ImageFormat = ".avif" ImageFormatLottie ImageFormat = ".json" )
type ImageSize ¶
type ImageSize int
ImageSize defines supported image sizes for Discord assets.
const ( ImageSizeDefault ImageSize = 0 ImageSize16 ImageSize = 16 ImageSize32 ImageSize = 32 ImageSize64 ImageSize = 64 ImageSize128 ImageSize = 128 ImageSize256 ImageSize = 256 ImageSize512 ImageSize = 512 ImageSize1024 ImageSize = 1024 ImageSize2048 ImageSize = 2048 ImageSize4096 ImageSize = 4096 )
type InMemoryCacheManager ¶ added in v0.15.0
type InMemoryCacheManager struct {
// contains filtered or unexported fields
}
func NewInMemoryCacheManager ¶ added in v0.15.0
func NewInMemoryCacheManager(flags CacheFlags) *InMemoryCacheManager
func (*InMemoryCacheManager) CountChannels ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountChannels() int
func (*InMemoryCacheManager) CountGuildChannels ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountGuildChannels(guildID Snowflake) int
func (*InMemoryCacheManager) CountGuildMembers ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountGuildMembers(guildID Snowflake) int
func (*InMemoryCacheManager) CountGuildRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountGuildRoles(guildID Snowflake) int
func (*InMemoryCacheManager) CountGuilds ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountGuilds() int
func (*InMemoryCacheManager) CountMembers ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountMembers() int
func (*InMemoryCacheManager) CountMessages ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountMessages() int
func (*InMemoryCacheManager) CountRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountRoles() int
func (*InMemoryCacheManager) CountUsers ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountUsers() int
func (*InMemoryCacheManager) CountVoiceStates ¶ added in v0.15.0
func (c *InMemoryCacheManager) CountVoiceStates() int
func (*InMemoryCacheManager) DelChannel ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelChannel(channelID Snowflake) bool
func (*InMemoryCacheManager) DelGuild ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelGuild(guildID Snowflake) bool
func (*InMemoryCacheManager) DelGuildChannels ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelGuildChannels(guildID Snowflake) bool
func (*InMemoryCacheManager) DelGuildMembers ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelGuildMembers(guildID Snowflake) bool
func (*InMemoryCacheManager) DelMember ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelMember(guildID, userID Snowflake) bool
func (*InMemoryCacheManager) DelMessage ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelMessage(messageID Snowflake) bool
func (*InMemoryCacheManager) DelRole ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelRole(guildID, roleID Snowflake) bool
func (*InMemoryCacheManager) DelRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelRoles(roleIDs ...Snowflake) bool
func (*InMemoryCacheManager) DelUser ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelUser(userID Snowflake) bool
func (*InMemoryCacheManager) DelVoiceState ¶ added in v0.15.0
func (c *InMemoryCacheManager) DelVoiceState(guildID, userID Snowflake) bool
func (*InMemoryCacheManager) Flags ¶ added in v0.15.0
func (c *InMemoryCacheManager) Flags() CacheFlags
func (*InMemoryCacheManager) GetChannel ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetChannel(channelID Snowflake) optional.Option[Channel]
func (*InMemoryCacheManager) GetGuild ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetGuild(guildID Snowflake) optional.Option[Guild]
func (*InMemoryCacheManager) GetGuildChannels ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetGuildChannels(guildID Snowflake) optional.Option[map[Snowflake]GuildChannel]
func (*InMemoryCacheManager) GetGuildMembers ¶ added in v0.15.0
func (*InMemoryCacheManager) GetGuildRoles ¶ added in v0.15.0
func (*InMemoryCacheManager) GetGuildVoiceStates ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetGuildVoiceStates(guildID Snowflake) optional.Option[map[Snowflake]VoiceState]
func (*InMemoryCacheManager) GetMember ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetMember(guildID, userID Snowflake) optional.Option[Member]
func (*InMemoryCacheManager) GetMessage ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetMessage(messageID Snowflake) optional.Option[Message]
func (*InMemoryCacheManager) GetRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetRoles(rolesIDs ...Snowflake) map[Snowflake]Role
func (*InMemoryCacheManager) GetUser ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetUser(userID Snowflake) optional.Option[User]
func (*InMemoryCacheManager) GetVoiceState ¶ added in v0.15.0
func (c *InMemoryCacheManager) GetVoiceState(guildID, userID Snowflake) optional.Option[VoiceState]
func (*InMemoryCacheManager) HasChannel ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasChannel(channelID Snowflake) bool
func (*InMemoryCacheManager) HasGuild ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasGuild(guildID Snowflake) bool
func (*InMemoryCacheManager) HasGuildChannels ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasGuildChannels(guildID Snowflake) bool
func (*InMemoryCacheManager) HasGuildMembers ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasGuildMembers(guildID Snowflake) bool
func (*InMemoryCacheManager) HasGuildRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasGuildRoles(guildID Snowflake) bool
func (*InMemoryCacheManager) HasGuildVoiceStates ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasGuildVoiceStates(guildID Snowflake) bool
func (*InMemoryCacheManager) HasMember ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasMember(guildID, userID Snowflake) bool
func (*InMemoryCacheManager) HasMessage ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasMessage(messageID Snowflake) bool
func (*InMemoryCacheManager) HasRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasRoles(rolesIDs ...Snowflake) bool
func (*InMemoryCacheManager) HasUser ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasUser(userID Snowflake) bool
func (*InMemoryCacheManager) HasVoiceState ¶ added in v0.15.0
func (c *InMemoryCacheManager) HasVoiceState(guildID, userID Snowflake) bool
func (*InMemoryCacheManager) PutChannel ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutChannel(channel Channel)
func (*InMemoryCacheManager) PutGuild ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutGuild(guild Guild)
func (*InMemoryCacheManager) PutMember ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutMember(member Member)
func (*InMemoryCacheManager) PutMessage ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutMessage(message Message)
func (*InMemoryCacheManager) PutRole ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutRole(role Role)
func (*InMemoryCacheManager) PutRoles ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutRoles(roles ...Role)
func (*InMemoryCacheManager) PutUser ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutUser(user User)
func (*InMemoryCacheManager) PutVoiceState ¶ added in v0.15.0
func (c *InMemoryCacheManager) PutVoiceState(voiceState VoiceState)
func (*InMemoryCacheManager) SetFlags ¶ added in v0.15.0
func (c *InMemoryCacheManager) SetFlags(flags ...CacheFlags)
type IntegerConstraints ¶
type IntegerConstraints struct {
// MinValue is the minimum value permitted for the integer.
//
// Info:
// - Must be between -2^53 and 2^53.
//
// Optional:
// - May be nil if no minimum value is specified.
MinValue *int `json:"min_value,omitempty"`
// MaxValue is the maximum value permitted for the integer.
//
// Info:
// - Must be between -2^53 and 2^53.
//
// Optional:
// - May be nil if no maximum value is specified.
MaxValue *int `json:"max_value,omitempty"`
}
IntegerConstraints contains constraints for integer options.
type Integration ¶ added in v0.15.0
type Integration struct {
// ID is the integration id.
ID Snowflake `json:"id"`
// Name is the integration name.
Name string `json:"name"`
// Type is the integration type (twitch, youtube, discord, or guild_subscription).
Type string `json:"type"`
// Enabled is whether this integration is enabled.
Enabled bool `json:"enabled"`
// Syncing is whether this integration is syncing.
Syncing bool `json:"syncing,omitempty"`
// RoleID is the id that this integration uses for "subscribers".
RoleID Snowflake `json:"role_id,omitempty"`
// EnableEmoticons is whether emoticons should be synced for this integration.
EnableEmoticons bool `json:"enable_emoticons,omitempty"`
// ExpireBehavior is the behavior of expiring subscribers.
ExpireBehavior *IntegrationExpireBehavior `json:"expire_behavior,omitempty"`
// ExpireGracePeriod is the grace period (in days) before expiring subscribers.
ExpireGracePeriod int `json:"expire_grace_period,omitempty"`
// User is the user for this integration.
User *User `json:"user,omitempty"`
// Account is the integration account information.
Account IntegrationAccount `json:"account"`
// SyncedAt is when this integration was last synced.
SyncedAt optional.Option[time.Time] `json:"synced_at,omitzero"`
// SubscriberCount is how many subscribers this integration has.
SubscriberCount int `json:"subscriber_count,omitempty"`
// Revoked is whether this integration has been revoked.
Revoked bool `json:"revoked,omitempty"`
// Application is the bot/OAuth2 application for discord integrations.
Application *IntegrationApplication `json:"application,omitempty"`
// Scopes are the scopes the application has been authorized for.
Scopes []string `json:"scopes,omitempty"`
}
Integration represents a guild integration.
Reference: https://discord.com/developers/docs/resources/guild#integration-object
type IntegrationAccount ¶ added in v0.15.0
type IntegrationAccount struct {
// ID is the id of the account.
ID string `json:"id"`
// Name is the name of the account.
Name string `json:"name"`
}
IntegrationAccount represents an integration account.
Reference: https://discord.com/developers/docs/resources/guild#integration-account-object
type IntegrationApplication ¶ added in v0.15.0
type IntegrationApplication struct {
// ID is the id of the app.
ID Snowflake `json:"id"`
// Name is the name of the app.
Name string `json:"name"`
// Icon is the icon hash of the app.
Icon string `json:"icon,omitempty"`
// Description is the description of the app.
Description string `json:"description"`
// Bot is the bot associated with this application.
Bot *User `json:"bot,omitempty"`
}
IntegrationApplication represents an integration application.
Reference: https://discord.com/developers/docs/resources/guild#integration-application-object
type IntegrationCreateEvent ¶ added in v0.15.0
type IntegrationCreateEvent struct {
}
IntegrationCreateEvent Guild integration was created
type IntegrationDeleteEvent ¶ added in v0.15.0
type IntegrationDeleteEvent struct {
}
IntegrationDeleteEvent Guild integration was deleted
type IntegrationExpireBehavior ¶ added in v0.15.0
type IntegrationExpireBehavior int
IntegrationExpireBehavior represents the behavior of expiring subscribers.
const ( IntegrationExpireBehaviorRemoveRole IntegrationExpireBehavior = 0 IntegrationExpireBehaviorKick IntegrationExpireBehavior = 1 )
type IntegrationUpdateEvent ¶ added in v0.15.0
type IntegrationUpdateEvent struct {
}
IntegrationUpdateEvent Guild integration was updated
type Interaction ¶
type Interaction interface {
GetID() Snowflake
GetType() InteractionType
GetApplicationID() Snowflake
GetToken() string
}
Interaction is the interface representing a Discord interaction.
This interface can represent any type of interaction returned by Discord, including ping interactions, chat input commands, user commands, message commands, component interactions, autocomplete interactions, and modal submits.
Use this interface when you want to handle interactions generically without knowing the specific concrete type in advance.
You can convert (assert) it to a specific interaction type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var i Interaction
switch in := i.(type) {
case *PingInteraction:
fmt.Println("Ping interaction ID:", in.ID)
case *ChatInputCommandInteraction:
fmt.Println("Chat input command name:", in.Data.Name)
case *UserCommandInteraction:
fmt.Println("User command target ID:", in.Data.TargetID)
default:
fmt.Println("Other interaction type:", in.GetType())
}
You can also use an if-condition to check a specific type:
if chatInputIn, ok := i.(*ChatInputCommandInteraction); ok {
fmt.Println("Chat input command:", chatInputIntr.Data.Name)
}
func UnmarshalInteraction ¶
func UnmarshalInteraction(buf []byte) (Interaction, error)
Helper func to Unmarshal any interaction type to a Interaction interface.
type InteractionContextType ¶
type InteractionContextType int
InteractionContextType is the context in Discord where an interaction can be used, or where it was triggered from. Details about using interaction contexts for application commands is in the commands context documentation.
const ( // Interaction can be used within servers InteractionContextTypeGuild InteractionContextType = iota // Interaction can be used within DMs with the app's bot user InteractionContextTypeBotDM // Interaction can be used within Group DMs and DMs other than the app's bot user InteractionContextTypePrivateChannel )
func (InteractionContextType) Is ¶ added in v0.14.0
func (t InteractionContextType) Is(interactionType InteractionContextType) bool
Is returns true if the interaction context's Type matches the provided one.
type InteractionCreateEvent ¶ added in v0.14.0
type InteractionCreateEvent struct {
ShardsID int // shard that dispatched this event
Interaction Interaction
}
InteractionCreateEvent Interaction created
func (*InteractionCreateEvent) UnmarshalJSON ¶ added in v0.14.0
func (c *InteractionCreateEvent) UnmarshalJSON(buf []byte) error
UnmarshalJSON implements json.Unmarshaler for InteractionCreateEvent.
type InteractionFields ¶
type InteractionFields struct {
// ID is the unique ID of the interaction.
ID Snowflake `json:"id"`
// Type is the type of the interaction.
Type InteractionType `json:"type"`
// ApplicationID is the ID of the application/bot this interaction belongs to.
ApplicationID Snowflake `json:"application_id"`
// Token is a token used to respond to the interaction.
Token string `json:"token"`
}
InteractionFields holds fields common to all Discord interactions.
func (*InteractionFields) GetApplicationID ¶
func (i *InteractionFields) GetApplicationID() Snowflake
func (*InteractionFields) GetID ¶
func (i *InteractionFields) GetID() Snowflake
func (*InteractionFields) GetToken ¶
func (i *InteractionFields) GetToken() string
func (*InteractionFields) GetType ¶
func (i *InteractionFields) GetType() InteractionType
type InteractionMetadata ¶ added in v0.14.1
type InteractionMetadata struct {
// ID is the unique Discord snowflake ID of the interaction.
ID Snowflake `json:"id"`
// Type is the type of the interaction (e.g., command, component).
Type InteractionType `json:"type"`
// User is the user who triggered the interaction.
User User `json:"user"`
// AuthorizingIntegrationOwners maps integration types to their owner IDs.
AuthorizingIntegrationOwners map[ApplicationIntegrationType]Snowflake `json:"authorizing_integration_owners"`
// OriginalResponseMessageID is the ID of the original response message for the interaction.
//
// Optional:
// - Will be 0 if no original response message exists.
OriginalResponseMessageID Snowflake `json:"original_response_message_id"`
// TargetUser is the user targeted by a user command interaction.
//
// Optional:
// - Will be nil unless the interaction is of type ApplicationCommandTypeUser.
TargetUser *User `json:"target_user"`
// TargetMessageID is the ID of the message targeted by a message command interaction.
//
// Optional:
// - Will be 0 unless the interaction is of type ApplicationCommandTypeMessage.
TargetMessageID Snowflake `json:"target_message_id"`
// InteractedMessageID is the ID of the message interacted with in a component interaction.
//
// Optional:
// - Will be 0 unless the interaction is of type InteractionTypeComponent.
InteractedMessageID Snowflake `json:"interacted_message_id"`
// TriggeringInteractionMetadata is the metadata of the interaction that triggered a modal submit.
//
// Optional:
// - Will be nil unless the interaction is of type InteractionTypeModalSubmit.
TriggeringInteractionMetadata *InteractionMetadata `json:"triggering_interaction_metadata"`
}
InteractionMetadata represents metadata about an interaction that generated a message.
Reference: https://discord.com/developers/docs/resources/message#message-interaction-metadata-object
type InteractionType ¶
type InteractionType int
InteractionType represents the type of an interaction in Discord. It indicates how the interaction was triggered.
const ( InteractionTypePing InteractionType = iota + 1 // InteractionTypeApplicationCommand is triggered when a user invokes a slash command. InteractionTypeApplicationCommand // InteractionTypeComponent is triggered when a user interacts with a message component, like a button or select menu. InteractionTypeComponent // InteractionTypeAutocomplete is triggered when a user is typing in a command option that supports autocomplete. InteractionTypeAutocomplete // InteractionTypeModalSubmit is triggered when a user submits a modal dialog. InteractionTypeModalSubmit )
type InteractiveComponent ¶ added in v0.14.0
InteractiveComponent is an interface for components that can be included in an ActionRowComponent.
ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, ChannelSelectMenuComponent
type InteractiveComponentFields ¶ added in v0.14.0
type InteractiveComponentFields struct {
ComponentFields
// CustomID is a developer-defined identifier for interactive components, returned in interaction payloads.
//
// Note:
// - Max 100 characters.
// - Must be unique among components in the same message.
// - Used to maintain state or pass data when a user interacts with the component.
CustomID string `json:"custom_id"`
}
InteractiveComponentFields holds common fields for interactive components, extending ComponentFields with a custom_id.
Interactive components (e.g., buttons, select menus) require a custom_id, which is a developer-defined identifier returned in interaction payloads. The custom_id must be unique per component within the same message and is used to maintain state or pass data.
Reference: https://discord.com/developers/docs/interactions/message-components#component-object
func (*InteractiveComponentFields) GetCustomID ¶ added in v0.14.0
func (c *InteractiveComponentFields) GetCustomID() string
type Invite ¶ added in v0.15.0
type Invite struct {
// Type is the type of invite.
Type InviteType `json:"type"`
// Code is the invite code (unique ID).
Code string `json:"code"`
// Guild is the guild this invite is for.
Guild *PartialGuild `json:"guild"`
// Channel is the channel this invite is for.
Channel *PartialChannel `json:"channel"`
// Inviter is the user who created the invite.
Inviter *User `json:"inviter"`
// TargetType is the type of target for this voice channel invite.
TargetType optional.Option[InviteTargetType] `json:"target_type"`
// TargetUser is the user whose stream to display for this voice channel stream invite.
TargetUser *User `json:"target_user"`
// TargetApplication is the embedded application to open for this voice channel embedded application invite.
TargetApplication *PartialApplication `json:"target_application"`
// ApproximatePresenceCount is the approximate count of online members.
ApproximatePresenceCount optional.Option[int] `json:"approximate_presence_count"`
// ApproximateMemberCount is the approximate count of total members.
ApproximateMemberCount optional.Option[int] `json:"approximate_member_count"`
// ExpiresAt is the expiration date of this invite.
ExpiresAt optional.Option[time.Time] `json:"expires_at"`
// GuildScheduledSvent guild scheduled event data, only included if GuildScheduledEventID contains a valid guild scheduled event id.
GuildScheduledSvent *GuildScheduledEvent `json:"guild_scheduled_event"`
// Flags is the guild invite flags for guild invites.
Flags optional.Option[GuildInviteFlags] `json:"flags"`
}
Invite represents a invite object.
Reference: https://discord.com/developers/docs/resources/invite#invite-object
type InviteCreateEvent ¶ added in v0.15.0
type InviteCreateEvent struct {
}
InviteCreateEvent Invite to a channel was created
type InviteDeleteEvent ¶ added in v0.15.0
type InviteDeleteEvent struct {
}
InviteDeleteEvent Invite to a channel was deleted
type InviteMetadata ¶ added in v0.15.0
type InviteMetadata struct {
// Uses is the number of times this invite has been used.
Uses int `json:"uses"`
// MaxUses is the max number of times this invite can be used.
MaxUses int `json:"max_uses"`
// MaxAge is the duration (in seconds) after which the invite expires.
MaxAge int `json:"max_age"`
// Temporary is whether this invite only grants temporary membership.
Temporary bool `json:"temporary"`
// CreatedAt is when this invite was created.
CreatedAt time.Time `json:"created_at"`
}
InviteMetadata represents extra information about an invite, will extend the invite object.
Reference: https://discord.com/developers/docs/resources/invite#invite-metadata-object
type InviteTargetType ¶ added in v0.15.0
type InviteTargetType int
InviteTargetType represents invite target types.
Reference: https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
const ( InviteTargetTypeStream InviteTargetType = 1 InviteTargetTypeEmbeddedApplication InviteTargetType = 2 )
func (InviteTargetType) Is ¶ added in v0.15.0
func (t InviteTargetType) Is(inviteType InviteTargetType) bool
Is returns true if the invite target's Type matches the provided one.
type InviteType ¶ added in v0.15.0
type InviteType int
InviteType represents invite types.
Reference: https://discord.com/developers/docs/resources/invite#invite-object-invite-types
const ( InviteTypeGuild InviteType = iota InviteTypeGroupDM InviteTypeFriend )
func (InviteType) Is ¶ added in v0.15.0
func (t InviteType) Is(inviteType InviteType) bool
Is returns true if the invite's Type matches the provided one.
type KickMemberOptions ¶ added in v0.15.0
type KickMemberOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
KickMemberOptions contains parameters for kicking a member from a guild.
type LabelBuilder ¶ added in v0.15.0
type LabelBuilder struct {
// contains filtered or unexported fields
}
LabelBuilder helps build a LabelComponent with chainable methods.
func NewLabelBuilder ¶ added in v0.15.0
func NewLabelBuilder() *LabelBuilder
NewLabelBuilder creates a new LabelBuilder instance.
func (*LabelBuilder) AddComponent ¶ added in v0.15.0
func (b *LabelBuilder) AddComponent(component LabelSubComponent) *LabelBuilder
AddComponent adds a single component.
func (*LabelBuilder) Build ¶ added in v0.15.0
func (b *LabelBuilder) Build() *LabelComponent
Build returns the final LabelComponent.
func (*LabelBuilder) Reset ¶ added in v0.15.0
func (b *LabelBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*LabelBuilder) SetComponents ¶ added in v0.15.0
func (b *LabelBuilder) SetComponents(components []LabelSubComponent) *LabelBuilder
SetComponents sets all components at once.
func (*LabelBuilder) SetDescription ¶ added in v0.15.0
func (b *LabelBuilder) SetDescription(description string) *LabelBuilder
SetDescription sets the description text.
func (*LabelBuilder) SetID ¶ added in v0.15.0
func (b *LabelBuilder) SetID(id int) *LabelBuilder
SetID sets the component ID.
func (*LabelBuilder) SetLabel ¶ added in v0.15.0
func (b *LabelBuilder) SetLabel(label string) *LabelBuilder
SetLabel sets the label text.
type LabelComponent ¶ added in v0.14.0
type LabelComponent struct {
ComponentFields
// Label is the text displayed as the label for the component.
//
// Note:
// - Required.
// - Maximum of 45 characters.
Label string `json:"label"`
// Description is an optional text providing additional context for the component.
//
// Note:
// - Maximum of 100 characters.
// - May appear above or below the component depending on the platform.
Description string `json:"description,omitempty"`
// Components is an array containing a single child component.
//
// Valid components:
// - TextInputComponent
// - StringSelectMenuComponent
Components []LabelSubComponent `json:"components"`
}
LabelComponent is a top-level layout component that wraps modal components with a label and an optional description.
It is used to provide context to a single child component (e.g., TextInputComponent or StringSelectMenuComponent) in modals. The description may appear above or below the component depending on the platform.
Note:
- Only available in modals.
- Supports only one child component.
- The label field is required and must not exceed 45 characters.
- The description field is optional and must not exceed 100 characters.
Reference: https://discord.com/developers/docs/components/reference#label
func (*LabelComponent) MarshalJSON ¶ added in v0.14.0
func (c *LabelComponent) MarshalJSON() ([]byte, error)
func (*LabelComponent) UnmarshalJSON ¶ added in v0.14.0
func (c *LabelComponent) UnmarshalJSON(buf []byte) error
type LabelSubComponent ¶ added in v0.14.0
type LabelSubComponent interface {
Component
}
LabelSubComponent is an interface for all components that can be present in a LabelComponent.
TextInputComponent, StringSelectMenuComponent
type LayoutComponent ¶ added in v0.14.1
type LayoutComponent interface {
Component
}
LayoutComponent is an interface for all components that can be present as a top level component in a Message.
ActionRowComponent, SectionComponent, TextDisplayComponent, MediaGalleryComponent, FileComponent, SeparatorComponent, ContainerComponent, LabelComponent
type ListArchivedThreadsOptions ¶ added in v0.15.0
type ListArchivedThreadsOptions struct {
// Limit is the maximum number of members to return (1-100).
//
// Note:
// - Defaults to 100 if not specified.
Limit int `json:"limit,omitempty"`
// Returns threads archived before this timestamp.
Before time.Time `json:"before,omitzero"`
}
ListArchivedThreadsOptions contains parameters for listing archived threads.
type ListArchivedThreadsResponse ¶ added in v0.15.0
type ListArchivedThreadsResponse struct {
// Threads are the archived threads.
Threads []ThreadChannel `json:"threads"`
// A thread member object for each returned thread the current user has joined.
Members []ThreadMember `json:"members"`
// HasMore is whether there are potentially additional threads that could be returned on a subsequent call.
HasMore bool `json:"has_more"`
}
type ListJoinedPrivateArchivedThreadsOptions ¶ added in v0.15.0
type ListJoinedPrivateArchivedThreadsOptions struct {
// Limit is the maximum number of members to return (1-100).
//
// Note:
// - Defaults to 100 if not specified.
Limit int `json:"limit,omitempty"`
// Returns threads archived before this id.
Before Snowflake `json:"before,omitzero"`
}
ListJoinedPrivateArchivedThreadsOptions contains parameters for listing joined private archived threads.
type ListMembersOptions ¶ added in v0.15.0
type ListMembersOptions struct {
// Limit is the maximum number of members to return (1-1000).
//
// Note:
// - Defaults to 1 if not specified.
Limit int `json:"limit,omitempty"`
// After is the user ID to start after for pagination.
// Used to get the next page of results.
After Snowflake `json:"after,omitempty"`
}
ListMembersOptions contains parameters for paginating through guild members.
type ListThreadMembersOptions ¶ added in v0.15.0
type ListThreadMembersOptions struct {
// WithMember is whether to include a guild member object for the thread member.
WithMember bool `json:"member,omitempty"`
// Limit is the maximum number of members to return (1-100).
//
// Note:
// - Defaults to 100 if not specified.
Limit int `json:"limit,omitempty"`
// After is the member ID to start after for pagination.
// Used to get the next page of results.
After Snowflake `json:"after,omitempty"`
}
ListThreadMembersOptions contains parameters for listing a thread members.
type Locale ¶
type Locale string
Locale represents a Discord supported locale code.
Reference: https://discord.com/developers/docs/reference#locales
const ( LocaleIndonesian Locale = "id" // Bahasa Indonesia LocaleDanish Locale = "da" // Dansk LocaleGerman Locale = "de" // Deutsch LocaleEnglishUK Locale = "en-GB" // English, UK LocaleEnglishUS Locale = "en-US" // English, US LocaleSpanishSpain Locale = "es-ES" // Español LocaleSpanishLatam Locale = "es-419" // Español, LATAM LocaleFrench Locale = "fr" // Français LocaleCroatian Locale = "hr" // Hrvatski LocaleItalian Locale = "it" // Italiano LocaleLithuanian Locale = "lt" // Lietuviškai LocaleHungarian Locale = "hu" // Magyar LocaleDutch Locale = "nl" // Nederlands LocaleNorwegian Locale = "no" // Norsk LocalePolish Locale = "pl" // Polski LocalePortugueseBrazil Locale = "pt-BR" // Português do Brasil LocaleRomanian Locale = "ro" // Română LocaleFinnish Locale = "fi" // Suomi LocaleSwedish Locale = "sv-SE" // Svenska LocaleVietnamese Locale = "vi" // Tiếng Việt LocaleTurkish Locale = "tr" // Türkçe LocaleCzech Locale = "cs" // Čeština LocaleGreek Locale = "el" // Ελληνικά LocaleBulgarian Locale = "bg" // български LocaleRussian Locale = "ru" // Pусский LocaleUkrainian Locale = "uk" // Українська LocaleHindi Locale = "hi" // हिन्दी LocaleChineseChina Locale = "zh-CN" // 中文 LocaleJapanese Locale = "ja" // 日本語 LocaleChineseTaiwan Locale = "zh-TW" // 繁體中文 LocaleKorean Locale = "ko" // 한국어 )
type MFALevel ¶
type MFALevel int
ExplicitContentFilterLevel represents the mfa level on a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
type MediaChannel ¶
type MediaChannel struct {
ForumChannel
}
MediaChannel represents a media channel.
type MediaGalleryBuilder ¶ added in v0.15.0
type MediaGalleryBuilder struct {
// contains filtered or unexported fields
}
MediaGalleryBuilder helps build a MediaGalleryComponent with chainable methods.
func NewMediaGalleryBuilder ¶ added in v0.15.0
func NewMediaGalleryBuilder() *MediaGalleryBuilder
NewMediaGalleryBuilder creates a new MediaGalleryBuilder instance.
func (*MediaGalleryBuilder) AddItem ¶ added in v0.15.0
func (b *MediaGalleryBuilder) AddItem(item MediaGalleryItem) *MediaGalleryBuilder
AddItem adds a single gallery item.
func (*MediaGalleryBuilder) Build ¶ added in v0.15.0
func (b *MediaGalleryBuilder) Build() *MediaGalleryComponent
Build returns the final MediaGalleryComponent.
func (*MediaGalleryBuilder) Reset ¶ added in v0.15.0
func (b *MediaGalleryBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*MediaGalleryBuilder) SetID ¶ added in v0.15.0
func (b *MediaGalleryBuilder) SetID(id int) *MediaGalleryBuilder
SetID sets the component ID.
func (*MediaGalleryBuilder) SetItems ¶ added in v0.15.0
func (b *MediaGalleryBuilder) SetItems(items []MediaGalleryItem) *MediaGalleryBuilder
SetItems sets all gallery items at once.
type MediaGalleryComponent ¶ added in v0.14.0
type MediaGalleryComponent struct {
ComponentFields
// Items is an array of 1 to 10 media gallery items.
//
// Valid components:
// - MediaGalleryItem (1 to 10)
Items []MediaGalleryItem `json:"items"`
}
MediaGalleryComponent is a top-level content component that displays 1-10 media attachments in an organized gallery format.
Each item in the gallery can have an optional description and can be marked as a spoiler. Media Galleries require the IS_COMPONENTS_V2 message flag (1 << 15) to be set when sending the message.
Note:
- Only available in messages.
- Requires the IS_COMPONENTS_V2 message flag (1 << 15).
- Contains 1 to 10 media gallery items.
Reference: https://discord.com/developers/docs/components/reference#media-gallery
func (*MediaGalleryComponent) MarshalJSON ¶ added in v0.14.0
func (c *MediaGalleryComponent) MarshalJSON() ([]byte, error)
type MediaGalleryItem ¶ added in v0.14.0
type MediaGalleryItem struct {
// Media is a url or attachment provided as an unfurled media item.
Media UnfurledMediaItem `json:"media"`
// Description is an alt text for the media.
//
// Note:
// - Max 1024 characters.
Description string `json:"description,omitempty"`
// Spoiler is whether the media should be a spoiler (or blurred out). Defaults to false.
Spoiler bool `json:"spoiler,omitempty"`
}
MediaGalleryItem represents an item in a MediaGallery component.
It contains a single media item with an optional description and spoiler flag.
Note:
- Maximum of 1024 characters for the description.
Reference: https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-item-structure
type Member ¶
type Member struct {
// ID is the user's unique Discord ID.
ID Snowflake `json:"id"`
// GuildID is the ID of the guild this member belongs to.
GuildID Snowflake `json:"guild_id"`
// Nickname is the member's guild-specific nickname.
// Empty if no nickname is set.
Nickname string `json:"nick"`
// Avatar is the member's guild-specific avatar hash.
// This is different from the user's global avatar.
// Empty if the member hasn't set a guild avatar.
Avatar string `json:"avatar"`
// Banner is the member's guild-specific banner hash.
// This is different from the user's global banner.
// Empty if the member hasn't set a guild banner.
Banner string `json:"banner"`
// RoleIDs contains the IDs of all roles assigned to this member.
RoleIDs []Snowflake `json:"roles,omitempty"`
// JoinedAt is the timestamp when the user joined the guild.
// May be nil if the member was invited as a guest.
JoinedAt *time.Time `json:"joined_at,omitzero"`
// PremiumSince is the timestamp when the user started boosting the guild.
// Nil if the member is not currently boosting.
PremiumSince *time.Time `json:"premium_since,omitzero"`
// Deaf indicates whether the user is deafened in voice channels.
Deaf bool `json:"deaf,omitempty"`
// Mute indicates whether the user is muted in voice channels.
Mute bool `json:"mute,omitempty"`
// Flags contains the member's guild-specific flags.
Flags MemberFlags `json:"flags"`
// Pending indicates whether the user has completed the guild's Membership Screening.
// True if they still need to complete screening.
Pending bool `json:"pending"`
// CommunicationDisabledUntil is when the member's timeout expires.
// Nil or a past time if the member is not currently timed out.
CommunicationDisabledUntil *time.Time `json:"communication_disabled_until,omitzero"`
// AvatarDecorationData contains information about the member's avatar decoration.
AvatarDecorationData *AvatarDecorationData `json:"avatar_decoration_data"`
}
Member represents a user's membership in a specific guild.
This contains guild-specific information like nickname, roles, and join date.
func (*Member) AvatarDecorationURL ¶
AvatarDecorationURL returns the URL to the member's avatar decoration image.
If the member has no avatar decoration, it returns an empty string.
Example usage:
url := member.AvatarDecorationURL()
func (*Member) AvatarDecorationURLWith ¶
AvatarDecorationURLWith returns the URL to the member's avatar decoration image, allowing explicit specification of image size.
If the member has no avatar decoration, it returns an empty string.
Example usage:
url := member.AvatarDecorationURLWith(ImageSize512)
func (*Member) AvatarURL ¶
AvatarURL returns the URL to the members's avatar image.
If the member has a custom avatar set, it returns the URL to that avatar, otherwise empty string. By default, it uses GIF format if the avatar is animated, otherwise PNG.
Example usage:
url := member.AvatarURL()
func (*Member) AvatarURLWith ¶
func (m *Member) AvatarURLWith(format ImageFormat, size ImageSize) string
AvatarURLWith returns the URL to the member's avatar image, allowing explicit specification of image format and size.
If the user has a custom avatar set, it returns the URL to that avatar, otherwise empty string.
Example usage:
url := member.AvatarURLWith(ImageFormatWebP, ImageSize512)
func (*Member) BannerURL ¶
BannerURL returns the URL to the member's banner image.
If the member has a custom banner set, it returns the URL to that banner, otherwise empty string. By default, it uses GIF format if the banner is animated, otherwise PNG.
Example usage:
url := member.BannerURL()
func (*Member) BannerURLWith ¶
func (m *Member) BannerURLWith(format ImageFormat, size ImageSize) string
BannerURLWith returns the URL to the member's banner image, allowing explicit specification of image format and size.
If the user has a custom banner set, it returns the URL to that avatar, otherwise empty string.
Example usage:
url := member.BannerURLWith(ImageFormatWebP, ImageSize512)
type MemberFlags ¶
type MemberFlags int
MemberFlags represents flags of a guild member.
Reference: https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-flags
const ( // Member has left and rejoined the guild // - Editable: false MemberFlagDidRejoin MemberFlags = 1 << iota // Member has completed onboarding // - Editable: false MemberFlagCompletedOnboarding // Member is exempt from guild verification requirements // - Editable: true MemberFlagBypassesVerification // Member has started onboarding // - Editable: false MemberFlagStartedOnboarding // Member is a guest and can only access the voice channel they were invited to // - Editable: false MemberFlagIsGuest // Member has started Server Guide new member actions // - Editable: false MemberFlagStartedHomeActions // Member has completed Server Guide new member actions // - Editable: false MemberFlagCompletedHomeActions // Member's username, display name, or nickname is blocked by AutoMod // - Editable: false MemberFlagQuarantinedUsername // Member has dismissed the DM settings upsell // - Editable: false MemberFlagDMSettingsUpsellAcknowledged // Member's guild tag is blocked by AutoMod // - Editable: false MemberFlagQuarantinedGuildTag )
func (MemberFlags) Has ¶
func (f MemberFlags) Has(flags ...MemberFlags) bool
Has returns true if all provided flags are set.
type MembershipState ¶
type MembershipState int
MembershipState represent a team member MembershipState.
Reference: https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
const ( MembershipStateInvited MembershipState = iota + 1 MembershipStateAccepted )
func (MembershipState) Is ¶
func (s MembershipState) Is(memberShipState MembershipState) bool
Is returns true if the team member's membership state matches the provided membership state.
type MentionChannel ¶ added in v0.14.1
type MentionChannel struct {
// ID is the unique Discord snowflake ID of the channel.
ID Snowflake `json:"id"`
// GuildID is the ID of the guild containing the channel.
//
// Optional:
// - Will be 0 if the channel is not in a guild (e.g., a DM channel).
GuildID Snowflake `json:"guild_id"`
// Type is the type of the channel.
Type ChannelType `json:"type"`
// Name is the name of the channel.
Name string `json:"name"`
}
MentionChannel represents a channel mentioned in a message.
Reference: https://discord.com/developers/docs/resources/message#channel-mention-object
func (*MentionChannel) Mention ¶ added in v0.14.1
func (c *MentionChannel) Mention() string
Mention returns the Discord mention string for the channel in the format "<#channel_id>".
func (*MentionChannel) String ¶ added in v0.15.0
func (c *MentionChannel) String() string
String implements the fmt.Stringer interface.
type MentionableSelectMenuBuilder ¶ added in v0.15.0
type MentionableSelectMenuBuilder struct {
// contains filtered or unexported fields
}
MentionableSelectMenuBuilder helps build a MentionableSelectMenuComponent with chainable methods.
func NewMentionableSelectMenuBuilder ¶ added in v0.15.0
func NewMentionableSelectMenuBuilder() *MentionableSelectMenuBuilder
NewMentionableSelectMenuBuilder creates a new MentionableSelectMenuBuilder instance.
func (*MentionableSelectMenuBuilder) AddDefaultValue ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *MentionableSelectMenuBuilder
AddDefaultValue adds a single default value.
func (*MentionableSelectMenuBuilder) Build ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) Build() *MentionableSelectMenuComponent
Build returns the final MentionableSelectMenuComponent.
func (*MentionableSelectMenuBuilder) Reset ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*MentionableSelectMenuBuilder) SetCustomID ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) SetCustomID(customID string) *MentionableSelectMenuBuilder
SetCustomID sets the custom ID.
func (*MentionableSelectMenuBuilder) SetDefaultValues ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *MentionableSelectMenuBuilder
SetDefaultValues sets all default values at once.
func (*MentionableSelectMenuBuilder) SetDisabled ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) SetDisabled(disabled bool) *MentionableSelectMenuBuilder
SetDisabled sets whether the select menu is disabled.
func (*MentionableSelectMenuBuilder) SetMaxValues ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) SetMaxValues(maxValues int) *MentionableSelectMenuBuilder
SetMaxValues sets the maximum number of selections.
func (*MentionableSelectMenuBuilder) SetMinValues ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) SetMinValues(minValues *int) *MentionableSelectMenuBuilder
SetMinValues sets the minimum number of selections.
func (*MentionableSelectMenuBuilder) SetPlaceholder ¶ added in v0.15.0
func (b *MentionableSelectMenuBuilder) SetPlaceholder(placeholder string) *MentionableSelectMenuBuilder
SetPlaceholder sets the placeholder text.
type MentionableSelectMenuComponent ¶ added in v0.14.0
type MentionableSelectMenuComponent struct {
InteractiveComponentFields
// Placeholder is the text if nothing is selected.
//
// Note:
// - Max 150 characters.
Placeholder string `json:"placeholder,omitempty"`
// DefaultValues is a list of default values for auto-populated select menu components;
// number of default values must be in the range defined by min_values and max_values.
DefaultValues []SelectDefaultValue `json:"default_values,omitempty"`
// MinValues is the minimum number of items that must be chosen (defaults to 1).
//
// Note:
// - Min 0, max 25.
MinValues *int `json:"min_values,omitempty"`
// MaxValues is the maximum number of items that can be chosen (defaults to 1).
//
// Note:
// - Min 1, max 25.
MaxValues int `json:"max_values,omitempty"`
// Disabled is whether select menu is disabled (defaults to false).
Disabled bool `json:"disabled,omitempty"`
}
MentionableSelectMenuComponent represents a mentionable select menu component.
Reference: https://discord.com/developers/docs/components/reference#mentionable-select
func (*MentionableSelectMenuComponent) MarshalJSON ¶ added in v0.14.0
func (c *MentionableSelectMenuComponent) MarshalJSON() ([]byte, error)
type Message ¶ added in v0.14.1
type Message struct {
// ID is the unique Discord snowflake ID of the message.
ID Snowflake `json:"id"`
// ChannelID is the ID of the channel where the message was sent.
ChannelID Snowflake `json:"channel_id"`
// Author is the user who authored the message.
//
// Note:
// - For webhook messages, this field reflects the webhook's ID, username, and avatar.
Author User `json:"author"`
// Content is the text content of the message.
//
// Note:
// - Will be empty if the bot lacks the GatewayIntentMessageContent privileged intent (1 << 15).
Content string `json:"content"`
// Timestamp is when the message was sent.
Timestamp time.Time `json:"timestamp,omitzero"`
// EditedTimestamp is when the message was last edited.
//
// Optional:
// - Will be None if the message has never been edited.
EditedTimestamp optional.Option[time.Time] `json:"edited_timestamp,omitzero"`
// TTS indicates whether the message is a text-to-speech message.
TTS bool `json:"tts"`
// MentionEveryone indicates whether the message mentions @everyone or @here.
MentionEveryone bool `json:"mention_everyone"`
// Mentions is an array of users specifically mentioned in the message.
Mentions []User `json:"mentions"`
// MentionRoles is an array of roles specifically mentioned in the message.
MentionRoles []Role `json:"mention_roles"`
// MentionChannels is an array of channels specifically mentioned in the message.
//
// Note:
// - Not all channel mentions in this message will appear in this slice. Only textual
// channels that are visible to everyone in a lurkable guild will ever be included. Only
// crossposted messages (via Channel Following) currently include MentionChannels at all.
// If no mentions in the message meet these requirements, this field will be empty.
MentionChannels []MentionChannel `json:"mention_channels"`
// Attachments is an array of file attachments included with the message.
//
// Optional:
// - Will be empty if no attachments are included or if the bot lacks the GatewayIntentMessageContent privileged intent (1 << 15).
Attachments []Attachment `json:"attachments"`
// Embeds is an array of embedded content included with the message.
//
// Optional:
// - Will be empty if no embeds are included or if the bot lacks the GatewayIntentMessageContent privileged intent (1 << 15).
Embeds []Embed `json:"embeds"`
// Reactions is an array of reactions to the message.
Reactions []MessageReaction `json:"reactions"`
// Nonce is a value used to validate that a message was sent successfully.
Nonce Nonce `json:"nonce"`
// Pinned indicates whether the message is pinned in the channel.
Pinned bool `json:"pinned"`
// WebhookID is the ID of the webhook that generated the message.
//
// Optional:
// - Will be 0 if the message is not sent by a webhook.
WebhookID Snowflake `json:"webhook_id"`
// Type is the type of the message.
Type MessageType `json:"type"`
// Activity is the activity associated with the message, used for Rich Presence embeds.
//
// Optional:
// - Will be nil if the message is not associated with a Rich Presence activity.
Activity *MessageActivity `json:"activity"`
// Application is a partial application object sent with Rich Presence-related chat embeds.
//
// Optional:
// - Will be nil if the message is not associated with a Rich Presence-related chat embed.
Application *MessageApplication `json:"application"`
// ApplicationID is the unique Discord snowflake ID of the application.
//
// Optional:
// - Will be 0 if the message is not an interaction or application-owned webhook.
ApplicationID Snowflake `json:"application_id"`
// Flags is a bitfield of message flags.
Flags MessageFlags `json:"flags"`
// MessageReference contains data showing the source of a crosspost, channel follow add, pin, or reply message.
//
// Optional:
// - Will be nil if the message is not a crosspost, channel follow add, pin, or reply.
MessageReference *MessageReference `json:"message_reference"`
// MessageSnapshots is an array of message snapshot objects associated with the message_reference,
// containing a minimal subset of message fields (e.g., excludes Author).
//
// Optional:
// - Will be empty if the message is not associated with message forwarding.
MessageSnapshots []MessageSnapshot `json:"message_snapshots"`
// ReferencedMessage is the message associated with the message_reference.
//
// Optional:
// - Will be nil if the message is not of type MessageTypeReply, MessageTypeThreadStarterMessage,
// or MessageTypeContextMenuCommand, or if the referenced message was deleted.
//
// Note:
// - Only included for messages of type MessageTypeReply, MessageTypeThreadStarterMessage, or MessageTypeContextMenuCommand.
ReferencedMessage *Message `json:"referenced_message"`
// InteractionMetadata contains metadata about the interaction that generated the message.
//
// Optional:
// - Will be nil if the message is not generated by an interaction.
InteractionMetadata *InteractionMetadata `json:"interaction_metadata"`
// Thread is the thread started from this message, including thread member data.
//
// Optional:
// - Will be nil if the message did not start a thread.
Thread *ResolvedThread `json:"thread"`
// Components is an array of interactive components (e.g., buttons, select menus) included with the message.
//
// Optional:
// - Will be empty if no components are included or if the bot lacks the GatewayIntentMessageContent privileged intent (1 << 15).
Components []LayoutComponent `json:"components"`
// StickerItems is an array of sticker items included with the message.
StickerItems []StickerItem `json:"sticker_items"`
// Position is the approximate position of the message in a thread.
//
// Optional:
// - Will be nil if the message is not in a thread.
Position optional.Option[int] `json:"position"`
// GuildID is the ID of the guild where the message was sent.
//
// Optional:
// - Will be 0 if the message is not in a guild (e.g., a DM).
GuildID Snowflake `json:"guild_id"`
// Poll is the poll object included with the message.
//
// Optional:
// - Will be nil if no poll is included or if the bot lacks the GatewayIntentMessageContent privileged intent (1 << 15).
Poll *Poll `json:"poll"`
// Call is the call associated with the message (e.g., voice or video call).
//
// Optional:
// - Will be nil if the message is not associated with a call.
Call *MessageCall `json:"call"`
}
Message represents a message sent in a channel within Discord.
Reference: https://discord.com/developers/docs/resources/message#message-object
func (*Message) URL ¶ added in v0.14.1
URL returns the Discord URL for the message in the format "https://discord.com/channels/{guild_id}/{channel_id}/{message_id}". If GuildID is 0 (e.g., for DMs), "@me" is used instead of a guild ID.
func (*Message) UnmarshalJSON ¶ added in v0.14.1
UnmarshalJSON unmarshals a JSON message into a Message struct, handling component deserialization.
type MessageActivity ¶ added in v0.14.1
type MessageActivity struct {
// Type is the type of the activity (e.g., join, spectate).
Type MessageActivityType `json:"type"`
// PartyID is the party ID from a Rich Presence event.
//
// Optional:
// - Will be empty if no party is associated with the activity.
PartyID string `json:"party_id"`
}
MessageActivity represents an activity associated with a message, used for Rich Presence.
Reference: https://discord.com/developers/docs/resources/message#message-object-message-activity-structure
type MessageActivityType ¶ added in v0.14.1
type MessageActivityType int
MessageActivityType represents the type of activity associated with a message.
Reference: https://discord.com/developers/docs/resources/message#message-object-message-activity-types
const ( // MessageActivityTypeJoin indicates a join activity (e.g., for Rich Presence). MessageActivityTypeJoin MessageActivityType = iota + 1 // MessageActivityTypeSpectate indicates a spectate activity. MessageActivityTypeSpectate // MessageActivityTypeListen indicates a listen activity. MessageActivityTypeListen // MessageActivityTypeJoinRequest indicates a join request activity. MessageActivityTypeJoinRequest )
func (MessageActivityType) Is ¶ added in v0.14.1
func (t MessageActivityType) Is(messageActivityType MessageActivityType) bool
Is checks if the message activity type matches the provided type.
type MessageApplication ¶ added in v0.14.1
type MessageApplication struct {
// ID is the unique Discord snowflake ID of the application.
ID Snowflake `json:"id"`
// CoverImage is the cover image hash of the application.
//
// Optional:
// - Will be empty if no cover image is set.
CoverImage string `json:"cover_image"`
// Description is the description of the application.
Description string `json:"description"`
// Icon is the icon hash of the application.
//
// Optional:
// - Will be empty if no icon is set.
Icon string `json:"icon"`
// Name is the name of the application.
Name string `json:"name"`
}
MessageApplication represents a partial application object for Rich Presence or webhooks.
Reference: https://discord.com/developers/docs/resources/application#application-object
type MessageCall ¶ added in v0.14.1
type MessageCall struct {
// Participants is an array of user IDs participating in the call.
//
// Optional:
// - Will be empty if no participants are present.
Participants []Snowflake `json:"participants"`
// EndedTimestamp is when the call ended.
//
// Optional:
// - Will be nil if the call is ongoing or not applicable.
EndedTimestamp *time.Time `json:"ended_timestamp,omitzero"`
}
MessageCall represents a call associated with a message.
Reference: https://discord.com/developers/docs/resources/message#message-call-object
type MessageChannel ¶
type MessageChannel interface {
Channel
// GetLastMessageID returns the Snowflake ID to the last message sent in this channel.
//
// Note:
// - Will always return 0 if no Message has been sent yet.
GetLastMessageID() Snowflake
}
MessageChannel represents a Discord text channel.
This interface extends the Channel interface and adds text-channel-specific fields, such as the ID of the last message and the rate limit (slowmode) per user.
Use this interface when you want to handle text channels specifically.
You can convert (assert) it to a concrete type using a type assertion or type switch:
Example usage:
var ch MessageChannel
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel name:", c.GetName())
fmt.Println("Last message ID:", c.GetLastMessageID())
case *VoiceChannel:
fmt.Println("Voiec channel name:", c.GetName())
fmt.Println("Last message ID:", c.GetLastMessageID())
case *DMChannel:
fmt.Println("DM channel name:", c.GetName())
fmt.Println("Last message ID:", c.GetLastMessageID())
default:
fmt.Println("Other text channel type:", c.GetType())
}
You can also use an if-condition to check a specific type:
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel:", textCh.GetName())
}
type MessageChannelFields ¶
type MessageChannelFields struct {
// LastMessageID is the id of the last message sent in this channel.
LastMessageID Snowflake `json:"last_message_id"`
}
MessageChannelFields holds fields related to text-based features like messaging.
func (*MessageChannelFields) GetLastMessageID ¶
func (t *MessageChannelFields) GetLastMessageID() Snowflake
type MessageCommandInteraction ¶ added in v0.14.0
type MessageCommandInteraction struct {
ApplicationCommandInteractionFields
// Data contains the payload of the interaction specific to message commands.
Data MessageCommandInteractionData `json:"data"`
}
MessageCommandInteraction represents an interaction triggered by a message context menu command.
Reference: https://discord.com/developers/docs/interactions/application-commands
type MessageCommandInteractionData ¶ added in v0.14.0
type MessageCommandInteractionData struct {
ApplicationCommandInteractionDataFields
// Resolved contains the resolved objects referenced by the command, messages in this case.
Resolved MessageCommandInteractionDataResolved `json:"resolved"`
// TargetID is the id of the message targeted by the command.
TargetID Snowflake `json:"target_id"`
}
MessageCommandInteractionData represents the data for a message command interaction.
type MessageCommandInteractionDataResolved ¶ added in v0.14.0
type MessageCommandInteractionDataResolved struct {
// Messages is a map of message IDs to partial Message objects
// referenced by the command.
Messages map[Snowflake]Message `json:"messages"`
}
MessageCommandInteractionDataResolved represents the resolved data for a message command interaction.
type MessageCreateEvent ¶
MessageCreateEvent Message was created
type MessageDeleteBulkEvent ¶ added in v0.15.0
type MessageDeleteBulkEvent struct {
}
MessageDeleteBulkEvent Multiple messages were deleted at once
type MessageDeleteEvent ¶
MessageDeleteEvent Message was deleted
type MessageFlags ¶ added in v0.14.1
type MessageFlags int
MessageFlags represents a bitfield of flags for a message.
Reference: https://discord.com/developers/docs/resources/message#message-object-message-flags
const ( // MessageFlagCrossposted indicates the message was published to subscribed channels via Channel Following. MessageFlagCrossposted MessageFlags = 1 << iota // MessageFlagIsCrosspost indicates the message originated from another channel via Channel Following. MessageFlagIsCrosspost // MessageFlagSuppressEmbeds indicates embeds should not be included when serializing the message. MessageFlagSuppressEmbeds // MessageFlagSourceMessageDeleted indicates the source message for a crosspost was deleted. MessageFlagSourceMessageDeleted // MessageFlagUrgent indicates the message came from the urgent message system. MessageFlagUrgent // MessageFlagHasThread indicates the message has an associated thread with the same ID. MessageFlagHasThread // MessageFlagEphemeral indicates the message is only visible to the user who invoked the interaction. MessageFlagEphemeral // MessageFlagLoading indicates the message is an interaction response and the bot is "thinking". MessageFlagLoading // MessageFlagFailedToMentionSomeRolesInThread indicates the message failed to mention some roles in a thread. MessageFlagFailedToMentionSomeRolesInThread // MessageFlagSuppressNotifications indicates the message will not trigger push or desktop notifications. MessageFlagSuppressNotifications // MessageFlagIsVoiceMessage indicates the message is a voice message. MessageFlagIsVoiceMessage // MessageFlagHasSnapshot indicates the message has a snapshot via Message Forwarding. MessageFlagHasSnapshot // MessageFlagIsComponentsV2 indicates the message supports fully component-driven interactions. MessageFlagIsComponentsV2 // MessageFlagsNone represents no flags set. MessageFlagsNone MessageFlags = 0 )
func (*MessageFlags) Add ¶ added in v0.14.1
func (f *MessageFlags) Add(flags ...MessageFlags)
Add sets all provided flags in the bitfield.
func (MessageFlags) Has ¶ added in v0.14.1
func (f MessageFlags) Has(flags ...MessageFlags) bool
Has checks if all provided flags are set in the bitfield.
func (*MessageFlags) Remove ¶ added in v0.14.1
func (f *MessageFlags) Remove(flags ...MessageFlags)
Remove clears all provided flags from the bitfield.
type MessageNotificationsLevel ¶
type MessageNotificationsLevel int
MessageNotificationLevel represents the default notification level on a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
const ( // Members will receive notifications for all messages by default. MessageNotificationsLevelAllMessages MessageNotificationsLevel = iota // Members will receive notifications only for messages that @mention them by default. MessageNotificationsLevelOnlyMentions )
func (MessageNotificationsLevel) Is ¶ added in v0.14.0
func (l MessageNotificationsLevel) Is(messageNotificationLevel MessageNotificationsLevel) bool
Is returns true if the message notifaction level matches the provided one.
type MessagePollVoteAddEvent ¶ added in v0.15.0
type MessagePollVoteAddEvent struct {
}
MessagePollVoteAddEvent User voted on a poll
type MessagePollVoteRemoveEvent ¶ added in v0.15.0
type MessagePollVoteRemoveEvent struct {
}
MessagePollVoteRemoveEvent User removed a vote on a poll
type MessageReaction ¶ added in v0.14.1
type MessageReaction struct {
// Count is the total number of times this emoji has been used to react, including super reactions.
Count int `json:"count"`
// CountDetails provides detailed counts of normal and super reactions.
CountDetails ReactionCountDetails `json:"count_details"`
// Me indicates whether the current user reacted with this emoji.
Me bool `json:"me"`
// MeBurst indicates whether the current user used a super reaction with this emoji.
MeBurst bool `json:"me_burst"`
// Emoji is the emoji used for the reaction.
Emoji Emoji `json:"emoji"`
// BurstColors contains the HEX colors used for super reactions.
//
// Optional:
// - Will be empty if no super reactions are present.
BurstColors []string `json:"burst_colors"`
}
MessageReaction represents a reaction to a message on Discord.
Reference: https://discord.com/developers/docs/resources/message#reaction-object
type MessageReactionAddEvent ¶ added in v0.15.0
type MessageReactionAddEvent struct {
}
MessageReactionAddEvent User reacted to a message
type MessageReactionRemoveAllEvent ¶ added in v0.15.0
type MessageReactionRemoveAllEvent struct {
}
MessageReactionRemoveAllEvent All reactions were explicitly removed from a message
type MessageReactionRemoveEmojiEvent ¶ added in v0.15.0
type MessageReactionRemoveEmojiEvent struct {
}
MessageReactionRemoveEmojiEvent All reactions for a given emoji were explicitly removed from a message
type MessageReactionRemoveEvent ¶ added in v0.15.0
type MessageReactionRemoveEvent struct {
}
MessageReactionRemoveEvent User removed a reaction from a message
type MessageReference ¶ added in v0.14.1
type MessageReference struct {
// Type is the type of reference (e.g., default, forward).
//
// Optional:
// - Will be omitted if not specified when sending a message.
Type MessageReferenceType `json:"type,omitempty"`
// MessageID is the ID of the referenced message.
MessageID Snowflake `json:"message_id"`
// ChannelID is the ID of the channel containing the referenced message.
//
// Optional:
// - Will be omitted if not specified when sending a message.
ChannelID Snowflake `json:"channel_id,omitempty"`
// GuildID is the ID of the guild containing the referenced message.
//
// Optional:
// - Will be 0 if the referenced message is not in a guild.
GuildID Snowflake `json:"guild_id,omitempty"`
// FailIfNotExists determines whether to error if the referenced message does not exist.
//
// Optional:
// - Defaults to true when sending a message.
FailIfNotExists bool `json:"fail_if_not_exists,omitempty"`
}
MessageReference represents a reference to another message, such as for replies or crossposts.
Reference: https://discord.com/developers/docs/resources/message#message-reference-structure
type MessageReferenceType ¶ added in v0.14.1
type MessageReferenceType int
MessageReferenceType determines how associated data is populated for a message reference.
Reference: https://discord.com/developers/docs/resources/message#message-reference-types
const ( // MessageReferenceTypeDefault is a standard message reference (e.g., for replies). MessageReferenceTypeDefault MessageReferenceType = iota // MessageReferenceTypeForward is a reference for forwarded messages. MessageReferenceTypeForward )
type MessageSnapshot ¶ added in v0.14.1
type MessageSnapshot struct {
// Message is the partial message data for the snapshot.
Message PartialMessage `json:"message"`
}
MessageSnapshot represents a snapshot of a message, used for message forwarding.
Reference: https://discord.com/developers/docs/resources/message#message-snapshot-object
type MessageType ¶ added in v0.14.1
type MessageType int
MessageType represents the type of a message on Discord.
Reference: https://discord.com/developers/docs/resources/message#message-object-message-types
const ( // MessageTypeDefault is a standard user-sent message. // Deletable: true MessageTypeDefault MessageType = iota // MessageTypeRecipientAdd is a system message indicating a user was added to a group DM. // Deletable: false MessageTypeRecipientAdd // MessageTypeRecipientRemove is a system message indicating a user was removed from a group DM. // Deletable: false MessageTypeRecipientRemove // MessageTypeCall is a system message indicating a call was started. // Deletable: false MessageTypeCall // MessageTypeChannelNameChange is a system message indicating a channel's name was changed. // Deletable: false MessageTypeChannelNameChange // MessageTypeChannelIconChange is a system message indicating a channel's icon was changed. // Deletable: false MessageTypeChannelIconChange // MessageTypeChannelPinnedMessage is a system message indicating a message was pinned. // Deletable: true MessageTypeChannelPinnedMessage // MessageTypeUserJoin is a system message indicating a user joined a guild. // Deletable: true MessageTypeUserJoin // MessageTypeGuildBoost is a system message indicating a guild received a boost. // Deletable: true MessageTypeGuildBoost // MessageTypeGuildBoostTier1 is a system message indicating a guild reached boost tier 1. // Deletable: true MessageTypeGuildBoostTier1 // MessageTypeGuildBoostTier2 is a system message indicating a guild reached boost tier 2. // Deletable: true MessageTypeGuildBoostTier2 // MessageTypeGuildBoostTier3 is a system message indicating a guild reached boost tier 3. // Deletable: true MessageTypeGuildBoostTier3 // MessageTypeChannelFollowAdd is a system message indicating a channel was followed. // Deletable: true MessageTypeChannelFollowAdd // MessageTypeGuildDiscoveryDisqualified is a system message indicating a guild was disqualified from Discovery. // Deletable: true MessageTypeGuildDiscoveryDisqualified // MessageTypeGuildDiscoveryRequalified is a system message indicating a guild requalified for Discovery. // Deletable: true MessageTypeGuildDiscoveryRequalified // MessageTypeGuildDiscoveryGracePeriodInitialWarning is a system message for the initial Discovery grace period warning. // Deletable: true MessageTypeGuildDiscoveryGracePeriodInitialWarning // MessageTypeGuildDiscoveryGracePeriodFinalWarning is a system message for the final Discovery grace period warning. // Deletable: true MessageTypeGuildDiscoveryGracePeriodFinalWarning // MessageTypeThreadCreated is a system message indicating a thread was created. // Deletable: true MessageTypeThreadCreated // MessageTypeReply is a message sent as a reply to another message. // Deletable: true MessageTypeReply // MessageTypeSlashCommand is a message resulting from a slash command interaction. // Deletable: true MessageTypeSlashCommand // MessageTypeThreadStarterMessage is the initial message of a thread. // Deletable: false MessageTypeThreadStarterMessage // MessageTypeGuildInviteReminder is a system message reminding users to invite friends to the guild. // Deletable: true MessageTypeGuildInviteReminder // MessageTypeContextMenuCommand is a message resulting from a context menu command. // Deletable: true MessageTypeContextMenuCommand // MessageTypeAutoModerationAction is a system message generated by an AutoMod action. // Deletable: true MessageTypeAutoModerationAction // MessageTypeRoleSubscriptionPurchase is a system message for a role subscription purchase. // Deletable: true MessageTypeRoleSubscriptionPurchase // MessageTypeInteractionPremiumUpsell is a system message encouraging a premium subscription upsell. // Deletable: true MessageTypeInteractionPremiumUpsell // MessageTypeStageStart is a system message indicating a stage instance started. // Deletable: true MessageTypeStageStart // MessageTypeStageEnd is a system message indicating a stage instance ended. // Deletable: true MessageTypeStageEnd // MessageTypeStageSpeaker is a system message indicating a stage speaker was added. // Deletable: true MessageTypeStageSpeaker // MessageTypeStageTopic is a system message indicating a stage topic was changed. // Deletable: true MessageTypeStageTopic // MessageTypeGuildApplicationPremiumSubscription is a system message for a guild premium subscription via an app. // Deletable: true MessageTypeGuildApplicationPremiumSubscription // MessageTypeGuildIncidentAlertModeEnabled is a system message indicating incident alert mode was enabled. // Deletable: true MessageTypeGuildIncidentAlertModeEnabled // MessageTypeGuildIncidentAlertModeDisabled is a system message indicating incident alert mode was disabled. // Deletable: true MessageTypeGuildIncidentAlertModeDisabled // MessageTypeGuildIncidentReportRaid is a system message indicating a raid was reported. // Deletable: true MessageTypeGuildIncidentReportRaid // MessageTypeGuildIncidentReportFalseAlarm is a system message indicating a raid report was marked as false. // Deletable: true MessageTypeGuildIncidentReportFalseAlarm // MessageTypePurchaseNotification is a system message for a purchase notification. // Deletable: true MessageTypePurchaseNotification // MessageTypePollResult is a system message indicating the results of a poll. // Deletable: true MessageTypePollResult )
func (MessageType) Deletable ¶ added in v0.14.1
func (t MessageType) Deletable() bool
Deletable indicates whether the message can be deleted.
func (MessageType) Is ¶ added in v0.14.1
func (t MessageType) Is(messageType MessageType) bool
Is checks if the message type matches the provided type.
func (MessageType) System ¶ added in v0.14.1
func (t MessageType) System() bool
System indicates whether the message is a system-generated message.
type MessageUpdateEvent ¶ added in v0.14.0
type MessageUpdateEvent struct {
ShardsID int // shard that dispatched this event
OldMessage Message
NewMessage Message
}
MessageCreateEvent Message was created
type ModalSubmitInteraction ¶
type ModalSubmitInteraction struct {
InteractionFields
}
type ModifyApplicationEmojiOptions ¶ added in v0.15.0
type ModifyApplicationEmojiOptions struct {
// Name is the name of the emoji.
Name string `json:"name,omitempty"`
}
ModifyApplicationEmojiOptions contains parameters for updating an existing application emoji.
Reference: https://discord.com/developers/docs/resources/emoji#modify-application-emoji-json-params
type ModifyChannelPositionOptions ¶ added in v0.15.0
type ModifyChannelPositionOptions struct {
Channels []ChannelPosition
}
ModifyChannelPositionOptions contains parameters for modifying channel positions.
Reference: https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
type ModifyCurrentMemberOptions ¶ added in v0.15.0
type ModifyCurrentMemberOptions struct {
// Nick sets your bot's nickname in this guild.
//
// Requires the PermissionManageNicknames permission.
Nick optional.Option[string] `json:"nick,omitzero"`
// Banner sets your bot's guild-specific banner image.
Banner optional.Option[Base64Image] `json:"banner,omitzero"`
// Avatar sets your bot's guild-specific avatar image.
Avatar optional.Option[Base64Image] `json:"avatar,omitzero"`
// Bio sets your bot's bio text for this guild.
Bio optional.Option[string] `json:"bio,omitzero"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyCurrentMemberOptions contains parameters for modifying your bot's member profile.
This allows you to update your bot's nickname, avatar, banner, and bio in a specific guild.
type ModifyGroupDMOptions ¶ added in v0.15.0
type ModifyGroupDMOptions struct {
// Name is the channel's name (1-100 characters).
Name string `json:"name,omitempty"`
// Icon sets the icon for Group DM.
Icon Base64Image `json:"icon,omitempty"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
ModifyGroupDMOptions contains parameters for modifying a Group DM channel.
type ModifyGuildChannelOptions ¶ added in v0.15.0
type ModifyGuildChannelOptions struct {
// Name is the channel's name (1-100 characters).
Name string `json:"name,omitempty"`
// Type specifies the type of channel to update.
//
// Note:
// - Defaults to ChannelTypeGuildText if unset.
// - Valid values include ChannelTypeGuildText, ChannelTypeGuildVoice, ChannelTypeGuildForum, etc.
//
// Applies to All Channels.
Type optional.Option[ChannelType] `json:"type,omitzero"`
// Position determines the channel’s position in the server’s channel list (lower numbers appear higher).
//
// Note:
// - Channels with the same position are sorted by their internal ID.
//
// Applies to All Channels.
Position optional.Option[int] `json:"position,omitzero"`
// Topic is a description of the channel (0-1024 characters).
//
// Note:
// - This field is optional.
//
// Applies to Channels of Type: Text, Announcement, Forum, Media.
Topic optional.Option[string] `json:"topic,omitzero"`
// Nsfw marks the channel as Not Safe For Work, restricting it to 18+ users.
//
// Note:
// - Set to true to enable the age restriction.
//
// Applies to Channels of Type: Text, Voice, Announcement, Stage, Forum.
Nsfw optional.Option[bool] `json:"nsfw,omitzero"`
// RateLimitPerUser sets the seconds a user must wait before sending another message (0-21600).
//
// Note:
// - Bots and users with manage_messages or manage_channel permissions are unaffected.
//
// Applies to Channels of Type: Text, Voice, Stage, Forum, Media.
RateLimitPerUser optional.Option[int] `json:"rate_limit_per_user,omitzero"`
// Bitrate sets the audio quality for voice or stage channels (in bits, minimum 8000).
//
// Note:
// - This field is ignored for non-voice channels.
//
// Applies to Channels of Type: Voice, Stage.
Bitrate optional.Option[int] `json:"bitrate,omitzero"`
// UserLimit caps the number of users in a voice or stage channel (0 for unlimited, 1-99 for a limit).
//
// Note:
// - Set to 0 to allow unlimited users.
//
// Applies to Channels of Type: Voice, Stage.
UserLimit optional.Option[int] `json:"user_limit,omitzero"`
// PermissionOverwrites defines custom permissions for specific roles or users.
//
// Note:
// - This field requires valid overwrite objects.
//
// Applies to All Channels.
PermissionOverwrites optional.Option[[]PermissionOverwrite] `json:"permission_overwrites,omitzero"`
// ParentID is the ID of the category to nest the channel under.
//
// Note:
// - This field is ignored for category channels.
//
// Applies to Channels of Type: Text, Voice, Announcement, Stage, Forum, Media.
ParentID optional.Option[Snowflake] `json:"parent_id,omitzero"`
// RtcRegion sets the voice region id for the voice channel.
//
// Note:
// - Automatic when set to null (or empty string in Option).
//
// Applies to Channels of Type: Voice, Stage.
RtcRegion optional.Option[string] `json:"rtc_region,omitzero"`
// VideoQualityMode sets the camera video quality for voice or stage channels.
//
// Note:
// - Valid options are defined in VideoQualityModes.
//
// Applies to Channels of Type: Voice, Stage.
VideoQualityMode optional.Option[VideoQualityModes] `json:"video_quality_mode,omitzero"`
// DefaultAutoArchiveDuration sets the default auto archive duration for new threads in this channel.
DefaultAutoArchiveDuration optional.Option[AutoArchiveDuration] `json:"default_auto_archive_duration,omitzero"`
// Flags sets the channel flags.
Flags optional.Option[ChannelFlags] `json:"flags,omitzero"`
// AvailableTags sets the available tags for a forum/media channel.
AvailableTags optional.Option[[]ForumTag] `json:"available_tags,omitzero"`
// DefaultReactionEmoji sets the default reaction emoji for a forum/media channel.
DefaultReactionEmoji optional.Option[DefaultReactionEmoji] `json:"default_reaction_emoji,omitzero"`
// DefaultThreadRateLimitPerUser sets the default thread slowmode.
DefaultThreadRateLimitPerUser optional.Option[int] `json:"default_thread_rate_limit_per_user,omitzero"`
// DefaultSortOrder sets the default sort order for a forum/media channel.
DefaultSortOrder optional.Option[ForumPostsSortOrder] `json:"default_sort_order,omitzero"`
// DefaultForumLayout sets the default layout for a forum channel.
DefaultForumLayout optional.Option[ForumLayout] `json:"default_forum_layout,omitzero"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
ModifyGuildChannelOptions contains parameters for modifying a Guild channel.
type ModifyGuildEmojiOptions ¶ added in v0.15.0
type ModifyGuildEmojiOptions struct {
// Name is the name of the emoji.
Name string `json:"name,omitempty"`
// Roles are the roles allowed to use this emoji.
Roles []Snowflake `json:"roles,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyGuildEmojiOptions contains parameters for modifying an existing guild emoji.
Reference: https://discord.com/developers/docs/resources/emoji#modify-guild-emoji-json-params
type ModifyGuildIncidentActionsOptions ¶ added in v0.15.0
type ModifyGuildIncidentActionsOptions struct {
// InvitesDisabledUntil is when invites will be enabled again.
//
// Note: Supplying 'optional.Nil[time.Time]()' disables the action.
InvitesDisabledUntil optional.Option[time.Time] `json:"invites_disabled_until,omitzero"`
// DMsDisabledUntil is when direct messages will be enabled again.
//
// Note: Supplying 'optional.Nil[time.Time]()' disables the action.
DMsDisabledUntil optional.Option[time.Time] `json:"dms_disabled_until,omitzero"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyGuildIncidentActionsOptions contains parameters for modifying guild incident actions.
Reference: https://discord.com/developers/docs/resources/guild#modify-guild-incident-actions
type ModifyGuildOnboardingOptions ¶ added in v0.15.0
type ModifyGuildOnboardingOptions struct {
// Prompts are the prompts shown during onboarding and in customize community.
Prompts optional.Option[[]OnboardingPrompt] `json:"prompts,omitzero"`
// DefaultChannelIDs are the channel IDs that members get opted into automatically.
DefaultChannelIDs optional.Option[[]Snowflake] `json:"default_channel_ids,omitzero"`
// Enabled is whether onboarding is enabled in the guild.
Enabled optional.Option[bool] `json:"enabled,omitzero"`
// Mode is the current mode of onboarding.
Mode OnboardingMode `json:"mode,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyGuildOnboardingOptions contains parameters for modifying guild onboarding.
Reference: https://discord.com/developers/docs/resources/guild#modify-guild-onboarding
type ModifyGuildOptions ¶ added in v0.15.0
type ModifyGuildOptions struct {
Name string `json:"name,omitempty"`
VerificationLevel optional.Option[VerificationLevel] `json:"verification_level,omitzero"`
DefaultMessageNotifications optional.Option[MessageNotificationsLevel] `json:"default_message_notifications,omitzero"`
ExplicitContentFilter optional.Option[ExplicitContentFilterLevel] `json:"explicit_content_filter,omitzero"`
AfkChannelID optional.Option[Snowflake] `json:"afk_channel_id,omitzero"`
AfkTimeout AfkTimeout `json:"afk_timeout,omitempty"`
Icon optional.Option[Base64Image] `json:"icon,omitzero"`
Splash optional.Option[Base64Image] `json:"splash,omitzero"`
DiscoverySplash optional.Option[Base64Image] `json:"discovery_splash,omitzero"`
Banner optional.Option[Base64Image] `json:"banner,omitzero"`
SystemChannelID optional.Option[Snowflake] `json:"system_channel_id,omitzero"`
SystemChannelFlags optional.Option[SystemChannelFlags] `json:"system_channel_flags,omitzero"`
RulesChannelID optional.Option[Snowflake] `json:"rules_channel_id,omitzero"`
PublicUpdatesChannelID optional.Option[Snowflake] `json:"public_updates_channel_id,omitzero"`
PreferredLocale Locale `json:"preferred_locale,omitempty"`
Features []GuildFeature `json:"features"`
Description string `json:"description"`
PremiumProgressBarEnabled optional.Option[bool] `json:"premium_progress_bar_enabled,omitzero"`
SafetyAlertsChannelID optional.Option[Snowflake] `json:"safety_alerts_channel_id,omitzero"`
Reason string `json:"-"`
}
ModifyGuildOptions contains parameters for modifying a guild's settings.
Reference: https://discord.com/developers/docs/resources/guild#modify-guild
type ModifyGuildThreadOptions ¶ added in v0.15.0
type ModifyGuildThreadOptions struct {
// Name is the channel's name (1-100 characters).
Name string `json:"name,omitempty"`
// Archived sets the archived state of the thread.
Archived optional.Option[bool] `json:"archived,omitzero"`
// AutoArchiveDuration sets the duration after which the thread will automatically archive.
AutoArchiveDuration optional.Option[AutoArchiveDuration] `json:"auto_archive_duration,omitzero"`
// Locked sets the locked state of the thread.
Locked optional.Option[bool] `json:"locked,omitzero"`
// Invitable sets whether non-moderators can invite others to the thread (private threads only).
Invitable optional.Option[bool] `json:"invitable,omitzero"`
// RateLimitPerUser sets the seconds a user must wait before sending another message (0-21600).
//
// Note:
// - Bots and users with manage_messages or manage_channel permissions are unaffected.
RateLimitPerUser optional.Option[int] `json:"rate_limit_per_user,omitzero"`
// Flags sets the channel flags.
Flags optional.Option[ChannelFlags] `json:"flags,omitzero"`
// AppliedTags sets the tags applied to a thread.
AppliedTags optional.Option[[]Snowflake] `json:"applied_tags,omitzero"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
ModifyGuildThreadOptions contains parameters for modifying a Guild thread's settings.
type ModifyGuildWelcomeScreenOptions ¶ added in v0.15.0
type ModifyGuildWelcomeScreenOptions struct {
// Enabled is whether the welcome screen is enabled.
Enabled optional.Option[bool] `json:"enabled,omitzero"`
// WelcomeChannels are the channels linked in the welcome screen and their display options.
WelcomeChannels optional.Option[[]GuildWelcomeChannel] `json:"welcome_channels,omitzero"`
// Description is the the server description to show in the welcome screen.
Description optional.Option[string] `json:"description,omitzero"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyGuildWelcomeScreenOptions contains parameters for modifying a guild welcome screen.
Reference: https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
type ModifyGuildWidgetOptions ¶ added in v0.15.0
type ModifyGuildWidgetOptions struct {
Enabled optional.Option[bool] `json:"enabled,omitzero"`
ChannelID Snowflake `json:"channel_id,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyGuildWidgetOptions contains parameters for modifying a guild widget.
type ModifyMemberOptions ¶ added in v0.15.0
type ModifyMemberOptions struct {
// Nickname sets the member's guild nickname.
// Set to empty string to remove the nickname.
//
// Requires the PermissionManageNicknames permission.
Nickname optional.Option[string] `json:"nick,omitzero"`
// Roles sets the complete list of role IDs for the member.
// This replaces all existing roles with the provided list.
//
// Requires the PermissionManageRoles permission.
Roles optional.Option[[]Snowflake] `json:"roles,omitzero"`
// Mute sets whether the member is muted in voice channels.
// The member must be in a voice channel for this to work.
//
// Requires the PermissionMuteMembers permission.
Mute optional.Option[bool] `json:"mute,omitzero"`
// Deaf sets whether the member is deafened in voice channels.
// The member must be in a voice channel for this to work.
//
// Requires the PermissionDeafenMembers permission.
Deaf optional.Option[bool] `json:"deaf,omitzero"`
// ChannelID moves the member to a different voice channel.
// The member must be connected to voice for this to work.
//
// Requires the PermissionMoveMembers permission.
ChannelID Snowflake `json:"channel_id,omitempty"`
// CommunicationDisabledUntil sets when the member's timeout expires.
// Can be up to 28 days in the future.
//
// Note: Supplying 'optional.Nil[time.Time]()' disables the action.
//
// Requires the PermissionModerateMembers permission.
CommunicationDisabledUntil optional.Option[time.Time] `json:"communication_disabled_until,omitzero"`
// Flags sets the member's guild-specific flags.
//
// Requires the PermissionManageGuild or PermissionManageRoles or (PermissionModerateMembers and PermissionKickMembers and PermissionBanMembers).
Flags MemberFlags `json:"flags,omitempty"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyMemberOptions contains parameters for modifying a guild member.
All fields are optional. Only provide the fields you want to change.
type ModifyRoleOptions ¶ added in v0.15.0
type ModifyRoleOptions struct {
// Name is the channel's name (max 100 characters).
Name string `json:"name,omitempty"`
// Permissions is the permission to set for the role.
Permissions optional.Option[Permissions] `json:"permissions,omitzero"`
// Colors are the colors to set for the role.
Colors optional.Option[RoleColors] `json:"colors,omitzero"`
// Hoist is whether the role should be displayed separately in the sidebar.
Hoist optional.Option[bool] `json:"hoist,omitzero"`
// Mentionable is whether the role should be displayed separately in the sidebar.
Mentionable optional.Option[bool] `json:"mentionable,omitzero"`
// Icon is the role's icon image (if the guild has the GuildFeatureRoleIcons feature).
Icon optional.Option[Base64Image] `json:"icon,omitzero"`
// UnicodeEmoji is the role's unicode emoji as a standard emoji (if the guild has the GuildFeatureRoleIcons feature).
UnicodeEmoji optional.Option[string] `json:"unicode_emoji,omitzero"`
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
ModifyRoleOptions contains parameters for modifying a guild role.
type ModifyRolePositionsOptions ¶ added in v0.15.0
type ModifyRolePositionsOptions struct {
Roles []RolePosition
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
ModifyRolePositionsOptions defines the configuration for modifying roles positions.
type NSFWLevel ¶
type NSFWLevel int
NSFWLevel represent the NSFW level on a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level
type NamedChannel ¶
NamedChannel represents a Discord channel that has a name.
This interface is used for channel types that expose a name, such as text channels, voice channels, forum channels, thread channels, DM channels, and Group DM channels.
Use this interface when you want to handle channels generically by their name without knowing the specific concrete type in advance.
You can convert (assert) it to a specific channel type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var ch NamedChannel
// Using a type switch to handle specific channel types
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel name:", c.GetName())
case *VoiceChannel:
fmt.Println("Voice channel name:", c.GetName())
default:
fmt.Println("Other named channel type:", c.GetType())
}
// Using a type assertion to check a specific type
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel name:", textCh.GetName())
}
type Nameplate ¶
type Nameplate struct {
// SkuID is the Discord snowflake ID of the nameplate SKU.
SkuID Snowflake `json:"sku_id"`
// Asset is the path to the nameplate asset.
Asset string `json:"asset"`
// Label is the label of this nameplate.
//
// Optional:
// - May be empty string.
Label string `json:"label"`
// Palette is the background color of the nameplate.
//
// Values possible:
// "crimson", "berry", "sky", "teal", "forest",
// "bubble_gum", "violet", "cobalt", "clover", "lemon", "white"
Palette string `json:"palette"`
}
Nameplate represents the nameplate the user has.
Reference: https://discord.com/developers/docs/resources/user#nameplate
type Nonce ¶ added in v0.14.1
type Nonce string
Nonce represents a string or integer used to validate message sending.
func (*Nonce) UnmarshalJSON ¶ added in v0.14.1
type NsfwChannelFields ¶
type NsfwChannelFields struct {
// Nsfw indicates whether the channel is NSFW.
Nsfw bool `json:"nsfw"`
}
NsfwChannelFields holds the NSFW indicator field.
type OAuth2Scope ¶
type OAuth2Scope string
OAuth2Scope represent the scopes you can request in the OAuth2 flow.
Referenceflag flag://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-flag
const ( // OAuth2ScopeActivitiesRead allows your app to fetch data from a // user's "Now Playing/Recently Played" list - requires Discord approval. OAuth2ScopeActivitiesRead OAuth2Scope = "activities.read" // OAuth2ScopeActivitiesWrite allows your app to update a user's activity - requires // Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER). OAuth2ScopeActivitiesWrite OAuth2Scope = "activities.write" // OAuth2ScopeApplicationsBuildsRead allows your app to read build data for a user's applications. OAuth2ScopeApplicationsBuildsRead OAuth2Scope = "applications.builds.read" // OAuth2ScopeApplicationsBuildsUpload allows your app to upload/update builds for a user's // applications - requires Discord approval. OAuth2ScopeApplicationsBuildsUpload OAuth2Scope = "applications.builds.upload" // OAuth2ScopeApplicationsCommands allows your app to add commands to a // guild - included by default with the bot scope. OAuth2ScopeApplicationsCommands OAuth2Scope = "applications.commands" // OAuth2ScopeApplicationsCommandsUpdate allows your app to update its commands // using a Bearer token - client credentials grant only. OAuth2ScopeApplicationsCommandsUpdate OAuth2Scope = "applications.commands.update" // OAuth2ScopeApplicationsCommandsPermissionsUpdate allows your app to update permissions // for its commands in a guild a user has permissions to. OAuth2ScopeApplicationsCommandsPermissionsUpdate OAuth2Scope = "applications.commands.permissions.update" // OAuth2ScopeApplicationsEntitlements allows your app to read entitlements for a user's applications. OAuth2ScopeApplicationsEntitlements OAuth2Scope = "applications.entitlements" // OAuth2ScopeApplicationsStoreUpdate allows your app to read and update store data // (SKUs, store listings, achievements, etc.) for a user's applications. OAuth2ScopeApplicationsStoreUpdate OAuth2Scope = "applications.store.update" // OAuth2ScopeBot for oauth2 bots, this puts the bot in the user's selected guild by default. OAuth2ScopeBot OAuth2Scope = "bot" // OAuth2ScopeConnections allows /users/@me/connections to return linked third-party accounts. OAuth2ScopeConnections OAuth2Scope = "connections" // OAuth2ScopeDMChannelsRead allows your app to see information about the user's DMs and // group DMs - requires Discord approval. OAuth2ScopeDMChannelsRead OAuth2Scope = "dm_channels.read" // OAuth2ScopeEmail enables /users/@me to return an email. OAuth2ScopeEmail OAuth2Scope = "email" // OAuth2ScopeGDMJoin allows your app to join users to a group dm. OAuth2ScopeGDMJoin OAuth2Scope = "gdm.join" // OAuth2ScopeGuilds allows /users/@me/guilds to return basic information about all of a user's guilds. OAuth2ScopeGuilds OAuth2Scope = "guilds" // OAuth2ScopeGuildsJoin allows /guilds/{guild.id}/members/{user.id} to be used for joining users to a guild. OAuth2ScopeGuildsJoin OAuth2Scope = "guilds.join" // OAuth2ScopeGuildsMembersRead allows /users/@me/guilds/{guild.id}/member to return // a user's member information in a guild. OAuth2ScopeGuildsMembersRead OAuth2Scope = "guilds.members.read" // OAuth2ScopeIdentify allows /users/@me without email. OAuth2ScopeIdentify OAuth2Scope = "identify" // OAuth2ScopeMessagesRead for local rpc server api access, this allows you to read messages // from all client channels (otherwise restricted to channels/guilds your app creates). OAuth2ScopeMessagesRead OAuth2Scope = "messages.read" // OAuth2ScopeRelationshipsRead allows your app to know a user's friends and implicit // relationships - requires Discord approval. OAuth2ScopeRelationshipsRead OAuth2Scope = "relationships.read" // OAuth2ScopeRoleConnectionsWrite allows your app to update a user's connection and metadata for the app. OAuth2ScopeRoleConnectionsWrite OAuth2Scope = "role_connections.write" // OAuth2ScopeRPC for local rpc server access, this allows you to control a user's local // Discord client - requires Discord approval. OAuth2ScopeRPC OAuth2Scope = "rpc" // OAuth2ScopeRPCActivitiesWrite for local rpc server access, this allows you to update // a user's activity - requires Discord approval. OAuth2ScopeRPCActivitiesWrite OAuth2Scope = "rpc.activities.write" // OAuth2ScopeRPCNotificationsRead for local rpc server access, this allows you to // receive notifications pushed out to the user - requires Discord approval. OAuth2ScopeRPCNotificationsRead OAuth2Scope = "rpc.notifications.read" // OAuth2ScopeRPCVoiceRead for local rpc server access, this allows you to read // a user's voice settings and listen for voice events - requires Discord approval. OAuth2ScopeRPCVoiceRead OAuth2Scope = "rpc.voice.read" // OAuth2ScopeRPCVoiceWrite for local rpc server access, this allows you to update // a user's voice settings - requires Discord approval. OAuth2ScopeRPCVoiceWrite OAuth2Scope = "rpc.voice.write" // OAuth2ScopeVoice allows your app to connect to voice on user's behalf // and see all the voice members - requires Discord approval. OAuth2ScopeVoice OAuth2Scope = "voice" // OAuth2ScopeWebhookIncoming this generates a webhook that is returned in // the oauth token response for authorization code grants. OAuth2ScopeWebhookIncoming OAuth2Scope = "webhook.incoming" )
type OAuth2User ¶
type OAuth2User struct {
User
// Flags are internal user account flags.
Flags UserFlags `json:"flags"`
// Locale is the user's chosen language/locale.
Locale Locale `json:"locale"`
// MFAEnabled indicates if the user has two-factor authentication enabled.
MFAEnabled bool `json:"mfa_enabled"`
// Verified indicates if the user's email is verified.
Verified bool `json:"verified"`
// Email is the user's email address.
Email string `json:"email"`
}
type OnboardingMode ¶ added in v0.15.0
type OnboardingMode int
OnboardingMode defines the criteria used to satisfy Onboarding constraints that are required for enabling.
Reference: https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-mode
const ( // OnboardingModeDefault counts only Default Channels towards constraints. OnboardingModeDefault OnboardingMode = 0 // OnboardingModeAdvanced counts Default Channels and Questions towards constraints. OnboardingModeAdvanced OnboardingMode = 1 )
func (OnboardingMode) Is ¶ added in v0.15.0
func (m OnboardingMode) Is(mode OnboardingMode) bool
Is checks if the onboarding mode matches the provided mode.
type OnboardingPrompt ¶ added in v0.15.0
type OnboardingPrompt struct {
// ID is the ID of the prompt.
ID Snowflake `json:"id,omitempty"`
// Type is the type of prompt.
Type PromptType `json:"type"`
// Options are the options available within the prompt.
Options []OnboardingPromptOption `json:"options"`
// Title is the title of the prompt.
Title string `json:"title"`
// SingleSelect indicates whether users are limited to selecting one option.
SingleSelect bool `json:"single_select"`
// Required indicates whether the prompt is required before completing onboarding.
Required bool `json:"required"`
// InOnboarding indicates whether the prompt is present in the onboarding flow.
InOnboarding bool `json:"in_onboarding"`
}
OnboardingPrompt represents an onboarding prompt.
type OnboardingPromptOption ¶ added in v0.15.0
type OnboardingPromptOption struct {
// ID is the ID of the prompt option.
ID Snowflake `json:"id,omitempty"`
// ChannelIDs are the IDs for channels a member is added to.
ChannelIDs []Snowflake `json:"channel_ids"`
// RoleIDs are the IDs for roles assigned to a member.
RoleIDs []Snowflake `json:"role_ids"`
// EmojiID is the emoji ID of the option.
EmojiID Snowflake `json:"emoji_id,omitempty"`
// EmojiName is the emoji name of the option.
EmojiName string `json:"emoji_name,omitempty"`
// EmojiAnimated is whether the emoji is animated.
EmojiAnimated bool `json:"emoji_animated"`
// Title is the title of the option.
Title string `json:"title"`
// Description is the description of the option.
Description string `json:"description,omitempty"`
}
OnboardingPromptOption represents an option within an onboarding prompt.
Reference: https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
type OptionBase ¶
type OptionBase struct {
// Type is the type of the option.
Type ApplicationCommandOptionType `json:"type"`
// Name is the name of the option.
//
// Info:
// - Must be 1-32 characters.
// - Must be unique within an array of application command options.
Name string `json:"name"`
// Description is the description of the option.
//
// Info:
// - Must be 1-100 characters.
Description string `json:"description"`
// NameLocalizations is a localization dictionary for the name field.
//
// Info:
// - Keys are available locales.
// - Values follow the same restrictions as Name (1-32 characters).
NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
// DescriptionLocalizations is a localization dictionary for the description field.
//
// Info:
// - Keys are available locales.
// - Values follow the same restrictions as Description (1-100 characters).
DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
}
OptionBase contains fields common to all application command option types.
func (*OptionBase) GetDescription ¶
func (o *OptionBase) GetDescription() string
func (*OptionBase) GetName ¶
func (o *OptionBase) GetName() string
func (*OptionBase) GetType ¶
func (o *OptionBase) GetType() ApplicationCommandOptionType
type PartialApplication ¶ added in v0.15.0
type PartialApplication struct {
// ID is the applications's unique Discord snowflake ID.
ID Snowflake `json:"id"`
// Name is the applications's name.
Name string `json:"name"`
// Icon is the application's icon hash.
//
// Optional:
// - May be empty string if no icon.
Icon string `json:"icon"`
// Description is the description of a application.
Description string `json:"description"`
}
PartialApplication represent a Discord partial application object.
Reference: https://discord.com/developers/docs/resources/application#application-object
func (*PartialApplication) IconURL ¶ added in v0.15.0
func (a *PartialApplication) IconURL() string
IconURL returns the URL to the app's icon image.
If the application has a custom icon set, it returns the URL to that icon, otherwise empty string. By default, it uses PNG format.
Example usage:
url := application.IconURL()
type PartialChannel ¶ added in v0.15.0
type PartialChannel struct {
ChannelFields
// Name is the name of the channel.
//
// Info:
// - can be 1 to 100 characters.
Name string `json:"name,omitempty"`
}
func (*PartialChannel) GetName ¶ added in v0.15.0
func (c *PartialChannel) GetName() string
func (*PartialChannel) MarshalJSON ¶ added in v0.15.0
func (c *PartialChannel) MarshalJSON() ([]byte, error)
type PartialEmoji ¶
type PartialEmoji struct {
// ID is the unique identifier for a custom emoji.
// When sending a poll request with a custom emoji, provide only the ID and leave Name empty.
//
// Optional:
// - Will be 0 if no ID is set (e.g., for Unicode emojis or when not provided in a response).
ID Snowflake `json:"id,omitempty"`
// Name is the name of the emoji, used for Unicode emojis (e.g., "😊").
// When sending a poll request with a Unicode emoji, provide only the Name and leave ID as 0.
//
// Optional:
// - Will be empty if no name is set (e.g., for custom emojis or when not provided in a response).
Name string `json:"name,omitempty"`
// Animated indicates whether the emoji is animated.
Animated bool `json:"animated"`
}
PartialEmoji represents a partial emoji object used in a Discord poll, typically within a PollMedia object for poll answers, or when sending a message with a poll request.
When creating a poll answer, provide only the ID for a custom emoji or only the Name for a Unicode emoji.
Reference: https://discord.com/developers/docs/resources/poll#poll-media-object-poll-media-object-structure
type PartialGuild ¶ added in v0.14.0
type PartialGuild struct {
// ID is the guild's unique Discord snowflake ID.
ID Snowflake `json:"id"`
// Name is the guild's name.
Name string `json:"name"`
// Icon is the guild's icon hash.
//
// Optional:
// - May be empty string if no icon.
Icon string `json:"icon"`
// Banner is the guild's banner hash.
//
// Optional:
// - May be empty string if no banner is set.
Banner string `json:"banner"`
// Locale is the preferred locale of the guild;
Locale Locale `json:"locale"`
// Features is the enabled guild features.
Features []GuildFeature `json:"features"`
}
PartialGuild represents a partial struct of a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild
func (*PartialGuild) BannerURL ¶ added in v0.15.0
func (g *PartialGuild) BannerURL() string
BannerURL returns the URL to the guild's banner image.
If the guild has a custom banner set, it returns the URL to that banner, otherwise empty string. By default, it uses GIF format if the banner is animated, otherwise PNG.
Example usage:
url := guild.BannerURL()
func (*PartialGuild) IconURL ¶ added in v0.15.0
func (g *PartialGuild) IconURL() string
IconURL returns the URL to the guild's icon image.
If the guild has a custom icon set, it returns the URL to that icon, otherwise empty string. By default, it uses GIF format if the icon is animated, otherwise PNG.
Example usage:
url := guild.IconURL()
type PartialInvite ¶ added in v0.15.0
type PartialInvite struct {
// Code is the vanity url code.
Code string `json:"code,omitempty"`
// Uses is the number of times this invite has been used.
Uses int `json:"uses"`
}
PartialInvite represents a guild's partial object.
Reference: https://discord.com/developers/docs/resources/guild#get-guild-vanity-url
type PartialMember ¶ added in v0.15.0
type PartialMember struct {
// ID is the user's unique Discord ID.
ID Snowflake `json:"id"`
// GuildID is the ID of the guild this member belongs to.
GuildID Snowflake `json:"guild_id"`
// Nickname is the member's guild-specific nickname.
// Empty if no nickname is set.
Nickname string `json:"nick"`
// Avatar is the member's guild-specific avatar hash.
// This is different from the user's global avatar.
// Empty if the member hasn't set a guild avatar.
Avatar string `json:"avatar"`
// Banner is the member's guild-specific banner hash.
// This is different from the user's global banner.
// Empty if the member hasn't set a guild banner.
Banner string `json:"banner"`
// RoleIDs contains the IDs of all roles assigned to this member.
RoleIDs []Snowflake `json:"roles,omitempty"`
}
func (*PartialMember) AvatarURL ¶ added in v0.15.0
func (m *PartialMember) AvatarURL() string
AvatarURL returns the URL to the members's avatar image.
If the member has a custom avatar set, it returns the URL to that avatar, otherwise empty string. By default, it uses GIF format if the avatar is animated, otherwise PNG.
Example usage:
url := member.AvatarURL()
func (*PartialMember) AvatarURLWith ¶ added in v0.15.0
func (m *PartialMember) AvatarURLWith(format ImageFormat, size ImageSize) string
AvatarURLWith returns the URL to the member's avatar image, allowing explicit specification of image format and size.
If the user has a custom avatar set, it returns the URL to that avatar, otherwise empty string.
Example usage:
url := member.AvatarURLWith(ImageFormatWebP, ImageSize512)
func (*PartialMember) BannerURL ¶ added in v0.15.0
func (m *PartialMember) BannerURL() string
BannerURL returns the URL to the member's banner image.
If the member has a custom banner set, it returns the URL to that banner, otherwise empty string. By default, it uses GIF format if the banner is animated, otherwise PNG.
Example usage:
url := member.BannerURL()
func (*PartialMember) BannerURLWith ¶ added in v0.15.0
func (m *PartialMember) BannerURLWith(format ImageFormat, size ImageSize) string
BannerURLWith returns the URL to the member's banner image, allowing explicit specification of image format and size.
If the user has a custom banner set, it returns the URL to that avatar, otherwise empty string.
Example usage:
url := member.BannerURLWith(ImageFormatWebP, ImageSize512)
func (*PartialMember) CreatedAt ¶ added in v0.15.0
func (m *PartialMember) CreatedAt() time.Time
CreatedAt returns the time when this member account is created.
func (*PartialMember) Mention ¶ added in v0.15.0
func (m *PartialMember) Mention() string
Mention returns a Discord mention string for the user.
Example output: "<@123456789012345678>"
func (*PartialMember) String ¶ added in v0.15.0
func (m *PartialMember) String() string
String implements the fmt.Stringer interface.
type PartialMessage ¶ added in v0.14.1
type PartialMessage struct {
// Type is the type of the message (e.g., default, reply).
Type MessageType `json:"type"`
// Content is the text content of the message.
Content string `json:"content"`
// Embeds is an array of embedded content in the message.
//
// Optional:
// - Will be empty if no embeds are included.
Embeds []Embed `json:"embeds"`
// Attachments is an array of file attachments in the message.
//
// Optional:
// - Will be empty if no attachments are included.
Attachments []Attachment `json:"attachments"`
// Timestamp is when the message was sent.
Timestamp time.Time `json:"timestamp,omitzero"`
// EditedTimestamp is when the message was last edited.
//
// Optional:
// - Will be nil if the message has never been edited.
EditedTimestamp *time.Time `json:"edited_timestamp,omitzero"`
// Flags is a bitfield of message flags (e.g., crossposted, ephemeral).
Flags MessageFlags `json:"flags"`
// Mentions is an array of users mentioned in the message.
//
// Optional:
// - Will be empty if no users are mentioned.
Mentions []User `json:"mentions"`
// MentionRoles is an array of roles mentioned in the message.
//
// Optional:
// - Will be empty if no roles are mentioned.
MentionRoles []Snowflake `json:"mention_roles"`
// Stickers is an array of stickers included in the message.
//
// Optional:
// - Will be empty if no stickers are included.
Stickers []Sticker `json:"stickers"`
}
PartialMessage represents a lightweight version of a Discord message.
Reference: https://discord.com/developers/docs/resources/message#message-reference-structure
type PermissionName ¶
type PermissionName = string
PermissionName is a human-readable name for a Discord permission.
const ( PermissionNameCreateInstantInvite PermissionName = "CreateInstantInvite" PermissionNameKickMembers PermissionName = "KickMembers" PermissionNameBanMembers PermissionName = "BanMembers" PermissionNameAdministrator PermissionName = "Administrator" PermissionNameManageChannels PermissionName = "ManageChannels" PermissionNameManageGuild PermissionName = "ManageGuild" PermissionNameAddReactions PermissionName = "AddReactions" PermissionNameViewAuditLog PermissionName = "ViewAuditLog" PermissionNamePrioritySpeaker PermissionName = "PrioritySpeaker" PermissionNameStream PermissionName = "Stream" PermissionNameViewChannel PermissionName = "ViewChannel" PermissionNameSendMessages PermissionName = "SendMessages" PermissionNameSendTTSMessages PermissionName = "SendTTSMessages" PermissionNameManageMessages PermissionName = "ManageMessages" PermissionNameEmbedLinks PermissionName = "EmbedLinks" PermissionNameAttachFiles PermissionName = "AttachFiles" PermissionNameReadMessageHistory PermissionName = "ReadMessageHistory" PermissionNameMentionEveryone PermissionName = "MentionEveryone" PermissionNameUseExternalEmojis PermissionName = "UseExternalEmojis" PermissionNameViewGuildInsights PermissionName = "ViewGuildInsights" PermissionNameConnect PermissionName = "Connect" PermissionNameSpeak PermissionName = "Speak" PermissionNameMuteMembers PermissionName = "MuteMembers" PermissionNameDeafenMembers PermissionName = "DeafenMembers" PermissionNameMoveMembers PermissionName = "MoveMembers" PermissionNameUseVAD PermissionName = "UseVAD" PermissionNameChangeNickname PermissionName = "ChangeNickname" PermissionNameManageNicknames PermissionName = "ManageNicknames" PermissionNameManageRoles PermissionName = "ManageRoles" PermissionNameManageWebhooks PermissionName = "ManageWebhooks" PermissionNameManageGuildExpressions PermissionName = "ManageGuildExpressions" PermissionNameUseApplicationCommands PermissionName = "UseApplicationCommands" PermissionNameRequestToSpeak PermissionName = "RequestToSpeak" PermissionNameManageEvents PermissionName = "ManageEvents" PermissionNameManageThreads PermissionName = "ManageThreads" PermissionNameCreatePublicThreads PermissionName = "CreatePublicThreads" PermissionNameCreatePrivateThreads PermissionName = "CreatePrivateThreads" PermissionNameUseExternalStickers PermissionName = "UseExternalStickers" PermissionNameSendMessagesInThreads PermissionName = "SendMessagesInThreads" PermissionNameUseEmbeddedActivities PermissionName = "UseEmbeddedActivities" PermissionNameModerateMembers PermissionName = "ModerateMembers" PermissionNameViewCreatorMonetizationAnalytics PermissionName = "ViewCreatorMonetizationAnalytics" PermissionNameUseSoundboard PermissionName = "UseSoundboard" PermissionNameCreateGuildExpressions PermissionName = "CreateGuildExpressions" PermissionNameCreateEvents PermissionName = "CreateEvents" PermissionNameUseExternalSounds PermissionName = "UseExternalSounds" PermissionNameSendVoiceMessages PermissionName = "SendVoiceMessages" PermissionNameSendPolls PermissionName = "SendPolls" PermissionNameUseExternalApps PermissionName = "UseExternalApps" PermissionNamePinMessages PermissionName = "PinMessages" PermissionNameBypassSlowmode PermissionName = "BypassSlowmode" )
type PermissionOverwrite ¶
type PermissionOverwrite struct {
// ID is the role or user ID the overwrite applies to.
ID Snowflake `json:"id"`
// Type specifies whether this overwrite is for a role or a member.
Type PermissionOverwriteType `json:"type"`
// Allow is the permission bit set explicitly allowed.
Allow Permissions `json:"allow,omitempty"`
// Deny is the permission bit set explicitly denied.
Deny Permissions `json:"deny,omitempty"`
}
PermissionOverwrite represents a permission overwrite for a role or member.
Used to grant or deny specific permissions in a channel.
Reference: https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
type PermissionOverwriteType ¶
type PermissionOverwriteType int
PermissionOverwriteType defines the type of permission overwrite target.
Reference: https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
const ( // PermissionOverwriteTypeRole indicates the overwrite applies to a role. PermissionOverwriteTypeRole PermissionOverwriteType = 0 // PermissionOverwriteTypeMember indicates the overwrite applies to a member. PermissionOverwriteTypeMember PermissionOverwriteType = 1 )
func (PermissionOverwriteType) Is ¶
func (t PermissionOverwriteType) Is(overWriteType PermissionOverwriteType) bool
Is returns true if the overWrite's Type matches the provided one.
type Permissions ¶
type Permissions uint64
Permissions flags for roles and channels permissions.
Reference: https://discord.com/developers/docs/topics/permissions
const ( // CreateInstantInvite allows creation of instant invites. // // Channel types: Text, Voice, Stage PermissionCreateInstantInvite Permissions = 1 << 0 // KickMembers allows kicking members. PermissionKickMembers Permissions = 1 << 1 // BanMembers allows banning members. PermissionBanMembers Permissions = 1 << 2 // Administrator allows all permissions and bypasses channel permission overwrites. PermissionAdministrator Permissions = 1 << 3 // ManageChannels allows management and editing of channels. // // Channel types: Text, Voice, Stage PermissionManageChannels Permissions = 1 << 4 // ManageGuild allows management and editing of the guild. PermissionManageGuild Permissions = 1 << 5 // AddReactions allows adding new reactions to messages. // Does not apply to reacting with an existing reaction. // // Channel types: Text, Voice, Stage PermissionAddReactions Permissions = 1 << 6 // ViewAuditLog allows viewing audit logs. PermissionViewAuditLog Permissions = 1 << 7 // PrioritySpeaker allows using priority speaker in a voice channel. // // Channel types: Voice PermissionPrioritySpeaker Permissions = 1 << 8 // Stream allows the user to go live. // // Channel types: Voice, Stage PermissionStream Permissions = 1 << 9 // ViewChannel allows viewing a channel, reading messages, or joining voice channels. // // Channel types: Text, Voice, Stage PermissionViewChannel Permissions = 1 << 10 // SendMessages allows sending messages and creating threads in forums. // Does not allow sending messages in threads. // // Channel types: Text, Voice, Stage PermissionSendMessages Permissions = 1 << 11 // SendTTSMessages allows sending /tts messages. // // Channel types: Text, Voice, Stage PermissionSendTTSMessages Permissions = 1 << 12 // ManageMessages allows deletion of other users' messages. // // Channel types: Text, Voice, Stage PermissionManageMessages Permissions = 1 << 13 // EmbedLinks allows links to be auto-embedded. // // Channel types: Text, Voice, Stage PermissionEmbedLinks Permissions = 1 << 14 // AttachFiles allows uploading images and files. // // Channel types: Text, Voice, Stage PermissionAttachFiles Permissions = 1 << 15 // ReadMessageHistory allows reading message history. // // Channel types: Text, Voice, Stage PermissionReadMessageHistory Permissions = 1 << 16 // MentionEveryone allows using @everyone and @here tags. // // Channel types: Text, Voice, Stage PermissionMentionEveryone Permissions = 1 << 17 // UseExternalEmojis allows using custom emojis from other servers. // // Channel types: Text, Voice, Stage PermissionUseExternalEmojis Permissions = 1 << 18 // ViewGuildInsights allows viewing guild insights. PermissionViewGuildInsights Permissions = 1 << 19 // Connect allows joining a voice channel. // // Channel types: Voice, Stage PermissionConnect Permissions = 1 << 20 // Speak allows speaking in a voice channel. // // Channel types: Voice PermissionSpeak Permissions = 1 << 21 // MuteMembers allows muting members in a voice channel. // // Channel types: Voice, Stage PermissionMuteMembers Permissions = 1 << 22 // DeafenMembers allows deafening members in a voice channel. // // Channel types: Voice PermissionDeafenMembers Permissions = 1 << 23 // MoveMembers allows moving members between voice channels. // // Channel types: Voice, Stage PermissionMoveMembers Permissions = 1 << 24 // UseVAD allows using voice activity detection in a voice channel. // // Channel types: Voice PermissionUseVAD Permissions = 1 << 25 // ChangeNickname allows modification of own nickname. PermissionChangeNickname Permissions = 1 << 26 // ManageNicknames allows modification of other users' nicknames. PermissionManageNicknames Permissions = 1 << 27 // ManageRoles allows management and editing of roles. // // Channel types: Text, Voice, Stage PermissionManageRoles Permissions = 1 << 28 // ManageWebhooks allows management and editing of webhooks. // // Channel types: Text, Voice, Stage PermissionManageWebhooks Permissions = 1 << 29 // ManageGuildExpressions allows editing/deleting emojis, stickers, and soundboard sounds created by all users. PermissionManageGuildExpressions Permissions = 1 << 30 // UseApplicationCommands allows using application (slash) commands. // // Channel types: Text, Voice, Stage PermissionUseApplicationCommands Permissions = 1 << 31 // RequestToSpeak allows requesting to speak in stage channels. // // Channel types: Stage PermissionRequestToSpeak Permissions = 1 << 32 // ManageEvents allows editing and deleting scheduled events created by all users. // // Channel types: Voice, Stage PermissionManageEvents Permissions = 1 << 33 // ManageThreads allows deleting, archiving, and viewing all private threads. // // Channel types: Text PermissionManageThreads Permissions = 1 << 34 // CreatePublicThreads allows creating public and announcement threads. // // Channel types: Text PermissionCreatePublicThreads Permissions = 1 << 35 // CreatePrivateThreads allows creating private threads. // // Channel types: Text PermissionCreatePrivateThreads Permissions = 1 << 36 // UseExternalStickers allows using custom stickers from other servers. // // Channel types: Text, Voice, Stage PermissionUseExternalStickers Permissions = 1 << 37 // SendMessagesInThreads allows sending messages in threads. // // Channel types: Text PermissionSendMessagesInThreads Permissions = 1 << 38 // UseEmbeddedActivities allows using Activities (applications with the EMBEDDED flag). // // Channel types: Text, Voice PermissionUseEmbeddedActivities Permissions = 1 << 39 // ModerateMembers allows timing out users to prevent sending/reacting to messages or speaking. PermissionModerateMembers Permissions = 1 << 40 // ViewCreatorMonetizationAnalytics allows viewing role subscription insights. PermissionViewCreatorMonetizationAnalytics Permissions = 1 << 41 // UseSoundboard allows using soundboard in a voice channel. // // Channel types: Voice PermissionUseSoundboard Permissions = 1 << 42 // CreateGuildExpressions allows creating emojis, stickers, and soundboard sounds, and editing/deleting those created by self. PermissionCreateGuildExpressions Permissions = 1 << 43 // CreateEvents allows creating scheduled events, editing, and deleting those created by self. // // Channel types: Voice, Stage PermissionCreateEvents Permissions = 1 << 44 // UseExternalSounds allows using custom soundboard sounds from other servers. // // Channel types: Voice PermissionUseExternalSounds Permissions = 1 << 45 // SendVoiceMessages allows sending voice messages. // // Channel types: Text, Voice, Stage PermissionSendVoiceMessages Permissions = 1 << 46 // SendPolls allows sending polls. // // Channel types: Text, Voice, Stage PermissionSendPolls Permissions = 1 << 49 // UseExternalApps allows user-installed apps to send public responses. // // Channel types: Text, Voice, Stage PermissionUseExternalApps Permissions = 1 << 50 // PermissionPinMessages allows pinning and unpinning messages. // // Channel types: Text PermissionPinMessages Permissions = 1 << 51 // PermissionPinMessages allows pinning and unpinning messages. // // Channel types: Text, Voice, Stage PermissionBypassSlowmode Permissions = 1 << 52 )
func (*Permissions) Add ¶
func (p *Permissions) Add(perms ...Permissions)
Add sets all given permissions.
func (Permissions) Has ¶
func (p Permissions) Has(perms ...Permissions) bool
Has returns true if all given permissions are set.
func (Permissions) MarshalJSON ¶
func (p Permissions) MarshalJSON() ([]byte, error)
Method used internally by the library.
func (Permissions) Missing ¶
func (p Permissions) Missing(perms ...Permissions) Permissions
Missing returns a Permissions bitmask containing the permissions that are present in the input perms but missing from p.
Example:
p := PermissionSendMessages missing := p.Missing(PermissionSendMessages, PermissionManageChannels) // missing will contain PermissionManageChannels
func (Permissions) Names ¶
func (p Permissions) Names() []PermissionName
PermissionsToNames returns a slice of PermissionName for all permissions set in the mask.
func (*Permissions) Remove ¶
func (p *Permissions) Remove(perms ...Permissions)
Remove clears all given permissions.
func (*Permissions) UnmarshalJSON ¶
func (p *Permissions) UnmarshalJSON(data []byte) error
type PingInteraction ¶
type PingInteraction struct {
InteractionFields
}
PingInteraction represents a Discord Ping interaction.
Reference: https://discord.com/developers/docs/interactions/receiving-and-responding
type Poll ¶
type Poll struct {
// Question is the question of the poll. Only text is supported.
Question PollMedia `json:"question"`
// Answers is a list of each answer available in the poll.
//
// Note:
// - Currently, there is a maximum of 10 answers per poll.
Answers []PollAnswer `json:"answers"`
// Expiry is the time when the poll ends. Nullable to support potential
// future non-expiring polls. Will be nil if the poll has no expiry, but currently all polls expire.
// This is designed for future Discord updates to support never-expiring polls.
//
// Optional:
// - Will be nil if the poll has no expiry.
Expiry *time.Time `json:"expiry,omitzero"`
// AllowMultiselect indicates whether a user can select multiple answers.
AllowMultiselect bool `json:"allow_multiselect"`
// LayoutType is an integer defining the visual layout of the poll.
LayoutType PollLayoutType `json:"layout_type"`
// Results contains the results of the poll, if available. Optional and nullable.
//
// Optional:
// - Will be nil if the poll has no results.
Results *PollResults `json:"results"`
}
Poll represents a message poll sent in a channel within Discord.
Reference: https://discord.com/developers/docs/resources/poll#poll-object
type PollAnswer ¶
type PollAnswer struct {
// AnswerID is the ID of the answer, a number that labels each answer.
// Currently, it is always set for poll answers, but future updates may allow it to be
// unset. Will be nil if not provided.
// As an implementation detail, it currently starts at 1 for the first answer and
// increments sequentially. It is recommended not to depend on this sequence.
//
// Optional:
// - Will be nil if no ID is set.
AnswerID *int `json:"answer_id,omitempty"`
// PollMedia is the data of the answer.
PollMedia PollMedia `json:"poll_media"`
}
PollAnswer represents an answer option in a Discord poll. It contains the answer's ID and its media content.
Reference: https://discord.com/developers/docs/resources/poll#poll-answer-object-poll-answer-object-structure
type PollAnswerCount ¶
type PollAnswerCount struct {
// ID is the answer_id of the poll answer, corresponding to the unique identifier of the answer option.
ID int `json:"id"`
// Count is the number of votes cast for this answer.
// Note:
// - While a poll is in progress, this count may not be perfectly accurate due to the complexities
// of counting at scale. Once the poll is finalized (as indicated by PollResults.IsFinalized),
// the count reflects the accurate tally.
Count int `json:"count"`
// MeVoted indicates whether the current user has voted for this answer.
MeVoted bool `json:"me_voted"`
}
PollAnswerCount represents the vote count and user voting status for a specific answer in a Discord poll. It is part of the Poll Results Object, which contains the number of votes for each answer.
type PollCreateOptions ¶ added in v0.14.3
type PollCreateOptions struct {
// Question defines the main question of the poll.
Question PollMedia `json:"question"`
// Answers is the list of possible answers a user can select from.
Answers []PollAnswer `json:"answers"`
// Duration specifies the number of hours the poll should remain open.
//
// Defaults to 24 hours if omitted.
// Constraints:
// - Minimum: 1 hour
// - Maximum: 768 hours (32 days)
Duration int `json:"duration,omitempty"`
// AllowMultiselect indicates whether users may select more than one answer.
//
// Defaults to false if omitted.
AllowMultiselect bool `json:"allow_multiselect,omitempty"`
// LayoutType specifies how the poll is visually arranged.
//
// Defaults to PollLayoutTypeDefault if omitted.
LayoutType PollLayoutType `json:"layout_type,omitempty"`
}
PollCreateOptions represents the request payload for creating a poll in a message.
Reference:
Note:
This object is similar to the main Poll object, but differs in that it specifies a `duration` field (how long the poll remains open), which later becomes an `expiry` field in the resulting poll object.
type PollLayoutType ¶
type PollLayoutType int
PollLayoutType represents the layout type of a Discord poll. It defines the visual or structural arrangement of the poll. Currently, only the default layout is supported, but additional layouts may be introduced in the future.
Reference: https://discord.com/developers/docs/resources/poll#poll-object-poll-object-structure
const ( // PollLayoutTypeDefault represents the default layout type for a poll, with an ID of 1. // This is currently the only supported layout type. PollLayoutTypeDefault PollLayoutType = iota + 1 )
func (PollLayoutType) Is ¶
func (t PollLayoutType) Is(pollLayoutType PollLayoutType) bool
Is returns true if the pool layout's type matches the provided layout type.
type PollMedia ¶
type PollMedia struct {
// Text is the text content of the poll question or answer.
// Currently, it is always non-empty, with a max length of 300
// characters for questions and 55 for answers. Future Discord
// updates may allow empty text to indicate no text content.
// Use an empty string ("") to represent no text.
//
// Optional:
// - Will be empty if no text is set.
Text string `json:"text"`
// Emoji is an optional partial emoji for the poll question or answer.
// When creating a poll answer with an emoji, only the emoji's ID
// (for custom emojis) or name (for default emojis) needs to be provided.
//
// Optional:
// - Will be nil if no emoji is set.
Emoji *PartialEmoji `json:"emoji,omitempty"`
}
PollMedia represents the media content of a poll question or answer in Discord. It encapsulates the text and optional emoji associated with a poll's question or answer.
Reference: https://discord.com/developers/docs/resources/poll#poll-media-object-poll-media-object-structure
type PollResults ¶
type PollResults struct {
// IsFinalized indicates whether the votes for the poll have been precisely counted.
// If true, the vote counts are final; if false, the counts may still be updating.
IsFinalized bool `json:"is_finalized"`
// AnswerCounts is a list of PollAnswerCount objects, each containing the count
// of votes for a specific answer option in the poll.
AnswerCounts []PollAnswerCount `json:"answer_counts"`
}
PollResults represents the results of a Discord poll, including whether the votes have been finalized and the counts for each answer option.
Reference: https://discord.com/developers/docs/resources/poll#poll-results-object-poll-results-object-structure
type PositionedChannel ¶
type PositionedChannel interface {
NamedChannel
GetPosition() int
}
PositionedChannel represents a Discord channel that has a sorting position within its parent category.
This interface is used for guild channels that have a defined position, such as category channels, text channels, voice channels, announcement channels, stage voice channels, forum channels, and media channels. The position determines the order in which channels appear within their parent category in the Discord client. If the channel is not under a parent category, the position is relative to other top-level channels in the guild.
Use this interface when you want to handle channels generically by their position without knowing the specific concrete type in advance.
You can convert (assert) it to a specific channel type using a type assertion or a type switch, as described in the official Go documentation:
Example usage:
var ch PositionedChannel
// Using a type switch to handle specific channel types
switch c := ch.(type) {
case *TextChannel:
fmt.Println("Text channel position:", c.GetPosition())
case *VoiceChannel:
fmt.Println("Voice channel position:", c.GetPosition())
case *ForumChannel:
fmt.Println("Forum channel position:", c.GetPosition())
default:
fmt.Println("Other positioned channel type:", c.GetType())
}
// Using a type assertion to check a specific type
if textCh, ok := ch.(*TextChannel); ok {
fmt.Println("Text channel position:", textCh.GetPosition())
}
type PremiumTier ¶
type PremiumTier int
PremiumTier represents the boost level of a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
const ( // Guild has not unlocked any Server Boost perks. PremiumTierNone PremiumTier = iota // Guild has unlocked Server Boost level 1 perks. PremiumTierOne // Guild has unlocked Server Boost level 2 perks. PremiumTierTwo // Guild has unlocked Server Boost level 3 perks. PremiumTierThree )
func (PremiumTier) Is ¶
func (p PremiumTier) Is(premiumTier PremiumTier) bool
Is returns true if the guild's premium tier matches the provided premium tier.
type PresenceUpdateEvent ¶ added in v0.15.0
type PresenceUpdateEvent struct {
}
PresenceUpdateEvent User was updated
type PromptType ¶ added in v0.15.0
type PromptType int
PromptType represents the type of onboarding prompt.
Reference: https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-type
const ( // PromptTypeMultipleChoice represents a multiple choice prompt. PromptTypeMultipleChoice PromptType = 0 // PromptTypeDropdown represents a dropdown prompt. PromptTypeDropdown PromptType = 1 )
func (PromptType) Is ¶ added in v0.15.0
func (t PromptType) Is(typ PromptType) bool
Is checks if the prompt type matches the provided type.
type PruneCount ¶ added in v0.15.0
type PruneCount struct {
// Pruned is the number of members that would be/were removed in a prune operation.
Pruned int `json:"pruned"`
}
PruneCount represents the result of a prune count.
type ReactionCountDetails ¶ added in v0.14.1
type ReactionCountDetails struct {
// Burst is the count of super reactions.
Burst int `json:"burst"`
// Normal is the count of normal reactions.
Normal int `json:"normal"`
}
ReactionCountDetails provides counts for normal and super reactions to a message.
Reference: https://discord.com/developers/docs/resources/message#reaction-count-details-object
type ReadyEvent ¶
ReadyCreateEvent Shard is ready
type RemoveMemberRoleOptions ¶ added in v0.15.0
type RemoveMemberRoleOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
RemoveMemberRoleOptions contains parameters for removing a role from a member.
type Request ¶ added in v0.15.0
type Request struct {
// Body is the raw JSON request body or other data sent to the API.
Body []byte
// Method is the HTTP verb (GET, POST, etc.) to use for the request.
Method string
// URL is the endpoint path (e.g., "/guilds/123") relative to the base URL.
URL string
// Reason is the value for the "X-Audit-Log-Reason" header, useful for audit logs.
Reason string
// NoAuth indicates whether to skip token-based authentication for this request.
// If false (default), the "Authorization" header will be automatically set using the bot token.
NoAuth bool
}
Request represents an HTTP request to be executed by the requester.
type RequesterConfig ¶ added in v0.15.0
type RequesterConfig struct {
// BaseURL is the base URL for API requests. Defaults to Discord API.
// Change this to use a reverse proxy like nirn-proxy.
BaseURL string
// APIVersion is the Discord API version. Defaults to "v10".
APIVersion string
// UserAgent is the User-Agent header value.
UserAgent string
// MaxRetries is the maximum number of retries for failed requests.
MaxRetries int
// Token is the Bot token.
Token string
// HTTPClient is a custom HTTP client.
HTTPClient *http.Client
}
RequesterConfig holds configuration for the HTTP requester.
func DefaultRequesterConfig ¶ added in v0.15.0
func DefaultRequesterConfig() RequesterConfig
type RequiredBase ¶
type RequiredBase struct {
// Required indicates whether the parameter is required or optional.
//
// Info:
// - Defaults to false.
// - Required options must be listed before optional options in an array of options.
Required bool `json:"required,omitempty"`
}
RequiredBase contains the required field for value-based options.
type ResolvedChannel ¶
type ResolvedChannel struct {
Channel
Permissions Permissions `json:"permissions"`
}
func (*ResolvedChannel) UnmarshalJSON ¶
func (c *ResolvedChannel) UnmarshalJSON(buf []byte) error
UnmarshalJSON implements json.Unmarshaler for ResolvedChannel.
type ResolvedMember ¶
type ResolvedMember struct {
FullMember
// Permissions contains all permissions the member has in a specific channel,
// including role permissions and permission overwrites.
Permissions Permissions `json:"permissions,omitempty"`
}
ResolvedMember represents a member with their computed permissions.
This is typically used in interaction contexts where you need to know what permissions the member has in the channel where the interaction occurred.
type ResolvedMessageChannel ¶ added in v0.14.0
type ResolvedMessageChannel struct {
MessageChannel
Permissions Permissions `json:"permissions"`
}
func (*ResolvedMessageChannel) UnmarshalJSON ¶ added in v0.14.0
func (c *ResolvedMessageChannel) UnmarshalJSON(buf []byte) error
UnmarshalJSON implements json.Unmarshaler for ResolvedMessageChannel.
type ResolvedThread ¶
type ResolvedThread struct {
ThreadChannel
Permissions Permissions `json:"permissions"`
}
type RestGuild ¶
type RestGuild struct {
Guild
// Stickers contains the custom stickers available in the guild.
Stickers []Sticker `json:"stickers"`
// Roles contains all roles defined in the guild.
Roles []Role `json:"roles"`
// Emojis contains the custom emojis available in the guild.
Emojis []Emoji `json:"emojis"`
}
RestGuild represents a guild object returned by the Discord API. It embeds Guild and adds additional fields provided by the REST endpoint.
Reference: https://discord.com/developers/docs/resources/guild
type Role ¶
type Role struct {
// ID is the role ID.
ID Snowflake `json:"id"`
// GuildID is the id of the guild this role is in.
GuildID Snowflake `json:"guild_id"`
// Name is the role name.
Name string `json:"name"`
// Colors contains the role's color definitions.
Colors RoleColors `json:"colors"`
// Hoist indicates if this role is pinned in the user listing.
Hoist bool `json:"hoist"`
// Icon is the role's icon hash.
//
// Optional:
// - Will be empty string if no icon.
Icon string `json:"icon"`
// UnicodeEmoji is the role's unicode emoji.
//
// Optional:
// - Will be empty string if not set.
UnicodeEmoji string `json:"unicode_emoji"`
// Position is the position of this role (roles with same position are sorted by ID).
//
// Note:
// - Roles with same position are sorted by ID.
Position int `json:"position"`
// Permissions is the permission bit set for this role.
Permissions Permissions `json:"permissions"`
// Managed indicates whether this role is managed by an integration.
Managed bool `json:"managed"`
// Mentionable indicates whether this role is mentionable.
Mentionable bool `json:"mentionable"`
// Tags contains the tags this role has.
//
// Optional:
// - Will be nil if no tags.
Tags *RoleTags `json:"tags,omitempty"`
// Flags are role flags combined as a bitfield.
Flags RoleFlags `json:"flags"`
}
Role represents a Discord role.
Reference: https://discord.com/developers/docs/resources/guild#role-object-role-structure
func (*Role) IconURL ¶
IconURL returns the URL to the role's icon image in PNG format.
If the role has a custom icon set, it returns the URL to that icon, Otherwise it returns an empty string.
Example usage:
url := role.IconURL()
func (*Role) IconURLWith ¶
func (u *Role) IconURLWith(format ImageFormat, size ImageSize) string
IconURLWith returns the URL to the role's icon image, allowing explicit specification of image format and size.
If the role has a custom icon set, it returns the URL to that icon using the provided format and size, Otherwise it returns an empty string.
Example usage:
url := role.IconURLWith(ImageFormatWebP, ImageSize512)
type RoleColors ¶
type RoleColors struct {
// PrimaryColor is the primary color for the role.
PrimaryColor Color `json:"primary_color"`
// SecondaryColor is the secondary color for the role.
SecondaryColor optional.Option[Color] `json:"secondary_color"`
// TertiaryColor is the tertiary color for the role.
TertiaryColor optional.Option[Color] `json:"tertiary_color"`
}
RoleColors represents a role's color definitions.
Reference: https://discord.com/developers/docs/resources/guild#role-object-role-colors-object
type RoleFlags ¶
type RoleFlags int
RoleFlags represents flags on a Discord guild role.
Reference: https://discord.com/developers/docs/topics/permissions#role-object-role-flags
const ( // Role can be selected by members in an onboarding prompt. RoleFlagInPrompt RoleFlags = 1 << 0 )
type RolePosition ¶ added in v0.15.0
type RoleSelectMenuBuilder ¶ added in v0.15.0
type RoleSelectMenuBuilder struct {
// contains filtered or unexported fields
}
RoleSelectMenuBuilder helps build a RoleSelectMenuComponent with chainable methods.
func NewRoleSelectMenuBuilder ¶ added in v0.15.0
func NewRoleSelectMenuBuilder() *RoleSelectMenuBuilder
NewRoleSelectMenuBuilder creates a new RoleSelectMenuBuilder instance.
func (*RoleSelectMenuBuilder) AddDefaultValue ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *RoleSelectMenuBuilder
AddDefaultValue adds a single default value.
func (*RoleSelectMenuBuilder) Build ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) Build() *RoleSelectMenuComponent
Build returns the final RoleSelectMenuComponent.
func (*RoleSelectMenuBuilder) Reset ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*RoleSelectMenuBuilder) SetCustomID ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) SetCustomID(customID string) *RoleSelectMenuBuilder
SetCustomID sets the custom ID.
func (*RoleSelectMenuBuilder) SetDefaultValues ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *RoleSelectMenuBuilder
SetDefaultValues sets all default values at once.
func (*RoleSelectMenuBuilder) SetDisabled ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) SetDisabled(disabled bool) *RoleSelectMenuBuilder
SetDisabled sets whether the select menu is disabled.
func (*RoleSelectMenuBuilder) SetMaxValues ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) SetMaxValues(maxValues int) *RoleSelectMenuBuilder
SetMaxValues sets the maximum number of selections.
func (*RoleSelectMenuBuilder) SetMinValues ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) SetMinValues(minValues *int) *RoleSelectMenuBuilder
SetMinValues sets the minimum number of selections.
func (*RoleSelectMenuBuilder) SetPlaceholder ¶ added in v0.15.0
func (b *RoleSelectMenuBuilder) SetPlaceholder(placeholder string) *RoleSelectMenuBuilder
SetPlaceholder sets the placeholder text.
type RoleSelectMenuComponent ¶ added in v0.14.0
type RoleSelectMenuComponent struct {
InteractiveComponentFields
// Placeholder is the custom placeholder text displayed when no role is selected.
//
// Note:
// - Maximum of 150 characters.
Placeholder string `json:"placeholder,omitempty"`
// DefaultValues is an array of default roles for the select menu.
//
// Note:
// - Number of default values must be within the range defined by MinValues and MaxValues.
DefaultValues []SelectDefaultValue `json:"default_values,omitempty"`
// MinValues is the minimum number of roles that must be selected.
//
// Note:
// - Defaults to 1.
// - Minimum 0, maximum 25.
MinValues *int `json:"min_values,omitempty"`
// MaxValues is the maximum number of roles that can be selected.
//
// Note:
// - Defaults to 1.
// - Maximum 25.
MaxValues int `json:"max_values,omitempty"`
// Disabled specifies whether the select menu is disabled in a message.
//
// Note:
// - Defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
RoleSelectMenuComponent represents a role select menu, an interactive component allowing users to select one or more roles in a message. Options are automatically populated based on the server's available roles.
It supports both single-select and multi-select behavior, sending an interaction to the application when a user makes their selection(s). RoleSelectMenuComponent must be placed inside an ActionRowComponent and is only available in messages. An ActionRowComponent containing a RoleSelectMenuComponent cannot include buttons.
Note:
- Maximum of 25 selections can be allowed (via MaxValues).
- Options are auto-populated by Discord based on server roles.
func (*RoleSelectMenuComponent) MarshalJSON ¶ added in v0.14.0
func (c *RoleSelectMenuComponent) MarshalJSON() ([]byte, error)
type RoleSubscriptionData ¶ added in v0.14.1
type RoleSubscriptionData struct {
// RoleSubscriptionListingID is the ID of the role subscription listing.
RoleSubscriptionListingID Snowflake `json:"role_subscription_listing_id"`
// TierName is the name of the subscription tier.
TierName string `json:"tier_name"`
// TotalMonthsSubscribed is the total number of months subscribed.
TotalMonthsSubscribed int `json:"total_months_subscribed"`
// IsRenewal indicates whether the subscription is a renewal.
IsRenewal bool `json:"is_renewal"`
}
RoleSubscriptionData represents data for a role subscription purchase.
type RoleTags ¶
type RoleTags struct {
// BotID is the ID of the bot that this role belongs to.
// It is set for roles automatically created when adding a bot
// to a guild with specific permissions.
//
// Optional:
// - Will be 0 if the role is not associated with a bot.
BotID Snowflake `json:"bot_id"`
// IntegrationID is the ID of the integration that this role belongs to.
//
// Optional:
// - Will be 0 if the role is not associated with an integration.
IntegrationID Snowflake `json:"integration_id"`
// PremiumSubscriber indicates whether this is the guild's Booster role.
//
// True if present (not nil), false otherwise (nil).
PremiumSubscriber *struct{} `json:"premium_subscriber,omitempty"`
// SubscriptionListingID is the ID of this role's subscription SKU and listing.
//
// Optional:
// - Will be 0 if the role is not linked to a subscription.
SubscriptionListingID Snowflake `json:"subscription_listing_id"`
// AvailableForPurchase indicates whether this role is available for purchase.
//
// True if present (not nil), false otherwise (nil).
AvailableForPurchase *struct{} `json:"available_for_purchase,omitempty"`
// GuildConnections indicates whether this role is a guild's linked role.
//
// True if present (not nil), false otherwise (nil).
GuildConnections *struct{} `json:"guild_connections,omitempty"`
}
RoleTags represents the tags object attached to a role.
Reference: https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
type SearchMembersOptions ¶ added in v0.15.0
type SearchMembersOptions struct {
// Query is the text to search for in usernames and nicknames.
//
// Note:
// - Query is required to be set
Query string `json:"query"`
// Limit is the maximum number of members to return (1-1000).
// Defaults to 1 if not specified.
Limit int `json:"limit,omitempty"`
}
SearchMembersOptions contains parameters for searching members by name.
type SectionAccessoryComponent ¶ added in v0.14.0
type SectionAccessoryComponent interface {
Component
}
SectionAccessoryComponent is an interface for all components that can be present in a SectionComponent.
ButtonComponent, ThumbnailComponent
type SectionBuilder ¶ added in v0.15.0
type SectionBuilder struct {
// contains filtered or unexported fields
}
SectionBuilder helps build a SectionComponent with chainable methods.
func NewSectionBuilder ¶ added in v0.15.0
func NewSectionBuilder() *SectionBuilder
NewSectionBuilder creates a new SectionBuilder instance.
func (*SectionBuilder) AddComponent ¶ added in v0.15.0
func (b *SectionBuilder) AddComponent(component SectionSubComponent) *SectionBuilder
AddComponent adds a single component.
func (*SectionBuilder) Build ¶ added in v0.15.0
func (b *SectionBuilder) Build() *SectionComponent
Build returns the final SectionComponent.
func (*SectionBuilder) Reset ¶ added in v0.15.0
func (b *SectionBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*SectionBuilder) SetAccessory ¶ added in v0.15.0
func (b *SectionBuilder) SetAccessory(accessory SectionAccessoryComponent) *SectionBuilder
SetAccessory sets the accessory component.
func (*SectionBuilder) SetComponents ¶ added in v0.15.0
func (b *SectionBuilder) SetComponents(components []SectionSubComponent) *SectionBuilder
SetComponents sets all components at once.
func (*SectionBuilder) SetID ¶ added in v0.15.0
func (b *SectionBuilder) SetID(id int) *SectionBuilder
SetID sets the component ID.
type SectionComponent ¶ added in v0.14.0
type SectionComponent struct {
ComponentFields
// Components is an array of one to three child components representing the content of the section.
//
// Valid components:
// - TextDisplayComponent
Components []SectionSubComponent `json:"components"`
// Accessory is a component contextually associated with the content of the section.
//
// Valid components:
// - ButtonComponent
// - ThumbnailComponent
Accessory SectionAccessoryComponent `json:"accessory,omitempty"`
}
SectionComponent is a top-level layout component that contextually associates content with an accessory component.
It is typically used to associate text content with an accessory, such as a button or thumbnail. Sections require the IS_COMPONENTS_V2 message flag (1 << 15) to be set when sending the message. Additional component types for content and accessories may be supported in the future.
Note:
- Only available in messages.
- Requires the IS_COMPONENTS_V2 message flag (1 << 15).
- Contains one to three child components for content.
Reference: https://discord.com/developers/docs/components/reference#section
func (*SectionComponent) MarshalJSON ¶ added in v0.14.0
func (c *SectionComponent) MarshalJSON() ([]byte, error)
func (*SectionComponent) UnmarshalJSON ¶ added in v0.14.0
func (c *SectionComponent) UnmarshalJSON(buf []byte) error
type SectionSubComponent ¶ added in v0.14.0
type SectionSubComponent interface {
Component
}
SectionSubComponent is an interface for all components that can be present in a SectionComponent.
TextDisplayComponent
type SelectDefaultValue ¶ added in v0.14.0
type SelectDefaultValue struct {
// ID is the identifier of the default value (e.g., user ID, role ID, or channel ID).
ID Snowflake `json:"id"`
// Type is the type of the default value (user, role, or channel).
Type SelectDefaultValueType `json:"type"`
}
SelectDefaultValue represents a default value in a select menu component (e.g., UserSelectMenuComponent, RoleSelectMenuComponent, ChannelSelectMenuComponent, MentionableSelectMenuComponent).
It specifies the ID and type of the default selected entity (user, role, or channel).
type SelectDefaultValueType ¶ added in v0.14.0
type SelectDefaultValueType string
SelectDefaultValueType represents the type of a default value in a select menu component.
const ( // SelectDefaultValueTypeUser indicates the default value is a user ID. SelectDefaultValueTypeUser SelectDefaultValueType = "user" // SelectDefaultValueTypeRole indicates the default value is a role ID. SelectDefaultValueTypeRole SelectDefaultValueType = "role" // SelectDefaultValueTypeChannel indicates the default value is a channel ID. SelectDefaultValueTypeChannel SelectDefaultValueType = "channel" )
func (SelectDefaultValueType) Is ¶ added in v0.14.0
func (t SelectDefaultValueType) Is(valueType SelectDefaultValueType) bool
Is returns true if the value Type matches the provided one.
type SelectOptionStructure ¶ added in v0.14.0
type SelectOptionStructure struct {
// Label is the user-facing name of the option.
//
// Note:
// - Maximum of 100 characters.
Label string `json:"label"`
// Value is the developer-defined value of the option.
//
// Note:
// - Maximum of 100 characters.
Value string `json:"value"`
// Description is an additional description of the option.
//
// Note:
// - Maximum of 100 characters.
Description string `json:"description,omitempty"`
// Emoji is the emoji displayed alongside the option.
Emoji *PartialEmoji `json:"emoji,omitempty"`
// Default specifies whether this option is selected by default.
Default bool `json:"default,omitempty"`
}
SelectOptionStructure represents an option in a StringSelectMenuComponent.
It defines the user-facing label, developer-defined value, and optional description and emoji for a selectable option.
type SeparatorBuilder ¶ added in v0.15.0
type SeparatorBuilder struct {
// contains filtered or unexported fields
}
SeparatorBuilder helps build a SeparatorComponent with chainable methods.
func NewSeparatorBuilder ¶ added in v0.15.0
func NewSeparatorBuilder() *SeparatorBuilder
NewSeparatorBuilder creates a new SeparatorBuilder instance.
func (*SeparatorBuilder) Build ¶ added in v0.15.0
func (b *SeparatorBuilder) Build() *SeparatorComponent
Build returns the final SeparatorComponent.
func (*SeparatorBuilder) Reset ¶ added in v0.15.0
func (b *SeparatorBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*SeparatorBuilder) SetDivider ¶ added in v0.15.0
func (b *SeparatorBuilder) SetDivider(divider bool) *SeparatorBuilder
SetDivider sets whether a visual divider is shown.
func (*SeparatorBuilder) SetID ¶ added in v0.15.0
func (b *SeparatorBuilder) SetID(id int) *SeparatorBuilder
SetID sets the component ID.
func (*SeparatorBuilder) SetSpacing ¶ added in v0.15.0
func (b *SeparatorBuilder) SetSpacing(spacing SeperatorComponentSpacing) *SeparatorBuilder
SetSpacing sets the vertical padding size.
type SeparatorComponent ¶ added in v0.14.0
type SeparatorComponent struct {
ComponentFields
// Divider indicates whether a visual divider line should be displayed.
//
// Note:
// - Defaults to true.
Divider bool `json:"divider,omitempty"`
// Spacing determines the size of the vertical padding.
//
// Note:
// - 1 for small padding, 2 for large padding.
// - Defaults to 1.
Spacing SeperatorComponentSpacing `json:"spacing,omitempty"`
}
SeparatorComponent is a top-level layout component that adds vertical padding and an optional visual divider between other components.
It is used to create spacing or visual separation in messages. Separators require the IS_COMPONENTS_V2 message flag (1 << 15) to be set when sending the message.
Note:
- Only available in messages.
- Requires the IS_COMPONENTS_V2 message flag (1 << 15).
- The divider field defaults to true, indicating whether a visual divider is displayed.
- The spacing field defaults to 1 (small padding), with 2 indicating large padding.
Reference: https://discord.com/developers/docs/components/reference#separator
func (*SeparatorComponent) MarshalJSON ¶ added in v0.14.0
func (c *SeparatorComponent) MarshalJSON() ([]byte, error)
type SeperatorComponentSpacing ¶ added in v0.14.0
type SeperatorComponentSpacing int
const ( SeperatorComponentSpacingSmall SeperatorComponentSpacing = 1 + iota SeperatorComponentSpacingLarge )
type Shard ¶
type Shard struct {
// contains filtered or unexported fields
}
Shard manages a single WebSocket connection to Discord Gateway, including session state, event handling, heartbeats, and reconnects.
type ShardManager ¶ added in v0.15.0
type ShardManager struct {
// contains filtered or unexported fields
}
ShardManager manages the lifecycle of multiple Gateway shards.
It handles shard creation, connection, and shutdown with support for both sharding (multiple shards in one process) and clustering (distributing specific shards across multiple processes).
func NewShardManager ¶ added in v0.15.0
func NewShardManager( config ShardManagerConfig, token string, intents GatewayIntent, useCompression bool, logger xlog.Logger, dispatcher *dispatcher, identifyLimiter ShardsIdentifyRateLimiter, ) *ShardManager
NewShardManager creates a new ShardManager with the given configuration.
func (*ShardManager) ShardCount ¶ added in v0.15.0
func (sm *ShardManager) ShardCount() int
ShardCount returns the number of shards currently managed.
func (*ShardManager) Shards ¶ added in v0.15.0
func (sm *ShardManager) Shards() []*Shard
Shards returns the list of managed shards.
func (*ShardManager) Shutdown ¶ added in v0.15.0
func (sm *ShardManager) Shutdown()
Shutdown gracefully closes all managed shards.
func (*ShardManager) Start ¶ added in v0.15.0
func (sm *ShardManager) Start(ctx context.Context, totalShards int) error
Start connects all configured shards to Discord Gateway.
If ShardIDs are specified in config, only those shards are started. Otherwise, all shards [0..TotalShards-1] are started.
The totalShards parameter is the total shard count (from Discord or override).
type ShardManagerConfig ¶ added in v0.15.0
type ShardManagerConfig struct {
TotalShards int
ShardIDs []int
Identify IdentifyProperties
}
type ShardsIdentifyRateLimiter ¶
type ShardsIdentifyRateLimiter interface {
// Wait blocks until the shard is allowed to send an Identify payload.
Wait()
}
ShardsIdentifyRateLimiter defines the interface for a rate limiter that controls the frequency of Identify payloads sent per shard.
Implementations block the caller in Wait() until an Identify token is available.
type Snowflake ¶
type Snowflake uint64
Snowflake is a Discord unique identifier.
func ParseSnowflake ¶
ParseSnowflake parses a string into a Snowflake.
func (Snowflake) MarshalJSON ¶
func (Snowflake) Sequence ¶
Sequence extracts the sequence number (increment part) of the snowflake.
func (*Snowflake) UnmarshalJSON ¶
type SnowflakePairKey ¶ added in v0.14.3
type SoundBoardSound ¶
type SoundBoardSound struct {
// SoundID is the sound's unique Discord snowflake ID.
SoundID Snowflake `json:"id"`
// Name is the sound's name.
Name string `json:"name"`
// Volumek is the volume of this sound, from 0 to 1.
Volume float64 `json:"volume"`
// EmojiID is the id of this sound's custom emoji
//
// Optional:
// - Will be 0 if the emoji is Unicode (standard emoji).
EmojiID Snowflake `json:"emoji_id"`
// EmojiName is the name of this sound's standard emoji.
//
// Optional:
// - Will be empty string if the emoji is custom (not standard emoji).
EmojiName string `json:"emoji_name"`
// Available is whether this sound can be used, may be false due to loss of Server Boosts.
Available bool `json:"available"`
// GuildID is the ID of the guild this sound belongs to.
//
// Optional:
// - Will be absent if the sound is global (not guild-specific).
GuildID Snowflake `json:"guild_id"`
// User is the user who created this sound.
//
// Optional:
// - Will be absent if the sound is global (not guild-specific).
User *User `json:"user"`
}
func (*SoundBoardSound) Save ¶
func (s *SoundBoardSound) Save(fileName, dir string) (string, error)
Save downloads the soundboard's sound from its URL and saves it to disk.
If fileName is not provided (empty string), it saves the file in the given directory using Attachment.Filename
Info:
- The extension is replaced based on the Content-Type of the file.
Example:
err := sound.Save("mysound", "./downloads")
if err != nil {
// handle error
}
Returns:
- string: full path to the downloaded file.
- error: non-nil if any operation fails.
func (*SoundBoardSound) URL ¶
func (s *SoundBoardSound) URL() string
type SoundboardSoundsEvent ¶ added in v0.15.0
type SoundboardSoundsEvent struct {
}
SoundboardSoundsEvent Response to Request Soundboard Sounds
type StageInstance ¶
type StageInstance struct {
// ID is the stageInstance's unique Discord snowflake ID.
ID Snowflake `json:"id"`
// GuildID is the guild id of the associated Stage channel
GuildID Snowflake `json:"guild_id"`
// ChannelID is the id of the associated Stage channel
ChannelID Snowflake `json:"channel_id"`
// Topic is the topic of the Stage instance (1-120 characters)
Topic string `json:"topic"`
// PrivacyLevel is the privacy level of the Stage instance
PrivacyLevel StagePrivacyLevel `json:"privacy_level"`
// DiscoverableDisabled is whether or not Stage Discovery is disabled (deprecated)
DiscoverableDisabled bool `json:"discoverable_disabled"`
}
StageInstance represent a Discord stage instance.
Reference: https://discord.com/developers/docs/resources/stage-instance#stage-instance-object
func (*StageInstance) CreatedAt ¶
func (s *StageInstance) CreatedAt() time.Time
CreatedAt returns the time when this stage instance is created.
type StageInstanceCreateEvent ¶ added in v0.15.0
type StageInstanceCreateEvent struct {
}
StageInstanceCreateEvent Stage instance was created
type StageInstanceDeleteEvent ¶ added in v0.15.0
type StageInstanceDeleteEvent struct {
}
StageInstanceDeleteEvent Stage instance was deleted or closed
type StageInstanceUpdateEvent ¶ added in v0.15.0
type StageInstanceUpdateEvent struct {
}
StageInstanceUpdateEvent Stage instance was updated
type StagePrivacyLevel ¶
type StagePrivacyLevel int
StagePrivacyLevel represents the privacy level of a Discord stage instance.
Reference: https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
const ( // The Stage instance is visible publicly. (deprecated) StagePrivacyLevelPublic StagePrivacyLevel = iota + 1 // The Stage instance is visible to only guild members. StagePrivacyLevelGuildOnly )
type StageVoiceChannel ¶
type StageVoiceChannel struct {
GuildChannelFields
CategorizedChannelFields
GuildMessageChannelFields
NsfwChannelFields
AudioChannelFields
TopicChannelFields
}
StageVoiceChannel represents a stage voice channel.
func (*StageVoiceChannel) MarshalJSON ¶
func (c *StageVoiceChannel) MarshalJSON() ([]byte, error)
type StartThreadFromMessageOptions ¶ added in v0.15.0
type StartThreadFromMessageOptions struct {
// Name is a 1-100 character channel name
Name string `json:"name"`
// AutoArchiveDuration is the number of minutes of inactivity after which the
// thread will be automatically archived and stop showing in the channel list.
// Valid values are: 60, 1440, 4320, and 10080.
AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration,omitempty"`
// RateLimitPerUser is the amount of seconds a user has to wait before sending another message (0-21600).
RateLimitPerUser int `json:"rate_limit_per_user"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
StartThreadFromMessageOptions contains parameters for starting a thread from a message.
type StartThreadWithoutMessageOptions ¶ added in v0.15.0
type StartThreadWithoutMessageOptions struct {
// Type the type of thread to create
//
// Can be one of: ChannelTypeAnnouncementThread, ChannelTypePublicThread or ChannelTypePrivateThread.
Type ChannelType `json:"type,omitzero"`
// Name is a 1-100 character channel name
Name string `json:"name"`
// AutoArchiveDuration is the number of minutes of inactivity after which the
// thread will be automatically archived and stop showing in the channel list.
// Valid values are: 60, 1440, 4320, and 10080.
AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration,omitempty"`
// RateLimitPerUser is the amount of seconds a user has to wait before sending another message (0-21600).
RateLimitPerUser int `json:"rate_limit_per_user"`
// Invitable is whether non-moderators can add other non-moderators to a thread
//
// Note:
// - only available when creating a private thread.
Invitable optional.Option[bool] `json:"invitable,omitzero"`
// Reason specifies the audit log reason for this action.
Reason string `json:"-"`
}
StartThreadWithoutMessageOptions contains parameters for starting a thread without a message.
type Sticker ¶
type Sticker struct {
// Unique ID of the sticker.
ID Snowflake `json:"id"`
// ID of the pack for standard stickers.
PackID Snowflake `json:"pack_id,omitempty"`
// Name of the sticker.
Name string `json:"name"`
// Description of the sticker (optional).
Description string `json:"description,omitempty"`
// Autocomplete/suggestion tags (max 200 characters).
Tags string `json:"tags"`
// Type of the sticker (standard or guild).
Type StickerType `json:"type"`
// Format type of the sticker.
FormatType StickerFormatType `json:"format_type"`
// Whether the guild sticker is available for use.
Available *bool `json:"available,omitempty"`
// ID of the guild that owns this sticker.
GuildID Snowflake `json:"guild_id,omitempty"`
// The user that uploaded the guild sticker.
User *User `json:"user,omitempty"`
// Sort order of the standard sticker in its pack.
SortValue *int `json:"sort_value,omitempty"`
}
Sticker represents a sticker that can be sent in messages.
Reference: https://discord.com/developers/docs/resources/sticker#sticker-object
func (*Sticker) URLWith ¶
func (s *Sticker) URLWith(format ImageFormat) string
URLWith returns the URL to the sticker's image with custom format.
type StickerFormatType ¶
type StickerFormatType int
StickerFormatType defines the format of a sticker's image.
Reference: https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
const ( // StickerFormatTypePNG represents a PNG format sticker. StickerFormatTypePNG StickerFormatType = iota + 1 // StickerFormatTypeAPNG represents an APNG format sticker. StickerFormatTypeAPNG // StickerFormatTypeLottie represents a Lottie format sticker. StickerFormatTypeLottie // StickerFormatTypeGIF represents a GIF format sticker. StickerFormatTypeGIF )
type StickerItem ¶ added in v0.14.1
type StickerItem struct {
// ID is the unique Discord snowflake ID of the sticker.
ID Snowflake `json:"id"`
// Name is the name of the sticker.
Name string `json:"name"`
// FormatType is the format type of the sticker (e.g., PNG, APNG, Lottie).
FormatType StickerFormatType `json:"format_type"`
}
StickerItem represents a sticker included in a message.
Reference: https://discord.com/developers/docs/resources/sticker#sticker-item-object
type StickerPack ¶
type StickerPack struct {
// Unique ID of the sticker pack.
ID Snowflake `json:"id"`
// Array of stickers in the pack.
Stickers []Sticker `json:"stickers"`
// Name of the sticker pack.
Name string `json:"name"`
// SKU ID of the pack.
SkuID Snowflake `json:"sku_id"`
// ID of a sticker shown as icon.
CoverStickerID Snowflake `json:"cover_sticker_id,omitempty"`
// Description of the sticker pack.
Description string `json:"description"`
// Banner image ID.
BannerAssetID Snowflake `json:"banner_asset_id,omitempty"`
}
StickerPack represents a pack of standard stickers.
Reference: https://discord.com/developers/docs/resources/sticker#sticker-pack-object
func (*StickerPack) BannerURL ¶
func (p *StickerPack) BannerURL() string
BannerURL returns the banner URL in PNG format, or empty string if none.
func (*StickerPack) BannerURLWith ¶
func (p *StickerPack) BannerURLWith(format ImageFormat, size ImageSize) string
BannerURLWith returns the banner URL with a custom format and size.
type StickerType ¶
type StickerType int
StickerType defines whether the sticker is a standard or guild sticker.
Reference: https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
const ( // StickerTypeStandard represents an official sticker in a pack. StickerTypeStandard StickerType = iota + 1 // StickerTypeGuild represents a sticker uploaded to a guild. StickerTypeGuild )
type StringConstraints ¶
type StringConstraints struct {
// MinLength is the minimum allowed length for the string.
//
// Info:
// - Minimum of 0, maximum of 6000.
//
// Optional:
// - May be nil if no minimum length is specified.
MinLength *int `json:"min_length,omitempty"`
// MaxLength is the maximum allowed length for the string.
//
// Info:
// - Minimum of 1, maximum of 6000.
//
// Optional:
// - May be nil if no maximum length is specified.
MaxLength *int `json:"max_length,omitempty"`
}
StringConstraints contains constraints for string options.
type StringSelectMenuBuilder ¶ added in v0.15.0
type StringSelectMenuBuilder struct {
// contains filtered or unexported fields
}
StringSelectMenuBuilder helps build a StringSelectMenuComponent with chainable methods.
func NewStringSelectMenuBuilder ¶ added in v0.15.0
func NewStringSelectMenuBuilder() *StringSelectMenuBuilder
NewStringSelectMenuBuilder creates a new StringSelectMenuBuilder instance.
func (*StringSelectMenuBuilder) AddOption ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) AddOption(option SelectOptionStructure) *StringSelectMenuBuilder
AddOption adds a single option.
func (*StringSelectMenuBuilder) Build ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) Build() *StringSelectMenuComponent
Build returns the final StringSelectMenuComponent.
func (*StringSelectMenuBuilder) Reset ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*StringSelectMenuBuilder) SetCustomID ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetCustomID(customID string) *StringSelectMenuBuilder
SetCustomID sets the custom ID.
func (*StringSelectMenuBuilder) SetDisabled ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetDisabled(disabled bool) *StringSelectMenuBuilder
SetDisabled sets whether the select menu is disabled.
func (*StringSelectMenuBuilder) SetMaxValues ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetMaxValues(maxValues int) *StringSelectMenuBuilder
SetMaxValues sets the maximum number of selections.
func (*StringSelectMenuBuilder) SetMinValues ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetMinValues(minValues *int) *StringSelectMenuBuilder
SetMinValues sets the minimum number of selections.
func (*StringSelectMenuBuilder) SetOptions ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetOptions(options []SelectOptionStructure) *StringSelectMenuBuilder
SetOptions sets all options at once.
func (*StringSelectMenuBuilder) SetPlaceholder ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetPlaceholder(placeholder string) *StringSelectMenuBuilder
SetPlaceholder sets the placeholder text.
func (*StringSelectMenuBuilder) SetRequired ¶ added in v0.15.0
func (b *StringSelectMenuBuilder) SetRequired(required bool) *StringSelectMenuBuilder
SetRequired sets whether the select menu is required.
type StringSelectMenuComponent ¶ added in v0.14.0
type StringSelectMenuComponent struct {
InteractiveComponentFields
// Options is an array of choices available in the select menu.
//
// Note:
// - Maximum of 25 options.
Options []SelectOptionStructure `json:"options,omitempty"`
// Placeholder is the custom placeholder text displayed when no option is selected.
//
// Note:
// - Maximum of 150 characters.
Placeholder string `json:"placeholder,omitempty"`
// MinValues is the minimum number of options that must be selected.
//
// Note:
// - Defaults to 1.
// - Minimum 0, maximum 25.
MinValues *int `json:"min_values,omitempty"`
// MaxValues is the maximum number of options that can be selected.
//
// Note:
// - Defaults to 1.
// - Maximum 25.
MaxValues int `json:"max_values,omitempty"`
// Required specifies whether the select menu must be filled in a modal.
//
// Note:
// - Defaults to true.
// - Only applicable in modals; ignored in messages.
Required bool `json:"required,omitempty"`
// Disabled specifies whether the select menu is disabled in a message.
//
// Note:
// - Defaults to false.
// - Causes an error if set to true in modals.
Disabled bool `json:"disabled,omitempty"`
}
StringSelectMenuComponent represents a string select menu, an interactive component allowing users to select one or more predefined text options.
It supports both single-select and multi-select behavior, sending an interaction to the application when a user makes their selection(s). StringSelectMenuComponent must be placed inside an ActionRowComponent for messages or a LabelComponent for modals.
Note:
- Maximum of 25 options can be provided.
- In messages, it must be the only component in an ActionRowComponent (cannot coexist with buttons).
- In modals, the `Disabled` field will cause an error if set to true, as modals do not support disabled components.
func (*StringSelectMenuComponent) MarshalJSON ¶ added in v0.14.0
func (c *StringSelectMenuComponent) MarshalJSON() ([]byte, error)
type SubscriptionCreateEvent ¶ added in v0.15.0
type SubscriptionCreateEvent struct {
}
SubscriptionCreateEvent Premium App Subscription was created
type SubscriptionDeleteEvent ¶ added in v0.15.0
type SubscriptionDeleteEvent struct {
}
SubscriptionDeleteEvent Premium App Subscription was deleted
type SubscriptionUpdateEvent ¶ added in v0.15.0
type SubscriptionUpdateEvent struct {
}
SubscriptionUpdateEvent Premium App Subscription was updated
type SystemChannelFlags ¶
type SystemChannelFlags int
SystemChannelFlags contains the settings for the Guild(s) system channel
Reference: https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
const ( // Suppress member join notifications. SystemChannelFlagSuppressJoinNotifications SystemChannelFlags = 1 << iota // Suppress server boost notifications. SystemChannelFlagSuppressPremiumSubscriptions // Suppress server setup tips. SystemChannelFlagSuppressGuildReminderNotifications // Hide member join sticker reply buttons. SystemChannelFlagSuppressJoinNotificationReplies // Suppress role subscription purchase and renewal notifications. SystemChannelFlagSuppressRoleSubscriptionPurchaseNotifications // Hide role subscription sticker reply buttons SystemChannelFlagSuppressRoleSubscriptionPurchaseNotificationReplies )
func (SystemChannelFlags) Has ¶
func (f SystemChannelFlags) Has(flags ...SystemChannelFlags) bool
Has returns true if all provided flags are set.
type Team ¶
type Team struct {
// ID is the team's unique Discord snowflake ID.
ID Snowflake `json:"id"`
// Icon is the team's icon hash.
//
// Optional:
// - May be empty string if no icon.
Icon string `json:"icon"`
// Members are the members of the team.
Members []TeamMember `json:"members"`
// Name is the name of the team.
Name string `json:"name"`
// OwnerID is the user ID of the current team owner.
OwnerID Snowflake `json:"owner_user_id"`
}
Team represent a Discord team object.
Reference: https://discord.com/developers/docs/topics/teams#data-models-team-object
func (*Team) IconURL ¶
IconURL returns the URL to the team's icon image.
If the team has a custom icon set, it returns the URL to that icon, otherwise empty string. By default, it uses PNG format.
Example usage:
url := team.IconURL()
func (*Team) IconURLWith ¶
func (t *Team) IconURLWith(format ImageFormat, size ImageSize) string
IconURLWith returns the URL to the team's icon image, allowing explicit specification of image format and size.
If the team has a custom icon set, it returns the URL to that icon (otherwise empty string) using the provided format and size.
Example usage:
url := team.IconURLWith(ImageFormatWebP, ImageSize512)
type TeamMember ¶
type TeamMember struct {
// MembershipState is the user's membership state on the team.
MembershipState MembershipState `json:"membership_state"`
// TeamID is the team member's unique Discord snowflake ID.
TeamID Snowflake `json:"team_id"`
// User is the partial user object of the team member.
// Avatar, discriminator, ID, and Username of the user.
User User `json:"user"`
// Role is the role of the team member.
Role TeamRole `json:"role"`
}
TeamMember represent a member of a Discord team.
Reference: https://discord.com/developers/docs/topics/teams#data-models-team-member-object
type TeamRole ¶
type TeamRole string
TeamRole represent a team member role.
Reference: https://discord.com/developers/docs/topics/teams#team-member-roles-team-member-role-types
const ( // Admins have similar access as owners, except they cannot take // destructive actions on the team or team-owned apps. TeamRoleAdmin TeamRole = "admin" // Developers can access information about team-owned apps, like the client secret or public key. // They can also take limited actions on team-owned apps, like configuring interaction endpoints // or resetting the bot token. Members with the Developer role cannot manage the team or its members, // or take destructive actions on team-owned apps. TeamRoleDeveloper TeamRole = "developer" // Read-only members can access information about a team and any team-owned apps. // Some examples include getting the IDs of applications and exporting payout records. // Members can also invite bots associated with team-owned apps that are marked private. TeamRoleReadOnly TeamRole = "read_only" )
type TextChannel ¶
type TextChannel struct {
GuildChannelFields
CategorizedChannelFields
GuildMessageChannelFields
NsfwChannelFields
TopicChannelFields
}
TextChannel represents a guild text channel.
func (*TextChannel) MarshalJSON ¶
func (c *TextChannel) MarshalJSON() ([]byte, error)
type TextDisplayBuilder ¶ added in v0.15.0
type TextDisplayBuilder struct {
// contains filtered or unexported fields
}
TextDisplayBuilder helps build a TextDisplayComponent with chainable methods.
func NewTextDisplayBuilder ¶ added in v0.15.0
func NewTextDisplayBuilder() *TextDisplayBuilder
NewTextDisplayBuilder creates a new TextDisplayBuilder instance.
func (*TextDisplayBuilder) Build ¶ added in v0.15.0
func (b *TextDisplayBuilder) Build() *TextDisplayComponent
Build returns the final TextDisplayComponent.
func (*TextDisplayBuilder) Reset ¶ added in v0.15.0
func (b *TextDisplayBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*TextDisplayBuilder) SetContent ¶ added in v0.15.0
func (b *TextDisplayBuilder) SetContent(content string) *TextDisplayBuilder
SetContent sets the markdown content.
func (*TextDisplayBuilder) SetID ¶ added in v0.15.0
func (b *TextDisplayBuilder) SetID(id int) *TextDisplayBuilder
SetID sets the component ID.
type TextDisplayComponent ¶ added in v0.14.0
type TextDisplayComponent struct {
ComponentFields
// Content is the markdown-formatted text to be displayed, similar to a message's content field.
Content string `json:"content,omitempty"`
}
TextDisplayComponent is a content component that displays markdown-formatted text, including mentions and emojis.
It behaves similarly to the content field of a message, allowing multiple text components to control message layout. Pingable mentions (@user, @role, etc.) in this component will trigger notifications based on the message's allowed_mentions field. Text Displays require the IS_COMPONENTS_V2 message flag (1 << 15) to be set when sending the message.
Note:
- Only available in messages.
- Requires the IS_COMPONENTS_V2 message flag (1 << 15).
- Supports markdown formatting, user/role mentions, and emojis.
Reference: https://discord.com/developers/docs/components/reference#text-display
func (*TextDisplayComponent) MarshalJSON ¶ added in v0.14.0
func (c *TextDisplayComponent) MarshalJSON() ([]byte, error)
type TextInputBuilder ¶ added in v0.15.0
type TextInputBuilder struct {
// contains filtered or unexported fields
}
TextInputBuilder helps build a TextInputComponent with chainable methods.
func NewTextInputBuilder ¶ added in v0.15.0
func NewTextInputBuilder() *TextInputBuilder
NewTextInputBuilder creates a new TextInputBuilder instance.
func (*TextInputBuilder) Build ¶ added in v0.15.0
func (b *TextInputBuilder) Build() *TextInputComponent
Build returns the final TextInputComponent.
func (*TextInputBuilder) Reset ¶ added in v0.15.0
func (b *TextInputBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*TextInputBuilder) SetCustomID ¶ added in v0.15.0
func (b *TextInputBuilder) SetCustomID(customID string) *TextInputBuilder
SetCustomID sets the custom ID.
func (*TextInputBuilder) SetMaxLength ¶ added in v0.15.0
func (b *TextInputBuilder) SetMaxLength(maxLength int) *TextInputBuilder
SetMaxLength sets the maximum input length.
func (*TextInputBuilder) SetMinLength ¶ added in v0.15.0
func (b *TextInputBuilder) SetMinLength(minLength *int) *TextInputBuilder
SetMinLength sets the minimum input length.
func (*TextInputBuilder) SetPlaceholder ¶ added in v0.15.0
func (b *TextInputBuilder) SetPlaceholder(placeholder string) *TextInputBuilder
SetPlaceholder sets the placeholder text.
func (*TextInputBuilder) SetRequired ¶ added in v0.15.0
func (b *TextInputBuilder) SetRequired(required bool) *TextInputBuilder
SetRequired sets whether the input is required.
func (*TextInputBuilder) SetStyle ¶ added in v0.15.0
func (b *TextInputBuilder) SetStyle(style TextInputStyle) *TextInputBuilder
SetStyle sets the text input style.
func (*TextInputBuilder) SetValue ¶ added in v0.15.0
func (b *TextInputBuilder) SetValue(value string) *TextInputBuilder
SetValue sets the pre-filled value.
type TextInputComponent ¶ added in v0.14.0
type TextInputComponent struct {
InteractiveComponentFields
// Style specifies the text input style (short or paragraph).
Style TextInputStyle `json:"style,omitempty"`
// MinLength is the minimum input length for the text input.
//
// Note:
// - Minimum 0, maximum 4000.
MinLength *int `json:"min_length,omitempty"`
// MaxLength is the maximum input length for the text input.
//
// Note:
// - Minimum 1, maximum 4000.
MaxLength int `json:"max_length,omitempty"`
// Required specifies whether this component must be filled in a modal.
//
// Note:
// - Defaults to true.
Required bool `json:"required,omitempty"`
// Value is the pre-filled text for this component.
//
// Note:
// - Maximum of 4000 characters.
Value string `json:"value,omitempty"`
// Placeholder is the custom placeholder text displayed when the input is empty.
//
// Note:
// - Maximum of 100 characters.
Placeholder string `json:"placeholder,omitempty"`
}
TextInputComponent is an interactive component that allows users to enter free-form text responses in modals. It supports both short (single-line) and long (multi-line) input styles.
TextInputComponent must be placed inside a LabelComponent in modals.
Note:
- Only available in modals.
Reference: https://discord.com/developers/docs/interactions/message-components#text-inputs
func (*TextInputComponent) MarshalJSON ¶ added in v0.14.0
func (c *TextInputComponent) MarshalJSON() ([]byte, error)
type TextInputStyle ¶ added in v0.14.0
type TextInputStyle int
TextInputStyle represents the style of a TextInputComponent.
Reference: https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles
const ( // TextInputStyleShort represents a single-line text input. TextInputStyleShort TextInputStyle = 1 + iota // TextInputStyleLong represents a multi-line text input. TextInputStyleLong )
func (TextInputStyle) Is ¶ added in v0.14.0
func (s TextInputStyle) Is(style TextInputStyle) bool
Is returns true if the text input style matches the provided one.
type ThreadChannel ¶
type ThreadChannel struct {
ThreadChannelFields
CategorizedChannelFields
GuildMessageChannelFields
// OwnerID is the id of this thread owner
OwnerID Snowflake `json:"owner_id"`
// ThreadMetadata is the metadata that contains a number of thread-specific channel fields.
ThreadMetadata ThreadMetaData `json:"thread_metadata"`
}
ThreadChannel represents the base for thread channels.
func (*ThreadChannel) MarshalJSON ¶
func (c *ThreadChannel) MarshalJSON() ([]byte, error)
type ThreadChannelFields ¶
type ThreadChannelFields struct {
ChannelFields
// GuildID is the id of the guild.
GuildID Snowflake `json:"guild_id"`
// Name is the name of the channel.
//
// Info:
// - can be 1 to 100 characters.
Name string `json:"name,omitempty"`
// PermissionOverwrites are explicit permission overwrites for members and roles.
PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites,omitempty"`
// Flags are combined channel flags.
Flags ChannelFlags `json:"flags,omitempty"`
}
ThreadChannelFields embeds BaseChannel and adds fields common to thread channels.
func (*ThreadChannelFields) GetFlags ¶
func (c *ThreadChannelFields) GetFlags() ChannelFlags
func (*ThreadChannelFields) GetGuildID ¶
func (c *ThreadChannelFields) GetGuildID() Snowflake
func (*ThreadChannelFields) GetName ¶
func (c *ThreadChannelFields) GetName() string
func (*ThreadChannelFields) GetPermissionOverwrites ¶
func (c *ThreadChannelFields) GetPermissionOverwrites() []PermissionOverwrite
func (*ThreadChannelFields) JumpURL ¶
func (c *ThreadChannelFields) JumpURL() string
type ThreadCreateEvent ¶ added in v0.15.0
type ThreadCreateEvent struct {
}
ThreadCreateEvent Thread created
type ThreadDeleteEvent ¶ added in v0.15.0
type ThreadDeleteEvent struct {
}
ThreadDeleteEvent Thread was deleted
type ThreadListSyncEvent ¶ added in v0.15.0
type ThreadListSyncEvent struct {
}
ThreadListSyncEvent Sent when gaining access to a channel, contains all active threads
type ThreadMember ¶
type ThreadMember struct {
// ThreadID is the id of the thread.
ThreadID Snowflake `json:"id"`
// UserID is the id of the member.
UserID Snowflake `json:"user_id"`
// JoinTimestamp is the time the user last joined the thread.
JoinTimestamp time.Time `json:"join_timestamp,omitzero"`
// Flags are any user-thread settings, currently only used for notifications.
Flags ThreadMemberFlags `json:"flags"`
// Member is the guild member object of this thread member.
//
// Optional:
// - This field is only present when 'with_member' is set to true when calling [ListThreadMembers] or [GetThreadMember].
//
// [ListThreadMembers]: https://discord.com/developers/docs/resources/channel#list-thread-members
// [GetThreadMember]: https://discord.com/developers/docs/resources/channel#get-thread-member
Member *Member `json:"member"`
}
ThreadMember represents Discord thread channel member.
Reference: https://discord.com/developers/docs/resources/channel#channel-object-channel-types
type ThreadMemberFlags ¶
type ThreadMemberFlags int
type ThreadMemberUpdateEvent ¶ added in v0.15.0
type ThreadMemberUpdateEvent struct {
}
ThreadMemberUpdateEvent Thread member for the current user was updated
type ThreadMembersUpdateEvent ¶ added in v0.15.0
type ThreadMembersUpdateEvent struct {
}
ThreadMembersUpdateEvent Some user(s) were added to or removed from a thread
type ThreadMetaData ¶
type ThreadMetaData struct {
// Archived is whether the thread is archived
Archived bool `json:"archived"`
// AutoArchiveDuration is the duration will thread need to stop showing in the channel list.
AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration"`
// ArchiveTimestamp is the timestamp when the thread's archive status was last changed,
// used for calculating recent activity
ArchiveTimestamp time.Time `json:"archive_timestamp,omitzero"`
// Locked is whether the thread is locked; when a thread is locked,
// only users with MANAGE_THREADS can unarchive it
Locked bool `json:"locked"`
// Invitable is whether non-moderators can add other non-moderators to a thread.
Invitable bool `json:"invitable"`
}
ThreadMetaData represents the metadata object that contains a number of thread-specific channel fields.
Reference: https://discord.com/developers/docs/resources/channel#thread-metadata-object
type ThreadUpdateEvent ¶ added in v0.15.0
type ThreadUpdateEvent struct {
}
ThreadUpdateEvent Thread was updated
type ThumbnailBuilder ¶ added in v0.15.0
type ThumbnailBuilder struct {
// contains filtered or unexported fields
}
ThumbnailBuilder helps build a ThumbnailComponent with chainable methods.
func NewThumbnailBuilder ¶ added in v0.15.0
func NewThumbnailBuilder() *ThumbnailBuilder
NewThumbnailBuilder creates a new ThumbnailBuilder instance.
func (*ThumbnailBuilder) Build ¶ added in v0.15.0
func (b *ThumbnailBuilder) Build() *ThumbnailComponent
Build returns the final ThumbnailComponent.
func (*ThumbnailBuilder) Reset ¶ added in v0.15.0
func (b *ThumbnailBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*ThumbnailBuilder) SetDescription ¶ added in v0.15.0
func (b *ThumbnailBuilder) SetDescription(description string) *ThumbnailBuilder
SetDescription sets the alt text description.
func (*ThumbnailBuilder) SetID ¶ added in v0.15.0
func (b *ThumbnailBuilder) SetID(id int) *ThumbnailBuilder
SetID sets the component ID.
func (*ThumbnailBuilder) SetMedia ¶ added in v0.15.0
func (b *ThumbnailBuilder) SetMedia(media UnfurledMediaItem) *ThumbnailBuilder
SetMedia sets the media item.
func (*ThumbnailBuilder) SetSpoiler ¶ added in v0.15.0
func (b *ThumbnailBuilder) SetSpoiler(spoiler bool) *ThumbnailBuilder
SetSpoiler sets whether the thumbnail is a spoiler.
type ThumbnailComponent ¶ added in v0.14.0
type ThumbnailComponent struct {
ComponentFields
// Description is an alt text for the media.
//
// Note:
// - Max 1024 characters.
Description string `json:"description,omitempty"`
// Media is a url or attachment provided as an unfurled media item.
Media UnfurledMediaItem `json:"media"`
// Spoiler is whether the thumbnail should be a spoiler (or blurred out). Defaults to false.
Spoiler bool `json:"spoiler,omitempty"`
}
ThumbnailComponent represents a Thumbnail component.
Reference: https://discord.com/developers/docs/components/reference#thumbnail
func (*ThumbnailComponent) MarshalJSON ¶ added in v0.14.0
func (c *ThumbnailComponent) MarshalJSON() ([]byte, error)
type TopicChannelFields ¶
type TopicChannelFields struct {
// Topic is the channel topic.
//
// Length:
// - 0-1024 characters for text, announcement, and stage voice channels.
// - 0-4096 characters for forum and media channels.
//
// Optional:
// - May be empty string if the channel has no topic.
Topic string `json:"topic"`
}
TopicChannelFields holds the topic field.
type TypingStartEvent ¶ added in v0.15.0
type TypingStartEvent struct {
}
TypingStartEvent User started typing in a channel
type UnbanMemberOptions ¶ added in v0.15.0
type UnbanMemberOptions struct {
// Reason is the reason shown in the audit log for this action.
Reason string `json:"-"`
}
UnbanMemberOptions contains parameters for unbanning a guild member.
type UnfurledMediaItem ¶ added in v0.14.0
type UnfurledMediaItem struct {
// URL is the url of the media item.
//
// Note:
// - Supports arbitrary urls and 'attachment://filename' references.
URL string `json:"url"`
// ProxyURL is the proxied url of the media item. This field is ignored
// and provided by the API as part of the response.
ProxyURL string `json:"proxy_url"`
// Height is the height of the media item. This field is ignored
// and provided by the API as part of the response.
Height int `json:"height,omitempty"`
// Width is the width of the media item. This field is ignored
// and provided by the API as part of the response.
Width int `json:"width,omitempty"`
// ContentType is the [media type] of the content. This field is ignored
// and provided by the API as part of the response.
//
// [media type]: https://en.wikipedia.org/wiki/Media_type
ContentType string `json:"content_type,omitempty"`
// AttachmentID is the id of the uploaded attachment. This field is ignored
// and provided by the API as part of the response.
AttachmentID Snowflake `json:"attachment_id,omitempty"`
}
UnfurledMediaItem represents an unfurled media item.
Reference: https://discord.com/developers/docs/components/reference#unfurled-media-item
type UnfurledMediaItemLoadingState ¶ added in v0.14.0
type UnfurledMediaItemLoadingState int
const ( UnfurledMediaItemLoadingStateUnknown UnfurledMediaItemLoadingState = iota UnfurledMediaItemLoadingStateLoading UnfurledMediaItemLoadingStateLoadedSuccess UnfurledMediaItemLoadingStateLoadedNotFound )
type UpdateSelfUserOptions ¶
type UpdateSelfUserOptions struct {
Username string `json:"username,omitempty"`
// Use:
//
// avatar, err := dwaz.NewImageFile("path/to/your/image.png")
// if err != nil {
// // handler err
// }
Avatar Base64Image `json:"avatar,omitempty"`
// Use:
//
// banner, err := dwaz.NewImageFile("path/to/your/banner.png")
// if err != nil {
// // handler err
// }
Banner Base64Image `json:"banner,omitempty"`
}
UpdateSelfUserOptions defines the parameters to update the current user account.
All fields are optional:
- If a field is not set (left empty), it will remain unchanged.
type User ¶
type User struct {
// ID is the user's unique Discord snowflake ID.
ID Snowflake `json:"id"`
// Username is the user's username (not unique).
Username string `json:"username"`
// Discriminator is the user's 4-digit Discord tag suffix.
Discriminator string `json:"discriminator"`
// GlobalName is the user's display name.
// For bots, this is the application name.
//
// Optional:
// - May be empty string if unset.
GlobalName string `json:"global_name"`
// Avatar is the user's avatar hash.
//
// Optional:
// - May be empty string if no avatar.
Avatar string `json:"avatar"`
// Bot indicates if the user is a bot account.
Bot bool `json:"bot,omitempty"`
// System indicates if the user is an official Discord system user.
System bool `json:"system,omitempty"`
// Banner is the user's banner hash.
//
// Optional:
// - May be empty string if no banner.
Banner string `json:"banner"`
// AccentColor is the user's banner color encoded as an integer.
//
// Optional:
// - May be nil if no accent color is set.
AccentColor *Color `json:"accent_color"`
// PremiumType is the Nitro subscription type.
PremiumType UserPremiumType `json:"premium_type,omitempty"`
// PublicFlags are the public flags on the user account.
PublicFlags UserFlags `json:"public_flags,omitempty"`
// AvatarDecorationData holds avatar decoration info.
//
// Optional:
// - May be nil if user has no avatar decoration.
AvatarDecorationData *AvatarDecorationData `json:"avatar_decoration_data,omitempty"`
// Collectibles holds user's collectibles.
//
// Optional:
// - May be nil if user has no collectibles.
Collectibles *Collectibles `json:"collectibles,omitempty"`
// PrimaryGuild holds the user's primary guild info.
//
// Optional:
// - May be nil if user is a bot.
// - May be nil if no primary guild set.
// - May be nil if identity cleared due to guild tag or privacy settings.
PrimaryGuild *UserPrimaryGuild `json:"primary_guild,omitempty"`
}
User represents a Discord user object.
Reference: https://discord.com/developers/docs/resources/user#user-object-user-structure
func (*User) AvatarDecorationURL ¶
AvatarDecorationURL returns the URL to the user's avatar decoration.
If the user has no avatar decoration, it returns an empty string.
Example usage:
url := user.AvatarDecorationURL()
func (*User) AvatarDecorationURLWith ¶
AvatarDecorationURLWith returns the URL to the user's avatar decoration, allowing explicit specification of image size.
If the user has no avatar decoration, it returns an empty string.
Example usage:
url := user.AvatarDecorationURL(ImageSize512)
func (*User) AvatarURL ¶
AvatarURL returns the URL to the user's avatar image.
If the user has a custom avatar set, it returns the URL to that avatar, otherwise empty string. By default, it uses GIF format if the avatar is animated, otherwise PNG.
If the user has no custom avatar, it returns the URL to their default avatar based on their discriminator or ID, using PNG format.
Example usage:
url := user.AvatarURL()
func (*User) AvatarURLWith ¶
func (u *User) AvatarURLWith(format ImageFormat, size ImageSize) string
AvatarURLWith returns the URL to the user's avatar image, allowing explicit specification of image format and size.
If the user has a custom avatar set, it returns the URL to that avatar using the provided format and size, otherwise empty string.
If the user has no custom avatar, it returns the URL to their default avatar, using PNG format (size parameter is ignored for default avatars).
Example usage:
url := user.AvatarURLWith(ImageFormatWebP, ImageSize1024)
func (*User) BannerURL ¶
BannerURL returns the URL to the user's banner image.
If the user has a custom banner set, it returns the URL to that banner. By default, it uses GIF format if the banner is animated, otherwise PNG.
If the user has no custom banner, it returns an empty string.
Example usage:
url := user.BannerURL()
func (*User) BannerURLWith ¶
func (u *User) BannerURLWith(format ImageFormat, size ImageSize) string
BannerURLWith returns the URL to the member's avatar image, allowing explicit specification of image format and size.
If the user has no custom banner, it returns an empty string.
Example usage:
url := user.BannerURLWith(ImageFormatWebP, ImageSize1024)
func (*User) DefaultAvatarIndex ¶
DefaultAvatarIndex returns the index (0-5) used to determine which default avatar is assigned to the user.
For users with discriminator "0" (new Discord usernames), it uses the user's snowflake ID shifted right by 22 bits modulo 6.
For legacy users with a numeric discriminator, it parses the discriminator as an integer and returns modulo 5.
This logic follows Discord's default avatar assignment rules.
Example usage:
index := user.DefaultAvatarIndex()
func (*User) DisplayName ¶
DisplayName returns the user's global name if set, otherwise it returns their username.
The global name is their profile display name visible across Discord, while Username is their original account username.
Example usage:
name := user.DisplayName()
func (*User) GuildTagBadgeURL ¶
GuildTagBadgeURL returns the URL to the user's PrimaryGuild badge image.
If the user has no PrimaryGuild badge, it returns an empty string.
Example usage:
url := user.GuildTagBadgeURL()
type UserCommandInteraction ¶ added in v0.14.0
type UserCommandInteraction struct {
ApplicationCommandInteractionFields
// Data contains the payload of the interaction specific to user commands.
Data UserCommandInteractionData `json:"data"`
}
UserCommandInteraction represents an interaction triggered by a user context menu command.
Reference: https://discord.com/developers/docs/interactions/application-commands
type UserCommandInteractionData ¶ added in v0.14.0
type UserCommandInteractionData struct {
ApplicationCommandInteractionDataFields
// Resolved contains the resolved objects referenced by the command, members and users in this case.
Resolved UserCommandInteractionDataResolved `json:"resolved"`
// TargetID is the id of the user targeted by the command.
TargetID Snowflake `json:"target_id"`
}
UserCommandInteractionData represents the data for a user command interaction.
type UserCommandInteractionDataResolved ¶ added in v0.14.0
type UserCommandInteractionDataResolved struct {
// Users is a map of user IDs to User objects referenced by the command.
Users map[Snowflake]User `json:"users"`
// Members is a map of user IDs to partial Member objects for the guild.
Members map[Snowflake]ResolvedMember `json:"members"`
}
type UserFlags ¶
type UserFlags int
UserFlags represents flags on a Discord user account.
Reference: https://discord.com/developers/docs/resources/user#user-object-user-flags
const ( // Discord Employee UserFlagStaff UserFlags = 1 << 0 // Partnered Server Owner UserFlagPartner UserFlags = 1 << 1 // HypeSquad Events Member UserFlagHypeSquad UserFlags = 1 << 2 // Bug Hunter Level 1 UserFlagBugHunterLevel1 UserFlags = 1 << 3 // House Bravery Member UserFlagHypeSquadOnlineHouse1 UserFlags = 1 << 6 // House Brilliance Member UserFlagHypeSquadOnlineHouse2 UserFlags = 1 << 7 // House Balance Member UserFlagHypeSquadOnlineHouse3 UserFlags = 1 << 8 // Early Nitro Supporter UserFlagPremiumEarlySupporter UserFlags = 1 << 9 // User is a team UserFlagTeamPseudoUser UserFlags = 1 << 10 // Bug Hunter Level 2 UserFlagBugHunterLevel2 UserFlags = 1 << 14 // Verified Bot UserFlagVerifiedBot UserFlags = 1 << 16 // Early Verified Bot Developer UserFlagVerifiedDeveloper UserFlags = 1 << 17 // Moderator Programs Alumni UserFlagCertifiedModerator UserFlags = 1 << 18 // Bot uses only HTTP interactions and is shown in the online member list UserFlagBotHTTPInteractions UserFlags = 1 << 19 // User is an Active Developer UserFlagActiveDeveloper UserFlags = 1 << 22 )
type UserPremiumType ¶
type UserPremiumType int
UserPremiumType is the type of premium (nitro) subscription a user has (see UserPremiumType* consts). https://discord.com/developers/docs/resources/user#user-object-premium-types
const ( UserPremiumTypeNone UserPremiumType = 0 UserPremiumTypeNitroClassic UserPremiumType = 1 UserPremiumTypeNitro UserPremiumType = 2 UserPremiumTypeNitroBasic UserPremiumType = 3 )
Valid UserPremiumType values.
func (UserPremiumType) Is ¶
func (t UserPremiumType) Is(premiumType UserPremiumType) bool
Is returns true if the user's premium type matches the provided premium type.
type UserPrimaryGuild ¶
type UserPrimaryGuild struct {
// IdentityGuildID is the Discord snowflake ID of the user's primary guild.
//
// Optional:
// - May be nil if the user has no primary guild set.
// - May be nil if the system cleared the identity due to guild tag support removal or privacy.
IdentityGuildID *Snowflake `json:"identity_guild_id,omitempty"`
// IdentityEnabled indicates if the user currently displays the primary guild's server tag.
//
// Optional:
// - May be nil if the identity was cleared by the system (e.g., guild tag disabled).
// - May be false if the user explicitly disabled showing the tag.
IdentityEnabled *bool `json:"identity_enabled,omitempty"`
// Tag is the text of the user's server tag.
//
// Optional:
// - May be nil or empty string if no tag is set.
// - Limited to 4 characters.
// - May be cleared if tag data is invalid or unavailable.
Tag *string `json:"tag,omitempty"`
// Badge is the hash string of the user's server tag badge.
//
// Optional:
// - May be nil if user has no badge or badge info unavailable.
Badge *string `json:"badge,omitempty"`
}
UserPrimaryGuild represents the user's primary guild info.
Optionally included by Discord API.
Reference: https://discord.com/developers/docs/resources/user#user-primary-guild-object
type UserSelectMenuBuilder ¶ added in v0.15.0
type UserSelectMenuBuilder struct {
// contains filtered or unexported fields
}
UserSelectMenuBuilder helps build a UserSelectMenuComponent with chainable methods.
func NewUserSelectMenuBuilder ¶ added in v0.15.0
func NewUserSelectMenuBuilder() *UserSelectMenuBuilder
NewUserSelectMenuBuilder creates a new UserSelectMenuBuilder instance.
func (*UserSelectMenuBuilder) AddDefaultValue ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) AddDefaultValue(defaultValue SelectDefaultValue) *UserSelectMenuBuilder
AddDefaultValue adds a single default value.
func (*UserSelectMenuBuilder) Build ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) Build() *UserSelectMenuComponent
Build returns the final UserSelectMenuComponent.
func (*UserSelectMenuBuilder) Reset ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) Reset()
Reset clears the builder state, allowing it to be reused.
func (*UserSelectMenuBuilder) SetCustomID ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) SetCustomID(customID string) *UserSelectMenuBuilder
SetCustomID sets the custom ID.
func (*UserSelectMenuBuilder) SetDefaultValues ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) SetDefaultValues(defaults []SelectDefaultValue) *UserSelectMenuBuilder
SetDefaultValues sets all default values at once.
func (*UserSelectMenuBuilder) SetDisabled ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) SetDisabled(disabled bool) *UserSelectMenuBuilder
SetDisabled sets whether the select menu is disabled.
func (*UserSelectMenuBuilder) SetMaxValues ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) SetMaxValues(maxValues int) *UserSelectMenuBuilder
SetMaxValues sets the maximum number of selections.
func (*UserSelectMenuBuilder) SetMinValues ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) SetMinValues(minValues *int) *UserSelectMenuBuilder
SetMinValues sets the minimum number of selections.
func (*UserSelectMenuBuilder) SetPlaceholder ¶ added in v0.15.0
func (b *UserSelectMenuBuilder) SetPlaceholder(placeholder string) *UserSelectMenuBuilder
SetPlaceholder sets the placeholder text.
type UserSelectMenuComponent ¶ added in v0.14.0
type UserSelectMenuComponent struct {
InteractiveComponentFields
// Placeholder is the custom placeholder text if the input is empty.
//
// Note:
// - Max 150 characters.
Placeholder string `json:"placeholder,omitempty"`
// DefaultValues is a list of default values for auto-populated select menu components;
// number of default values must be in the range defined by min_values and max_values.
DefaultValues []SelectDefaultValue `json:"default_values,omitempty"`
// MinValues is the minimum number of items that must be chosen (defaults to 1).
//
// Note:
// - Min 0, max 25.
MinValues *int `json:"min_values,omitempty"`
// MaxValues is the maximum number of items that can be chosen (defaults to 1).
//
// Note:
// - Min 1, max 25.
MaxValues int `json:"max_values,omitempty"`
// Disabled is whether select menu is disabled (defaults to false).
Disabled bool `json:"disabled,omitempty"`
}
UserSelectMenuComponent represents a user select menu component.
Reference: https://discord.com/developers/docs/components/reference#user-select-user-select-structure
func (*UserSelectMenuComponent) MarshalJSON ¶ added in v0.14.0
func (c *UserSelectMenuComponent) MarshalJSON() ([]byte, error)
type UserUpdateEvent ¶ added in v0.15.0
type UserUpdateEvent struct {
}
UserUpdateEvent Properties about the user changed
type VerificationLevel ¶
type VerificationLevel int
VerificationLevel represents the verification level required on a Discord guild.
Reference: https://discord.com/developers/docs/resources/guild#guild-object-verification-level
const ( // Unrestricted. VerificationLevelNone VerificationLevel = iota // Must have verified email on account. VerificationLevelLow // Must be registered on Discord for longer than 5 minutes. VerificationLevelMedium // Must be a member of the server for longer than 10 minutes. VerificationLevelHigh // Must have a verified phone number VerificationLevelVeryHigh )
func (VerificationLevel) Is ¶ added in v0.14.0
func (l VerificationLevel) Is(verifLevel VerificationLevel) bool
Is returns true if the verification level matches the provided one.
type VideoQualityModes ¶ added in v0.15.0
type VideoQualityModes int
const ( VideoQualityModesAuto VideoQualityModes = iota + 1 VideoQualityModesFull )
type VoiceChannel ¶
type VoiceChannel struct {
GuildChannelFields
CategorizedChannelFields
GuildMessageChannelFields
NsfwChannelFields
AudioChannelFields
}
VoiceChannel represents a guild voice channel.
func (*VoiceChannel) MarshalJSON ¶
func (c *VoiceChannel) MarshalJSON() ([]byte, error)
type VoiceChannelEffectSendEvent ¶ added in v0.15.0
type VoiceChannelEffectSendEvent struct {
}
VoiceChannelEffectSendEvent Someone sent an effect in a voice channel
type VoiceRegion ¶
type VoiceRegion struct {
// ID is the unique identifier for the voice region.
ID string `json:"id"`
// Name is the name of the voice region.
Name string `json:"name"`
// Optimal indicates whether this region is optimal for the current user.
//
// True if this is the single server closest to the current user's client.
Optimal bool `json:"optimal"`
// Deprecated indicates whether this voice region is deprecated.
//
// Avoid switching to these regions.
Deprecated bool `json:"deprecated"`
// Custom indicates whether this is a custom voice region.
//
// Used for special events or similar use cases.
Custom bool `json:"custom"`
}
VoiceRegion represents a Discord voice region.
Reference: https://discord.com/developers/docs/resources/voice#voice-region-object
type VoiceServerUpdateEvent ¶ added in v0.15.0
type VoiceServerUpdateEvent struct {
}
VoiceServerUpdateEvent Guild's voice server was updated
type VoiceState ¶
type VoiceState struct {
// GuildID is the ID of the guild this voice state is for.
GuildID Snowflake `json:"guild_id"`
// ChannelID is the ID of the voice channel the user is connected to.
ChannelID Snowflake `json:"channel_id,omitempty"`
// UserID is the ID of the user this voice state is for.
UserID Snowflake `json:"user_id"`
// SessionID is the session identifier for this voice state.
SessionID string `json:"session_id"`
// GuildDeaf indicates whether the user is deafened by the server.
GuildDeaf bool `json:"deaf"`
// GuildMute indicates whether the user is muted by the server.
GuildMute bool `json:"mute"`
// SelfDeaf indicates whether the user is locally deafened.
SelfDeaf bool `json:"self_deaf"`
// SelfMute indicates whether the user is locally muted.
SelfMute bool `json:"self_mute"`
// SelfStream indicates whether the user is streaming using "Go Live".
SelfStream bool `json:"self_stream,omitempty"`
// SelfVideo indicates whether the user's camera is enabled.
SelfVideo bool `json:"self_video"`
// Suppress indicates whether the user's permission to speak is denied.
Suppress bool `json:"suppress"`
// RequestToSpeakTimestamp is the time at which the user requested to speak.
//
// Optional:
// - May be nil if the user has not requested to speak.
RequestToSpeakTimestamp *time.Time `json:"request_to_speak_timestamp,omitzero"`
}
VoiceState represents a user's voice connection status in a guild.
Reference: https://discord.com/developers/docs/resources/voice#voice-state-object
type VoiceStateUpdateEvent ¶ added in v0.14.3
type VoiceStateUpdateEvent struct {
ShardsID int // shard that dispatched this event
OldState GatewayVoiceState
NewState GatewayVoiceState
}
VoiceStateUpdateEvent VoiceState was updated
type WebhookEventTypes ¶
type WebhookEventTypes string
WebhookEventTypes represent the webhook event types your app can subscribe to.
Reference: https://discord.com/developers/docs/events/webhook-events#event-types
const ( // Sent when an app was authorized by a user to a server or their account. // // See: https://discord.com/developers/docs/events/webhook-events#application-authorized WebhookEventTypesApplicationAuthorized WebhookEventTypes = "APPLICATION_AUTHORIZED" // // See: https://discord.com/developers/docs/events/webhook-events#application-deauthorized WebhookEventTypesApplicationApplicationDeauthorized WebhookEventTypes = "APPLICATION_DEAUTHORIZED" // Entitlement was created. // // See: https://discord.com/developers/docs/events/webhook-events#entitlement-create WebhookEventTypesApplicationApplicationEntitlementCreate WebhookEventTypes = "ENTITLEMENT_CREATE" // User was added to a Quest (currently unavailable). // // See: https://discord.com/developers/docs/events/webhook-events#quest-user-enrollment WebhookEventTypesApplicationApplicationQuestUserEnrollment WebhookEventTypes = "QUEST_USER_ENROLLMENT" )
func (WebhookEventTypes) Is ¶
func (t WebhookEventTypes) Is(webhookEventType WebhookEventTypes) bool
Is returns true if the webhook event type matches the provided webhook event type.
type WebhooksUpdateEvent ¶ added in v0.15.0
type WebhooksUpdateEvent struct {
}
WebhooksUpdateEvent Guild channel webhook was created, update, or deleted
Source Files
¶
- application.go
- application_command.go
- attachment.go
- bitfield.go
- cache.go
- channel.go
- client.go
- color.go
- component.go
- dispatcher.go
- emoji.go
- entitlement.go
- event.go
- event_handler.go
- file.go
- gateway.go
- guild.go
- guild_scheduled_event.go
- image.go
- info.go
- interaction.go
- invite.go
- locales.go
- member.go
- message.go
- permissions.go
- poll.go
- requester.go
- role.go
- shard.go
- snowflake.go
- soundboard.go
- stage_instance.go
- sticker.go
- user.go
- voice_state.go