rest

package
v0.0.0-...-f41d48a Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: BSD-3-Clause Imports: 27 Imported by: 138

Documentation

Index

Constants

View Source
const (
	GrantTypeAuthorizationCode GrantType = "authorization_code"
	GrantTypeRefreshToken      GrantType = "refresh_token"

	TokenTypeHintAccessToken  TokenTypeHint = "access_token"
	TokenTypeHintRefreshToken TokenTypeHint = "refresh_token"
)

Variables

This section is empty.

Functions

func AddGuildMemberRole

func AddGuildMemberRole(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId, roleId uint64) error

func AddPinnedChannelMessage

func AddPinnedChannelMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64) error

func AddThreadMember

func AddThreadMember(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, userId uint64) (err error)

func BeginGuildPrune

func BeginGuildPrune(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, days int, computePruneCount bool) error

computePruneCount = whether 'pruned' is returned, discouraged for large guilds

func BulkDeleteMessages

func BulkDeleteMessages(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, messages []uint64) error

func ConsumeEntitlement

func ConsumeEntitlement(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, entitlementId uint64) error

func CreateChannelInvite

func CreateChannelInvite(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data CreateInviteData) (invite.Invite, error)

func CreateDM

func CreateDM(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, recipientId uint64) (channel.Channel, error)

func CreateFollowupMessage

func CreateFollowupMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64, data WebhookBody) (msg message.Message, err error)

func CreateGlobalCommand

func CreateGlobalCommand(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64, data CreateCommandData) (command interaction.ApplicationCommand, err error)

func CreateGuild

func CreateGuild(ctx context.Context, token string, data CreateGuildData) (guild.Guild, error)

only available to bots in < 10 guilds

func CreateGuildBan

func CreateGuildBan(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId uint64, data CreateGuildBanData) error

func CreateGuildChannel

func CreateGuildChannel(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data CreateChannelData) (channel.Channel, error)

func CreateGuildCommand

func CreateGuildCommand(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId uint64, data CreateCommandData) (command interaction.ApplicationCommand, err error)

func CreateGuildEmoji

func CreateGuildEmoji(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data CreateEmojiData) (emoji.Emoji, error)

func CreateGuildIntegration

func CreateGuildIntegration(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data CreateIntegrationData) error

func CreateGuildRole

func CreateGuildRole(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data GuildRoleData) (guild.Role, error)

func CreateMessage

func CreateMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data CreateMessageData) (message.Message, error)

func CreateReaction

func CreateReaction(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64, emoji string) error

emoji is the raw unicode emoji

func CreateTestEntitlement

func CreateTestEntitlement(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64, data CreateTestEntitlementData) (entitlement.Entitlement, error)

func CreateWebhook

func CreateWebhook(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data WebhookData) (guild.Webhook, error)

func DeleteAllReactions

func DeleteAllReactions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64) error

func DeleteAllReactionsEmoji

func DeleteAllReactionsEmoji(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64, emoji string) error

func DeleteChannel

func DeleteChannel(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) (channel.Channel, error)

func DeleteChannelPermissions

func DeleteChannelPermissions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, overwriteId uint64) error

func DeleteFollowupMessages

func DeleteFollowupMessages(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, messageId uint64) (err error)

func DeleteGlobalCommand

func DeleteGlobalCommand(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, commandId uint64) (err error)

func DeleteGuild

func DeleteGuild(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) error

func DeleteGuildCommand

func DeleteGuildCommand(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId, commandId uint64) (err error)

func DeleteGuildEmoji

func DeleteGuildEmoji(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, emojiId uint64) error

func DeleteGuildIntegration

func DeleteGuildIntegration(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, integrationId uint64) error

func DeleteGuildRole

func DeleteGuildRole(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, roleId uint64) error

func DeleteInvite

func DeleteInvite(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, inviteCode string) (invite.Invite, error)

func DeleteMessage

func DeleteMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64) error

func DeleteOriginalInteractionResponse

func DeleteOriginalInteractionResponse(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64) (err error)

func DeleteOwnReaction

func DeleteOwnReaction(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64, emoji string) error

emoji is the raw unicode emoji

func DeletePinnedChannelMessage

func DeletePinnedChannelMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64) error

func DeleteTestEntitlement

