Documentation ¶
Overview ¶
Package rest handles the REST API of Discord
Index ¶
- func CreateMultipartBodyWithJSON[...](data T, files []discord.File) (string, []byte, error)
- func DoEmptyRequest(client *Client, method, url string, requestBody any, ...) error
- func DoEmptyRequestWithFiles(client *Client, method, url string, requestBody []byte, ...) error
- func DoRequestAsList[T any](client *Client, method, url string, requestBody any, ...) ([]T, error)
- func DoRequestAsStructure[T any](client *Client, method, url string, requestBody any, ...) (*T, error)
- func DoRequestWithFiles[T any](client *Client, method, url string, requestBody []byte, ...) (*T, error)
- type Bucket
- type Client
- func (c *Client) AddGuildMemberRole(guildID, userID, roleID discord.Snowflake, reason string) error
- func (c *Client) AddThreadMember(threadID, userID discord.Snowflake) error
- func (c *Client) BeginGuildPrune(guildID discord.Snowflake, prune discord.BeginGuildPrune) (*discord.GuildPrune, error)
- func (c *Client) BulkDeleteMessages(channelID discord.Snowflake, bulkDeleteMessages discord.BulkDeleteMessages) error
- func (c *Client) BulkOverwriteGlobalApplicationCommand(applicationCommands []discord.CreateGlobalApplicationCommand) ([]discord.ApplicationCommand, error)
- func (c *Client) BulkOverwriteGuildApplicationCommand(guildID discord.Snowflake, ...) ([]discord.ApplicationCommand, error)
- func (c *Client) CreateAutoModerationRule(guildID discord.Snowflake, autoModerationRule discord.CreateAutoModerationRule) (*discord.AutoModerationRule, error)
- func (c *Client) CreateChannelInvite(channelID discord.Snowflake, invite discord.CreateChannelInvite) (*discord.Invite, error)
- func (c *Client) CreateDM(userID discord.Snowflake) (*discord.Channel, error)
- func (c *Client) CreateFollowupMessage(interactionToken string, message discord.CreateFollowupMessage) (*discord.Message, error)
- func (c *Client) CreateGlobalApplicationCommand(applicationCommand discord.CreateGlobalApplicationCommand) (*discord.ApplicationCommand, error)
- func (c *Client) CreateGuild(guild discord.CreateGuild) (*discord.Guild, error)
- func (c *Client) CreateGuildApplicationCommand(guildID discord.Snowflake, ...) (*discord.ApplicationCommand, error)
- func (c *Client) CreateGuildBan(guildID discord.Snowflake, ban discord.CreateGuildBan) error
- func (c *Client) CreateGuildChannel(guildID discord.Snowflake, channel discord.CreateGuildChannel) (*discord.Channel, error)
- func (c *Client) CreateGuildEmoji(guildID discord.Snowflake, emoji discord.CreateGuildEmoji) (*discord.Emoji, error)
- func (c *Client) CreateGuildFromTemplate(templateCode string, guild discord.CreateGuildFromTemplate) (*discord.Guild, error)
- func (c *Client) CreateGuildRole(guildID discord.Snowflake, role discord.CreateGuildRole) (*discord.Role, error)
- func (c *Client) CreateGuildScheduledEvent(guildID discord.Snowflake, scheduledEvent discord.CreateGuildScheduledEvent) (*discord.GuildScheduledEvent, error)
- func (c *Client) CreateGuildSticker(guildID discord.Snowflake, sticker discord.CreateGuildSticker) (*discord.Sticker, error)
- func (c *Client) CreateGuildTemplate(guildID discord.Snowflake, guildTemplate discord.CreateGuildTemplate) (*discord.GuildTemplate, error)
- func (c *Client) CreateInteractionResponse(interactionID discord.Snowflake, interactionToken string, ...) error
- func (c *Client) CreateMessage(channelID discord.Snowflake, message discord.CreateMessage) (*discord.Message, error)
- func (c *Client) CreateReaction(channelID, messageID discord.Snowflake, emoji string) error
- func (c *Client) CreateStageInstance(stageInstance discord.CreateStageInstance) (*discord.StageInstance, error)
- func (c *Client) CreateWebhook(channelID discord.Snowflake, webhook discord.CreateWebhook) (*discord.Webhook, error)
- func (c *Client) CrosspostMessage(channelID, messageID discord.Snowflake) (*discord.Message, error)
- func (c *Client) DeleteAllReactions(channelID, messageID discord.Snowflake) error
- func (c *Client) DeleteAllReactionsForEmoji(channelID, messageID discord.Snowflake, emoji string) error
- func (c *Client) DeleteAutoModerationRule(guildID, ruleID discord.Snowflake, reason string) error
- func (c *Client) DeleteChannel(channelID discord.Snowflake, reason string) error
- func (c *Client) DeleteChannelPermissions(channelID, overwriteID discord.Snowflake, reason string) error
- func (c *Client) DeleteFollowupMessage(interactionToken string, messageID discord.Snowflake) error
- func (c *Client) DeleteGlobalApplicationCommand(commandID discord.Snowflake) error
- func (c *Client) DeleteGuild(guildID discord.Snowflake) error
- func (c *Client) DeleteGuildApplicationCommand(guildID, commandID discord.Snowflake) error
- func (c *Client) DeleteGuildEmoji(guildID, emojiID discord.Snowflake, reason string) error
- func (c *Client) DeleteGuildIntegration(guildID, integrationID discord.Snowflake, reason string) error
- func (c *Client) DeleteGuildRole(guildID, roleID discord.Snowflake, reason string) error
- func (c *Client) DeleteGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake) error
- func (c *Client) DeleteGuildSticker(guildID, stickerID discord.Snowflake, reason string) error
- func (c *Client) DeleteGuildTemplate(guildID discord.Snowflake, templateCode string) (*discord.GuildTemplate, error)
- func (c *Client) DeleteInvite(inviteCode string) (*discord.Invite, error)
- func (c *Client) DeleteMessage(channelID, messageID discord.Snowflake, reason string) error
- func (c *Client) DeleteOriginalInteractionResponse(interactionToken string) error
- func (c *Client) DeleteOwnReaction(channelID, messageID discord.Snowflake, emoji string) error
- func (c *Client) DeleteStageInstance(channelID discord.Snowflake) error
- func (c *Client) DeleteUserReaction(channelID, messageID, userID discord.Snowflake, emoji string) error
- func (c *Client) DeleteWebhook(webhookID discord.Snowflake) error
- func (c *Client) DeleteWebhookMessage(webhookID, messageID discord.Snowflake, webhookToken string, ...) error
- func (c *Client) DeleteWebhookWithToken(webhookID discord.Snowflake, webhookToken string) error
- func (c *Client) DoRequest(method, url string, requestBody []byte, queryParams QueryParameters, ...) ([]byte, *http.Response, error)
- func (c *Client) EditChannelPermissions(channelID, overwriteID discord.Snowflake, ...) error
- func (c *Client) EditFollowupMessage(interactionToken string, messageID, threadID discord.Snowflake, ...) (*discord.Webhook, error)
- func (c *Client) EditGlobalApplicationCommand(commandID discord.Snowflake, ...) (*discord.ApplicationCommand, error)
- func (c *Client) EditGuildApplicationCommand(guildID, commandID discord.Snowflake, ...) (*discord.ApplicationCommand, error)
- func (c *Client) EditMessage(channelID, messageID discord.Snowflake, message discord.EditMessage) (*discord.Message, error)
- func (c *Client) EditOriginalInteractionResponse(interactionToken string, threadID discord.Snowflake, ...) (*discord.Webhook, error)
- func (c *Client) EditWebhookMessage(webhookID, messageID discord.Snowflake, webhookToken string, ...) (*discord.Webhook, error)
- func (c *Client) ExecuteWebhook(webhookID discord.Snowflake, webhookToken string, threadID discord.Snowflake, ...) (*discord.Message, error)
- func (c *Client) FollowAnnouncementChannel(channelID, targetID discord.Snowflake) (*discord.FollowedChannel, error)
- func (c *Client) GetApplicationCommandPermissions(guildID, commandID discord.Snowflake) ([]discord.GuildApplicationCommandPermissions, error)
- func (c *Client) GetApplicationRoleConnectionMetadataRecords() ([]discord.ApplicationRoleConnectionMetadata, error)
- func (c *Client) GetAutoModerationRule(guildID, ruleID discord.Snowflake) (*discord.AutoModerationRule, error)
- func (c *Client) GetAutoModerationRules(guildID discord.Snowflake) ([]discord.AutoModerationRule, error)
- func (c *Client) GetChannel(channelID discord.Snowflake) (*discord.Channel, error)
- func (c *Client) GetChannelInvites(channelID discord.Snowflake) ([]discord.InviteWithMetadata, error)
- func (c *Client) GetChannelMessage(channelID, messageID discord.Snowflake) (*discord.Message, error)
- func (c *Client) GetChannelMessages(channelID discord.Snowflake) ([]discord.Message, error)
- func (c *Client) GetChannelWebhooks(channelID discord.Snowflake) ([]discord.Webhook, error)
- func (c *Client) GetCurrentUser() (*discord.User, error)
- func (c *Client) GetCurrentUserGuilds(before, after discord.Snowflake, limit int) ([]discord.PartialGuild, error)
- func (c *Client) GetFollowupMessage(interactionToken string, messageID discord.Snowflake) (*discord.Message, error)
- func (c *Client) GetGlobalApplicationCommand(commandID discord.Snowflake) (*discord.ApplicationCommand, error)
- func (c *Client) GetGlobalApplicationCommands(withLocalizations bool) ([]discord.ApplicationCommand, error)
- func (c *Client) GetGuild(guildID discord.Snowflake, withCounts bool) (*discord.Guild, error)
- func (c *Client) GetGuildApplicationCommand(guildID, commandID discord.Snowflake) (*discord.ApplicationCommand, error)
- func (c *Client) GetGuildApplicationCommandPermissions(guildID discord.Snowflake) ([]discord.GuildApplicationCommandPermissions, error)
- func (c *Client) GetGuildApplicationCommands(guildID discord.Snowflake, withLocalizations bool) ([]discord.ApplicationCommand, error)
- func (c *Client) GetGuildAuditLog(guildID discord.Snowflake) (*discord.AuditLog, error)
- func (c *Client) GetGuildBan(guildID, userID discord.Snowflake) (*discord.GuildBan, error)
- func (c *Client) GetGuildBans(guildID, before, after discord.Snowflake, limit int) ([]discord.GuildBan, error)
- func (c *Client) GetGuildChannels(guildID discord.Snowflake) ([]discord.Channel, error)
- func (c *Client) GetGuildEmoji(guildID, emojiID discord.Snowflake) (*discord.Emoji, error)
- func (c *Client) GetGuildIntegrations(guildID discord.Snowflake) ([]discord.Integration, error)
- func (c *Client) GetGuildInvites(guildID discord.Snowflake) ([]discord.InviteWithMetadata, error)
- func (c *Client) GetGuildMember(guildID, userID discord.Snowflake) (*discord.Member, error)
- func (c *Client) GetGuildOnboarding(guildID discord.Snowflake) (*discord.Onboarding, error)
- func (c *Client) GetGuildPreview(guildID discord.Snowflake) (*discord.GuildPreview, error)
- func (c *Client) GetGuildPruneCount(guildID discord.Snowflake, days int, includeRoles discord.ArraySnowflakes) (*discord.GuildPrune, error)
- func (c *Client) GetGuildRoles(guildID discord.Snowflake) ([]discord.Role, error)
- func (c *Client) GetGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake, withUserCount bool) (*discord.GuildScheduledEvent, error)
- func (c *Client) GetGuildScheduledEventUsers(guildID, scheduledEventID, before, after discord.Snowflake, limit int, ...) ([]discord.GuildScheduledEventUser, error)
- func (c *Client) GetGuildSticker(guildID, stickerID discord.Snowflake) (*discord.Sticker, error)
- func (c *Client) GetGuildTemplate(templateCode string) (*discord.GuildTemplate, error)
- func (c *Client) GetGuildTemplates(guildID discord.Snowflake) ([]discord.GuildTemplate, error)
- func (c *Client) GetGuildVanityURL(guildID discord.Snowflake) (*discord.PartialInvite, error)
- func (c *Client) GetGuildVoiceRegions(guildID discord.Snowflake) ([]discord.VoiceRegion, error)
- func (c *Client) GetGuildWebhooks(guildID discord.Snowflake) ([]discord.Webhook, error)
- func (c *Client) GetGuildWelcomeScreen(guildID discord.Snowflake) (*discord.WelcomeScreen, error)
- func (c *Client) GetGuildWidget(guildID discord.Snowflake) (*discord.Widget, error)
- func (c *Client) GetGuildWidgetSetting(guildID discord.Snowflake) (*discord.WidgetSetting, error)
- func (c *Client) GetInvite(inviteCode string, withCounts, withExpiration bool, ...) (*discord.Invite, error)
- func (c *Client) GetOriginalInteractionResponse(interactionToken string, threadID discord.Snowflake) (*discord.Message, error)
- func (c *Client) GetPinnedMessages(channelID discord.Snowflake) ([]discord.Message, error)
- func (c *Client) GetReactions(channelID, messageID discord.Snowflake, emoji string, after discord.Snowflake, ...) ([]discord.User, error)
- func (c *Client) GetSelfUser() (*discord.User, error)
- func (c *Client) GetStageInstance(channelID discord.Snowflake) (*discord.StageInstance, error)
- func (c *Client) GetSticker(stickerID discord.Snowflake) (*discord.Sticker, error)
- func (c *Client) GetThreadMember(threadID, userID discord.Snowflake) (*discord.ThreadMember, error)
- func (c *Client) GetUser(userID discord.Snowflake) (*discord.User, error)
- func (c *Client) GetWebhook(webhookID discord.Snowflake) (*discord.Webhook, error)
- func (c *Client) GetWebhookMessage(webhookID discord.Snowflake, webhookToken string, ...) (*discord.Message, error)
- func (c *Client) GetWebhookWithToken(webhookID discord.Snowflake, webhookToken string) (*discord.Webhook, error)
- func (c *Client) LeaveGuild(guildID discord.Snowflake) error
- func (c *Client) LeaveThread(threadID discord.Snowflake) error
- func (c *Client) ListActiveThreads(guildID discord.Snowflake) (*discord.ActiveThreads, error)
- func (c *Client) ListGuildEmojis(guildID discord.Snowflake) ([]discord.Emoji, error)
- func (c *Client) ListGuildMembers(guildID, after discord.Snowflake, limit int) ([]discord.Member, error)
- func (c *Client) ListGuildScheduledEvents(guildID discord.Snowflake, withUserCount bool) ([]discord.GuildScheduledEvent, error)
- func (c *Client) ListGuildStickers(guildID discord.Snowflake) ([]discord.Sticker, error)
- func (c *Client) ListJoinedPrivateArchivedThreads(channelID, before discord.Snowflake, limit int) (*discord.ArchivedThreads, error)
- func (c *Client) ListPrivateArchivedThreads(channelID discord.Snowflake, before *time.Time, limit int) (*discord.ArchivedThreads, error)
- func (c *Client) ListPublicArchivedThreads(channelID discord.Snowflake, before *time.Time, limit int) (*discord.ArchivedThreads, error)
- func (c *Client) ListStickerPacks() (*discord.NitroStickerPacks, error)
- func (c *Client) ListThreadMembers(threadID, after discord.Snowflake, withMember bool, limit int) ([]discord.ThreadMember, error)
- func (c *Client) ListVoiceRegions() ([]discord.VoiceRegion, error)
- func (c *Client) ModifyAutoModerationRule(guildID, ruleID discord.Snowflake, ...) (*discord.AutoModerationRule, error)
- func (c *Client) ModifyChannel(channelID discord.Snowflake, newChannel discord.ModifyChannel) (*discord.Channel, error)
- func (c *Client) ModifyCurrentUser(user discord.ModifyCurrentUser) (*discord.User, error)
- func (c *Client) ModifyCurrentUserVoiceState(guildID discord.Snowflake, voiceState discord.ModifyCurrentUserVoiceState) error
- func (c *Client) ModifyGuild(guildID discord.Snowflake, guild discord.ModifyGuild) (*discord.Guild, error)
- func (c *Client) ModifyGuildChannelPositions(guildID discord.Snowflake, ...) error
- func (c *Client) ModifyGuildEmoji(guildID, emojiID discord.Snowflake, emoji discord.ModifyGuildEmoji) (*discord.Emoji, error)
- func (c *Client) ModifyGuildMFALevel(guildID discord.Snowflake, mfaLevel discord.ModifyGuildMFALevel) (*discord.MFALevel, error)
- func (c *Client) ModifyGuildMember(guildID, userID discord.Snowflake, member discord.ModifyGuildMember) (*discord.Member, error)
- func (c *Client) ModifyGuildRole(guildID, roleID discord.Snowflake, role discord.ModifyGuildRole) (*discord.Role, error)
- func (c *Client) ModifyGuildRolePositions(guildID discord.Snowflake, rolePositions []discord.GuildRolePosition) ([]discord.Role, error)
- func (c *Client) ModifyGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake, ...) (*discord.GuildScheduledEvent, error)
- func (c *Client) ModifyGuildSticker(guildID, stickerID discord.Snowflake, sticker discord.ModifyGuildSticker) (*discord.Sticker, error)
- func (c *Client) ModifyGuildTemplate(guildID discord.Snowflake, guildTemplate discord.ModifyGuildTemplate) (*discord.GuildTemplate, error)
- func (c *Client) ModifyGuildWelcomeScreen(guildID discord.Snowflake, welcomeScreen discord.ModifyGuildWelcomeScreen) (*discord.WelcomeScreen, error)
- func (c *Client) ModifyGuildWidget(guildID discord.Snowflake, widget discord.ModifyGuildWidget) (*discord.WidgetSetting, error)
- func (c *Client) ModifyStageInstance(channelID discord.Snowflake, stageInstance discord.ModifyStageInstance) (*discord.StageInstance, error)
- func (c *Client) ModifyUserVoiceState(guildID, userID discord.Snowflake, voiceState discord.ModifyUserVoiceState) error
- func (c *Client) ModifyWebhook(webhookID discord.Snowflake, webhook discord.ModifyWebhook) (*discord.Webhook, error)
- func (c *Client) ModifyWebhookWithToken(webhookID discord.Snowflake, webhookToken string, ...) (*discord.Webhook, error)
- func (c *Client) PinMessage(channelID, messageID discord.Snowflake, reason string) error
- func (c *Client) RemoveGuildBan(guildID, userID discord.Snowflake, reason string) error
- func (c *Client) RemoveGuildMember(guildID, userID discord.Snowflake, reason string) error
- func (c *Client) RemoveGuildMemberRole(guildID, userID, roleID discord.Snowflake, reason string) error
- func (c *Client) RemoveThreadMember(threadID, userID discord.Snowflake) error
- func (c *Client) SearchGuildMember(guildID discord.Snowflake, query string, limit int) ([]discord.Member, error)
- func (c *Client) StartThreadFromMessage(channelID, messageID discord.Snowflake, thread discord.StartThreadFromMessage) (*discord.Channel, error)
- func (c *Client) StartThreadInForumChannel(channelID discord.Snowflake, thread discord.StartThreadInForumChannel) (*discord.Channel, error)
- func (c *Client) StartThreadWithoutMessage(channelID discord.Snowflake, thread discord.StartThreadWithoutMessage) (*discord.Channel, error)
- func (c *Client) SyncGuildTemplate(guildID discord.Snowflake, templateCode string) (*discord.GuildTemplate, error)
- func (c *Client) TriggerTyping(channelID discord.Snowflake) error
- func (c *Client) UnpinMessage(channelID, messageID discord.Snowflake, reason string) error
- func (c *Client) UpdateApplicationRoleConnectionMetadataRecords(records []discord.ApplicationRoleConnectionMetadata) ([]discord.ApplicationRoleConnectionMetadata, error)
- type DefaultInterceptor
- type HttpClient
- type Interceptor
- type QueryParameters
- type RateLimiter
- type RequestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMultipartBodyWithJSON ¶ added in v0.4.0
func CreateMultipartBodyWithJSON[T discord.CreateMessage | discord.EditMessage | discord.ExecuteWebhook | discord.EditWebhookMessage | discord.StartThreadInForumChannel | discord.CreateGuildSticker | discord.CreateInteractionResponse | discord.EditOriginalInteractionResponse | discord.CreateFollowupMessage | discord.EditFollowupMessage](data T, files []discord.File) (string, []byte, error)
CreateMultipartBodyWithJSON returns the new bytes for when uploading files to Discord https://discord.com/developers/docs/reference#uploading-files
func DoEmptyRequest ¶ added in v0.4.0
func DoEmptyRequest(client *Client, method, url string, requestBody any, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) error
func DoEmptyRequestWithFiles ¶ added in v0.4.0
func DoEmptyRequestWithFiles(client *Client, method, url string, requestBody []byte, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) error
func DoRequestAsList ¶ added in v0.3.0
func DoRequestAsList[T any](client *Client, method, url string, requestBody any, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) ([]T, error)
func DoRequestAsStructure ¶ added in v0.4.0
func DoRequestAsStructure[T any](client *Client, method, url string, requestBody any, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) (*T, error)
func DoRequestWithFiles ¶ added in v0.4.0
func DoRequestWithFiles[T any](client *Client, method, url string, requestBody []byte, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) (*T, error)
Types ¶
type Client ¶
type Client struct { HttpClient *HttpClient Logger *tangra.Logger Debug bool RateLimiter *RateLimiter TaskManager *tasks.TaskManager // Extras is a field you can use freely that will **never** be touched by the library itself Extras interface{} // contains filtered or unexported fields }
Client is a client made to send REST API requests only
func (*Client) AddGuildMemberRole ¶ added in v0.4.0
AddGuildMemberRole adds a role (discord.Role) for the given guild, user and role IDs
func (*Client) AddThreadMember ¶ added in v0.4.0
AddThreadMember adds a member to a thread given the thread and user IDs
func (*Client) BeginGuildPrune ¶ added in v0.4.0
func (c *Client) BeginGuildPrune(guildID discord.Snowflake, prune discord.BeginGuildPrune) (*discord.GuildPrune, error)
BeginGuildPrune begins a guild prune operation (discord.GuildPrune) for the given guild ID and returns the number of members that were removed
func (*Client) BulkDeleteMessages ¶ added in v0.4.0
func (c *Client) BulkDeleteMessages(channelID discord.Snowflake, bulkDeleteMessages discord.BulkDeleteMessages) error
BulkDeleteMessages deletes multiple messages from the given channel ID in a single request
func (*Client) BulkOverwriteGlobalApplicationCommand ¶ added in v0.4.0
func (c *Client) BulkOverwriteGlobalApplicationCommand(applicationCommands []discord.CreateGlobalApplicationCommand) ([]discord.ApplicationCommand, error)
BulkOverwriteGlobalApplicationCommand overwrites all the existing global application commands (discord.ApplicationCommand) and returns a list of application command structures
func (*Client) BulkOverwriteGuildApplicationCommand ¶ added in v0.4.0
func (c *Client) BulkOverwriteGuildApplicationCommand(guildID discord.Snowflake, applicationCommands []discord.CreateGuildApplicationCommand) ([]discord.ApplicationCommand, error)
BulkOverwriteGuildApplicationCommand overwrites all the existing guild application commands (discord.ApplicationCommand) for the given guild ID and returns a list of application command structures
func (*Client) CreateAutoModerationRule ¶ added in v0.4.0
func (c *Client) CreateAutoModerationRule(guildID discord.Snowflake, autoModerationRule discord.CreateAutoModerationRule) (*discord.AutoModerationRule, error)
CreateAutoModerationRule creates a new auto moderation rule (discord.AutoModerationRule) and returns its structure
func (*Client) CreateChannelInvite ¶ added in v0.4.0
func (c *Client) CreateChannelInvite(channelID discord.Snowflake, invite discord.CreateChannelInvite) (*discord.Invite, error)
CreateChannelInvite creates a new invite (discord.Invite) for the given channel ID and returns its new structure
func (*Client) CreateDM ¶ added in v0.4.0
CreateDM creates a new DM channel (discord.Channel) for the given user ID and returns its structure
func (*Client) CreateFollowupMessage ¶ added in v0.6.0
func (c *Client) CreateFollowupMessage(interactionToken string, message discord.CreateFollowupMessage) (*discord.Message, error)
CreateFollowupMessage creates a followup message (discord.Message) for the given interaction token
func (*Client) CreateGlobalApplicationCommand ¶ added in v0.4.0
func (c *Client) CreateGlobalApplicationCommand(applicationCommand discord.CreateGlobalApplicationCommand) (*discord.ApplicationCommand, error)
CreateGlobalApplicationCommand creates a global application command (discord.ApplicationCommand) and returns its structure
func (*Client) CreateGuild ¶ added in v0.4.0
CreateGuild creates a guild (discord.Guild) and returns its structure
func (*Client) CreateGuildApplicationCommand ¶ added in v0.4.0
func (c *Client) CreateGuildApplicationCommand(guildID discord.Snowflake, applicationCommand discord.CreateGuildApplicationCommand) (*discord.ApplicationCommand, error)
CreateGuildApplicationCommand creates a guild application command (discord.ApplicationCommand) for the given guild ID and returns its structure
func (*Client) CreateGuildBan ¶ added in v0.4.0
CreateGuildBan creates a guild ban (discord.GuildBan) for the given guild ID
func (*Client) CreateGuildChannel ¶ added in v0.4.0
func (c *Client) CreateGuildChannel(guildID discord.Snowflake, channel discord.CreateGuildChannel) (*discord.Channel, error)
CreateGuildChannel creates a channel (discord.Channel) for the given guild ID and returns its structure
func (*Client) CreateGuildEmoji ¶ added in v0.4.0
func (c *Client) CreateGuildEmoji(guildID discord.Snowflake, emoji discord.CreateGuildEmoji) (*discord.Emoji, error)
CreateGuildEmoji creates a new emoji (discord.Emoji) for the given guild ID and returns its structure
func (*Client) CreateGuildFromTemplate ¶ added in v0.4.0
func (c *Client) CreateGuildFromTemplate(templateCode string, guild discord.CreateGuildFromTemplate) (*discord.Guild, error)
CreateGuildFromTemplate creates a guild (discord.Guild) based on the given template code and returns its structure
func (*Client) CreateGuildRole ¶ added in v0.4.0
func (c *Client) CreateGuildRole(guildID discord.Snowflake, role discord.CreateGuildRole) (*discord.Role, error)
CreateGuildRole creates a role (discord.Role) for the given guild ID and returns its structure
func (*Client) CreateGuildScheduledEvent ¶ added in v0.4.0
func (c *Client) CreateGuildScheduledEvent(guildID discord.Snowflake, scheduledEvent discord.CreateGuildScheduledEvent) (*discord.GuildScheduledEvent, error)
CreateGuildScheduledEvent creates a guild scheduled event (discord.GuildScheduledEvent) for the given guild ID and returns its structure
func (*Client) CreateGuildSticker ¶ added in v0.4.0
func (c *Client) CreateGuildSticker(guildID discord.Snowflake, sticker discord.CreateGuildSticker) (*discord.Sticker, error)
CreateGuildSticker creates a new sticker (discord.Sticker) for the given guild ID and returns its structure **Warning**: Seems to not be working at the moment, always giving "Invalid Asset"
func (*Client) CreateGuildTemplate ¶ added in v0.4.0
func (c *Client) CreateGuildTemplate(guildID discord.Snowflake, guildTemplate discord.CreateGuildTemplate) (*discord.GuildTemplate, error)
CreateGuildTemplate creates a guild template (discord.GuildTemplate) for the given guild ID and returns its structure
func (*Client) CreateInteractionResponse ¶ added in v0.6.0
func (c *Client) CreateInteractionResponse(interactionID discord.Snowflake, interactionToken string, interactionResponse discord.CreateInteractionResponse) error
CreateInteractionResponse creates a response to an interaction (discord.Interaction) for the given interaction ID and token
func (*Client) CreateMessage ¶ added in v0.4.0
func (c *Client) CreateMessage(channelID discord.Snowflake, message discord.CreateMessage) (*discord.Message, error)
CreateMessage posts a message (discord.Message) in a given channel ID and returns its structure
func (*Client) CreateReaction ¶ added in v0.4.0
CreateReaction creates a reaction (discord.Reaction) for the given channel and message IDs
func (*Client) CreateStageInstance ¶ added in v0.4.0
func (c *Client) CreateStageInstance(stageInstance discord.CreateStageInstance) (*discord.StageInstance, error)
CreateStageInstance creates a new stage instance (discord.StageInstance) and returns its structure
func (*Client) CreateWebhook ¶ added in v0.4.0
func (c *Client) CreateWebhook(channelID discord.Snowflake, webhook discord.CreateWebhook) (*discord.Webhook, error)
CreateWebhook creates a new webhook (discord.Webhook) for the given channel ID and returns its structure
func (*Client) CrosspostMessage ¶ added in v0.4.0
CrosspostMessage cross-posts a given message ID from a given announcement channel (discord.ChannelTypeGuildAnnouncement) ID to following channels (discord.Channel) and returns a message structure (discord.Message)
func (*Client) DeleteAllReactions ¶ added in v0.4.0
DeleteAllReactions deletes all reactions (discord.Reaction) for the given channel and message IDs
func (*Client) DeleteAllReactionsForEmoji ¶ added in v0.4.0
func (c *Client) DeleteAllReactionsForEmoji(channelID, messageID discord.Snowflake, emoji string) error
DeleteAllReactionsForEmoji deletes all reactions (discord.Reaction) for the given channel and message IDs and the emoji
func (*Client) DeleteAutoModerationRule ¶ added in v0.4.0
DeleteAutoModerationRule deletes an existing auto moderation rule (discord.AutoModerationRule)
func (*Client) DeleteChannel ¶ added in v0.4.0
DeleteChannel deletes an existing channel (discord.Channel)
func (*Client) DeleteChannelPermissions ¶ added in v0.4.0
func (c *Client) DeleteChannelPermissions(channelID, overwriteID discord.Snowflake, reason string) error
DeleteChannelPermissions delete the permissions for the given channel and overwrite IDs
func (*Client) DeleteFollowupMessage ¶ added in v0.6.0
DeleteFollowupMessage deletes the followup response message (discord.Message) for the given interaction token and message ID
func (*Client) DeleteGlobalApplicationCommand ¶ added in v0.4.0
DeleteGlobalApplicationCommand deletes an existing global application command (discord.Guild) from the given command ID
func (*Client) DeleteGuild ¶ added in v0.4.0
DeleteGuild deletes an existing guild (discord.Guild) from the given guild ID
func (*Client) DeleteGuildApplicationCommand ¶ added in v0.4.0
DeleteGuildApplicationCommand deletes an existing guild application command (discord.Guild) from the given guild and command IDs
func (*Client) DeleteGuildEmoji ¶ added in v0.4.0
DeleteGuildEmoji deletes an existing emoji (discord.Emoji) for the given guild and emoji IDs
func (*Client) DeleteGuildIntegration ¶ added in v0.4.0
func (c *Client) DeleteGuildIntegration(guildID, integrationID discord.Snowflake, reason string) error
DeleteGuildIntegration deletes an existing integration (discord.Integration) for the given guild and integration IDs
func (*Client) DeleteGuildRole ¶ added in v0.4.0
DeleteGuildRole deletes an existing role (discord.Role) for the given guild and role IDs
func (*Client) DeleteGuildScheduledEvent ¶ added in v0.4.0
DeleteGuildScheduledEvent deletes an existing guild scheduled event (discord.GuildScheduledEvent) for the given guild and scheduled event IDs
func (*Client) DeleteGuildSticker ¶ added in v0.4.0
DeleteGuildSticker deletes an existing sticker (discord.Sticker) from the given guild and sticker ID
func (*Client) DeleteGuildTemplate ¶ added in v0.4.0
func (c *Client) DeleteGuildTemplate(guildID discord.Snowflake, templateCode string) (*discord.GuildTemplate, error)
DeleteGuildTemplate deletes an existing guild template (discord.GuildTemplate) for the given guild ID and template code and returns the structure of the deleted template
func (*Client) DeleteInvite ¶ added in v0.4.0
DeleteInvite deletes an existing invitation (discord.Invite) for the given invite code
func (*Client) DeleteMessage ¶ added in v0.4.0
DeleteMessage deletes a message from the given channel and message IDs
func (*Client) DeleteOriginalInteractionResponse ¶ added in v0.6.0
DeleteOriginalInteractionResponse deletes the original interaction response message (discord.Message) for the given interaction token
func (*Client) DeleteOwnReaction ¶ added in v0.4.0
DeleteOwnReaction deletes a reaction (discord.Reaction) the current user has made for the given channel and message IDs
func (*Client) DeleteStageInstance ¶ added in v0.4.0
DeleteStageInstance deletes an existing stage instance (discord.StageInstance) for the given channel ID
func (*Client) DeleteUserReaction ¶ added in v0.4.0
func (c *Client) DeleteUserReaction(channelID, messageID, userID discord.Snowflake, emoji string) error
DeleteUserReaction deletes a reaction (discord.Reaction) a given user ID has made for the given channel and message IDs
func (*Client) DeleteWebhook ¶ added in v0.4.0
DeleteWebhook deletes an existing webhook (discord.Webhook) from the given webhook ID
func (*Client) DeleteWebhookMessage ¶ added in v0.5.0
func (c *Client) DeleteWebhookMessage(webhookID, messageID discord.Snowflake, webhookToken string, threadID discord.Snowflake) error
DeleteWebhookMessage deletes a message (discord.Message) sent by a webhook (discord.Webhook) for the given webhook and message IDs and webhook token
func (*Client) DeleteWebhookWithToken ¶ added in v0.4.0
DeleteWebhookWithToken deletes an existing webhook (discord.Webhook) from the given webhook ID and webhook token (does not require authentication)
func (*Client) DoRequest ¶
func (c *Client) DoRequest(method, url string, requestBody []byte, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) ([]byte, *http.Response, error)
DoRequest performs a request to the given URL with the given method, it will make sure to follow rate limits, and returns the body and the response individually
func (*Client) EditChannelPermissions ¶ added in v0.4.0
func (c *Client) EditChannelPermissions(channelID, overwriteID discord.Snowflake, channelPermissions discord.EditChannelPermissions) error
EditChannelPermissions edits the permissions for the given channel and overwrite IDs
func (*Client) EditFollowupMessage ¶ added in v0.6.0
func (c *Client) EditFollowupMessage(interactionToken string, messageID, threadID discord.Snowflake, message discord.EditFollowupMessage) (*discord.Webhook, error)
EditFollowupMessage edits the followup message (discord.Message) for the given interaction token and message ID and returns its new structure
func (*Client) EditGlobalApplicationCommand ¶ added in v0.4.0
func (c *Client) EditGlobalApplicationCommand(commandID discord.Snowflake, applicationCommand discord.EditGlobalApplicationCommand) (*discord.ApplicationCommand, error)
EditGlobalApplicationCommand edits and existing global application command (discord.ApplicationCommand) for the given command ID and returns its new structure
func (*Client) EditGuildApplicationCommand ¶ added in v0.4.0
func (c *Client) EditGuildApplicationCommand(guildID, commandID discord.Snowflake, applicationCommand discord.EditGuildApplicationCommand) (*discord.ApplicationCommand, error)
EditGuildApplicationCommand edits and existing guild application command (discord.ApplicationCommand) for the given guild and command IDs and returns its new structure
func (*Client) EditMessage ¶ added in v0.4.0
func (c *Client) EditMessage(channelID, messageID discord.Snowflake, message discord.EditMessage) (*discord.Message, error)
EditMessage edits a message (discord.Message) from the given channel and message IDs and returns its structure
func (*Client) EditOriginalInteractionResponse ¶ added in v0.6.0
func (c *Client) EditOriginalInteractionResponse(interactionToken string, threadID discord.Snowflake, message discord.EditOriginalInteractionResponse) (*discord.Webhook, error)
EditOriginalInteractionResponse edits the original interaction response message (discord.Message) for the given interaction token and returns its new structure
func (*Client) EditWebhookMessage ¶ added in v0.5.0
func (c *Client) EditWebhookMessage(webhookID, messageID discord.Snowflake, webhookToken string, threadID discord.Snowflake, message discord.EditWebhookMessage) (*discord.Webhook, error)
EditWebhookMessage edits a message (discord.Message) sent by a webhook (discord.Webhook) for the given webhook and message IDs and webhook token and returns its new structure
func (*Client) ExecuteWebhook ¶ added in v0.4.0
func (c *Client) ExecuteWebhook(webhookID discord.Snowflake, webhookToken string, threadID discord.Snowflake, wait bool, message discord.ExecuteWebhook) (*discord.Message, error)
ExecuteWebhook executes a webhook (discord.Webhook) to send some message with it for the given webhook ID and webhook token (can also be executed in a given thread ID)
func (*Client) FollowAnnouncementChannel ¶ added in v0.4.0
func (c *Client) FollowAnnouncementChannel(channelID, targetID discord.Snowflake) (*discord.FollowedChannel, error)
FollowAnnouncementChannel follows the given channel ID to the given target channel ID and returns a followed channel structure (discord.FollowedChannel)
func (*Client) GetApplicationCommandPermissions ¶ added in v0.3.0
func (c *Client) GetApplicationCommandPermissions(guildID, commandID discord.Snowflake) ([]discord.GuildApplicationCommandPermissions, error)
GetApplicationCommandPermissions returns a guild application command permissions structure (discord.GuildApplicationCommandPermissions) for the given guild and command IDs that is available in the guild ID
func (*Client) GetApplicationRoleConnectionMetadataRecords ¶ added in v0.4.0
func (c *Client) GetApplicationRoleConnectionMetadataRecords() ([]discord.ApplicationRoleConnectionMetadata, error)
GetApplicationRoleConnectionMetadataRecords returns a list of application role connection metadata structures (discord.ApplicationRoleConnectionMetadata) for the given application ID
func (*Client) GetAutoModerationRule ¶ added in v0.3.0
func (c *Client) GetAutoModerationRule(guildID, ruleID discord.Snowflake) (*discord.AutoModerationRule, error)
GetAutoModerationRule returns an auto moderation rule structure (discord.AutoModerationRule) for the given guild and rule ID
func (*Client) GetAutoModerationRules ¶ added in v0.3.0
func (c *Client) GetAutoModerationRules(guildID discord.Snowflake) ([]discord.AutoModerationRule, error)
GetAutoModerationRules returns a list of auto moderation rule structures (discord.AutoModerationRule) for the given guild ID
func (*Client) GetChannel ¶ added in v0.3.0
GetChannel returns a channel structure (discord.Channel) for the given channel ID
func (*Client) GetChannelInvites ¶ added in v0.3.0
func (c *Client) GetChannelInvites(channelID discord.Snowflake) ([]discord.InviteWithMetadata, error)
GetChannelInvites returns a list of invite with metadata structures (discord.InviteWithMetadata) for a given channel ID
func (*Client) GetChannelMessage ¶ added in v0.3.0
func (c *Client) GetChannelMessage(channelID, messageID discord.Snowflake) (*discord.Message, error)
GetChannelMessage returns a message (discord.Message) for the given channel and message IDs
func (*Client) GetChannelMessages ¶ added in v0.3.0
GetChannelMessages returns a list of message structures (discord.Message) for the given channel ID
func (*Client) GetChannelWebhooks ¶ added in v0.3.0
GetChannelWebhooks returns a list of channel webhook structures (discord.Webhook) given the channel ID
func (*Client) GetCurrentUser ¶
GetCurrentUser returns the current user structure (discord.User)
func (*Client) GetCurrentUserGuilds ¶ added in v0.5.0
func (c *Client) GetCurrentUserGuilds(before, after discord.Snowflake, limit int) ([]discord.PartialGuild, error)
GetCurrentUserGuilds returns a list of partial guild structures (discord.PartialGuild)
func (*Client) GetFollowupMessage ¶ added in v0.6.0
func (c *Client) GetFollowupMessage(interactionToken string, messageID discord.Snowflake) (*discord.Message, error)
GetFollowupMessage returns the message structure (discord.Message) of the followup message for the given the interaction token and message ID
func (*Client) GetGlobalApplicationCommand ¶ added in v0.3.0
func (c *Client) GetGlobalApplicationCommand(commandID discord.Snowflake) (*discord.ApplicationCommand, error)
GetGlobalApplicationCommand returns a global application command structure (discord.ApplicationCommand) for the given command ID
func (*Client) GetGlobalApplicationCommands ¶ added in v0.3.0
func (c *Client) GetGlobalApplicationCommands(withLocalizations bool) ([]discord.ApplicationCommand, error)
GetGlobalApplicationCommands returns a list of global application command structures (discord.ApplicationCommand)
func (*Client) GetGuild ¶ added in v0.3.0
GetGuild returns a guild structure (discord.Guild) for the given guild ID
func (*Client) GetGuildApplicationCommand ¶ added in v0.3.0
func (c *Client) GetGuildApplicationCommand(guildID, commandID discord.Snowflake) (*discord.ApplicationCommand, error)
GetGuildApplicationCommand returns a guild application command structure (discord.ApplicationCommand) for the given guild and command IDs that is available in the given guild ID
func (*Client) GetGuildApplicationCommandPermissions ¶ added in v0.3.0
func (c *Client) GetGuildApplicationCommandPermissions(guildID discord.Snowflake) ([]discord.GuildApplicationCommandPermissions, error)
GetGuildApplicationCommandPermissions returns a list of guild application command permissions structures (discord.GuildApplicationCommandPermissions) for the given guild ID that is available in the guild ID
func (*Client) GetGuildApplicationCommands ¶ added in v0.3.0
func (c *Client) GetGuildApplicationCommands(guildID discord.Snowflake, withLocalizations bool) ([]discord.ApplicationCommand, error)
GetGuildApplicationCommands returns a list of guild application command structures (discord.ApplicationCommand) that are available in the given guild ID
func (*Client) GetGuildAuditLog ¶ added in v0.3.0
GetGuildAuditLog returns an audit log structure (discord.AuditLog) for given guild ID
func (*Client) GetGuildBan ¶ added in v0.3.0
GetGuildBan returns a guild ban structure (discord.GuildBan) for the given guild and user IDs
func (*Client) GetGuildBans ¶ added in v0.3.0
func (c *Client) GetGuildBans(guildID, before, after discord.Snowflake, limit int) ([]discord.GuildBan, error)
GetGuildBans returns a list of guild ban structures (discord.GuildBan) for the given guild ID
func (*Client) GetGuildChannels ¶ added in v0.3.0
GetGuildChannels returns a list of channel structures (discord.Channel) for the given guild ID
func (*Client) GetGuildEmoji ¶ added in v0.3.0
GetGuildEmoji returns an emoji structure (discord.Emoji) for the given guild and emoji IDs
func (*Client) GetGuildIntegrations ¶ added in v0.3.0
GetGuildIntegrations returns a list of integrations structures (discord.Integration) for the given guild ID
func (*Client) GetGuildInvites ¶ added in v0.3.0
GetGuildInvites returns a list of invite with metadata structures (discord.InviteWithMetadata) for the given guild ID
func (*Client) GetGuildMember ¶ added in v0.3.0
GetGuildMember returns a member structure (discord.Member) for the given guild and user IDs
func (*Client) GetGuildOnboarding ¶ added in v0.3.0
GetGuildOnboarding returns an onboarding structure (discord.Onboarding) for the given guild ID
func (*Client) GetGuildPreview ¶ added in v0.3.0
GetGuildPreview returns a guild preview structure (discord.GuildPreview) for the given guild ID
func (*Client) GetGuildPruneCount ¶ added in v0.3.0
func (c *Client) GetGuildPruneCount(guildID discord.Snowflake, days int, includeRoles discord.ArraySnowflakes) (*discord.GuildPrune, error)
GetGuildPruneCount returns a guild prune structure (discord.GuildPrune) for the given guild IDs
func (*Client) GetGuildRoles ¶ added in v0.3.0
GetGuildRoles returns a list role structures (discord.Role)
func (*Client) GetGuildScheduledEvent ¶ added in v0.3.0
func (c *Client) GetGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake, withUserCount bool) (*discord.GuildScheduledEvent, error)
GetGuildScheduledEvent returns a guild scheduled event structure (discord.GuildScheduledEvent) for the given guild ID and scheduled event ID
func (*Client) GetGuildScheduledEventUsers ¶ added in v0.3.0
func (c *Client) GetGuildScheduledEventUsers(guildID, scheduledEventID, before, after discord.Snowflake, limit int, withMember bool) ([]discord.GuildScheduledEventUser, error)
GetGuildScheduledEventUsers returns a list of guild scheduled event user structures (discord.GuildScheduledEventUser)
func (*Client) GetGuildSticker ¶ added in v0.3.0
GetGuildSticker returns a sticker structure (discord.Sticker) for the given guild and sticker IDs
func (*Client) GetGuildTemplate ¶ added in v0.3.0
func (c *Client) GetGuildTemplate(templateCode string) (*discord.GuildTemplate, error)
GetGuildTemplate returns a guild template structure (discord.GuildTemplate) for the given template code
func (*Client) GetGuildTemplates ¶ added in v0.3.0
GetGuildTemplates returns a list of guild template structures (discord.GuildTemplate) for the given guild ID
func (*Client) GetGuildVanityURL ¶ added in v0.3.0
GetGuildVanityURL returns the vanity invite, which is a partial invite structure (discord.PartialInvite), for the given guild ID
func (*Client) GetGuildVoiceRegions ¶ added in v0.3.0
GetGuildVoiceRegions returns a list of voice region structures (discord.VoiceRegion) for the given guild ID
func (*Client) GetGuildWebhooks ¶ added in v0.3.0
GetGuildWebhooks returns a list of guild webhook structures (discord.Webhook) given the guild ID
func (*Client) GetGuildWelcomeScreen ¶ added in v0.3.0
GetGuildWelcomeScreen returns a welcome screen structure (discord.WelcomeScreen) for the given guild ID
func (*Client) GetGuildWidget ¶ added in v0.3.0
GetGuildWidget returns a widget structure (discord.Widget) for the given guild ID
func (*Client) GetGuildWidgetSetting ¶ added in v0.3.0
GetGuildWidgetSetting returns a widget setting structure (discord.WidgetSetting) for the given guild ID
func (*Client) GetInvite ¶ added in v0.3.0
func (c *Client) GetInvite(inviteCode string, withCounts, withExpiration bool, guildScheduledEventID discord.Snowflake) (*discord.Invite, error)
GetInvite returns an invitation structure (discord.Invite) for the given invite code
func (*Client) GetOriginalInteractionResponse ¶ added in v0.6.0
func (c *Client) GetOriginalInteractionResponse(interactionToken string, threadID discord.Snowflake) (*discord.Message, error)
GetOriginalInteractionResponse returns the message structure (discord.Message) of the original interaction response for given the interaction token
func (*Client) GetPinnedMessages ¶ added in v0.3.0
GetPinnedMessages returns a list of message structures (discord.Message) that are pinned in the given channel ID
func (*Client) GetReactions ¶ added in v0.3.0
func (c *Client) GetReactions(channelID, messageID discord.Snowflake, emoji string, after discord.Snowflake, limit int) ([]discord.User, error)
GetReactions returns a list of user structures (discord.User) that reacted to the given message ID in the given channel ID with the given emoji
func (*Client) GetSelfUser ¶
GetSelfUser is an alias of GetCurrentUser
func (*Client) GetStageInstance ¶ added in v0.3.0
GetStageInstance returns a stage instance structure (discord.StageInstance) associated with the stage channel
func (*Client) GetSticker ¶ added in v0.3.0
GetSticker returns a sticker structure (discord.Sticker) for the given sticker ID
func (*Client) GetThreadMember ¶ added in v0.3.0
GetThreadMember returns a thread member structure (discord.ThreadMember) for a given thread and user ID if they are a member of said thread
func (*Client) GetUser ¶ added in v0.3.0
GetUser returns a user structure (discord.User) for the given user ID
func (*Client) GetWebhook ¶ added in v0.3.0
GetWebhook returns a webhook structure (discord.Webhook) given the webhook ID
func (*Client) GetWebhookMessage ¶ added in v0.3.0
func (c *Client) GetWebhookMessage(webhookID discord.Snowflake, webhookToken string, messageID, threadID discord.Snowflake) (*discord.Message, error)
GetWebhookMessage returns a previously-sent webhook message structure (discord.Message) from the same token given the message ID
func (*Client) GetWebhookWithToken ¶ added in v0.3.0
func (c *Client) GetWebhookWithToken(webhookID discord.Snowflake, webhookToken string) (*discord.Webhook, error)
GetWebhookWithToken returns a webhook structure (discord.Webhook) given the webhook ID and webhook token (does not require authentication and returns no user in the webhook structure)
func (*Client) LeaveGuild ¶ added in v0.4.0
LeaveGuild leaves a guild (discord.Guild) from the given guild ID
func (*Client) LeaveThread ¶ added in v0.4.0
LeaveThread removes the current user from a given thread given its ID
func (*Client) ListActiveThreads ¶ added in v0.3.0
ListActiveThreads returns an active threads structure (discord.ActiveThreads) for the given guild ID
func (*Client) ListGuildEmojis ¶ added in v0.3.0
ListGuildEmojis returns a list of emoji structures (discord.Emoji) for the given guild ID
func (*Client) ListGuildMembers ¶ added in v0.6.0
func (c *Client) ListGuildMembers(guildID, after discord.Snowflake, limit int) ([]discord.Member, error)
ListGuildMembers returns a list of member structures (discord.Member) for the given guild ID
func (*Client) ListGuildScheduledEvents ¶ added in v0.3.0
func (c *Client) ListGuildScheduledEvents(guildID discord.Snowflake, withUserCount bool) ([]discord.GuildScheduledEvent, error)
ListGuildScheduledEvents returns a list of guild scheduled event structures (discord.GuildScheduledEvent) for the given guild ID
func (*Client) ListGuildStickers ¶ added in v0.3.0
ListGuildStickers returns a list of sticker structures (discord.Sticker) for the given guild ID
func (*Client) ListJoinedPrivateArchivedThreads ¶ added in v0.3.0
func (c *Client) ListJoinedPrivateArchivedThreads(channelID, before discord.Snowflake, limit int) (*discord.ArchivedThreads, error)
ListJoinedPrivateArchivedThreads returns an archived threads structure (discord.ArchivedThreads) which contains the private archived threads in the given channel ID that the user has joined
func (*Client) ListPrivateArchivedThreads ¶ added in v0.3.0
func (c *Client) ListPrivateArchivedThreads(channelID discord.Snowflake, before *time.Time, limit int) (*discord.ArchivedThreads, error)
ListPrivateArchivedThreads returns an archived threads structure (discord.ArchivedThreads) which contains the private archived threads in the given channel ID
func (*Client) ListPublicArchivedThreads ¶ added in v0.3.0
func (c *Client) ListPublicArchivedThreads(channelID discord.Snowflake, before *time.Time, limit int) (*discord.ArchivedThreads, error)
ListPublicArchivedThreads returns an archived threads structure (discord.ArchivedThreads) which contains the public archived threads in the given channel ID
func (*Client) ListStickerPacks ¶ added in v0.7.0
func (c *Client) ListStickerPacks() (*discord.NitroStickerPacks, error)
ListStickerPacks returns the list of sticker pack structures (discord.NitroStickerPacks)
func (*Client) ListThreadMembers ¶ added in v0.3.0
func (c *Client) ListThreadMembers(threadID, after discord.Snowflake, withMember bool, limit int) ([]discord.ThreadMember, error)
ListThreadMembers returns a list of thread member structures (discord.ThreadMember) that are members of the given thread ID
func (*Client) ListVoiceRegions ¶ added in v0.3.0
func (c *Client) ListVoiceRegions() ([]discord.VoiceRegion, error)
ListVoiceRegions returns a list of voice region structures (discord.VoiceRegion) that can be used when setting a voice or stage channel's `rtc_region`
func (*Client) ModifyAutoModerationRule ¶ added in v0.4.0
func (c *Client) ModifyAutoModerationRule(guildID, ruleID discord.Snowflake, autoModerationRule discord.ModifyAutoModerationRule) (*discord.AutoModerationRule, error)
ModifyAutoModerationRule modifies an existing auto moderation rule (discord.AutoModerationRule) and returns its structure
func (*Client) ModifyChannel ¶ added in v0.4.0
func (c *Client) ModifyChannel(channelID discord.Snowflake, newChannel discord.ModifyChannel) (*discord.Channel, error)
ModifyChannel modifies an existing channel (discord.Channel) and returns its structure
func (*Client) ModifyCurrentUser ¶ added in v0.4.0
ModifyCurrentUser modifies the current user (discord.User) and returns its new structure
func (*Client) ModifyCurrentUserVoiceState ¶ added in v0.4.0
func (c *Client) ModifyCurrentUserVoiceState(guildID discord.Snowflake, voiceState discord.ModifyCurrentUserVoiceState) error
ModifyCurrentUserVoiceState modifies the voice state of the current user for the given guild ID
func (*Client) ModifyGuild ¶ added in v0.4.0
func (c *Client) ModifyGuild(guildID discord.Snowflake, guild discord.ModifyGuild) (*discord.Guild, error)
ModifyGuild modifies an existing guild (discord.Guild) from the given guild ID and returns its new structure
func (*Client) ModifyGuildChannelPositions ¶ added in v0.4.0
func (c *Client) ModifyGuildChannelPositions(guildID discord.Snowflake, channelPositions []discord.ModifyGuildChannelPosition) error
ModifyGuildChannelPositions modifies the position of existing channels (discord.Channel) for the given guild ID
func (*Client) ModifyGuildEmoji ¶ added in v0.4.0
func (c *Client) ModifyGuildEmoji(guildID, emojiID discord.Snowflake, emoji discord.ModifyGuildEmoji) (*discord.Emoji, error)
ModifyGuildEmoji modifies an existing emoji (discord.Emoji) for the given guild and emoji IDs and returns the edited emoji structure
func (*Client) ModifyGuildMFALevel ¶ added in v0.4.0
func (c *Client) ModifyGuildMFALevel(guildID discord.Snowflake, mfaLevel discord.ModifyGuildMFALevel) (*discord.MFALevel, error)
ModifyGuildMFALevel modifies the MFA level (discord.MFALevel) for the given guild ID and returns its new structure
func (*Client) ModifyGuildMember ¶ added in v0.4.0
func (c *Client) ModifyGuildMember(guildID, userID discord.Snowflake, member discord.ModifyGuildMember) (*discord.Member, error)
ModifyGuildMember modifies a guild member (discord.Member) for the given guild and user IDs and returns the new structure
func (*Client) ModifyGuildRole ¶ added in v0.4.0
func (c *Client) ModifyGuildRole(guildID, roleID discord.Snowflake, role discord.ModifyGuildRole) (*discord.Role, error)
ModifyGuildRole modifies an existing role (discord.Role) for the given guild and role IDs and returns its new structure
func (*Client) ModifyGuildRolePositions ¶ added in v0.4.0
func (c *Client) ModifyGuildRolePositions(guildID discord.Snowflake, rolePositions []discord.GuildRolePosition) ([]discord.Role, error)
ModifyGuildRolePositions modifies the position of existing roles (discord.Role) for the given guild ID and returns the list of role structures in the guild
func (*Client) ModifyGuildScheduledEvent ¶ added in v0.4.0
func (c *Client) ModifyGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake, scheduledEvent discord.ModifyGuildScheduledEvent) (*discord.GuildScheduledEvent, error)
ModifyGuildScheduledEvent modifies an existing guild scheduled event (discord.GuildScheduledEvent) for the given guild and scheduled event IDs and returns its new structure
func (*Client) ModifyGuildSticker ¶ added in v0.4.0
func (c *Client) ModifyGuildSticker(guildID, stickerID discord.Snowflake, sticker discord.ModifyGuildSticker) (*discord.Sticker, error)
ModifyGuildSticker modifies an existing sticker (discord.Sticker) for the given guild and sticker IDs and returns its new structure
func (*Client) ModifyGuildTemplate ¶ added in v0.4.0
func (c *Client) ModifyGuildTemplate(guildID discord.Snowflake, guildTemplate discord.ModifyGuildTemplate) (*discord.GuildTemplate, error)
ModifyGuildTemplate modifies an existing guild template (discord.GuildTemplate) for the given guild ID and template code and returns its new structure
func (*Client) ModifyGuildWelcomeScreen ¶ added in v0.4.0
func (c *Client) ModifyGuildWelcomeScreen(guildID discord.Snowflake, welcomeScreen discord.ModifyGuildWelcomeScreen) (*discord.WelcomeScreen, error)
ModifyGuildWelcomeScreen modifies an existing welcome screen (discord.WelcomeScreen) for the given guild ID and returns its new structure
func (*Client) ModifyGuildWidget ¶ added in v0.4.0
func (c *Client) ModifyGuildWidget(guildID discord.Snowflake, widget discord.ModifyGuildWidget) (*discord.WidgetSetting, error)
ModifyGuildWidget modifies an existing widget (discord.WidgetSetting) for the given guild ID and returns its new structure
func (*Client) ModifyStageInstance ¶ added in v0.4.0
func (c *Client) ModifyStageInstance(channelID discord.Snowflake, stageInstance discord.ModifyStageInstance) (*discord.StageInstance, error)
ModifyStageInstance modifies an existing stage instance (discord.StageInstance) for the given channel ID and returns its new structure
func (*Client) ModifyUserVoiceState ¶ added in v0.4.0
func (c *Client) ModifyUserVoiceState(guildID, userID discord.Snowflake, voiceState discord.ModifyUserVoiceState) error
ModifyUserVoiceState modifies the voice state of the current user for the given guild and user IDs
func (*Client) ModifyWebhook ¶ added in v0.4.0
func (c *Client) ModifyWebhook(webhookID discord.Snowflake, webhook discord.ModifyWebhook) (*discord.Webhook, error)
ModifyWebhook modifies an existing webhook (discord.Webhook) for the given webhook ID and returns its new structure
func (*Client) ModifyWebhookWithToken ¶ added in v0.4.0
func (c *Client) ModifyWebhookWithToken(webhookID discord.Snowflake, webhookToken string, webhook discord.ModifyWebhookWithToken) (*discord.Webhook, error)
ModifyWebhookWithToken modifies an existing webhook (discord.Webhook) for the given webhook ID and webhook token and returns its new structure (does not require authentication and returns no user in the webhook structure)
func (*Client) PinMessage ¶ added in v0.4.0
PinMessage pins the given message ID in the given channel ID
func (*Client) RemoveGuildBan ¶ added in v0.4.0
RemoveGuildBan removes an existing guild ban (discord.GuildBan) for the given guild and user IDs Note: This endpoint is the only endpoint rejecting a "Content-Type: application/json" header without body...
func (*Client) RemoveGuildMember ¶ added in v0.4.0
RemoveGuildMember removes a member (discord.Member) from a guild for the given guild and user IDs
func (*Client) RemoveGuildMemberRole ¶ added in v0.4.0
func (c *Client) RemoveGuildMemberRole(guildID, userID, roleID discord.Snowflake, reason string) error
RemoveGuildMemberRole removes a role (discord.Role) for the given guild, user and role IDs
func (*Client) RemoveThreadMember ¶ added in v0.4.0
RemoveThreadMember removes another member from a thread given the thread and user IDs
func (*Client) SearchGuildMember ¶ added in v0.3.0
func (c *Client) SearchGuildMember(guildID discord.Snowflake, query string, limit int) ([]discord.Member, error)
SearchGuildMember returns a list of member structures (discord.Member) matching the given query in the given guild ID
func (*Client) StartThreadFromMessage ¶ added in v0.4.0
func (c *Client) StartThreadFromMessage(channelID, messageID discord.Snowflake, thread discord.StartThreadFromMessage) (*discord.Channel, error)
StartThreadFromMessage creates a new thread from the given message ID and returns a channel structure (discord.Channel)
func (*Client) StartThreadInForumChannel ¶ added in v0.4.0
func (c *Client) StartThreadInForumChannel(channelID discord.Snowflake, thread discord.StartThreadInForumChannel) (*discord.Channel, error)
StartThreadInForumChannel creates a new thread in the given channel ID and returns a channel structure (discord.Channel) with a nested message structure (discord.Message)
func (*Client) StartThreadWithoutMessage ¶ added in v0.4.0
func (c *Client) StartThreadWithoutMessage(channelID discord.Snowflake, thread discord.StartThreadWithoutMessage) (*discord.Channel, error)
StartThreadWithoutMessage creates a new thread and returns a channel structure (discord.Channel)
func (*Client) SyncGuildTemplate ¶ added in v0.4.0
func (c *Client) SyncGuildTemplate(guildID discord.Snowflake, templateCode string) (*discord.GuildTemplate, error)
SyncGuildTemplate syncs an existing guild template (discord.GuildTemplate) for the given guild ID and template code and returns its structure
func (*Client) TriggerTyping ¶ added in v0.4.0
TriggerTyping triggers the "<User> is typing..." indicator for the given channel ID
func (*Client) UnpinMessage ¶ added in v0.4.0
UnpinMessage unpins the given message ID in the given channel ID
func (*Client) UpdateApplicationRoleConnectionMetadataRecords ¶ added in v0.4.0
func (c *Client) UpdateApplicationRoleConnectionMetadataRecords(records []discord.ApplicationRoleConnectionMetadata) ([]discord.ApplicationRoleConnectionMetadata, error)
UpdateApplicationRoleConnectionMetadataRecords returns a list of application role connection metadata structures (discord.ApplicationRoleConnectionMetadata) for the given application ID
type DefaultInterceptor ¶ added in v0.2.0
type DefaultInterceptor struct {
Interceptor
}
DefaultInterceptor is a default interceptor so that you do not have to add both methods in your custom interceptor
func (*DefaultInterceptor) ModifyRequest ¶ added in v0.2.0
func (i *DefaultInterceptor) ModifyRequest(_ *http.Request)
ModifyRequest is the default request modifying method from the default interceptor, which does nothing
func (*DefaultInterceptor) ModifyResponse ¶ added in v0.2.0
func (i *DefaultInterceptor) ModifyResponse(_ *http.Response)
ModifyResponse is the default response modifying method from the default interceptor, which does nothing
type HttpClient ¶ added in v0.2.0
type HttpClient struct { *http.Client Interceptor Interceptor }
HttpClient is a http.Client extended with a custom interceptor
func (*HttpClient) SetInterceptor ¶ added in v0.2.0
func (c *HttpClient) SetInterceptor(interceptor Interceptor)
SetInterceptor sets the interceptor for the HTTP client
type Interceptor ¶ added in v0.2.0
Interceptor is an interface all custom interceptor should inherit
type QueryParameters ¶ added in v0.3.0
QueryParameters is a map of query parameters when sending requests
type RateLimiter ¶
type RateLimiter struct { sync.Mutex Buckets map[string]*Bucket GlobalResetAt time.Time MaxRetries int }
RateLimiter represents the rate limiter holding a map of buckets (rest.Bucket) and responsible to sleep when someone is doing too many requests
func NewRateLimiter ¶
func NewRateLimiter() *RateLimiter
NewRateLimiter returns a new rate limited (rest.RateLimiter)
func (*RateLimiter) GetBucket ¶
func (r *RateLimiter) GetBucket(key string) *Bucket
GetBucket returns a bucket (rest.Bucket) based on the given key (URL without query parameters)
func (*RateLimiter) LockBucket ¶
func (r *RateLimiter) LockBucket(key string) *Bucket
LockBucket locks a bucket (rest.Bucket) and waits if needed until it is no longer rate limited
func (*RateLimiter) UnlockBucket ¶
func (r *RateLimiter) UnlockBucket(bucket *Bucket, headers http.Header) error
UnlockBucket unlocks a bucket (rest.Bucket) and sets the new values about the rate limits
type RequestOption ¶ added in v0.4.0
RequestOption is a function that will get executed before the request and can edit it. Unlike the interceptor (Interceptor), it will get executed per-request and not on all requests made by the client
func WithHeader ¶ added in v0.4.0
func WithHeader(key, value string) RequestOption
WithHeader returns a request option (RequestOption) that will set a header
func WithReason ¶ added in v0.4.0
func WithReason(reason string) RequestOption
WithReason returns a request option (RequestOption) that will set the 'X-Audit-Log-Reason' header