rest

package
v0.13.22 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 16 Imported by: 40

Documentation

Index

Constants

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 (
	// APIVersion is the Discord API version DisGo should use
	APIVersion = 10

	// API is the base path of the Discord API
	API = fmt.Sprintf("https://discord.com/api/v%d", APIVersion)
)
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  = NewEndpoint(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")
	GetCurrentMember          = NewEndpoint(http.MethodGet, "/users/@me/guilds/{guild.id}/member")
	UpdateSelfUser            = NewEndpoint(http.MethodPatch, "/users/@me")
	GetCurrentUserConnections = NewNoBotAuthEndpoint(http.MethodGet, "/users/@me/connections")
	GetCurrentUserGuilds      = NewNoBotAuthEndpoint(http.MethodGet, "/users/@me/guilds")
	LeaveGuild                = NewEndpoint(http.MethodDelete, "/users/@me/guilds/{guild.id}")
	GetDMChannels             = NewEndpoint(http.MethodGet, "/users/@me/channels")
	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")
	CreateGuild       = NewEndpoint(http.MethodPost, "/guilds")
	UpdateGuild       = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}")
	DeleteGuild       = NewEndpoint(http.MethodDelete, "/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}")

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

	GetPruneMembersCount = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/prune")
	PruneMembers         = 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")

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

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

	GetPermissionOverwrites   = NewEndpoint(http.MethodGet, "/channels/{channel.id}/permissions")
	GetPermissionOverwrite    = NewEndpoint(http.MethodGet, "/channels/{channel.id}/permissions/{overwrite.id}")
	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")
)

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

	GetArchivedPublicThreads        = NewEndpoint(http.MethodGet, "/channels/{channel.id}/threads/archived/public")
	GetArchivedPrivateThreads       = NewEndpoint(http.MethodGet, "/channels/{channel.id}/threads/archived/private")
	GetJoinedAchievedPrivateThreads = NewEndpoint(http.MethodGet, "/channels/{channel.id}/users/@me/threads/archived/private")
)

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

	GetPinnedMessages = NewEndpoint(http.MethodGet, "/channels/{channel.id}/pins")
	PinMessage        = NewEndpoint(http.MethodPut, "/channels/{channel.id}/pins/{message.id}")
	UnpinMessage      = NewEndpoint(http.MethodDelete, "/channels/{channel.id}/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")
	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}")

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

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

Invites

View Source
var (
	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  = NewEndpoint(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}")
	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}")
)

Interactions

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

Functions

func NewError

func NewError(rq *http.Request, rqBody []byte, rs *http.Response, rsBody []byte) error

NewError returns a new Error with the given http.Request, http.Response

Types

type Applications

type Applications interface {
	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)
}

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

	GetPermissionOverwrites(channelID snowflake.ID, opts ...RequestOpt) ([]discord.PermissionOverwrite, error)
	GetPermissionOverwrite(channelID snowflake.ID, overwriteID snowflake.ID, opts ...RequestOpt) (*discord.PermissionOverwrite, 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, 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

	GetPinnedMessages(channelID snowflake.ID, opts ...RequestOpt) ([]discord.Message, error)
	PinMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error
	UnpinMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error
}

func NewChannels

func NewChannels(client Client) 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 rrate.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 ...ConfigOpt) Client

NewClient constructs a new Client with the given Config struct

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 Config

type Config struct {
	Logger                    log.Logger
	HTTPClient                *http.Client
	RateLimiter               RateLimiter
	RateRateLimiterConfigOpts []RateLimiterConfigOpt
	UserAgent                 string
}

Config is the configuration for the rest client

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig is the configuration which is used by default

func (*Config) Apply

func (c *Config) Apply(opts []ConfigOpt)

Apply applies the given ConfigOpt(s) to the Config

type ConfigOpt

type ConfigOpt func(config *Config)

ConfigOpt can be used to supply optional parameters to NewClient

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ConfigOpt

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

func WithLogger

func WithLogger(logger log.Logger) ConfigOpt

WithLogger applies a custom logger to the rest rate limiter

func WithRateLimiter

func WithRateLimiter(rateLimiter RateLimiter) ConfigOpt

WithRateLimiter applies a custom rrate.RateLimiter to the rest client

func WithRateRateLimiterConfigOpts added in v0.12.0

func WithRateRateLimiterConfigOpts(opts ...RateLimiterConfigOpt) ConfigOpt

WithRateRateLimiterConfigOpts applies rrate.ConfigOpt for the rrate.RateLimiter to the rest rate limiter

func WithUserAgent

func WithUserAgent(userAgent string) ConfigOpt

WithUserAgent sets the user agent for all requests

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
	RqBody   []byte
	Response *http.Response
	RsBody   []byte
}

