rest

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 19 Imported by: 51

Documentation

Index

Constants

View Source
const (
	// MaxRetries is the maximum number of retries the client should do
	MaxRetries = 10
	// CleanupInterval is the interval at which the rate limiter cleans up old buckets
	CleanupInterval = time.Second * 10
)
View Source
const MajorParameters = "guild.id:channel.id:webhook.id:interaction.token"

MajorParameters is a list of url parameters which decide in which bucket a route belongs (https://discord.com/developers/docs/topics/rate-limits#rate-limits)

Variables

View Source
var (
	// Version is the Discord API version DisGo should use
	Version = 10

	// API is the base path of the Discord API
	API = "https://discord.com/api/"
)
View Source
var (
	GetGateway      = NewNoBotAuthEndpoint(http.MethodGet, "/gateway")
	GetGatewayBot   = NewEndpoint(http.MethodGet, "/gateway/bot")
	GetVoiceRegions = NewNoBotAuthEndpoint(http.MethodGet, "/voice/regions")
)

Misc

View Source
var (
	GetBotApplicationInfo = NewEndpoint(http.MethodGet, "/oauth2/applications/@me")
	GetAuthorizationInfo  = NewNoBotAuthEndpoint(http.MethodGet, "/oauth2/@me")
	Token                 = NewEndpoint(http.MethodPost, "/oauth2/token")
)

OAuth2

View Source
var (
	GetUser                                    = NewEndpoint(http.MethodGet, "/users/{user.id}")
	GetCurrentUser                             = NewEndpoint(http.MethodGet, "/users/@me")
	UpdateCurrentUser                          = NewEndpoint(http.MethodPatch, "/users/@me")
	GetCurrentUserGuilds                       = NewEndpoint(http.MethodGet, "/users/@me/guilds")
	GetCurrentMember                           = NewNoBotAuthEndpoint(http.MethodGet, "/users/@me/guilds/{guild.id}/member")
	GetCurrentUserConnections                  = NewNoBotAuthEndpoint(http.MethodGet, "/users/@me/connections")
	GetCurrentUserApplicationRoleConnection    = NewNoBotAuthEndpoint(http.MethodGet, "/users/@me/applications/{application.id}/role-connection")
	UpdateCurrentUserApplicationRoleConnection = NewNoBotAuthEndpoint(http.MethodPut, "/users/@me/applications/{application.id}/role-connection")
	LeaveGuild                                 = NewEndpoint(http.MethodDelete, "/users/@me/guilds/{guild.id}")
	CreateDMChannel                            = NewEndpoint(http.MethodPost, "/users/@me/channels")
)

Users

View Source
var (
	GetGuild          = NewEndpoint(http.MethodGet, "/guilds/{guild.id}")
	GetGuildPreview   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/preview")
	UpdateGuild       = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}")
	GetGuildVanityURL = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/vanity-url")

	CreateGuildChannel     = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/channels")
	GetGuildChannels       = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/channels")
	UpdateChannelPositions = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/channels")

	GetBans   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/bans")
	GetBan    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/bans/{user.id}")
	AddBan    = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/bans/{user.id}")
	DeleteBan = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/bans/{user.id}")
	BulkBan   = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/bulk-ban")

	GetMember        = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/members/{user.id}")
	GetMembers       = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/members")
	SearchMembers    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/members/search")
	AddMember        = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/members/{user.id}")
	UpdateMember     = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/members/{user.id}")
	RemoveMember     = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/members/{user.id}")
	AddMemberRole    = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/members/{user.id}/roles/{role.id}")
	RemoveMemberRole = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/members/{user.id}/roles/{role.id}")

	UpdateCurrentMember = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/members/@me")

	GetGuildPruneCount = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/prune")
	BeginGuildPrune    = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/prune")

	GetGuildWebhooks = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/webhooks")

	GetAuditLogs = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/audit-logs")

	GetGuildVoiceRegions = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/regions")

	GetGuildWelcomeScreen    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/welcome-screen")
	UpdateGuildWelcomeScreen = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/welcome-screen")

	GetGuildOnboarding    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/onboarding")
	UpdateGuildOnboarding = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/onboarding")

	UpdateGuildIncidentActions = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/incident-actions")

	GetCurrentUserVoiceState    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/voice-states/@me")
	GetUserVoiceState           = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/voice-states/{user.id}")
	UpdateCurrentUserVoiceState = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/voice-states/@me")
	UpdateUserVoiceState        = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/voice-states/{user.id}")
)

Guilds

View Source
var (
	GetAutoModerationRules   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/auto-moderation/rules")
	GetAutoModerationRule    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/auto-moderation/rules/{auto_moderation_rule.id}")
	CreateAutoModerationRule = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/auto-moderation/rules")
	UpdateAutoModerationRule = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/auto-moderation/rules/{auto_moderation_rule.id}")
	DeleteAutoModerationRule = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/auto-moderation/rules/{auto_moderation_rule.id}")
)

AutoModeration

View Source
var (
	GetIntegrations   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/integrations")
	CreateIntegration = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/integrations")
	UpdateIntegration = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/integrations/{integration.id}")
	DeleteIntegration = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/integrations/{integration.id}")
	SyncIntegration   = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/integrations/{integration.id}/sync")
)

GuildIntegrations

View Source
var (
	GetGuildTemplate        = NewEndpoint(http.MethodGet, "/guilds/templates/{template.code}")
	GetGuildTemplates       = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/templates")
	CreateGuildTemplate     = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/templates")
	SyncGuildTemplate       = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/templates/{template.code}")
	UpdateGuildTemplate     = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/templates/{template.code}")
	DeleteGuildTemplate     = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/templates/{template.code}")
	CreateGuildFromTemplate = NewEndpoint(http.MethodPost, "/guilds/templates/{template.code}")
)

GuildTemplates

View Source
var (
	GetGuildScheduledEvents   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/scheduled-events")
	GetGuildScheduledEvent    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}")
	CreateGuildScheduledEvent = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/scheduled-events")
	UpdateGuildScheduledEvent = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}")
	DeleteGuildScheduledEvent = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}")

	GetGuildScheduledEventUsers = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users")
)

GuildScheduledEvents

View Source
var (
	GetSoundboardDefaultSounds = NewEndpoint(http.MethodGet, "/soundboard-default-sounds")
	GetGuildSoundboardSounds   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/soundboard-sounds")
	CreateGuildSoundboardSound = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/soundboard-sounds")
	GetGuildSoundboardSound    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/soundboard-sounds/{sound.id}")
	UpdateGuildSoundboardSound = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/soundboard-sounds/{sound.id}")
	DeleteGuildSoundboardSound = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/soundboard-sounds/{sound.id}")
)

Sounds

View Source
var (
	GetStageInstance    = NewEndpoint(http.MethodGet, "/stage-instances/{channel.id}")
	CreateStageInstance = NewEndpoint(http.MethodPost, "/stage-instances")
	UpdateStageInstance = NewEndpoint(http.MethodPatch, "/stage-instances/{channel.id}")
	DeleteStageInstance = NewEndpoint(http.MethodDelete, "/stage-instances/{channel.id}")
)

StageInstance

View Source
var (
	GetRoles            = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/roles")
	GetRole             = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/roles/{role.id}")
	CreateRole          = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/roles")
	UpdateRole          = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/roles/{role.id}")
	UpdateRolePositions = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/roles")
	DeleteRole          = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/roles/{role.id}")
	GetRoleMemberCounts = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/roles/member-counts")
)

Roles

View Source
var (
	GetChannel    = NewEndpoint(http.MethodGet, "/channels/{channel.id}")
	UpdateChannel = NewEndpoint(http.MethodPatch, "/channels/{channel.id}")
	DeleteChannel = NewEndpoint(http.MethodDelete, "/channels/{channel.id}")

	GetChannelWebhooks = NewEndpoint(http.MethodGet, "/channels/{channel.id}/webhooks")
	CreateWebhook      = NewEndpoint(http.MethodPost, "/channels/{channel.id}/webhooks")

	UpdatePermissionOverwrite = NewEndpoint(http.MethodPut, "/channels/{channel.id}/permissions/{overwrite.id}")
	DeletePermissionOverwrite = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/permissions/{overwrite.id}")

	SendTyping    = NewEndpoint(http.MethodPost, "/channels/{channel.id}/typing")
	FollowChannel = NewEndpoint(http.MethodPost, "/channels/{channel.id}/followers")

	GetPollAnswerVotes = NewEndpoint(http.MethodGet, "/channels/{channel.id}/polls/{message.id}/answers/{answer.id}")
	ExpirePoll         = NewEndpoint(http.MethodPost, "/channels/{channel.id}/polls/{message.id}/expire")

	SendSoundboardSound = NewEndpoint(http.MethodPost, "/channels/{channel.id}/send-soundboard-sound")
)

Channels

View Source
var (
	CreateThreadWithMessage = NewEndpoint(http.MethodPost, "/channels/{channel.id}/messages/{message.id}/threads")
	CreateThread            = NewEndpoint(http.MethodPost, "/channels/{channel.id}/threads")
	JoinThread              = NewEndpoint(http.MethodPut, "/channels/{channel.id}/thread-members/@me")
	LeaveThread             = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/thread-members/@me")
	AddThreadMember         = NewEndpoint(http.MethodPut, "/channels/{channel.id}/thread-members/{user.id}")
	RemoveThreadMember      = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/thread-members/{user.id}")
	GetThreadMember         = NewEndpoint(http.MethodGet, "/channels/{channel.id}/thread-members/{user.id}")
	GetThreadMembers        = NewEndpoint(http.MethodGet, "/channels/{channel.id}/thread-members")

	GetPublicArchivedThreads        = NewEndpoint(http.MethodGet, "/channels/{channel.id}/threads/archived/public")
	GetPrivateArchivedThreads       = NewEndpoint(http.MethodGet, "/channels/{channel.id}/threads/archived/private")
	GetJoinedPrivateArchivedThreads = NewEndpoint(http.MethodGet, "/channels/{channel.id}/users/@me/threads/archived/private")
	GetActiveGuildThreads           = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/threads/active")
)

Threads