func DeleteTestEntitlement(ctx context.Context, token string, rateLimtier *ratelimit.Ratelimiter, applicationId, entitlementId uint64) error

func DeleteUserReaction

func DeleteUserReaction(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId, userId uint64, emoji string) error

emoji is the raw unicode emoji

func DeleteWebhook

func DeleteWebhook(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64) error

func DeleteWebhookWithToken

func DeleteWebhookWithToken(ctx context.Context, webhookToken string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64) error

func EditChannelPermissions

func EditChannelPermissions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, updated channel.PermissionOverwrite) error

func EditCurrentApplication

func EditCurrentApplication(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, data EditCurrentApplicationData) (application.Application, error)

func EditFollowupMessage

func EditFollowupMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, messageId uint64, data WebhookBody) (msg message.Message, err error)

func EditMessage

func EditMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64, data EditMessageData) (message.Message, error)

func EditOriginalInteractionResponse

func EditOriginalInteractionResponse(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64, data WebhookEditBody) (msg message.Message, err error)

func EditWebhookMessage

func EditWebhookMessage(ctx context.Context, webhookToken string, rateLimiter *ratelimit.Ratelimiter, webhookId, messageId uint64, data WebhookEditBody) (msg message.Message, err error)

func ExecuteWebhook

func ExecuteWebhook(ctx context.Context, webhookToken string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64, wait bool, data WebhookBody) (*message.Message, error)

if wait=true, a message object will be returned

func GetChannel

func GetChannel(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) (channel.Channel, error)

func GetChannelInvites

func GetChannelInvites(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) ([]invite.InviteMetadata, error)

func GetChannelMessage

func GetChannelMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64) (message.Message, error)

func GetChannelMessages

func GetChannelMessages(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data GetChannelMessagesData) ([]message.Message, error)

func GetChannelWebhooks

func GetChannelWebhooks(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) ([]guild.Webhook, error)

func GetCurrentApplication

func GetCurrentApplication(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter) (application.Application, error)

func GetCurrentUser

func GetCurrentUser(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter) (user.User, error)

func GetCurrentUserGuilds

func GetCurrentUserGuilds(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, data CurrentUserGuildsData) ([]guild.Guild, error)

func GetFollowupMessage

func GetFollowupMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, messageId uint64) (msg message.Message, err error)

func GetGlobalCommands

func GetGlobalCommands(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64) (commands []interaction.ApplicationCommand, err error)

func GetGuild

func GetGuild(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) (guild.Guild, error)

func GetGuildAuditLog

func GetGuildAuditLog(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data GetGuildAuditLogData) (log auditlog.AuditLog, err error)

func GetGuildBan

func GetGuildBan(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId uint64) (guild.Ban, error)

func GetGuildBans

func GetGuildBans(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data GetGuildBansData) ([]guild.Ban, error)

func GetGuildChannels

func GetGuildChannels(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]channel.Channel, error)

func GetGuildCommands

func GetGuildCommands(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId uint64) (commands []interaction.ApplicationCommand, err error)

func GetGuildEmoji

func GetGuildEmoji(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, emojiId uint64) (emoji.Emoji, error)

func GetGuildIntegrations

func GetGuildIntegrations(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]integration.Integration, error)

func GetGuildInvites

func GetGuildInvites(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]invite.InviteMetadata, error)

func GetGuildMember

func GetGuildMember(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId uint64) (member.Member, error)

func GetGuildPreview

func GetGuildPreview(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) (guild.GuildPreview, error)

func GetGuildPruneCount

func GetGuildPruneCount(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, days int) (int, error)

func GetGuildRoles

func GetGuildRoles(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]guild.Role, error)

func GetGuildVanityURL

func GetGuildVanityURL(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) (invite invite.Invite, err error)

returns invite object with only "code" and "uses" fields

func GetGuildVoiceRegions

func GetGuildVoiceRegions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]guild.VoiceRegion, error)

func GetGuildWebhooks

func GetGuildWebhooks(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]guild.Webhook, error)

func GetGuildWidget

func GetGuildWidget(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) (widget guild.GuildWidget, err error)

func GetInvite

func GetInvite(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, inviteCode string, withCounts bool) (invite.Invite, error)