Error holds the http.Response & an error related to a REST request

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 discord.APIError 6 has the same StatusCode

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 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)
	CreateGuild(guildCreate discord.GuildCreate, opts ...RequestOpt) (*discord.RestGuild, error)
	UpdateGuild(guildID snowflake.ID, guildUpdate discord.GuildUpdate, opts ...RequestOpt) (*discord.RestGuild, error)
	DeleteGuild(guildID snowflake.ID, opts ...RequestOpt) 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

	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

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

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

	GetAuditLog(guildID snowflake.ID, userID snowflake.ID, actionType discord.AuditLogEvent, before 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
}

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
	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) 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)
	GetGuildInvites(guildID snowflake.ID, opts ...RequestOpt) ([]discord.Invite, error)
	GetChannelInvites(channelID snowflake.ID, opts ...RequestOpt) ([]discord.Invite, error)
}

func NewInvites

func NewInvites(client Client) Invites

type Members

type Members interface {
	GetMember(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) (*discord.Member, error)
	GetMembers(guildID 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, nick string, opts ...RequestOpt) (*string, 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(bearerToken string, opts ...RequestOpt) (*discord.OAuth2User, error)
	GetCurrentMember(bearerToken string, guildID snowflake.ID, opts ...RequestOpt) (*discord.Member, error)
	GetCurrentUserGuilds(bearerToken string, before snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.OAuth2Guild, error)
	GetCurrentUserGuildsPage(bearerToken string, startID snowflake.ID, limit int, 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)

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

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

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

RateLimiter can be used to supply your own rate limit implementation

func NewRateLimiter added in v0.12.0

func NewRateLimiter(opts ...RateLimiterConfigOpt) RateLimiter

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

type RateLimiterConfig added in v0.12.0

type RateLimiterConfig struct {
	Logger          log.Logger
	MaxRetries      int
	CleanupInterval time.Duration
}

RateLimiterConfig is the configuration for the rate limiter.

func DefaultRateLimiterConfig added in v0.12.0

func DefaultRateLimiterConfig() *RateLimiterConfig

DefaultRateLimiterConfig is the configuration which is used by default.

func (*RateLimiterConfig) Apply added in v0.12.0

func (c *RateLimiterConfig) Apply(opts []RateLimiterConfigOpt)

Apply applies the given RateLimiterConfigOpt(s) to the RateLimiterConfig.

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 log.Logger) RateLimiterConfigOpt

WithRateLimiterLogger applies a custom logger to the rest rate limiter.

type RequestConfig

type RequestConfig struct {
	Request *http.Request
	Ctx     context.Context
	Checks  []Check
	Delay   time.Duration
}

RequestConfig are additional options for the request

func DefaultRequestConfig

func DefaultRequestConfig(rq *http.Request) *RequestConfig

func (*RequestConfig) Apply

func (c *RequestConfig) Apply(opts []RequestOpt)

Apply applies the given RequestOpt(s) to the RequestConfig & sets the context if none is set

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

New returns a new default Rest

type StageInstances

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

func NewStageInstances

func NewStageInstances(client Client) StageInstances

type Stickers

type Stickers interface {
	GetNitroStickerPacks(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 Threads

type Threads interface {
	// CreateThreadFromMessage does not work for discord.ChannelTypeGuildForum channels.
	CreateThreadFromMessage(channelID snowflake.ID, messageID snowflake.ID, threadCreateFromMessage discord.ThreadCreateFromMessage, opts ...RequestOpt) (thread *discord.GuildThread, err error)
	CreateThreadInForum(channelID snowflake.ID, threadCreateInForum discord.ForumThreadCreate, opts ...RequestOpt) (thread *discord.ForumThread, 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, opts ...RequestOpt) (threadMember *discord.ThreadMember, err error)
	GetThreadMembers(threadID snowflake.ID, opts ...RequestOpt) (threadMembers []discord.ThreadMember, err error)

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

func NewThreads

func NewThreads(client Client) Threads

type Users

type Users interface {
	GetUser(userID snowflake.ID, opts ...RequestOpt) (*discord.User, error)
	UpdateSelfUser(selfUserUpdate discord.SelfUserUpdate, opts ...RequestOpt) (*discord.OAuth2User, error)
	GetGuilds(before int, after int, limit int, opts ...RequestOpt) ([]discord.OAuth2Guild, error)
	LeaveGuild(guildID snowflake.ID, opts ...RequestOpt) error
	GetDMChannels(opts ...RequestOpt) ([]discord.Channel, 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

	CreateWebhookMessage(webhookID snowflake.ID, webhookToken string, messageCreate discord.WebhookMessageCreate, wait bool, threadID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
	CreateWebhookMessageSlack(webhookID snowflake.ID, webhookToken string, messageCreate discord.Payload, wait bool, threadID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
	CreateWebhookMessageGitHub(webhookID snowflake.ID, webhookToken string, messageCreate discord.Payload, wait bool, threadID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
	UpdateWebhookMessage(webhookID snowflake.ID, webhookToken string, messageID snowflake.ID, messageUpdate discord.WebhookMessageUpdate, threadID snowflake.ID, 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) Webhooks

Jump to

Keyboard shortcuts

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