View Source
var (
	GetMessages        = NewEndpoint(http.MethodGet, "/channels/{channel.id}/messages")
	GetMessage         = NewEndpoint(http.MethodGet, "/channels/{channel.id}/messages/{message.id}")
	CreateMessage      = NewEndpoint(http.MethodPost, "/channels/{channel.id}/messages")
	UpdateMessage      = NewEndpoint(http.MethodPatch, "/channels/{channel.id}/messages/{message.id}")
	DeleteMessage      = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/messages/{message.id}")
	BulkDeleteMessages = NewEndpoint(http.MethodPost, "/channels/{channel.id}/messages/bulk-delete")

	GetChannelPins = NewEndpoint(http.MethodGet, "/channels/{channel.id}/messages/pins")
	PinMessage     = NewEndpoint(http.MethodPut, "/channels/{channel.id}/messages/pins/{message.id}")
	UnpinMessage   = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/messages/pins/{message.id}")

	CrosspostMessage = NewEndpoint(http.MethodPost, "/channels/{channel.id}/messages/{message.id}/crosspost")

	GetReactions               = NewEndpoint(http.MethodGet, "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}")
	AddReaction                = NewEndpoint(http.MethodPut, "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me")
	RemoveOwnReaction          = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me")
	RemoveUserReaction         = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}")
	RemoveAllReactions         = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/messages/{message.id}/reactions")
	RemoveAllReactionsForEmoji = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}")
)

Messages

View Source
var (
	GetEmojis   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/emojis")
	GetEmoji    = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/emojis/{emoji.id}")
	CreateEmoji = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/emojis")
	UpdateEmoji = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/emojis/{emote.id}")
	DeleteEmoji = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/emojis/{emote.id}")
)

Emojis

View Source
var (
	GetNitroStickerPacks = NewEndpoint(http.MethodGet, "/sticker-packs")
	GetNitroStickerPack  = NewEndpoint(http.MethodGet, "/sticker-packs/{pack.id}")
	GetSticker           = NewEndpoint(http.MethodGet, "/stickers/{sticker.id}")
	GetGuildStickers     = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/stickers")
	CreateGuildSticker   = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/stickers")
	UpdateGuildSticker   = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/stickers/{sticker.id}")
	DeleteGuildSticker   = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/stickers/{sticker.id}")
)

Stickers

View Source
var (
	GetWebhook    = NewEndpoint(http.MethodGet, "/webhooks/{webhook.id}")
	UpdateWebhook = NewEndpoint(http.MethodPatch, "/webhooks/{webhook.id}")
	DeleteWebhook = NewEndpoint(http.MethodDelete, "/webhooks/{webhook.id}")

	GetWebhookWithToken    = NewNoBotAuthEndpoint(http.MethodGet, "/webhooks/{webhook.id}/{webhook.token}")
	UpdateWebhookWithToken = NewNoBotAuthEndpoint(http.MethodPatch, "/webhooks/{webhook.id}/{webhook.token}")
	DeleteWebhookWithToken = NewNoBotAuthEndpoint(http.MethodDelete, "/webhooks/{webhook.id}/{webhook.token}")

	GetWebhookMessage          = NewNoBotAuthEndpoint(http.MethodGet, "/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}")
	CreateWebhookMessage       = NewNoBotAuthEndpoint(http.MethodPost, "/webhooks/{webhook.id}/{webhook.token}")
	CreateWebhookMessageSlack  = NewNoBotAuthEndpoint(http.MethodPost, "/webhooks/{webhook.id}/{webhook.token}/slack")
	CreateWebhookMessageGitHub = NewNoBotAuthEndpoint(http.MethodPost, "/webhooks/{webhook.id}/{webhook.token}/github")
	UpdateWebhookMessage       = NewNoBotAuthEndpoint(http.MethodPatch, "/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}")
	DeleteWebhookMessage       = NewNoBotAuthEndpoint(http.MethodDelete, "/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}")
)

Webhooks

View Source
var (
	GetInvite                     = NewEndpoint(http.MethodGet, "/invites/{code}")
	CreateInvite                  = NewEndpoint(http.MethodPost, "/channels/{channel.id}/invites")
	DeleteInvite                  = NewEndpoint(http.MethodDelete, "/invites/{code}")
	GetInviteTargetUsers          = NewEndpoint(http.MethodGet, "/invites/{code}/target-users")
	SetInviteTargetUsers          = NewEndpoint(http.MethodPut, "/invites/{code}/target-users")
	GetInviteTargetUsersJobStatus = NewEndpoint(http.MethodGet, "/invites/{code}/target-users/job-status")

	GetGuildInvites   = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/invites")
	GetChannelInvites = NewEndpoint(http.MethodGet, "/channels/{channel.id}/invites")
)

Invites

View Source
var (
	GetCurrentApplication    = NewEndpoint(http.MethodGet, "/applications/@me")
	UpdateCurrentApplication = NewEndpoint(http.MethodPatch, "/applications/@me")

	GetGlobalCommands   = NewEndpoint(http.MethodGet, "/applications/{application.id}/commands")
	GetGlobalCommand    = NewEndpoint(http.MethodGet, "/applications/{application.id}/command/{command.id}")
	CreateGlobalCommand = NewEndpoint(http.MethodPost, "/applications/{application.id}/commands")
	SetGlobalCommands   = NewEndpoint(http.MethodPut, "/applications/{application.id}/commands")
	UpdateGlobalCommand = NewEndpoint(http.MethodPatch, "/applications/{application.id}/commands/{command.id}")
	DeleteGlobalCommand = NewEndpoint(http.MethodDelete, "/applications/{application.id}/commands/{command.id}")

	GetGuildCommands   = NewEndpoint(http.MethodGet, "/applications/{application.id}/guilds/{guild.id}/commands")
	GetGuildCommand    = NewEndpoint(http.MethodGet, "/applications/{application.id}/guilds/{guild.id}/command/{command.id}")
	CreateGuildCommand = NewEndpoint(http.MethodPost, "/applications/{application.id}/guilds/{guild.id}/commands")
	SetGuildCommands   = NewEndpoint(http.MethodPut, "/applications/{application.id}/guilds/{guild.id}/commands")
	UpdateGuildCommand = NewEndpoint(http.MethodPatch, "/applications/{application.id}/guilds/{guild.id}/commands/{command.id}")
	DeleteGuildCommand = NewEndpoint(http.MethodDelete, "/applications/{application.id}/guilds/{guild.id}/commands/{command.id}")

	GetGuildCommandsPermissions = NewEndpoint(http.MethodGet, "/applications/{application.id}/guilds/{guild.id}/commands/permissions")
	GetGuildCommandPermissions  = NewEndpoint(http.MethodGet, "/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions")
	SetGuildCommandPermissions  = NewNoBotAuthEndpoint(http.MethodPut, "/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions")

	GetInteractionResponse    = NewNoBotAuthEndpoint(http.MethodGet, "/webhooks/{application.id}/{interaction.token}/messages/@original")
	CreateInteractionResponse = NewNoBotAuthEndpoint(http.MethodPost, "/interactions/{interaction.id}/{interaction.token}/callback")
	UpdateInteractionResponse = NewNoBotAuthEndpoint(http.MethodPatch, "/webhooks/{application.id}/{interaction.token}/messages/@original")
	DeleteInteractionResponse = NewNoBotAuthEndpoint(http.MethodDelete, "/webhooks/{application.id}/{interaction.token}/messages/@original")

	GetFollowupMessage    = NewNoBotAuthEndpoint(http.MethodGet, "/webhooks/{application.id}/{interaction.token}/messages/{message.id}")
	CreateFollowupMessage = NewNoBotAuthEndpoint(http.MethodPost, "/webhooks/{application.id}/{interaction.token}")
	UpdateFollowupMessage = NewNoBotAuthEndpoint(http.MethodPatch, "/webhooks/{application.id}/{interaction.token}/messages/{message.id}")
	DeleteFollowupMessage = NewNoBotAuthEndpoint(http.MethodDelete, "/webhooks/{application.id}/{interaction.token}/messages/{message.id}")

	GetApplicationRoleConnectionMetadata    = NewEndpoint(http.MethodGet, "/applications/{application.id}/role-connections/metadata")
	UpdateApplicationRoleConnectionMetadata = NewEndpoint(http.MethodPut, "/applications/{application.id}/role-connections/metadata")

	GetEntitlements       = NewEndpoint(http.MethodGet, "/applications/{application.id}/entitlements")
	GetEntitlement        = NewEndpoint(http.MethodGet, "/applications/{application.id}/entitlements/{entitlement.id}")
	CreateTestEntitlement = NewEndpoint(http.MethodPost, "/applications/{application.id}/entitlements")
	DeleteTestEntitlement = NewEndpoint(http.MethodDelete, "/applications/{application.id}/entitlements/{entitlement.id}")
	ConsumeEntitlement    = NewEndpoint(http.MethodPost, "/applications/{application.id}/entitlements/{entitlement.id}/consume")

	GetApplicationEmojis   = NewEndpoint(http.MethodGet, "/applications/{application.id}/emojis")
	GetApplicationEmoji    = NewEndpoint(http.MethodGet, "/applications/{application.id}/emojis/{emoji.id}")
	CreateApplicationEmoji = NewEndpoint(http.MethodPost, "/applications/{application.id}/emojis")
	UpdateApplicationEmoji = NewEndpoint(http.MethodPatch, "/applications/{application.id}/emojis/{emoji.id}")
	DeleteApplicationEmoji = NewEndpoint(http.MethodDelete, "/applications/{application.id}/emojis/{emoji.id}")

	GetActivityInstance = NewEndpoint(http.MethodGet, "/applications/{application.id}/activity-instances/{instance.id}")
)

Applications

View Source
var (
	GetSKUs = NewEndpoint(http.MethodGet, "/applications/{application.id}/skus")

	GetSKUSubscriptions = NewEndpoint(http.MethodGet, "/skus/{sku.id}/subscriptions")
	GetSKUSubscription  = NewEndpoint(http.MethodGet, "/skus/{sku.id}/subscriptions/{subscription.id}")
)

SKUs

View Source
var ErrMissingBearerToken = errors.New("missing bearer token")

ErrMissingBearerToken is returned when a bearer token is missing for a request which requires it.

View Source
var ErrNoMorePages = errors.New("no more pages")

Functions

func IsJSONErrorCode added in v0.19.0

func IsJSONErrorCode(err error, codes ...JSONErrorCode) bool

IsJSONErrorCode returns true if the error is a *Error with one of the given error codes

Types

type Applications