func GetOriginalInteractionResponse

func GetOriginalInteractionResponse(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64) (msg message.Message, err error)

func GetPinnedMessages

func GetPinnedMessages(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) ([]message.Message, error)

func GetReactions

func GetReactions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64, emoji string, data GetReactionsData) ([]user.User, error)

func GetThreadMember

func GetThreadMember(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, userId uint64) (member channel.ThreadMember, err error)

func GetUser

func GetUser(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, userId uint64) (user.User, error)

func GetUserConnections

func GetUserConnections(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter) ([]integration.Connection, error)

func GetWebhook

func GetWebhook(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64) (guild.Webhook, error)

func GetWebhookWithToken

func GetWebhookWithToken(ctx context.Context, webhookToken string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64) (guild.Webhook, error)

does not return a User object

func JoinThread

func JoinThread(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) (err error)

func LeaveGuild

func LeaveGuild(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) error

func LeaveThread

func LeaveThread(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) (err error)

func ListEntitlements

func ListEntitlements(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64, options EntitlementQueryOptions) ([]entitlement.Entitlement, error)

func ListGuildEmojis

func ListGuildEmojis(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) ([]emoji.Emoji, error)

func ListGuildMembers

func ListGuildMembers(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data ListGuildMembersData) ([]member.Member, error)

func ListThreadMembers

func ListThreadMembers(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) (members []channel.ThreadMember, err error)

func ListVoiceRegions

func ListVoiceRegions(ctx context.Context, token string) ([]guild.VoiceRegion, error)

func ModifyChannel

func ModifyChannel(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data ModifyChannelData) (channel.Channel, error)

func ModifyCurrentUser

func ModifyCurrentUser(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, data ModifyUserData) (user.User, error)

func ModifyCurrentUserNick

func ModifyCurrentUserNick(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, nick string) error

func ModifyGlobalCommand

func ModifyGlobalCommand(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, commandId uint64, data CreateCommandData) (command interaction.ApplicationCommand, err error)

func ModifyGlobalCommands

func ModifyGlobalCommands(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId uint64, data []CreateCommandData) (commands []interaction.ApplicationCommand, err error)

func ModifyGuild

func ModifyGuild(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data ModifyGuildData) (guild.Guild, error)

func ModifyGuildChannelPositions

func ModifyGuildChannelPositions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, positions []Position) error

func ModifyGuildCommand

func ModifyGuildCommand(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId, commandId uint64, data CreateCommandData) (command interaction.ApplicationCommand, err error)

func ModifyGuildCommands

func ModifyGuildCommands(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId uint64, data []CreateCommandData) (commands []interaction.ApplicationCommand, err error)

func ModifyGuildEmbed

func ModifyGuildEmbed(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data guild.GuildEmbed) (widget guild.GuildEmbed, err error)

func ModifyGuildEmoji

func ModifyGuildEmoji(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, emojiId uint64, data CreateEmojiData) (emoji.Emoji, error)

updating Image is not permitted

func ModifyGuildIntegration

func ModifyGuildIntegration(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, integrationId uint64, data ModifyIntegrationData) error

func ModifyGuildMember

func ModifyGuildMember(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId uint64, data ModifyGuildMemberData) error

func ModifyGuildRole

func ModifyGuildRole(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, roleId uint64, data GuildRoleData) (guild.Role, error)

func ModifyGuildRolePositions

func ModifyGuildRolePositions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, positions []Position) ([]guild.Role, error)

func ModifyWebhook

func ModifyWebhook(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64, data ModifyWebhookData) (guild.Webhook, error)

func ModifyWebhookWithToken

func ModifyWebhookWithToken(ctx context.Context, webhookToken string, rateLimiter *ratelimit.Ratelimiter, webhookId uint64, data WebhookData) error

func RemoveGuildBan

func RemoveGuildBan(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId uint64) error

func RemoveGuildMember

func RemoveGuildMember(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId uint64) error

func RemoveGuildMemberRole

func RemoveGuildMemberRole(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, userId, roleId uint64) error

func RemoveThreadMember

func RemoveThreadMember(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, userId uint64) (err error)

func RevokeToken

func RevokeToken(ctx context.Context, rateLimiter *ratelimit.Ratelimiter, clientId uint64, clientSecret, token string, tokenTypeHint *TokenTypeHint) error

func SearchGuildMembers

func SearchGuildMembers(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64, data SearchGuildMembersData) (members []member.Member, err error)

func StartThreadWithMessage

func StartThreadWithMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId, messageId uint64, data StartThreadWithMessageData) (ch channel.Channel, err error)

func StartThreadWithoutMessage

func StartThreadWithoutMessage(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data StartThreadWithoutMessageData) (ch channel.Channel, err error)

func SyncGuildIntegration

func SyncGuildIntegration(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId, integrationId uint64) error

func TriggerTypingIndicator

func TriggerTypingIndicator(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64) error

Types

type CommandWithPermissionsData

type CommandWithPermissionsData struct {
	Id            uint64                                      `json:"id,string,omitempty"`
	ApplicationId uint64                                      `json:"application_id,string,omitempty"`
	GuildId       uint64                                      `json:"guild_id,string,omitempty"`
	Permissions   []interaction.ApplicationCommandPermissions `json:"permissions"`
}

func EditBulkCommandPermissions

func EditBulkCommandPermissions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId uint64, data []CommandWithPermissionsData) (commands []CommandWithPermissionsData, err error)

func EditCommandPermissions

func EditCommandPermissions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId, commandId uint64, data CommandWithPermissionsData) (command CommandWithPermissionsData, err error)

func GetBulkCommandPermissions

func GetBulkCommandPermissions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId uint64) (commands []CommandWithPermissionsData, err error)

func GetCommandPermissions

func GetCommandPermissions(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, applicationId, guildId, commandId uint64) (command CommandWithPermissionsData, err error)

type CreateChannelData

type CreateChannelData struct {
	Name                 string                        `json:"name"`
	Type                 channel.ChannelType           `json:"type"`
	Topic                string                        `json:"topic,omitempty"`
	Bitrate              int                           `json:"bitrate,omitempty"`
	UserLimit            int                           `json:"user_limit,omitempty"`
	RateLimitPerUser     int                           `json:"rate_limit_per_user"`
	Position             int                           `json:"position,omitempty"`
	PermissionOverwrites []channel.PermissionOverwrite `json:"permission_overwrites"`
	ParentId             uint64                        `json:"parent_id,string,omitempty"`
	Nsfw                 bool                          `json:"nsfw,omitempty"`
}

type CreateCommandData

type CreateCommandData struct {
	Id          uint64                                 `json:"id,omitempty"` // Optional: Use to rename without changing ID
	Name        string                                 `json:"name"`
	Description string                                 `json:"description"`
	Options     []interaction.ApplicationCommandOption `json:"options"`
	Type        interaction.ApplicationCommandType     `json:"type"`
}

type CreateEmojiData

type CreateEmojiData struct {
	Name  string
	Image Image
	Roles []uint64 // roles for which this emoji will be whitelisted
}

type CreateGuildBanData

type CreateGuildBanData struct {
	DeleteMessageDays int    `json:"delete_message_days,omitempty"` // 1 - 7
	Reason            string `json:"-"`
}

type CreateGuildData

type CreateGuildData struct {
	Name                        string                                `json:"name"`
	Region                      string                                `json:"region"` // voice region ID TODO: Helper function
	Icon                        string                                `json:"icon"`
	VerificationLevel           guild.VerificationLevel               `json:"verification_level"`
	DefaultMessageNotifications guild.DefaultMessageNotificationLevel `json:"default_message_notifications"`
	ExplicitContentFilter       guild.ExplicitContentFilterLevel      `json:"explicit_content_filter"`
	Roles                       []*guild.Role                         `json:"roles"`    // only @everyone
	Channels                    []*channel.Channel                    `json:"channels"` // channels cannot have a ParentId
	AfkChannelId                uint64                                `json:"afk_channel_id,string"`
	AfkTimeout                  int                                   `json:"afk_timeout"`
	SystemChannelId             uint64                                `json:"system_channel_id"`
}

type CreateIntegrationData

type CreateIntegrationData struct {
	Type string
	Id   uint64 `json:"id,string"`
}

type CreateInviteData