type Applications interface {
	GetCurrentApplication(opts ...RequestOpt) (*discord.Application, error)
	UpdateCurrentApplication(applicationUpdate discord.ApplicationUpdate, opts ...RequestOpt) (*discord.Application, error)

	GetGlobalCommands(applicationID snowflake.ID, withLocalizations bool, opts ...RequestOpt) ([]discord.ApplicationCommand, error)
	GetGlobalCommand(applicationID snowflake.ID, commandID snowflake.ID, opts ...RequestOpt) (discord.ApplicationCommand, error)
	CreateGlobalCommand(applicationID snowflake.ID, commandCreate discord.ApplicationCommandCreate, opts ...RequestOpt) (discord.ApplicationCommand, error)
	SetGlobalCommands(applicationID snowflake.ID, commandCreates []discord.ApplicationCommandCreate, opts ...RequestOpt) ([]discord.ApplicationCommand, error)
	UpdateGlobalCommand(applicationID snowflake.ID, commandID snowflake.ID, commandUpdate discord.ApplicationCommandUpdate, opts ...RequestOpt) (discord.ApplicationCommand, error)
	DeleteGlobalCommand(applicationID snowflake.ID, commandID snowflake.ID, opts ...RequestOpt) error

	GetGuildCommands(applicationID snowflake.ID, guildID snowflake.ID, withLocalizations bool, opts ...RequestOpt) ([]discord.ApplicationCommand, error)
	GetGuildCommand(applicationID snowflake.ID, guildID snowflake.ID, commandID snowflake.ID, opts ...RequestOpt) (discord.ApplicationCommand, error)
	CreateGuildCommand(applicationID snowflake.ID, guildID snowflake.ID, command discord.ApplicationCommandCreate, opts ...RequestOpt) (discord.ApplicationCommand, error)
	SetGuildCommands(applicationID snowflake.ID, guildID snowflake.ID, commands []discord.ApplicationCommandCreate, opts ...RequestOpt) ([]discord.ApplicationCommand, error)
	UpdateGuildCommand(applicationID snowflake.ID, guildID snowflake.ID, commandID snowflake.ID, command discord.ApplicationCommandUpdate, opts ...RequestOpt) (discord.ApplicationCommand, error)
	DeleteGuildCommand(applicationID snowflake.ID, guildID snowflake.ID, commandID snowflake.ID, opts ...RequestOpt) error

	GetGuildCommandsPermissions(applicationID snowflake.ID, guildID snowflake.ID, opts ...RequestOpt) ([]discord.ApplicationCommandPermissions, error)
	GetGuildCommandPermissions(applicationID snowflake.ID, guildID snowflake.ID, commandID snowflake.ID, opts ...RequestOpt) (*discord.ApplicationCommandPermissions, error)

	GetApplicationRoleConnectionMetadata(applicationID snowflake.ID, opts ...RequestOpt) ([]discord.ApplicationRoleConnectionMetadata, error)
	UpdateApplicationRoleConnectionMetadata(applicationID snowflake.ID, newRecords []discord.ApplicationRoleConnectionMetadata, opts ...RequestOpt) ([]discord.ApplicationRoleConnectionMetadata, error)

	GetEntitlements(applicationID snowflake.ID, params GetEntitlementsParams, opts ...RequestOpt) ([]discord.Entitlement, error)
	GetEntitlement(applicationID snowflake.ID, entitlementID snowflake.ID, opts ...RequestOpt) (*discord.Entitlement, error)
	CreateTestEntitlement(applicationID snowflake.ID, entitlementCreate discord.TestEntitlementCreate, opts ...RequestOpt) (*discord.Entitlement, error)
	DeleteTestEntitlement(applicationID snowflake.ID, entitlementID snowflake.ID, opts ...RequestOpt) error
	ConsumeEntitlement(applicationID snowflake.ID, entitlementID snowflake.ID, opts ...RequestOpt) error

	GetApplicationEmojis(applicationID snowflake.ID, opts ...RequestOpt) ([]discord.Emoji, error)
	GetApplicationEmoji(applicationID snowflake.ID, emojiID snowflake.ID, opts ...RequestOpt) (*discord.Emoji, error)
	CreateApplicationEmoji(applicationID snowflake.ID, emojiCreate discord.EmojiCreate, opts ...RequestOpt) (*discord.Emoji, error)
	UpdateApplicationEmoji(applicationID snowflake.ID, emojiID snowflake.ID, emojiUpdate discord.EmojiUpdate, opts ...RequestOpt) (*discord.Emoji, error)
	DeleteApplicationEmoji(applicationID snowflake.ID, emojiID snowflake.ID, opts ...RequestOpt) error

	GetActivityInstance(applicationID snowflake.ID, instanceID string, opts ...RequestOpt) (*discord.ActivityInstance, error)
}

func NewApplications

func NewApplications(client Client) Applications

type AuditLogPage added in v0.13.19

type AuditLogPage struct {
	discord.AuditLog
	Err error

	ID snowflake.ID
	// contains filtered or unexported fields
}

func (*AuditLogPage) Next added in v0.15.0

func (p *AuditLogPage) Next() bool

func (*AuditLogPage) Previous added in v0.13.19

func (p *AuditLogPage) Previous() bool

type AutoModeration added in v0.12.7

type AutoModeration interface {
	GetAutoModerationRules(guildID snowflake.ID, opts ...RequestOpt) ([]discord.AutoModerationRule, error)
	GetAutoModerationRule(guildID snowflake.ID, ruleID snowflake.ID, opts ...RequestOpt) (*discord.AutoModerationRule, error)
	CreateAutoModerationRule(guildID snowflake.ID, ruleCreate discord.AutoModerationRuleCreate, opts ...RequestOpt) (*discord.AutoModerationRule, error)
	UpdateAutoModerationRule(guildID snowflake.ID, ruleID snowflake.ID, ruleUpdate discord.AutoModerationRuleUpdate, opts ...RequestOpt) (*discord.AutoModerationRule, error)
	DeleteAutoModerationRule(guildID snowflake.ID, ruleID snowflake.ID, opts ...RequestOpt) error
}

func NewAutoModeration added in v0.12.7

func NewAutoModeration(client Client) AutoModeration

type ChannelPinsPage added in v0.19.0

type ChannelPinsPage struct {
	Items []discord.MessagePin
	Err   error

	Time time.Time
	// contains filtered or unexported fields
}

func (*ChannelPinsPage) Previous added in v0.19.0

func (p *ChannelPinsPage) Previous() bool

type Channels