type CreateInviteData struct {
	MaxAge         int    `json:"max_age"`  // seconds, 0 = never
	MaxUses        int    `json:"max_uses"` // 0 = unlimited
	Temporary      bool   `json:"temporary"`
	Unique         bool   `json:"unique"`
	TargetUser     uint64 `json:"target_user,string,omitempty"`
	TargetUserType int    `json:"target_user_type,omitempty"`
}

type CreateMessageData

type CreateMessageData struct {
	Content          string                    `json:"content"`
	Nonce            string                    `json:"nonce,omitempty"`
	Tts              bool                      `json:"tts,omitempty"`
	Embeds           []*embed.Embed            `json:"embeds,omitempty"`
	Flags            uint                      `json:"flags,omitempty"`
	AllowedMentions  message.AllowedMention    `json:"allowed_mentions"`
	MessageReference *message.MessageReference `json:"message_reference,omitempty"`
	Components       []component.Component     `json:"components,omitempty"`
	StickerIds       []uint64                  `json:"sticker_ids,omitempty"`
	Attachments      []request.Attachment      `json:"attachments,omitempty"`
}

func (CreateMessageData) GetAttachments

func (d CreateMessageData) GetAttachments() []request.Attachment

type CreateTestEntitlementData

type CreateTestEntitlementData struct {
	SkuId     uint64               `json:"sku_id,string"`
	OwnerId   uint64               `json:"owner_id,string"`
	OwnerType EntitlementOwnerType `json:"owner_type"`
}

type CurrentUserGuildsData

type CurrentUserGuildsData struct {
	Before uint64
	After  uint64
	Limit  int
}

func (*CurrentUserGuildsData) Query

func (d *CurrentUserGuildsData) Query() string

type EditCurrentApplicationData

type EditCurrentApplicationData struct {
	CustomInstallUrl               *string                    `json:"custom_install_url,omitempty"`
	Description                    *string                    `json:"description,omitempty"`
	RoleConnectionsVerificationUrl *string                    `json:"role_connections_verification_url,omitempty"`
	InstallParams                  *application.InstallParams `json:"install_params,omitempty"`
	Flags                          *application.Flag          `json:"flags,omitempty"`
	// TODO: icon
	// TODO: cover_image
	InteractionsEndpointUrl *string  `json:"interactions_endpoint_url,omitempty"`
	Tags                    []string `json:"tags,omitempty"`
}

type EditMessageData

type EditMessageData struct {
	Content    string                `json:"content"`
	Embeds     []*embed.Embed        `json:"embeds"`
	Flags      uint                  `json:"flags"` // https://discord.com/developers/docs/resources/channel#message-object-message-flags TODO: Helper function
	Components []component.Component `json:"components"`
}

type EntitlementOwnerType

type EntitlementOwnerType uint8
const (
	EntitlementOwnerTypeGuild EntitlementOwnerType = iota + 1
	EntitlementOwnerTypeUser
)

type EntitlementQueryOptions

type EntitlementQueryOptions struct {
	UserId        *uint64
	SkuIds        []uint64
	Before        *uint64
	After         *uint64
	Limit         *int
	GuildId       *uint64
	ExcludedEnded *bool
}

func (*EntitlementQueryOptions) Query

func (o *EntitlementQueryOptions) Query() string

type GetChannelMessagesData

type GetChannelMessagesData struct {
	Around uint64 // get messages around this message ID
	Before uint64 // get messages before this message ID
	After  uint64 // get messages after this message ID
	Limit  int    // 1 - 100
}

The before, after, and around keys are mutually exclusive, only one may be passed at a time.

func (*GetChannelMessagesData) Query

func (o *GetChannelMessagesData) Query() string

type GetGuildAuditLogData

type GetGuildAuditLogData struct {
	UserId     uint64
	ActionType auditlog.AuditLogEvent
	Before     uint64 // audit log entry ID
	Limit      int
}

func (*GetGuildAuditLogData) Query

func (d *GetGuildAuditLogData) Query() string

type GetGuildBansData

type GetGuildBansData struct {
	Limit  int // 1 - 1000
	Before uint64
	After  uint64
}

func (*GetGuildBansData) Query

func (d *GetGuildBansData) Query() string

type GetReactionsData

type GetReactionsData struct {
	Before uint64 // get users before this user ID
	After  uint64 // get users after this user ID
	Limit  int    // 1 - 100
}