type Channels interface {
	GetChannel(channelID snowflake.ID, opts ...RequestOpt) (discord.Channel, error)
	UpdateChannel(channelID snowflake.ID, channelUpdate discord.ChannelUpdate, opts ...RequestOpt) (discord.Channel, error)
	DeleteChannel(channelID snowflake.ID, opts ...RequestOpt) error

	GetWebhooks(channelID snowflake.ID, opts ...RequestOpt) ([]discord.Webhook, error)
	CreateWebhook(channelID snowflake.ID, webhookCreate discord.WebhookCreate, opts ...RequestOpt) (*discord.IncomingWebhook, error)

	UpdatePermissionOverwrite(channelID snowflake.ID, overwriteID snowflake.ID, permissionOverwrite discord.PermissionOverwriteUpdate, opts ...RequestOpt) error
	DeletePermissionOverwrite(channelID snowflake.ID, overwriteID snowflake.ID, opts ...RequestOpt) error

	SendTyping(channelID snowflake.ID, opts ...RequestOpt) error

	GetMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
	GetMessages(channelID snowflake.ID, around snowflake.ID, before snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.Message, error)
	GetMessagesPage(channelID snowflake.ID, startID snowflake.ID, limit int, opts ...RequestOpt) Page[discord.Message]
	CreateMessage(channelID snowflake.ID, messageCreate discord.MessageCreate, opts ...RequestOpt) (*discord.Message, error)
	UpdateMessage(channelID snowflake.ID, messageID snowflake.ID, messageUpdate discord.MessageUpdate, opts ...RequestOpt) (*discord.Message, error)
	DeleteMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error
	BulkDeleteMessages(channelID snowflake.ID, messageIDs []snowflake.ID, opts ...RequestOpt) error
	CrosspostMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)

	GetReactions(channelID snowflake.ID, messageID snowflake.ID, emoji string, reactionType discord.MessageReactionType, after int, limit int, opts ...RequestOpt) ([]discord.User, error)
	AddReaction(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) error
	RemoveOwnReaction(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) error
	RemoveUserReaction(channelID snowflake.ID, messageID snowflake.ID, emoji string, userID snowflake.ID, opts ...RequestOpt) error
	RemoveAllReactions(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error
	RemoveAllReactionsForEmoji(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) error

	GetChannelPins(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (*discord.ChannelPins, error)
	GetChannelPinsPage(channelID snowflake.ID, start time.Time, limit int, opts ...RequestOpt) ChannelPinsPage
	PinMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error
	UnpinMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error

	Follow(channelID snowflake.ID, targetChannelID snowflake.ID, opts ...RequestOpt) (*discord.FollowedChannel, error)

	GetPollAnswerVotes(channelID snowflake.ID, messageID snowflake.ID, answerID int, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.User, error)
	GetPollAnswerVotesPage(channelID snowflake.ID, messageID snowflake.ID, answerID int, startID snowflake.ID, limit int, opts ...RequestOpt) PollAnswerVotesPage
	ExpirePoll(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
}

func NewChannels

func NewChannels(client Client, defaultAllowedMentions discord.AllowedMentions) Channels

type Check

type Check func() bool

Check is a function which gets executed right before a request is made

type Client

type Client interface {
	// HTTPClient returns the http.Client the rest client uses
	HTTPClient() *http.Client

	// RateLimiter returns the RateLimiter the rest client uses
	RateLimiter() RateLimiter

	// Close closes the rest client and awaits all pending requests to finish. You can use a cancelling context to abort the waiting
	Close(ctx context.Context)

	// Do makes a request to the given CompiledAPIRoute and marshals the given any as json and unmarshalls the response into the given interface
	Do(endpoint *CompiledEndpoint, rqBody any, rsBody any, opts ...RequestOpt) error
}

Client allows doing requests to different endpoints

func NewClient

func NewClient(botToken string, opts ...ClientConfigOpt) Client

NewClient constructs a new Client with the given config struct

type ClientConfigOpt added in v0.19.0

type ClientConfigOpt func(config *clientConfig)

ClientConfigOpt can be used to supply optional parameters to NewClient

func WithDefaultRateLimiterConfigOpts added in v0.19.0

func WithDefaultRateLimiterConfigOpts(opts ...RateLimiterConfigOpt) ClientConfigOpt

WithDefaultRateLimiterConfigOpts applies RateLimiterConfigOpt to the RateLimiter and prepend the options to the existing ones.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientConfigOpt

WithHTTPClient applies a custom http.Client to the rest rate limiter

func WithLogger

func WithLogger(logger *slog.Logger) ClientConfigOpt

WithLogger applies a custom logger to the rest rate limiter

func WithRateLimiter

func WithRateLimiter(rateLimiter RateLimiter) ClientConfigOpt

WithRateLimiter applies a custom RateLimiter to the rest client

func WithRateLimiterConfigOpts

func WithRateLimiterConfigOpts(opts ...RateLimiterConfigOpt) ClientConfigOpt

WithRateLimiterConfigOpts applies RateLimiterConfigOpt to the RateLimiter

func WithURL added in v0.15.1

func WithURL(url string) ClientConfigOpt

WithURL sets the api url for all requests

func WithUserAgent

func WithUserAgent(userAgent string) ClientConfigOpt

WithUserAgent sets the user agent for all requests

type CompiledEndpoint added in v0.13.11

type CompiledEndpoint struct {
	Endpoint *Endpoint

	URL         string
	MajorParams string
}

CompiledEndpoint represents a Discord Rest API endpoint with applied url params & query values.

type ConfigOpt

type ConfigOpt func(config *config)

ConfigOpt can be used to supply optional parameters to New

func WithDefaultAllowedMentions added in v0.19.0

func WithDefaultAllowedMentions(mentions discord.AllowedMentions) ConfigOpt

type CreateWebhookMessageParams added in v0.18.16

type CreateWebhookMessageParams struct {
	Wait           bool
	ThreadID       snowflake.ID
	WithComponents bool
}

func (CreateWebhookMessageParams) ToQueryValues added in v0.18.16

type Emojis

type Emojis interface {
	GetEmojis(guildID snowflake.ID, opts ...RequestOpt) ([]discord.Emoji, error)
	GetEmoji(guildID snowflake.ID, emojiID snowflake.ID, opts ...RequestOpt) (*discord.Emoji, error)
	CreateEmoji(guildID snowflake.ID, emojiCreate discord.EmojiCreate, opts ...RequestOpt) (*discord.Emoji, error)
	UpdateEmoji(guildID snowflake.ID, emojiID snowflake.ID, emojiUpdate discord.EmojiUpdate, opts ...RequestOpt) (*discord.Emoji, error)
	DeleteEmoji(guildID snowflake.ID, emojiID snowflake.ID, opts ...RequestOpt) error
}

func NewEmojis

func NewEmojis(client Client) Emojis

type Endpoint added in v0.13.11

type Endpoint struct {
	Method  string
	Route   string
	BotAuth bool
}

Endpoint represents a Discord Rest API endpoint.

func NewEndpoint added in v0.13.11

func NewEndpoint(method string, route string) *Endpoint

NewEndpoint returns a new Endpoint which requires bot auth with the given http method & route.

func NewNoBotAuthEndpoint added in v0.13.11

func NewNoBotAuthEndpoint(method string, route string) *Endpoint

NewNoBotAuthEndpoint returns a new Endpoint which does not require bot auth with the given http method & route.

func (*Endpoint) Compile added in v0.13.11

func (e *Endpoint) Compile(values discord.QueryValues, params ...any) *CompiledEndpoint

Compile compiles an Endpoint to a CompiledEndpoint with the given url params & query values

type Error

type Error struct {
	Request  *http.Request  `json:"-"`
	RqBody   []byte         `json:"-"`
	Response *http.Response `json:"-"`
	RsBody   []byte         `json:"-"`

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

Error holds the *http.Request, *http.Response & an error related to a REST request. It's always a pointer to *Error that is returned by the REST client.

func (*Error) Error

func (e *Error) Error() string

Error returns the error formatted as string

func (*Error) Is

func (e *Error) Is(target error) bool

Is returns true if the error is a *Error with the same status code as the target error

func (*Error) String

func (e *Error) String() string

Error returns the error formatted as string

type Gateway

type Gateway interface {
	GetGateway(opts ...RequestOpt) (*discord.Gateway, error)
	GetGatewayBot(opts ...RequestOpt) (*discord.GatewayBot, error)
}

func NewGateway

func NewGateway(client Client) Gateway

type GetEntitlementsParams added in v0.18.14

type GetEntitlementsParams struct {
	UserID         snowflake.ID
	SkuIDs         []snowflake.ID
	Before         snowflake.ID
	After          snowflake.ID
	Limit          int
	GuildID        snowflake.ID
	ExcludeEnded   bool
	ExcludeDeleted bool
}

GetEntitlementsParams holds query parameters for Applications.GetEntitlements (https://discord.com/developers/docs/resources/entitlement#list-entitlements)

func (GetEntitlementsParams) ToQueryValues added in v0.18.14

func (p GetEntitlementsParams) ToQueryValues() discord.QueryValues

type GuildScheduledEvents

type GuildScheduledEvents interface {
	GetGuildScheduledEvents(guildID snowflake.ID, withUserCounts bool, opts ...RequestOpt) ([]discord.GuildScheduledEvent, error)
	GetGuildScheduledEvent(guildID snowflake.ID, guildScheduledEventID snowflake.ID, withUserCounts bool, opts ...RequestOpt) (*discord.GuildScheduledEvent, error)
	CreateGuildScheduledEvent(guildID snowflake.ID, guildScheduledEventCreate discord.GuildScheduledEventCreate, opts ...RequestOpt) (*discord.GuildScheduledEvent, error)
	UpdateGuildScheduledEvent(guildID snowflake.ID, guildScheduledEventID snowflake.ID, guildScheduledEventUpdate discord.GuildScheduledEventUpdate, opts ...RequestOpt) (*discord.GuildScheduledEvent, error)
	DeleteGuildScheduledEvent(guildID snowflake.ID, guildScheduledEventID snowflake.ID, opts ...RequestOpt) error

	GetGuildScheduledEventUsers(guildID snowflake.ID, guildScheduledEventID snowflake.ID, withMember bool, before snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.GuildScheduledEventUser, error)
	GetGuildScheduledEventUsersPage(guildID snowflake.ID, guildScheduledEventID snowflake.ID, withMember bool, startID snowflake.ID, limit int, opts ...RequestOpt) Page[discord.GuildScheduledEventUser]
}

func NewGuildScheduledEvents

func NewGuildScheduledEvents(client Client) GuildScheduledEvents

type GuildTemplates

type GuildTemplates interface {
	GetGuildTemplate(templateCode string, opts ...RequestOpt) (*discord.GuildTemplate, error)
	GetGuildTemplates(guildID snowflake.ID, opts ...RequestOpt) ([]discord.GuildTemplate, error)
	CreateGuildTemplate(guildID snowflake.ID, guildTemplateCreate discord.GuildTemplateCreate, opts ...RequestOpt) (*discord.GuildTemplate, error)
	CreateGuildFromTemplate(templateCode string, createGuildFromTemplate discord.GuildFromTemplateCreate, opts ...RequestOpt) (*discord.Guild, error)
	SyncGuildTemplate(guildID snowflake.ID, templateCode string, opts ...RequestOpt) (*discord.GuildTemplate, error)
	UpdateGuildTemplate(guildID snowflake.ID, templateCode string, guildTemplateUpdate discord.GuildTemplateUpdate, opts ...RequestOpt) (*discord.GuildTemplate, error)
	DeleteGuildTemplate(guildID snowflake.ID, templateCode string, opts ...RequestOpt) (*discord.GuildTemplate, error)
}

func NewGuildTemplates

func NewGuildTemplates(client Client) GuildTemplates

type Guilds

type Guilds interface {
	GetGuild(guildID snowflake.ID, withCounts bool, opts ...RequestOpt) (*discord.RestGuild, error)
	GetGuildPreview(guildID snowflake.ID, opts ...RequestOpt) (*discord.GuildPreview, error)
	UpdateGuild(guildID snowflake.ID, guildUpdate discord.GuildUpdate, opts ...RequestOpt) (*discord.RestGuild, error)

	GetGuildVanityURL(guildID snowflake.ID, opts ...RequestOpt) (*discord.PartialInvite, error)

	CreateGuildChannel(guildID snowflake.ID, guildChannelCreate discord.GuildChannelCreate, opts ...RequestOpt) (discord.GuildChannel, error)
	GetGuildChannels(guildID snowflake.ID, opts ...RequestOpt) ([]discord.GuildChannel, error)
	UpdateChannelPositions(guildID snowflake.ID, guildChannelPositionUpdates []discord.GuildChannelPositionUpdate, opts ...RequestOpt) error

	GetRoles(guildID snowflake.ID, opts ...RequestOpt) ([]discord.Role, error)
	GetRole(guildID snowflake.ID, roleID snowflake.ID, opts ...RequestOpt) (*discord.Role, error)
	CreateRole(guildID snowflake.ID, createRole discord.RoleCreate, opts ...RequestOpt) (*discord.Role, error)
	UpdateRole(guildID snowflake.ID, roleID snowflake.ID, roleUpdate discord.RoleUpdate, opts ...RequestOpt) (*discord.Role, error)
	UpdateRolePositions(guildID snowflake.ID, rolePositionUpdates []discord.RolePositionUpdate, opts ...RequestOpt) ([]discord.Role, error)
	DeleteRole(guildID snowflake.ID, roleID snowflake.ID, opts ...RequestOpt) error
	GetRoleMemberCounts(guildID snowflake.ID, opts ...RequestOpt) (map[snowflake.ID]int, error)

	GetBans(guildID snowflake.ID, before snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.Ban, error)
	GetBansPage(guildID snowflake.ID, startID snowflake.ID, limit int, opts ...RequestOpt) Page[discord.Ban]
	GetBan(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) (*discord.Ban, error)
	AddBan(guildID snowflake.ID, userID snowflake.ID, deleteMessageDuration time.Duration, opts ...RequestOpt) error
	DeleteBan(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) error
	BulkBan(guildID snowflake.ID, ban discord.BulkBan, opts ...RequestOpt) (*discord.BulkBanResult, error)

	GetIntegrations(guildID snowflake.ID, opts ...RequestOpt) ([]discord.Integration, error)
	DeleteIntegration(guildID snowflake.ID, integrationID snowflake.ID, opts ...RequestOpt) error

	GetGuildPruneCount(guildID snowflake.ID, days int, includeRoles []snowflake.ID, opts ...RequestOpt) (*discord.GuildPruneResult, error)
	BeginGuildPrune(guildID snowflake.ID, guildPrune discord.GuildPrune, opts ...RequestOpt) (*discord.GuildPruneResult, error)

	GetAllWebhooks(guildID snowflake.ID, opts ...RequestOpt) ([]discord.Webhook, error)

	GetGuildVoiceRegions(guildID snowflake.ID, opts ...RequestOpt) ([]discord.VoiceRegion, error)

	GetAuditLog(guildID snowflake.ID, userID snowflake.ID, actionType discord.AuditLogEvent, before snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) (*discord.AuditLog, error)
	GetAuditLogPage(guildID snowflake.ID, userID snowflake.ID, actionType discord.AuditLogEvent, startID snowflake.ID, limit int, opts ...RequestOpt) AuditLogPage

	GetGuildWelcomeScreen(guildID snowflake.ID, opts ...RequestOpt) (*discord.GuildWelcomeScreen, error)
	UpdateGuildWelcomeScreen(guildID snowflake.ID, screenUpdate discord.GuildWelcomeScreenUpdate, opts ...RequestOpt) (*discord.GuildWelcomeScreen, error)

	GetGuildOnboarding(guildID snowflake.ID, opts ...RequestOpt) (*discord.GuildOnboarding, error)
	UpdateGuildOnboarding(guildID snowflake.ID, onboardingUpdate discord.GuildOnboardingUpdate, opts ...RequestOpt) (*discord.GuildOnboarding, error)

	UpdateGuildIncidentActions(guildID snowflake.ID, actionsUpdate discord.GuildIncidentActionsUpdate, opts ...RequestOpt) (*discord.GuildIncidentsData, error)
}

func NewGuilds

func NewGuilds(client Client) Guilds

type Interactions

type Interactions interface {
	GetInteractionResponse(applicationID snowflake.ID, interactionToken string, opts ...RequestOpt) (*discord.Message, error)
	CreateInteractionResponse(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) error
	CreateInteractionResponseWithCallback(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) (*discord.InteractionCallbackResponse, error)
	UpdateInteractionResponse(applicationID snowflake.ID, interactionToken string, messageUpdate discord.MessageUpdate, opts ...RequestOpt) (*discord.Message, error)
	DeleteInteractionResponse(applicationID snowflake.ID, interactionToken string, opts ...RequestOpt) error

	GetFollowupMessage(applicationID snowflake.ID, interactionToken string, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
	CreateFollowupMessage(applicationID snowflake.ID, interactionToken string, messageCreate discord.MessageCreate, opts ...RequestOpt) (*discord.Message, error)
	UpdateFollowupMessage(applicationID snowflake.ID, interactionToken string, messageID snowflake.ID, messageUpdate discord.MessageUpdate, opts ...RequestOpt) (*discord.Message, error)
	DeleteFollowupMessage(applicationID snowflake.ID, interactionToken string, messageID snowflake.ID, opts ...RequestOpt) error
}

func NewInteractions

func NewInteractions(client Client, defaultAllowedMentions discord.AllowedMentions) Interactions

type Invites

type Invites interface {
	GetInvite(code string, opts ...RequestOpt) (*discord.Invite, error)
	CreateInvite(channelID snowflake.ID, inviteCreate discord.InviteCreate, opts ...RequestOpt) (*discord.Invite, error)
	DeleteInvite(code string, opts ...RequestOpt) (*discord.Invite, error)
	GetInviteTargetUsers(code string, opts ...RequestOpt) (targetUsers *string, err error)
	UpdateInviteTargetUsers(code string, inviteTargetUsersUpdate discord.InviteTargetUsersUpdate, opts ...RequestOpt) (err error)
	GetInviteTargetUsersJobStatus(code string, opts ...RequestOpt) (targetUsersJobStatus *discord.TargetUsersJobStatus, err error)
	GetGuildInvites(guildID snowflake.ID, opts ...RequestOpt) ([]discord.ExtendedInvite, error)
	GetChannelInvites(channelID snowflake.ID, opts ...RequestOpt) ([]discord.ExtendedInvite, error)
}

func NewInvites

func NewInvites(client Client) Invites

type JSONErrorCode added in v0.16.0

type JSONErrorCode int

JSONErrorCode is the error code returned by the Discord API. See https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes

const (
	// General error (such as a malformed request body, amongst other things)
	JSONErrorCodeGeneral JSONErrorCode = 0

	// Unknown resources
	JSONErrorCodeUnknownAccount                        JSONErrorCode = 10001
	JSONErrorCodeUnknownApplication                    JSONErrorCode = 10002
	JSONErrorCodeUnknownChannel                        JSONErrorCode = 10003
	JSONErrorCodeUnknownGuild                          JSONErrorCode = 10004
	JSONErrorCodeUnknownIntegration                    JSONErrorCode = 10005
	JSONErrorCodeUnknownInvite                         JSONErrorCode = 10006
	JSONErrorCodeUnknownMember                         JSONErrorCode = 10007
	JSONErrorCodeUnknownMessage                        JSONErrorCode = 10008
	JSONErrorCodeUnknownPermissionOverwrite            JSONErrorCode = 10009
	JSONErrorCodeUnknownProvider                       JSONErrorCode = 10010
	JSONErrorCodeUnknownRole                           JSONErrorCode = 10011
	JSONErrorCodeUnknownToken                          JSONErrorCode = 10012
	JSONErrorCodeUnknownUser                           JSONErrorCode = 10013
	JSONErrorCodeUnknownEmoji                          JSONErrorCode = 10014
	JSONErrorCodeUnknownWebhook                        JSONErrorCode = 10015
	JSONErrorCodeUnknownWebhookService                 JSONErrorCode = 10016
	JSONErrorCodeUnknownSession                        JSONErrorCode = 10020
	JSONErrorCodeUnknownAsset                          JSONErrorCode = 10021
	JSONErrorCodeUnknownBan                            JSONErrorCode = 10026
	JSONErrorCodeUnknownSKU                            JSONErrorCode = 10027
	JSONErrorCodeUnknownStoreListing                   JSONErrorCode = 10028
	JSONErrorCodeUnknownEntitlement                    JSONErrorCode = 10029
	JSONErrorCodeUnknownBuild                          JSONErrorCode = 10030
	JSONErrorCodeUnknownLobby                          JSONErrorCode = 10031
	JSONErrorCodeUnknownBranch                         JSONErrorCode = 10032
	JSONErrorCodeUnknownStoreDirectoryLayout           JSONErrorCode = 10033
	JSONErrorCodeUnknownRedistributable                JSONErrorCode = 10036
	JSONErrorCodeUnknownGiftCode                       JSONErrorCode = 10038
	JSONErrorCodeUnknownStream                         JSONErrorCode = 10049
	JSONErrorCodeUnknownPremiumServerSubscribeCooldown JSONErrorCode = 10050
	JSONErrorCodeUnknownGuildTemplate                  JSONErrorCode = 10057
	JSONErrorCodeUnknownDiscoverableServerCategory     JSONErrorCode = 10059
	JSONErrorCodeUnknownSticker                        JSONErrorCode = 10060
	JSONErrorCodeUnknownStickerPack                    JSONErrorCode = 10061
	JSONErrorCodeUnknownInteraction                    JSONErrorCode = 10062
	JSONErrorCodeUnknownApplicationCommand             JSONErrorCode = 10063
	JSONErrorCodeUnknownVoiceState                     JSONErrorCode = 10065
	JSONErrorCodeUnknownApplicationCommandPermissions  JSONErrorCode = 10066
	JSONErrorCodeUnknownStageInstance                  JSONErrorCode = 10067
	JSONErrorCodeUnknownGuildMemberVerificationForm    JSONErrorCode = 10068
	JSONErrorCodeUnknownGuildWelcomeScreen             JSONErrorCode = 10069
	JSONErrorCodeUnknownGuildScheduledEvent            JSONErrorCode = 10070
	JSONErrorCodeUnknownGuildScheduledEventUser        JSONErrorCode = 10071
	JSONErrorCodeUnknownTag                            JSONErrorCode = 10087
	JSONErrorCodeUnknownSound                          JSONErrorCode = 10097

	// Authorization/action errors
	JSONErrorCodeBotsCannotUseThisEndpoint                   JSONErrorCode = 20001
	JSONErrorCodeOnlyBotsCanUseThisEndpoint                  JSONErrorCode = 20002
	JSONErrorCodeExplicitContentCannotBeSent                 JSONErrorCode = 20009
	JSONErrorCodeNotAuthorizedToPerformThisAction            JSONErrorCode = 20012
	JSONErrorCodeActionCannotBePerformedDueToSlowmode        JSONErrorCode = 20016
	JSONErrorCodeOnlyOwnerCanPerformThisAction               JSONErrorCode = 20018
	JSONErrorCodeMessageCannotBeEditedDueToAnnouncementLimit JSONErrorCode = 20022
	JSONErrorCodeUnderMinimumAge                             JSONErrorCode = 20024
	JSONErrorCodeChannelWriteRateLimit                       JSONErrorCode = 20028
	JSONErrorCodeServerWriteRateLimit                        JSONErrorCode = 20029
	JSONErrorCodeStageTopicServerNameOrChannelNamesBlocked   JSONErrorCode = 20031
	JSONErrorCodeGuildPremiumSubscriptionLevelTooLow         JSONErrorCode = 20035

	// Maximum limits
	JSONErrorCodeMaximumGuildsReached                          JSONErrorCode = 30001
	JSONErrorCodeMaximumFriendsReached                         JSONErrorCode = 30002
	JSONErrorCodeMaximumPinsReached                            JSONErrorCode = 30003
	JSONErrorCodeMaximumRecipientsReached                      JSONErrorCode = 30004
	JSONErrorCodeMaximumGuildRolesReached                      JSONErrorCode = 30005
	JSONErrorCodeMaximumWebhooksReached                        JSONErrorCode = 30007
	JSONErrorCodeMaximumEmojisReached                          JSONErrorCode = 30008
	JSONErrorCodeMaximumReactionsReached                       JSONErrorCode = 30010
	JSONErrorCodeMaximumGroupDMsReached                        JSONErrorCode = 30011
	JSONErrorCodeMaximumGuildChannelsReached                   JSONErrorCode = 30013
	JSONErrorCodeMaximumAttachmentsInMessageReached            JSONErrorCode = 30015
	JSONErrorCodeMaximumInvitesReached                         JSONErrorCode = 30016
	JSONErrorCodeMaximumAnimatedEmojisReached                  JSONErrorCode = 30018
	JSONErrorCodeMaximumServerMembersReached                   JSONErrorCode = 30019
	JSONErrorCodeMaximumServerCategoriesReached                JSONErrorCode = 30030
	JSONErrorCodeGuildAlreadyHasTemplate                       JSONErrorCode = 30031
	JSONErrorCodeMaximumApplicationCommandsReached             JSONErrorCode = 30032
	JSONErrorCodeMaximumThreadParticipantsReached              JSONErrorCode = 30033
	JSONErrorCodeMaximumDailyApplicationCommandCreatesReached  JSONErrorCode = 30034
	JSONErrorCodeMaximumBansForNonGuildMembersExceeded         JSONErrorCode = 30035
	JSONErrorCodeMaximumBansFetchesReached                     JSONErrorCode = 30037
	JSONErrorCodeMaximumUncompletedGuildScheduledEventsReached JSONErrorCode = 30038
	JSONErrorCodeMaximumStickersReached                        JSONErrorCode = 30039
	JSONErrorCodeMaximumPruneRequestsReached                   JSONErrorCode = 30040
	JSONErrorCodeMaximumGuildWidgetSettingsUpdatesReached      JSONErrorCode = 30042
	JSONErrorCodeMaximumSoundboardSoundsReached                JSONErrorCode = 30045
	JSONErrorCodeMaximumEditsToMessagesOlderThan1HourReached   JSONErrorCode = 30046
	JSONErrorCodeMaximumPinnedThreadsInForumChannelReached     JSONErrorCode = 30047
	JSONErrorCodeMaximumTagsInForumChannelReached              JSONErrorCode = 30048
	JSONErrorCodeBitrateTooHighForChannelType                  JSONErrorCode = 30052
	JSONErrorCodeMaximumPremiumEmojisReached                   JSONErrorCode = 30056
	JSONErrorCodeMaximumWebhooksPerGuildReached                JSONErrorCode = 30058
	JSONErrorCodeMaximumChannelPermissionOverwritesReached     JSONErrorCode = 30060
	JSONErrorCodeChannelsForGuildTooLarge                      JSONErrorCode = 30061

	// Temporary/rate limit errors
	JSONErrorCodeUnauthorized                            JSONErrorCode = 40001
	JSONErrorCodeNeedToVerifyAccount                     JSONErrorCode = 40002
	JSONErrorCodeOpeningDirectMessagesTooFast            JSONErrorCode = 40003
	JSONErrorCodeSendMessagesTemporarilyDisabled         JSONErrorCode = 40004
	JSONErrorCodeRequestEntityTooLarge                   JSONErrorCode = 40005
	JSONErrorCodeFeatureTemporarilyDisabled              JSONErrorCode = 40006
	JSONErrorCodeUserBannedFromGuild                     JSONErrorCode = 40007
	JSONErrorCodeConnectionRevoked                       JSONErrorCode = 40012
	JSONErrorCodeOnlyConsumableSKUsCanBeConsumed         JSONErrorCode = 40018
	JSONErrorCodeCanOnlyDeleteSandboxEntitlements        JSONErrorCode = 40019
	JSONErrorCodeTargetUserNotConnectedToVoice           JSONErrorCode = 40032
	JSONErrorCodeMessageAlreadyCrossposted               JSONErrorCode = 40033
	JSONErrorCodeApplicationCommandWithNameAlreadyExists JSONErrorCode = 40041
	JSONErrorCodeApplicationInteractionFailedToSend      JSONErrorCode = 40043
	JSONErrorCodeCannotSendMessageInForumChannel         JSONErrorCode = 40058
	JSONErrorCodeInteractionAlreadyAcknowledged          JSONErrorCode = 40060
	JSONErrorCodeTagNamesMustBeUnique                    JSONErrorCode = 40061
	JSONErrorCodeServiceResourceRateLimited              JSONErrorCode = 40062
	JSONErrorCodeNoTagsAvailableForNonModerators         JSONErrorCode = 40066
	JSONErrorCodeTagRequiredToCreateForumPost            JSONErrorCode = 40067
	JSONErrorCodeEntitlementAlreadyGrantedForResource    JSONErrorCode = 40074
	JSONErrorCodeInteractionMaxFollowUpMessagesReached   JSONErrorCode = 40094

	// Cloudflare blocking
	JSONErrorCodeCloudflareBlockingRequest JSONErrorCode = 40333

	// Invalid/missing errors
	JSONErrorCodeMissingAccess                                JSONErrorCode = 50001
	JSONErrorCodeInvalidAccountType                           JSONErrorCode = 50002
	JSONErrorCodeCannotExecuteActionOnDMChannel               JSONErrorCode = 50003
	JSONErrorCodeGuildWidgetDisabled                          JSONErrorCode = 50004
	JSONErrorCodeCannotEditMessageAuthoredByAnotherUser       JSONErrorCode = 50005
	JSONErrorCodeCannotSendEmptyMessage                       JSONErrorCode = 50006
	JSONErrorCodeCannotSendMessagesToThisUser                 JSONErrorCode = 50007
	JSONErrorCodeCannotSendMessagesInNonTextChannel           JSONErrorCode = 50008
	JSONErrorCodeChannelVerificationLevelTooHigh              JSONErrorCode = 50009
	JSONErrorCodeOAuth2ApplicationDoesNotHaveBot              JSONErrorCode = 50010
	JSONErrorCodeOAuth2ApplicationLimitReached                JSONErrorCode = 50011
	JSONErrorCodeInvalidOAuth2State                           JSONErrorCode = 50012
	JSONErrorCodeLackPermissionsToPerformAction               JSONErrorCode = 50013
	JSONErrorCodeInvalidAuthenticationToken                   JSONErrorCode = 50014
	JSONErrorCodeNoteTooLong                                  JSONErrorCode = 50015
	JSONErrorCodeTooFewOrTooManyMessagesToDelete              JSONErrorCode = 50016
	JSONErrorCodeInvalidMFALevel                              JSONErrorCode = 50017
	JSONErrorCodeMessageCanOnlyBePinnedToOriginalChannel      JSONErrorCode = 50019
	JSONErrorCodeInviteCodeInvalidOrTaken                     JSONErrorCode = 50020
	JSONErrorCodeCannotExecuteActionOnSystemMessage           JSONErrorCode = 50021
	JSONErrorCodeCannotExecuteActionOnThisChannelType         JSONErrorCode = 50024
	JSONErrorCodeInvalidOAuth2AccessToken                     JSONErrorCode = 50025
	JSONErrorCodeMissingRequiredOAuth2Scope                   JSONErrorCode = 50026
	JSONErrorCodeInvalidWebhookToken                          JSONErrorCode = 50027
	JSONErrorCodeInvalidRole                                  JSONErrorCode = 50028
	JSONErrorCodeInvalidRecipients                            JSONErrorCode = 50033
	JSONErrorCodeMessageTooOldToBulkDelete                    JSONErrorCode = 50034
	JSONErrorCodeInvalidFormBody                              JSONErrorCode = 50035
	JSONErrorCodeInviteAcceptedToGuildBotNotIn                JSONErrorCode = 50036
	JSONErrorCodeInvalidActivityAction                        JSONErrorCode = 50039
	JSONErrorCodeInvalidAPIVersion                            JSONErrorCode = 50041
	JSONErrorCodeFileUploadedExceedsMaximumSize               JSONErrorCode = 50045
	JSONErrorCodeInvalidFileUploaded                          JSONErrorCode = 50046
	JSONErrorCodeCannotSelfRedeemGift                         JSONErrorCode = 50054
	JSONErrorCodeInvalidGuild                                 JSONErrorCode = 50055
	JSONErrorCodeInvalidSKU                                   JSONErrorCode = 50057
	JSONErrorCodeInvalidRequestOrigin                         JSONErrorCode = 50067
	JSONErrorCodeInvalidMessageType                           JSONErrorCode = 50068
	JSONErrorCodePaymentSourceRequiredToRedeemGift            JSONErrorCode = 50070
	JSONErrorCodeCannotModifySystemWebhook                    JSONErrorCode = 50073
	JSONErrorCodeCannotDeleteChannelRequiredForCommunity      JSONErrorCode = 50074
	JSONErrorCodeCannotEditStickersWithinMessage              JSONErrorCode = 50080
	JSONErrorCodeInvalidStickerSent                           JSONErrorCode = 50081
	JSONErrorCodeOperationOnArchivedThread                    JSONErrorCode = 50083
	JSONErrorCodeInvalidThreadNotificationSettings            JSONErrorCode = 50084
	JSONErrorCodeBeforeValueEarlierThanThreadCreation         JSONErrorCode = 50085
	JSONErrorCodeCommunityServerChannelsMustBeText            JSONErrorCode = 50086
	JSONErrorCodeEntityTypeDifferentFromEventEntity           JSONErrorCode = 50091
	JSONErrorCodeServerNotAvailableInLocation                 JSONErrorCode = 50095
	JSONErrorCodeServerNeedsMonetizationEnabled               JSONErrorCode = 50097
	JSONErrorCodeServerNeedsMoreBoosts                        JSONErrorCode = 50101
	JSONErrorCodeRequestBodyContainsInvalidJSON               JSONErrorCode = 50109
	JSONErrorCodeProvidedFileInvalid                          JSONErrorCode = 50110
	JSONErrorCodeProvidedFileTypeInvalid                      JSONErrorCode = 50123
	JSONErrorCodeProvidedFileDurationExceedsMaximum           JSONErrorCode = 50124
	JSONErrorCodeOwnerCannotBePendingMember                   JSONErrorCode = 50131
	JSONErrorCodeOwnershipCannotBeTransferredToBot            JSONErrorCode = 50132
	JSONErrorCodeFailedToResizeAssetBelowMaximumSize          JSONErrorCode = 50138
	JSONErrorCodeCannotMixSubscriptionAndNonSubscriptionRoles JSONErrorCode = 50144
	JSONErrorCodeCannotConvertBetweenPremiumAndNormalEmoji    JSONErrorCode = 50145
	JSONErrorCodeUploadedFileNotFound                         JSONErrorCode = 50146
	JSONErrorCodeSpecifiedEmojiInvalid                        JSONErrorCode = 50151
	JSONErrorCodeVoiceMessagesDoNotSupportAdditionalContent   JSONErrorCode = 50159
	JSONErrorCodeVoiceMessagesMustHaveSingleAudioAttachment   JSONErrorCode = 50160
	JSONErrorCodeVoiceMessagesMustHaveSupportingMetadata      JSONErrorCode = 50161
	JSONErrorCodeVoiceMessagesCannotBeEdited                  JSONErrorCode = 50162
	JSONErrorCodeCannotDeleteGuildSubscriptionIntegration     JSONErrorCode = 50163
	JSONErrorCodeCannotSendVoiceMessagesInChannel             JSONErrorCode = 50173
	JSONErrorCodeUserAccountMustFirstBeVerified               JSONErrorCode = 50178
	JSONErrorCodeProvidedFileDoesNotHaveValidDuration         JSONErrorCode = 50192

	// Permission error
	JSONErrorCodeNoPermissionToSendSticker JSONErrorCode = 50600

	// Two factor required
	JSONErrorCodeTwoFactorRequired JSONErrorCode = 60003

	// No users with DiscordTag
	JSONErrorCodeNoUsersWithDiscordTagExist JSONErrorCode = 80004

	// Reaction errors
	JSONErrorCodeReactionBlocked             JSONErrorCode = 90001
	JSONErrorCodeUserCannotUseBurstReactions JSONErrorCode = 90002

	// Application not available
	JSONErrorCodeApplicationNotYetAvailable JSONErrorCode = 110001

	// API overloaded
	JSONErrorCodeAPIResourceOverloaded JSONErrorCode = 130000

	// Stage already open
	JSONErrorCodeStageAlreadyOpen JSONErrorCode = 150006

	// Thread errors
	JSONErrorCodeCannotReplyWithoutReadMessageHistoryPermission JSONErrorCode = 160002
	JSONErrorCodeThreadAlreadyCreatedForMessage                 JSONErrorCode = 160004
	JSONErrorCodeThreadLocked                                   JSONErrorCode = 160005
	JSONErrorCodeMaximumActiveThreadsReached                    JSONErrorCode = 160006
	JSONErrorCodeMaximumActiveAnnouncementThreadsReached        JSONErrorCode = 160007

	// Lottie/sticker errors
	JSONErrorCodeInvalidJSONForUploadedLottieFile             JSONErrorCode = 170001
	JSONErrorCodeUploadedLottiesCannotContainRasterizedImages JSONErrorCode = 170002
	JSONErrorCodeStickerMaximumFramerateExceeded              JSONErrorCode = 170003
	JSONErrorCodeStickerFrameCountExceedsMaximum              JSONErrorCode = 170004
	JSONErrorCodeLottieAnimationMaximumDimensionsExceeded     JSONErrorCode = 170005
	JSONErrorCodeStickerFrameRateTooSmallOrTooLarge           JSONErrorCode = 170006
	JSONErrorCodeStickerAnimationDurationExceedsMaximum       JSONErrorCode = 170007

	// Event errors
	JSONErrorCodeCannotUpdateFinishedEvent        JSONErrorCode = 180000
	JSONErrorCodeFailedToCreateStageForStageEvent JSONErrorCode = 180002

	// Auto moderation
	JSONErrorCodeMessageBlockedByAutomaticModeration JSONErrorCode = 200000
	JSONErrorCodeTitleBlockedByAutomaticModeration   JSONErrorCode = 200001

	// Webhook errors
	JSONErrorCodeWebhooksPostedToForumChannelsMustHaveThreadNameOrID        JSONErrorCode = 220001
	JSONErrorCodeWebhooksPostedToForumChannelsCannotHaveBothThreadNameAndID JSONErrorCode = 220002
	JSONErrorCodeWebhooksCanOnlyCreateThreadsInForumChannels                JSONErrorCode = 220003
	JSONErrorCodeWebhookServicesCannotBeUsedInForumChannels                 JSONErrorCode = 220004

	// Harmful links
	JSONErrorCodeMessageBlockedByHarmfulLinksFilter JSONErrorCode = 240000

	// Onboarding errors
	JSONErrorCodeCannotEnableOnboardingRequirementsNotMet     JSONErrorCode = 350000
	JSONErrorCodeCannotUpdateOnboardingWhileBelowRequirements JSONErrorCode = 350001

	// File upload limit
	JSONErrorCodeAccessToFileUploadsLimitedForGuild JSONErrorCode = 400001

	// Failed to ban users
	JSONErrorCodeFailedToBanUsers JSONErrorCode = 500000

	// Poll errors
	JSONErrorCodePollVotingBlocked                 JSONErrorCode = 520000
	JSONErrorCodePollExpired                       JSONErrorCode = 520001
	JSONErrorCodeInvalidChannelTypeForPollCreation JSONErrorCode = 520002
	JSONErrorCodeCannotEditPollMessage             JSONErrorCode = 520003
	JSONErrorCodeCannotUseEmojiIncludedWithPoll    JSONErrorCode = 520004
	JSONErrorCodeCannotExpireNonPollMessage        JSONErrorCode = 520006
)

type Members

type Members interface {
	GetMember(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) (*discord.Member, error)
	GetMembers(guildID snowflake.ID, limit int, after snowflake.ID, opts ...RequestOpt) ([]discord.Member, error)
	SearchMembers(guildID snowflake.ID, query string, limit int, opts ...RequestOpt) ([]discord.Member, error)
	AddMember(guildID snowflake.ID, userID snowflake.ID, memberAdd discord.MemberAdd, opts ...RequestOpt) (*discord.Member, error)
	RemoveMember(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) error
	UpdateMember(guildID snowflake.ID, userID snowflake.ID, memberUpdate discord.MemberUpdate, opts ...RequestOpt) (*discord.Member, error)

	AddMemberRole(guildID snowflake.ID, userID snowflake.ID, roleID snowflake.ID, opts ...RequestOpt) error
	RemoveMemberRole(guildID snowflake.ID, userID snowflake.ID, roleID snowflake.ID, opts ...RequestOpt) error

	UpdateCurrentMember(guildID snowflake.ID, memberUpdate discord.CurrentMemberUpdate, opts ...RequestOpt) (*discord.Member, error)

	GetCurrentUserVoiceState(guildID snowflake.ID, opts ...RequestOpt) (*discord.VoiceState, error)
	GetUserVoiceState(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) (*discord.VoiceState, error)
	UpdateCurrentUserVoiceState(guildID snowflake.ID, currentUserVoiceStateUpdate discord.CurrentUserVoiceStateUpdate, opts ...RequestOpt) error
	UpdateUserVoiceState(guildID snowflake.ID, userID snowflake.ID, userVoiceStateUpdate discord.UserVoiceStateUpdate, opts ...RequestOpt) error
}

func NewMembers

func NewMembers(client Client) Members

type OAuth2

type OAuth2 interface {
	GetBotApplicationInfo(opts ...RequestOpt) (*discord.Application, error)

	GetCurrentAuthorizationInfo(bearerToken string, opts ...RequestOpt) (*discord.AuthorizationInformation, error)
	// GetCurrentUser returns the current user
	// Leave bearerToken empty to use the bot token.
	GetCurrentUser(bearerToken string, opts ...RequestOpt) (*discord.OAuth2User, error)
	GetCurrentMember(bearerToken string, guildID snowflake.ID, opts ...RequestOpt) (*discord.Member, error)
	// GetCurrentUserGuilds returns a list of guilds the current user is a member of. Requires the discord.OAuth2ScopeGuilds scope.
	// Leave bearerToken empty to use the bot token.
	GetCurrentUserGuilds(bearerToken string, before snowflake.ID, after snowflake.ID, limit int, withCounts bool, opts ...RequestOpt) ([]discord.OAuth2Guild, error)
	// GetCurrentUserGuildsPage returns a Page of guilds the current user is a member of. Requires the discord.OAuth2ScopeGuilds scope.
	// Leave bearerToken empty to use the bot token.
	GetCurrentUserGuildsPage(bearerToken string, startID snowflake.ID, limit int, withCounts bool, opts ...RequestOpt) Page[discord.OAuth2Guild]
	GetCurrentUserConnections(bearerToken string, opts ...RequestOpt) ([]discord.Connection, error)

	SetGuildCommandPermissions(bearerToken string, applicationID snowflake.ID, guildID snowflake.ID, commandID snowflake.ID, commandPermissions []discord.ApplicationCommandPermission, opts ...RequestOpt) (*discord.ApplicationCommandPermissions, error)

	GetCurrentUserApplicationRoleConnection(bearerToken string, applicationID snowflake.ID, opts ...RequestOpt) (*discord.ApplicationRoleConnection, error)
	UpdateCurrentUserApplicationRoleConnection(bearerToken string, applicationID snowflake.ID, connectionUpdate discord.ApplicationRoleConnectionUpdate, opts ...RequestOpt) (*discord.ApplicationRoleConnection, error)

	GetAccessToken(clientID snowflake.ID, clientSecret string, code string, redirectURI string, opts ...RequestOpt) (*discord.AccessTokenResponse, error)
	RefreshAccessToken(clientID snowflake.ID, clientSecret string, refreshToken string, opts ...RequestOpt) (*discord.AccessTokenResponse, error)
}

func NewOAuth2

func NewOAuth2(client Client) OAuth2

type Page added in v0.13.19

type Page[T any] struct {
	Items []T
	Err   error

	ID snowflake.ID
	// contains filtered or unexported fields
}

func (*Page[T]) Next added in v0.13.19

func (p *Page[T]) Next() bool

func (*Page[T]) Previous added in v0.13.19

func (p *Page[T]) Previous() bool

type PollAnswerVotesPage added in v0.18.3

type PollAnswerVotesPage struct {
	Items []discord.User
	Err   error

	ID snowflake.ID
	// contains filtered or unexported fields
}

func (*PollAnswerVotesPage) Next added in v0.18.3

func (p *PollAnswerVotesPage) Next() bool

type QueryParams added in v0.18.14

type QueryParams interface {
	// ToQueryValues transforms fields from the QueryParams interface implementations into discord.QueryValues.
	ToQueryValues() discord.QueryValues
}

QueryParams serves as a generic interface for implementations of rest endpoint query parameters.

type RateLimiter added in v0.12.0

type RateLimiter interface {
	// MaxRetries returns the maximum number of retries the client should do
	MaxRetries() int

	// Close gracefully closes the RateLimiter.
	// If the context deadline is exceeded, the RateLimiter will be closed immediately.
	Close(ctx context.Context)

	// Reset resets the rate limiter to its initial state
	Reset()

	// Wait waits for the given bucket to be available for new requests & locks it
	Wait(ctx context.Context, endpoint *CompiledEndpoint) error

	// Unlock unlocks the given bucket and calculates the rate limit for the next request
	Unlock(endpoint *CompiledEndpoint, rs *http.Response) error
}

RateLimiter can be used to supply your own rate limit implementation

func NewNoopRateLimiter added in v0.15.1

func NewNoopRateLimiter() RateLimiter

NewNoopRateLimiter return a new noop RateLimiter.

func NewRateLimiter added in v0.12.0

func NewRateLimiter(opts ...RateLimiterConfigOpt) RateLimiter

NewRateLimiter return a new default RateLimiter with the given RateLimiterConfigOpt(s).

type RateLimiterConfigOpt added in v0.12.0

type RateLimiterConfigOpt func(config *rateLimiterConfig)

RateLimiterConfigOpt can be used to supply optional parameters to NewRateLimiter.

func WithCleanupInterval added in v0.12.0

func WithCleanupInterval(cleanupInterval time.Duration) RateLimiterConfigOpt

WithCleanupInterval tells the rest rate limiter how often to clean up the rate limiter buckets.

func WithMaxRetries added in v0.12.0

func WithMaxRetries(maxRetries int) RateLimiterConfigOpt

WithMaxRetries tells the rest rate limiter to retry the request up to the specified number of times if it encounters a 429 response.

func WithRateLimiterLogger added in v0.12.0

func WithRateLimiterLogger(logger *slog.Logger) RateLimiterConfigOpt

WithRateLimiterLogger applies a custom logger to the rest rate limiter.

type RequestOpt

type RequestOpt func(config *requestConfig)

RequestOpt can be used to supply optional parameters to Client.Do

func WithCheck

func WithCheck(check Check) RequestOpt

WithCheck adds a new check to the request

func WithCtx

func WithCtx(ctx context.Context) RequestOpt

WithCtx applies a custom context to the request

func WithDelay

func WithDelay(delay time.Duration) RequestOpt

WithDelay applies a delay to the request

func WithDiscordLocale

func WithDiscordLocale(locale discord.Locale) RequestOpt

WithDiscordLocale adds the X-Discord-Locale header with the passed locale to the request

func WithHeader

func WithHeader(key string, value string) RequestOpt

WithHeader adds a custom header to the request

func WithQueryParam

func WithQueryParam(param string, value any) RequestOpt

WithQueryParam applies a custom query parameter to the request

func WithReason

func WithReason(reason string) RequestOpt

WithReason adds a reason header to the request. Not all discord endpoints support this

func WithToken

func WithToken(tokenType discord.TokenType, token string) RequestOpt

WithToken adds the Authorization header with the passed token to the request

type Rest

Rest is a manager for all of disgo's HTTP requests

func New added in v0.12.0

func New(client Client, opts ...ConfigOpt) Rest

New returns a new default Rest

type SKUs added in v0.18.11

type SKUs interface {
	GetSKUs(applicationID snowflake.ID, opts ...RequestOpt) ([]discord.SKU, error)

	GetSKUSubscriptions(skuID snowflake.ID, before snowflake.ID, after snowflake.ID, limit int, userID snowflake.ID, opts ...RequestOpt) ([]discord.Subscription, error)
	GetSKUSubscriptionsPage(skuID snowflake.ID, userID snowflake.ID, startID snowflake.ID, limit int, opts ...RequestOpt) Page[discord.Subscription]
	GetSKUSubscription(skuID snowflake.ID, subscriptionID snowflake.ID, opts ...RequestOpt) (*discord.Subscription, error)
}

func NewSKUs added in v0.18.11

func NewSKUs(client Client) SKUs

type SoundboardSounds added in v0.18.13

type SoundboardSounds interface {
	GetSoundboardDefaultSounds(opts ...RequestOpt) ([]discord.SoundboardSound, error)
	GetGuildSoundboardSounds(guildID snowflake.ID, opts ...RequestOpt) ([]discord.SoundboardSound, error)
	CreateGuildSoundboardSound(guildID snowflake.ID, soundCreate discord.SoundboardSoundCreate, opts ...RequestOpt) (*discord.SoundboardSound, error)
	GetGuildSoundboardSound(guildID snowflake.ID, soundID snowflake.ID, opts ...RequestOpt) (*discord.SoundboardSound, error)
	UpdateGuildSoundboardSound(guildID snowflake.ID, soundID snowflake.ID, soundUpdate discord.SoundboardSoundUpdate, opts ...RequestOpt) (*discord.SoundboardSound, error)
	DeleteGuildSoundboardSound(guildID snowflake.ID, soundID snowflake.ID, opts ...RequestOpt) error
	SendSoundboardSound(channelID snowflake.ID, sendSound discord.SendSoundboardSound, opts ...RequestOpt) error
}

func NewSoundboardSounds added in v0.18.13

func NewSoundboardSounds(client Client) SoundboardSounds

type StageInstances

type StageInstances interface {
	GetStageInstance(channelID snowflake.ID, opts ...RequestOpt) (*discord.StageInstance, error)
	CreateStageInstance(stageInstanceCreate discord.StageInstanceCreate, opts ...RequestOpt) (*discord.StageInstance, error)
	UpdateStageInstance(channelID snowflake.ID, stageInstanceUpdate discord.StageInstanceUpdate, opts ...RequestOpt) (*discord.StageInstance, error)
	DeleteStageInstance(channelID snowflake.ID, opts ...RequestOpt) error
}

func NewStageInstances

func NewStageInstances(client Client) StageInstances

type Stickers

type Stickers interface {
	GetNitroStickerPacks(opts ...RequestOpt) ([]discord.StickerPack, error)
	GetNitroStickerPack(packID snowflake.ID, opts ...RequestOpt) (*discord.StickerPack, error)
	GetSticker(stickerID snowflake.ID, opts ...RequestOpt) (*discord.Sticker, error)
	GetStickers(guildID snowflake.ID, opts ...RequestOpt) ([]discord.Sticker, error)
	CreateSticker(guildID snowflake.ID, createSticker discord.StickerCreate, opts ...RequestOpt) (*discord.Sticker, error)
	UpdateSticker(guildID snowflake.ID, stickerID snowflake.ID, stickerUpdate discord.StickerUpdate, opts ...RequestOpt) (*discord.Sticker, error)
	DeleteSticker(guildID snowflake.ID, stickerID snowflake.ID, opts ...RequestOpt) error
}

func NewStickers

func NewStickers(client Client) Stickers

type ThreadMemberPage added in v0.15.0

type ThreadMemberPage struct {
	Items []discord.ThreadMember
	Err   error

	ID snowflake.ID
	// contains filtered or unexported fields
}

func (*ThreadMemberPage) Next added in v0.15.0

func (p *ThreadMemberPage) Next() bool

type Threads

type Threads interface {
	// CreateThreadFromMessage does not work for discord.ChannelTypeGuildForum or discord.ChannelTypeGuildMedia channels.
	CreateThreadFromMessage(channelID snowflake.ID, messageID snowflake.ID, threadCreateFromMessage discord.ThreadCreateFromMessage, opts ...RequestOpt) (thread *discord.GuildThread, err error)
	CreatePostInThreadChannel(channelID snowflake.ID, postCreateInChannel discord.ThreadChannelPostCreate, opts ...RequestOpt) (post *discord.ThreadChannelPost, err error)
	CreateThread(channelID snowflake.ID, threadCreate discord.ThreadCreate, opts ...RequestOpt) (thread *discord.GuildThread, err error)
	JoinThread(threadID snowflake.ID, opts ...RequestOpt) error
	LeaveThread(threadID snowflake.ID, opts ...RequestOpt) error
	AddThreadMember(threadID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) error
	RemoveThreadMember(threadID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) error
	GetThreadMember(threadID snowflake.ID, userID snowflake.ID, withMember bool, opts ...RequestOpt) (threadMember *discord.ThreadMember, err error)
	GetThreadMembers(threadID snowflake.ID, opts ...RequestOpt) (threadMembers []discord.ThreadMember, err error)
	GetThreadMembersPage(threadID snowflake.ID, startID snowflake.ID, limit int, opts ...RequestOpt) ThreadMemberPage

	GetPublicArchivedThreads(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (threads *discord.GetThreads, err error)
	GetPrivateArchivedThreads(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (threads *discord.GetThreads, err error)
	GetJoinedPrivateArchivedThreads(channelID snowflake.ID, before time.Time, limit int, opts ...RequestOpt) (threads *discord.GetThreads, err error)
	GetActiveGuildThreads(guildID snowflake.ID, opts ...RequestOpt) (*discord.GuildActiveThreads, error)
}

func NewThreads

func NewThreads(client Client) Threads

type UpdateWebhookMessageParams added in v0.18.16

type UpdateWebhookMessageParams struct {
	ThreadID       snowflake.ID
	WithComponents bool
}

func (UpdateWebhookMessageParams) ToQueryValues added in v0.18.16

type Users

type Users interface {
	GetUser(userID snowflake.ID, opts ...RequestOpt) (*discord.User, error)
	UpdateCurrentUser(userUpdate discord.UserUpdate, opts ...RequestOpt) (*discord.OAuth2User, error)
	LeaveGuild(guildID snowflake.ID, opts ...RequestOpt) error
	CreateDMChannel(userID snowflake.ID, opts ...RequestOpt) (*discord.DMChannel, error)
}

func NewUsers

func NewUsers(client Client) Users

type Voice

type Voice interface {
	GetVoiceRegions(opts ...RequestOpt) ([]discord.VoiceRegion, error)
}

func NewVoice

func NewVoice(client Client) Voice

type Webhooks

type Webhooks interface {
	GetWebhook(webhookID snowflake.ID, opts ...RequestOpt) (discord.Webhook, error)
	UpdateWebhook(webhookID snowflake.ID, webhookUpdate discord.WebhookUpdate, opts ...RequestOpt) (discord.Webhook, error)
	DeleteWebhook(webhookID snowflake.ID, opts ...RequestOpt) error

	GetWebhookWithToken(webhookID snowflake.ID, webhookToken string, opts ...RequestOpt) (discord.Webhook, error)
	UpdateWebhookWithToken(webhookID snowflake.ID, webhookToken string, webhookUpdate discord.WebhookUpdateWithToken, opts ...RequestOpt) (discord.Webhook, error)
	DeleteWebhookWithToken(webhookID snowflake.ID, webhookToken string, opts ...RequestOpt) error

	GetWebhookMessage(webhookID snowflake.ID, webhookToken string, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
	CreateWebhookMessage(webhookID snowflake.ID, webhookToken string, messageCreate discord.WebhookMessageCreate, params CreateWebhookMessageParams, opts ...RequestOpt) (*discord.Message, error)
	CreateWebhookMessageSlack(webhookID snowflake.ID, webhookToken string, messageCreate discord.Payload, params CreateWebhookMessageParams, opts ...RequestOpt) (*discord.Message, error)
	CreateWebhookMessageGitHub(webhookID snowflake.ID, webhookToken string, messageCreate discord.Payload, params CreateWebhookMessageParams, opts ...RequestOpt) (*discord.Message, error)
	UpdateWebhookMessage(webhookID snowflake.ID, webhookToken string, messageID snowflake.ID, messageUpdate discord.WebhookMessageUpdate, params UpdateWebhookMessageParams, opts ...RequestOpt) (*discord.Message, error)
	DeleteWebhookMessage(webhookID snowflake.ID, webhookToken string, messageID snowflake.ID, threadID snowflake.ID, opts ...RequestOpt) error
}

func NewWebhooks

func NewWebhooks(client Client, defaultAllowedMentions discord.AllowedMentions) Webhooks

Jump to

Keyboard shortcuts

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