func (*GetReactionsData) Query

func (o *GetReactionsData) Query() string

type GrantType

type GrantType string

type GuildRoleData

type GuildRoleData struct {
	Name        string  `json:"name,omitempty"`
	Permissions *uint64 `json:"permissions,omitempty,string"`
	Color       *int    `json:"color,omitempty"`
	Hoist       *bool   `json:"hoist,omitempty"`
	Mentionable *bool   `json:"mentionable,omitempty"`
}

type Image

type Image struct {
	ContentType request.ContentType
	ImageReader io.Reader
}

func (*Image) Encode

func (i *Image) Encode() (string, error)

func (Image) MarshalJSON

func (i Image) MarshalJSON() ([]byte, error)

type ListGuildMembersData

type ListGuildMembersData struct {
	Limit int    // 1 - 1000
	After uint64 // Highest user ID in the previous page
}

all parameters are optional

func (*ListGuildMembersData) Query

func (d *ListGuildMembersData) Query() string

type ListThreadsData

type ListThreadsData struct {
	Before time.Time
	Limit  int
}

func (*ListThreadsData) Query

func (d *ListThreadsData) Query() string

type ModifyChannelData

type ModifyChannelData struct {
	Name                 string                        `json:"name,omitempty"`
	Position             int                           `json:"position,omitempty"`
	Topic                string                        `json:"topic,omitempty"`
	Nsfw                 bool                          `json:"nsfw,omitempty"`
	RateLimitPerUser     int                           `json:"rate_limit_per_user,omitempty"`
	Bitrate              int                           `json:"bitrate,omitempty"`
	UserLimit            int                           `json:"user_limit,omitempty"`
	PermissionOverwrites []channel.PermissionOverwrite `json:"permission_overwrites,omitempty"`
	ParentId             uint64                        `json:"parent_id,string,omitempty"`
	*ThreadMetadataModifyData
}

type ModifyGuildData

type ModifyGuildData struct {
	Name                        string                                `json:"name"`
	Region                      string                                `json:"region"` // voice region ID TODO: Helper function
	VerificationLevel           guild.VerificationLevel               `json:"verification_level"`
	DefaultMessageNotifications guild.DefaultMessageNotificationLevel `json:"default_message_notifications"`
	ExplicitContentFilter       guild.ExplicitContentFilterLevel      `json:"explicit_content_filter"`
	AfkChannelId                uint64                                `json:"afk_channel_id,string"`
	AfkTimeout                  int                                   `json:"afk_timeout"`
	Icon                        string                                `json:"icon"`
	OwnerId                     uint64                                `json:"owner_id"`
	Splash                      string                                `json:"splash"`
	Banner                      string                                `json:"banner"`
	SystemChannelId             uint64                                `json:"system_channel_id"`
	RulesChannelId              uint64                                `json:"rules_channel_id"`
	PublicUpdatesChannelId      uint64                                `json:"public_updates_channel_id"`
	PreferredLocale             string                                `json:"preferred_locale"`
}

type ModifyGuildMemberData

type ModifyGuildMemberData struct {
	Nick      string                   `json:"nick,omitempty"`
	Roles     *utils.Uint64StringSlice `json:"roles,omitempty"`
	Mute      *bool                    `json:"mute,omitempty"`
	Deaf      *bool                    `json:"deaf,omitempty"`
	ChannelId uint64                   `json:"channel_id,string,omitempty"` // id of channel to move user to (if they are connected to voice)
}

type ModifyIntegrationData

type ModifyIntegrationData struct {
	ExpireBehaviour   integration.IntegrationExpireBehaviour `json:"expire_behavior"`
	ExpireGracePeriod int                                    `json:"expire_grace_period"`
	EnableEmoticons   bool                                   `json:"enable_emoticons"`
}

type ModifyUserData

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

type ModifyWebhookData

type ModifyWebhookData struct {
	Name      string `json:"name,omitempty"`
	Avatar    string `json:"avatar,omitempty"`
	ChannelId uint64 `json:"channel_id,string,omitempty"`
}

type Position

type Position struct {
	ChannelId uint64 `json:"id,string"`
	Position  int    `json:"position"`
}

type SearchGuildMembersData

type SearchGuildMembersData struct {
	Query string // Username / nickname to match against
	Limit int    // 1 - 1000, optional (defaults to 1)
}

func (*SearchGuildMembersData) Encode

func (d *SearchGuildMembersData) Encode() string

type StartThreadWithMessageData

type StartThreadWithMessageData struct {
	Name                string `json:"name"`
	AutoArchiveDuration uint16 `json:"auto_archive_duration"`
}

type StartThreadWithoutMessageData

type StartThreadWithoutMessageData struct {
	Name                string              `json:"name"`
	AutoArchiveDuration uint16              `json:"auto_archive_duration"`
	Type                channel.ChannelType `json:"type"`
	Invitable           bool                `json:"invitable"`
}

type ThreadMetadataModifyData

type ThreadMetadataModifyData struct {
	Archived            *bool   `json:"archived,omitempty"`
	AutoArchiveDuration *uint16 `json:"auto_archive_duration,omitempty"`
	Locked              *bool   `json:"locked,omitempty"`
	Invitable           *bool   `json:"invitable,omitempty"`
}

type ThreadsResponse

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

func ListActiveThreads

func ListActiveThreads(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, guildId uint64) (threads ThreadsResponse, err error)

func ListJoinedPrivateArchivedThreads

func ListJoinedPrivateArchivedThreads(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data ListThreadsData) (threads ThreadsResponse, err error)

func ListPrivateArchivedThreads

func ListPrivateArchivedThreads(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data ListThreadsData) (threads ThreadsResponse, err error)

func ListPublicArchivedThreads

func ListPublicArchivedThreads(ctx context.Context, token string, rateLimiter *ratelimit.Ratelimiter, channelId uint64, data ListThreadsData) (threads ThreadsResponse, err error)

type TokenExchangeBody

type TokenExchangeBody struct {
	GrantType    GrantType `qs:"grant_type"`
	RefreshToken string    `qs:"refresh_token,omitempty"`
	Code         string    `qs:"code,omitempty"`
	RedirectUri  string    `qs:"redirect_uri,omitempty"`
}

type TokenExchangeResponse

type TokenExchangeResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
}

func ExchangeCode

func ExchangeCode(ctx context.Context, rateLimiter *ratelimit.Ratelimiter, clientId uint64, clientSecret, redirectUri, code string) (TokenExchangeResponse, error)

func RefreshToken

func RefreshToken(ctx context.Context, rateLimiter *ratelimit.Ratelimiter, clientId uint64, clientSecret, refreshToken string) (TokenExchangeResponse, error)

type TokenRevocationBody

type TokenRevocationBody struct {
	Token         string         `qs:"token"`
	TokenTypeHint *TokenTypeHint `qs:"token_type_hint,omitempty"`
}

type TokenTypeHint

type TokenTypeHint string

type WebhookBody

type WebhookBody struct {
	Content         string                 `json:"content,omitempty"`
	Username        string                 `json:"username,omitempty"`
	AvatarUrl       string                 `json:"avatar_url,omitempty"`
	Tts             bool                   `json:"tts"`
	Flags           uint                   `json:"flags,omitempty"`
	Embeds          []*embed.Embed         `json:"embeds,omitempty"`
	AllowedMentions message.AllowedMention `json:"allowed_mentions,omitempty"`
	Components      []component.Component  `json:"components,omitempty"`
	Attachments     []request.Attachment   `json:"attachments,omitempty"`
	ThreadName      string                 `json:"thread_name,omitempty"`
}

func (WebhookBody) GetAttachments

func (d WebhookBody) GetAttachments() []request.Attachment

type WebhookData

type WebhookData struct {
	Username string `json:"name,omitempty"`
	Avatar   string `json:"avatar,omitempty"`
}

type WebhookEditBody

type WebhookEditBody struct {
	Content         string                 `json:"content"`
	Embeds          []*embed.Embed         `json:"embeds"`
	AllowedMentions message.AllowedMention `json:"allowed_mentions"`
	Components      []component.Component  `json:"components"`
	Attachments     []request.Attachment   `json:"attachments"`
}

func (WebhookEditBody) GetAttachments

func (d WebhookEditBody) GetAttachments() []request.Attachment

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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