rest

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 28 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Discord API Base URL
	BaseURL = "https://discord.com/api/v9"

	XAuditLogReasonHeader = "X-Audit-Log-Reason"

	JsonContentType = "application/json"

	// Channels
	ChannelBaseFmt                   = BaseURL + "/channels/%d"
	ChannelMessagesFmt               = ChannelBaseFmt + "/messages"
	ChannelMessageFmt                = ChannelMessagesFmt + "/%d"
	CrosspostMessageFmt              = ChannelMessageFmt + "/crosspost"
	ReactionsBaseFmt                 = ChannelMessageFmt + "/reactions"
	ReactionsFmt                     = ReactionsBaseFmt + "/%s"
	ReactionFmt                      = ReactionsFmt + "/%s"
	ReactionUserFmt                  = ReactionsFmt + "/%d"
	BulkDeleteMessagesFmt            = ChannelMessagesFmt + "/bulk-delete"
	ChannelPermissionsFmt            = ChannelBaseFmt + "/permissions/%d"
	ChannelInvitesFmt                = ChannelBaseFmt + "/invites"
	ChannelPinsFmt                   = ChannelBaseFmt + "/pins"
	ChannelPinnedFmt                 = ChannelPinsFmt + "/%d"
	ChannelFollowersFmt              = ChannelBaseFmt + "/followers"
	ChannelTypingFmt                 = ChannelBaseFmt + "/typing"
	ChannelMessageThreadsFmt         = ChannelMessageFmt + "/threads"
	ChannelThreadsFmt                = ChannelBaseFmt + "/threads"
	ChannelThreadMembersFmt          = ChannelBaseFmt + "/thread-members"
	ChannelThreadMembersUserFmt      = ChannelThreadMembersFmt + "/%d"
	ChannelThreadMembersMeFmt        = ChannelThreadMembersFmt + "/@me"
	ChannelThreadsActiveFmt          = ChannelThreadsFmt + "/active"
	ChannelThreadsArchivedFmt        = ChannelThreadsFmt + "/archived"
	ChannelThreadsArchivedPublicFmt  = ChannelThreadsArchivedFmt + "/public"
	ChannelThreadsArchivedPrivateFmt = ChannelThreadsArchivedFmt + "/private"
	ChannelUsersMeThreadsArchivedFmt = ChannelBaseFmt + "/users/@me/threads/archived/private"

	// Commands
	ApplicationFmt              = BaseURL + "/applications"
	GlobalApplicationsFmt       = ApplicationFmt + "/%d/commands"
	GlobalApplicationsUpdateFmt = GlobalApplicationsFmt + "/%d"
	GuildApplicationsFmt        = ApplicationFmt + "/%d/guilds/%d/commands"
	GuildApplicationsUpdateFmt  = GuildApplicationsFmt + "/%d"

	// Guilds
	GuildBaseFmt                      = BaseURL + "/guilds/%d"
	GuildCreateFmt                    = BaseURL + "/guilds"
	GuildChannelsFmt                  = GuildBaseFmt + "/channels"
	GuildPreviewFmt                   = GuildBaseFmt + "/preview"
	GuildAuditLogsFmt                 = GuildBaseFmt + "/audit-logs"
	GuildMembersFmt                   = GuildBaseFmt + "/members"
	GuildMemberFmt                    = GuildMembersFmt + "/%d"
	GuildMemberEditCurrentUserNickFmt = GuildMembersFmt + "/@me/nick"
	GuildBansFmt                      = GuildBaseFmt + "/bans"
	GuildBanUserFmt                   = GuildBansFmt + "/%d"
	GuildPruneFmt                     = GuildBaseFmt + "/prune"
	GuildVoiceRegionsFmt              = GuildBaseFmt + "/regions"
	GuildInvitesFmt                   = GuildBaseFmt + "/invites"
	GuildWidgetFmt                    = GuildBaseFmt + "/widget"
	GuildWidgetJSONFmt                = GuildWidgetFmt + ".json"
	GuildVanityURLFmt                 = GuildBaseFmt + "/vanity-url"
	GuildWidgetImageFmt               = GuildWidgetFmt + ".png"
	GuildMembershipScreeningFmt       = GuildBaseFmt + "/member-verification"
	GuildThreadsFmt                   = GuildBaseFmt + "/threads/active"

	// Scheduled Events
	GuildScheduledEventBaseFmt  = GuildBaseFmt + "/scheduled-events"
	GuildScheduledEventFmt      = GuildScheduledEventBaseFmt + "/%d"
	GuildScheduledEventUsersFmt = GuildScheduledEventFmt + "/users"

	// Roles
	GuildMemberRoleFmt = GuildBaseFmt + "/members/%d/roles/%d"
	GuildRolesFmt      = GuildBaseFmt + "/roles"
	GuildRoleFmt       = GuildRolesFmt + "/%d"

	// Integrations
	IntegrationsBaseFmt = GuildBaseFmt + "/integrations"
	IntegrationBaseFmt  = IntegrationsBaseFmt + "/%d"
	IntegrationSync     = IntegrationBaseFmt + "/sync"

	// Invites
	InviteFmt = BaseURL + "/invites/%s"

	// Templates
	TemplateFmt       = BaseURL + "/guilds/templates/%s"
	GuildTemplateFmt  = BaseURL + "/guilds/%d/templates"
	GuildTemplatesFmt = GuildTemplateFmt + "/%s"

	// Stickers
	StickerFmt       = BaseURL + "/stickers/%d"
	NitroStickerFmt  = BaseURL + "/sticker-packs"
	GuildStickersFmt = GuildBaseFmt + "/stickers"
	GuildStickerFmt  = GuildStickersFmt + "/%d"

	// Users
	UsersFmt           = BaseURL + "/users"
	UsersMeFmt         = UsersFmt + "/@me"
	UsersMeGuilds      = UsersMeFmt + "/guilds"
	UsersMeGuild       = UsersMeGuilds + "/%d"
	UsersMeGuildMember = UsersMeGuild + "/member"
	UsersMeChannels    = UsersMeFmt + "/channels"
	UserFmt            = UsersFmt + "/%d"
	UserConnections    = UsersMeFmt + "/connections"

	// Voice
	VoiceRegions = BaseURL + "/voice/regions"

	// Webhooks
	ChannelWebhookFmt   = BaseURL + "/channels/%d/webhooks"
	GuildWebhookFmt     = BaseURL + "/guilds/%d/webhooks"
	WebhookFmt          = BaseURL + "/webhooks/%d"
	WebhookWithTokenFmt = WebhookFmt + "/%s"
	WebhookMessageFmt   = WebhookWithTokenFmt + "/messages/%d"

	// Interactions
	CreateInteractionResponseFmt   = BaseURL + "/interactions/%d/%s/callback"
	OriginalInteractionResponseFmt = WebhookWithTokenFmt + "/messages/@original"

	// Permissions
	GuildApplicationCommandsPermissionsFmt = GuildApplicationsFmt + "/permissions"
	GuildApplicationCommandPermissionsFmt  = GuildApplicationsFmt + "/%d/permissions"

	// Gateway
	GatewayFmt    = BaseURL + "/gateway"
	GatewayBotFmt = GatewayFmt + "/bot"
)

Variables

View Source
var ErrMaxRetriesExceeded = errors.New("max retries exceeded")

Functions

func NewRequest

func NewRequest() *request

Types

type AddGuildMemberParams

type AddGuildMemberParams struct {
	AccessToken string              `json:"access_token"`
	Nick        string              `json:"nick,omitempty"`
	Roles       []objects.Snowflake `json:"roles,omitempty"`
	Mute        bool                `json:"mute"`
	Deaf        bool                `json:"deaf"`
	Reason      string              `json:"-"`
}

type BaseStickerParams added in v0.1.0

type BaseStickerParams struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Tags        []string `json:"-"`
	RawTags     string   `json:"tags"`
	Reason      string   `json:"-"`
}

type BeginGuildPruneParams

type BeginGuildPruneParams struct {
	Days              int                 `json:"days,omitempty"`
	ComputePruneCount bool                `json:"compute_prune_count"`
	IncludeRoles      []objects.Snowflake `json:"include_roles,omitempty"`
	Reason            string              `json:"-"`
}

type Cache

type Cache interface {
	Get(key string) (*DiscordResponse, error)
	Put(key string, value *DiscordResponse) error
}

type CacheError

type CacheError struct {
	// contains filtered or unexported fields
}

func (*CacheError) Error

func (c *CacheError) Error() string

type CacheValue

type CacheValue struct {
	// contains filtered or unexported fields
}

type ChannelCreateParams

type ChannelCreateParams struct {
	Name                 string                         `json:"name"`
	Type                 objects.ChannelType            `json:"type,omitempty"`
	Topic                string                         `json:"topic,omitempty"`
	Bitrate              int                            `json:"bitrate,omitempty"`
	UserLimit            int                            `json:"user_limit,omitempty"`
	RateLimitPerUser     int                            `json:"rate_limit_per_user,omitempty"`
	Position             int                            `json:"position,omitempty"`
	PermissionOverwrites []*objects.PermissionOverwrite `json:"permission_overwrites,omitempty"`
	ParentID             objects.Snowflake              `json:"parent_id,omitempty"`
	NSFW                 bool                           `json:"nsfw,omitempty"`
	Reason               string                         `json:"-"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Client

func (*Client) AddGuildCommand

func (c *Client) AddGuildCommand(ctx context.Context, app, guild objects.SnowflakeObject, command *objects.ApplicationCommand) (*objects.ApplicationCommand, error)

func (*Client) AddGuildMember

func (c *Client) AddGuildMember(ctx context.Context, guild, user objects.SnowflakeObject, params *AddGuildMemberParams) (*objects.GuildMember, error)

func (*Client) AddGuildMemberRole

func (c *Client) AddGuildMemberRole(ctx context.Context, guild, user, role objects.SnowflakeObject, reason string) error

func (*Client) AddPinnedMessage

func (c *Client) AddPinnedMessage(ctx context.Context, channel, message objects.SnowflakeObject) error

func (*Client) AddThreadMember

func (c *Client) AddThreadMember(ctx context.Context, thread, user objects.SnowflakeObject) error

func (*Client) BatchEditApplicationCommandPermissions

func (c *Client) BatchEditApplicationCommandPermissions(ctx context.Context, app, guild objects.SnowflakeObject, permissions []*objects.GuildApplicationCommandPermissions) ([]*objects.GuildApplicationCommandPermissions, error)

func (*Client) BeginGuildPrune

func (c *Client) BeginGuildPrune(ctx context.Context, guild objects.SnowflakeObject, params *BeginGuildPruneParams) (int, error)

func (*Client) BulkDeleteMessages

func (c *Client) BulkDeleteMessages(ctx context.Context, channel objects.SnowflakeObject, params *DeleteMessagesParams) error

func (*Client) BulkOverwriteGlobalCommands

func (c *Client) BulkOverwriteGlobalCommands(ctx context.Context, app objects.SnowflakeObject, commands []*objects.ApplicationCommand) ([]*objects.ApplicationCommand, error)

func (*Client) BulkOverwriteGuildCommands

func (c *Client) BulkOverwriteGuildCommands(ctx context.Context, application, guild objects.SnowflakeObject, commands []*objects.ApplicationCommand) ([]*objects.ApplicationCommand, error)

func (*Client) CreateBan

func (c *Client) CreateBan(ctx context.Context, guild, user objects.SnowflakeObject, params *CreateGuildBanParams) error

func (*Client) CreateChannelInvite

func (c *Client) CreateChannelInvite(ctx context.Context, channel objects.SnowflakeObject, params *CreateInviteParams) (*objects.Invite, error)

func (*Client) CreateCommand

func (*Client) CreateDM

func (c *Client) CreateDM(ctx context.Context, params *CreateDMParams) (*objects.Channel, error)

func (*Client) CreateFollowupMessage

func (c *Client) CreateFollowupMessage(ctx context.Context, applicationID objects.SnowflakeObject, token string, params *CreateFollowupMessageParams) (*objects.Message, error)

func (*Client) CreateGroupDM

func (c *Client) CreateGroupDM(ctx context.Context, params *CreateGroupDMParams) (*objects.Channel, error)

func (*Client) CreateGuild

func (c *Client) CreateGuild(ctx context.Context, params *CreateGuildParams) (*objects.Guild, error)

func (*Client) CreateGuildChannel

func (c *Client) CreateGuildChannel(ctx context.Context, id objects.SnowflakeObject, params *ChannelCreateParams) (*objects.Channel, error)

func (*Client) CreateGuildFromTemplate

func (c *Client) CreateGuildFromTemplate(ctx context.Context, code string, reason string) (*objects.Guild, error)

func (*Client) CreateGuildRole

func (c *Client) CreateGuildRole(ctx context.Context, guild objects.SnowflakeObject, params *CreateGuildRoleParams) (*objects.Role, error)

func (*Client) CreateGuildScheduledEvent added in v0.1.0

func (c *Client) CreateGuildScheduledEvent(ctx context.Context, guildID objects.SnowflakeObject, params *CreateGuildScheduledEventParams) (*objects.GuildScheduledEvent, error)

func (*Client) CreateGuildSticker added in v0.1.0

func (c *Client) CreateGuildSticker(ctx context.Context, guildID objects.SnowflakeObject, params *CreateGuildStickerParams) (*objects.Sticker, error)

func (*Client) CreateGuildTemplate

func (c *Client) CreateGuildTemplate(ctx context.Context, guild objects.SnowflakeObject, params *CreateGuildTemplateParams) (*objects.Template, error)

func (*Client) CreateInteractionResponse

func (c *Client) CreateInteractionResponse(ctx context.Context, interactionID objects.SnowflakeObject, token string, response *objects.InteractionResponse) error

func (*Client) CreateMessage

func (c *Client) CreateMessage(ctx context.Context, channel objects.SnowflakeObject, params *CreateMessageParams) (*objects.Message, error)

func (*Client) CreateReaction

func (c *Client) CreateReaction(ctx context.Context, channel, message objects.SnowflakeObject, emoji interface{}) error

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(ctx context.Context, channel objects.SnowflakeObject, params *CreateWebhookParams) (*objects.Webhook, error)

func (*Client) CrossPostMessage

func (c *Client) CrossPostMessage(ctx context.Context, channel, message objects.SnowflakeObject) (*objects.Message, error)

func (*Client) DeleteAllReactions

func (c *Client) DeleteAllReactions(ctx context.Context, channel, message objects.SnowflakeObject) error

func (*Client) DeleteChannel

func (c *Client) DeleteChannel(ctx context.Context, id objects.SnowflakeObject, reason string) (*objects.Channel, error)

func (*Client) DeleteChannelPermission

func (c *Client) DeleteChannelPermission(ctx context.Context, channel, overwrite objects.SnowflakeObject, reason string) error

func (*Client) DeleteCommand

func (c *Client) DeleteCommand(ctx context.Context, app, commandID objects.SnowflakeObject) error

func (*Client) DeleteEmojiReactions

func (c *Client) DeleteEmojiReactions(ctx context.Context, channel, message objects.SnowflakeObject, emoji interface{}) error

func (*Client) DeleteFollowupMessage

func (c *Client) DeleteFollowupMessage(ctx context.Context, applicationID objects.SnowflakeObject, token string, messageID objects.SnowflakeObject) error

func (*Client) DeleteGuild

func (c *Client) DeleteGuild(ctx context.Context, id objects.SnowflakeObject) error

func (*Client) DeleteGuildCommand

func (c *Client) DeleteGuildCommand(ctx context.Context, app, guild, commandID objects.SnowflakeObject) error

func (*Client) DeleteGuildIntegration

func (c *Client) DeleteGuildIntegration(ctx context.Context, guild, integration objects.SnowflakeObject, reason string) error

func (*Client) DeleteGuildRole

func (c *Client) DeleteGuildRole(ctx context.Context, guild, role objects.SnowflakeObject, reason string) error

func (*Client) DeleteGuildScheduledEvent added in v0.1.0

func (c *Client) DeleteGuildScheduledEvent(ctx context.Context, guildID objects.SnowflakeObject, id objects.SnowflakeObject) error

func (*Client) DeleteGuildSticker added in v0.1.0

func (c *Client) DeleteGuildSticker(ctx context.Context, guildID, id objects.SnowflakeObject, reason ...string) error

func (*Client) DeleteGuildTemplate

func (c *Client) DeleteGuildTemplate(ctx context.Context, guild objects.SnowflakeObject, code, reason string) (*objects.Template, error)

func (*Client) DeleteInvite

func (c *Client) DeleteInvite(ctx context.Context, code, reason string) (*objects.Invite, error)

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(ctx context.Context, channel, message objects.SnowflakeObject) error

func (*Client) DeleteOriginalInteractionResponse

func (c *Client) DeleteOriginalInteractionResponse(ctx context.Context, applicationID objects.SnowflakeObject, token string) error

func (*Client) DeleteOwnReaction

func (c *Client) DeleteOwnReaction(ctx context.Context, channel, message objects.SnowflakeObject, emoji interface{}) error

func (*Client) DeletePinnedMessage

func (c *Client) DeletePinnedMessage(ctx context.Context, channel, message objects.SnowflakeObject) error

func (*Client) DeleteUserReaction

func (c *Client) DeleteUserReaction(ctx context.Context, channel, message, user objects.SnowflakeObject, emoji interface{}) error

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(ctx context.Context, id objects.SnowflakeObject) error

func (*Client) DeleteWebhookMessage

func (c *Client) DeleteWebhookMessage(ctx context.Context, messageID, webhookID objects.SnowflakeObject, token string) error

func (*Client) DeleteWebhookWithToken

func (c *Client) DeleteWebhookWithToken(ctx context.Context, id objects.SnowflakeObject, token string) error

func (*Client) EditApplicationCommandPermissions

func (c *Client) EditApplicationCommandPermissions(ctx context.Context, app, guild, cmd objects.SnowflakeObject, permissions []*objects.ApplicationCommandPermissions) (*objects.GuildApplicationCommandPermissions, error)

func (*Client) EditChannelPermissions

func (c *Client) EditChannelPermissions(ctx context.Context, channel, overwrite objects.SnowflakeObject, params *EditChannelParams) error

func (*Client) EditFollowupMessage

func (c *Client) EditFollowupMessage(ctx context.Context, applicationID objects.SnowflakeObject, token string, messageID objects.SnowflakeObject, params *EditWebhookMessageParams) (*objects.Message, error)

func (*Client) EditMessage

func (c *Client) EditMessage(ctx context.Context, channel, message objects.SnowflakeObject, params *EditMessageParams) (*objects.Message, error)

func (*Client) EditOriginalInteractionResponse

func (c *Client) EditOriginalInteractionResponse(ctx context.Context, applicationID objects.SnowflakeObject, token string, params *EditWebhookMessageParams) (*objects.Message, error)

func (*Client) EditWebhookMessage

func (c *Client) EditWebhookMessage(ctx context.Context, messageID, webhookID objects.SnowflakeObject, token string, params *EditWebhookMessageParams) (*objects.Message, error)

func (*Client) ExecuteWebhook

func (c *Client) ExecuteWebhook(ctx context.Context, id objects.SnowflakeObject, token string, params *ExecuteWebhookParams) (*objects.Message, error)

func (*Client) FollowNewsChannel

func (c *Client) FollowNewsChannel(ctx context.Context, channel objects.SnowflakeObject) (*objects.FollowedChannel, error)

func (*Client) Gateway added in v0.0.10

func (c *Client) Gateway(ctx context.Context) (*objects.Gateway, error)

func (*Client) GatewayBot added in v0.0.10

func (c *Client) GatewayBot(ctx context.Context) (*objects.Gateway, error)

func (*Client) GetApplicationCommandPermissions

func (c *Client) GetApplicationCommandPermissions(ctx context.Context, app, guild, cmd objects.SnowflakeObject) (*objects.GuildApplicationCommandPermissions, error)

func (*Client) GetAuditLogs

func (c *Client) GetAuditLogs(ctx context.Context, guild objects.SnowflakeObject, params *GetAuditLogParams) (*objects.AuditLog, error)

func (*Client) GetChannel

func (c *Client) GetChannel(ctx context.Context, id objects.SnowflakeObject) (*objects.Channel, error)

func (*Client) GetChannelInvites

func (c *Client) GetChannelInvites(ctx context.Context, channel objects.SnowflakeObject) ([]*objects.Invite, error)

func (*Client) GetChannelMessage

func (c *Client) GetChannelMessage(ctx context.Context, channel, message objects.SnowflakeObject) (*objects.Message, error)

func (*Client) GetChannelMessages

func (c *Client) GetChannelMessages(ctx context.Context, id objects.SnowflakeObject, params *GetChannelMessagesParams) ([]*objects.Message, error)

func (*Client) GetChannelWebhooks

func (c *Client) GetChannelWebhooks(ctx context.Context, channel objects.SnowflakeObject) ([]*objects.Webhook, error)

func (*Client) GetCommand

func (c *Client) GetCommand(ctx context.Context, app, commandID objects.SnowflakeObject) (*objects.ApplicationCommand, error)

func (*Client) GetCommands

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser(ctx context.Context) (*objects.User, error)

func (*Client) GetCurrentUserGuildMember added in v0.1.0

func (c *Client) GetCurrentUserGuildMember(ctx context.Context, guild objects.SnowflakeObject) (*objects.GuildMember, error)

func (*Client) GetCurrentUserGuilds

func (c *Client) GetCurrentUserGuilds(ctx context.Context, params *CurrentUserGuildsParams) ([]*objects.Guild, error)

func (*Client) GetFollowupMessage

func (c *Client) GetFollowupMessage(ctx context.Context, applicationID objects.SnowflakeObject, token string, messageID objects.SnowflakeObject) (*objects.Message, error)

func (*Client) GetGuild

func (c *Client) GetGuild(ctx context.Context, id objects.SnowflakeObject) (*objects.Guild, error)

func (*Client) GetGuildApplicationCommandPermissions

func (c *Client) GetGuildApplicationCommandPermissions(ctx context.Context, app, guild objects.SnowflakeObject) ([]*objects.GuildApplicationCommandPermissions, error)

func (*Client) GetGuildBan

func (c *Client) GetGuildBan(ctx context.Context, guild, user objects.SnowflakeObject) (*objects.Ban, error)

func (*Client) GetGuildBans

func (c *Client) GetGuildBans(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.Ban, error)

func (*Client) GetGuildChannels

func (c *Client) GetGuildChannels(ctx context.Context, id objects.SnowflakeObject) ([]*objects.Channel, error)

func (*Client) GetGuildCommand

func (c *Client) GetGuildCommand(ctx context.Context, app, guild, commandID objects.SnowflakeObject) (*objects.ApplicationCommand, error)

func (*Client) GetGuildCommands

func (c *Client) GetGuildCommands(ctx context.Context, app, guild objects.SnowflakeObject) ([]*objects.ApplicationCommand, error)

func (*Client) GetGuildIntegrations

func (c *Client) GetGuildIntegrations(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.Integration, error)

func (*Client) GetGuildInvites

func (c *Client) GetGuildInvites(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.Invite, error)

func (*Client) GetGuildMember

func (c *Client) GetGuildMember(ctx context.Context, guild, user objects.SnowflakeObject) (*objects.GuildMember, error)

func (*Client) GetGuildPreview

func (c *Client) GetGuildPreview(ctx context.Context, id objects.SnowflakeObject) (*objects.GuildPreview, error)

func (*Client) GetGuildPruneCount

func (c *Client) GetGuildPruneCount(ctx context.Context, guild objects.SnowflakeObject, params *GetGuildPruneCountParams) (int, error)

func (*Client) GetGuildRoles

func (c *Client) GetGuildRoles(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.Role, error)

func (*Client) GetGuildScheduledEvent added in v0.1.0

func (*Client) GetGuildScheduledEventUsers added in v0.1.0

func (*Client) GetGuildSticker added in v0.1.0

func (c *Client) GetGuildSticker(ctx context.Context, guildID objects.SnowflakeObject, stickerID objects.SnowflakeObject) (*objects.Sticker, error)

func (*Client) GetGuildTemplates

func (c *Client) GetGuildTemplates(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.Template, error)

func (*Client) GetGuildVanityURL

func (c *Client) GetGuildVanityURL(ctx context.Context, guild objects.SnowflakeObject) (*objects.Invite, error)

func (*Client) GetGuildVoiceRegions

func (c *Client) GetGuildVoiceRegions(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.VoiceRegion, error)

func (*Client) GetGuildWebhooks

func (c *Client) GetGuildWebhooks(ctx context.Context, guild objects.SnowflakeObject) ([]*objects.Webhook, error)

func (*Client) GetGuildWelcomeScreen

func (c *Client) GetGuildWelcomeScreen(ctx context.Context, guild objects.SnowflakeObject) (*objects.MembershipScreening, error)

func (*Client) GetGuildWidget

func (c *Client) GetGuildWidget(ctx context.Context, guild objects.SnowflakeObject) (*objects.GuildWidgetJSON, error)

func (*Client) GetGuildWidgetImage

func (c *Client) GetGuildWidgetImage(ctx context.Context, guild objects.SnowflakeObject, params *GuildWidgetImageParams) (image.Image, error)

func (*Client) GetGuildWidgetSettings

func (c *Client) GetGuildWidgetSettings(ctx context.Context, guild objects.SnowflakeObject) (*objects.GuildWidget, error)

func (*Client) GetInvite

func (c *Client) GetInvite(ctx context.Context, code string, params *GetInviteParams) (*objects.Invite, error)

func (*Client) GetOriginalInteractionResponse

func (c *Client) GetOriginalInteractionResponse(ctx context.Context, applicationID objects.SnowflakeObject, token string) (*objects.Message, error)

func (*Client) GetPinnedMessages

func (c *Client) GetPinnedMessages(ctx context.Context, channel objects.SnowflakeObject) ([]*objects.Message, error)

func (*Client) GetReactions

func (c *Client) GetReactions(ctx context.Context, channel, message objects.SnowflakeObject, emoji interface{}, params *GetReactionsParams) ([]*objects.User, error)

func (*Client) GetSticker added in v0.1.0

func (c *Client) GetSticker(ctx context.Context, id objects.SnowflakeObject) (*objects.Sticker, error)

func (*Client) GetTemplate

func (c *Client) GetTemplate(ctx context.Context, code string) (*objects.Template, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, user objects.SnowflakeObject) (*objects.User, error)

func (*Client) GetUserConnections

func (c *Client) GetUserConnections(ctx context.Context) ([]*objects.Connection, error)

func (*Client) GetVoiceRegions

func (c *Client) GetVoiceRegions(ctx context.Context) ([]*objects.VoiceRegion, error)

func (*Client) GetWebhook

func (c *Client) GetWebhook(ctx context.Context, id objects.SnowflakeObject) (*objects.Webhook, error)

func (*Client) GetWebhookWithToken

func (c *Client) GetWebhookWithToken(ctx context.Context, id objects.SnowflakeObject, token string) (*objects.Webhook, error)

func (*Client) JoinThread

func (c *Client) JoinThread(ctx context.Context, thread objects.SnowflakeObject) error

func (*Client) LeaveGuild

func (c *Client) LeaveGuild(ctx context.Context, guild objects.SnowflakeObject) error

func (*Client) LeaveThread

func (c *Client) LeaveThread(ctx context.Context, thread objects.SnowflakeObject) error

func (*Client) ListActiveThreads

func (c *Client) ListActiveThreads(ctx context.Context, id objects.SnowflakeObject) ([]*ListThreadsResponse, error)

func (*Client) ListGuildMembers

func (c *Client) ListGuildMembers(ctx context.Context, guild objects.SnowflakeObject, params *ListGuildMembersParams) ([]*objects.GuildMember, error)

func (*Client) ListGuildStickers added in v0.1.0

func (c *Client) ListGuildStickers(ctx context.Context, guildID objects.SnowflakeObject) ([]*objects.Sticker, error)

func (*Client) ListJoinedPrivateArchivedThreads

func (c *Client) ListJoinedPrivateArchivedThreads(ctx context.Context, channel objects.SnowflakeObject, params ...*ListThreadsParams) (*ListThreadsResponse, error)

func (*Client) ListNitroStickerPacks added in v0.1.0

func (c *Client) ListNitroStickerPacks(ctx context.Context) ([]*objects.StickerPack, error)

func (*Client) ListPrivateArchivedThreads

func (c *Client) ListPrivateArchivedThreads(ctx context.Context, channel objects.SnowflakeObject, params ...*ListThreadsParams) (*ListThreadsResponse, error)

func (*Client) ListPublicArchivedThreads

func (c *Client) ListPublicArchivedThreads(ctx context.Context, channel objects.SnowflakeObject, params ...*ListThreadsParams) (*ListThreadsResponse, error)

func (*Client) ListThreadMembers

func (c *Client) ListThreadMembers(ctx context.Context, thread objects.SnowflakeObject) ([]*objects.ThreadMember, error)

func (*Client) ModifyChannel

func (c *Client) ModifyChannel(ctx context.Context, id objects.SnowflakeObject, params *ModifyChannelParams) (*objects.Channel, error)

func (*Client) ModifyCurrentUser

func (c *Client) ModifyCurrentUser(ctx context.Context, params *ModifyCurrentUserParams) (*objects.User, error)

func (*Client) ModifyCurrentUserNick

func (*Client) ModifyGuild

func (c *Client) ModifyGuild(ctx context.Context, id objects.SnowflakeObject, params *ModifyGuildParams) (*objects.Guild, error)

func (*Client) ModifyGuildChannelPositions

func (c *Client) ModifyGuildChannelPositions(ctx context.Context, id objects.SnowflakeObject, params []*ModifyChannelPositionParams, reason string) error

func (*Client) ModifyGuildMember

func (c *Client) ModifyGuildMember(ctx context.Context, guild, member objects.SnowflakeObject, params *ModifyGuildMemberParams) (*objects.GuildMember, error)

func (*Client) ModifyGuildRole

func (c *Client) ModifyGuildRole(ctx context.Context, guild, role objects.SnowflakeObject, params *ModifyGuildRoleParams) (*objects.Role, error)

func (*Client) ModifyGuildRolePositions

func (c *Client) ModifyGuildRolePositions(ctx context.Context, guild objects.SnowflakeObject, params []*ModifyGuildRolePositionsParams) ([]*objects.Role, error)

func (*Client) ModifyGuildScheduledEvent added in v0.1.0

func (*Client) ModifyGuildSticker added in v0.1.0

func (c *Client) ModifyGuildSticker(ctx context.Context, guildID, id objects.SnowflakeObject, params *BaseStickerParams) (*objects.Sticker, error)

func (*Client) ModifyGuildTemplate

func (c *Client) ModifyGuildTemplate(ctx context.Context, guild objects.SnowflakeObject, code string, params *ModifyGuildTemplateParams) (*objects.Template, error)

func (*Client) ModifyGuildWidget

func (c *Client) ModifyGuildWidget(ctx context.Context, guild objects.SnowflakeObject, params *GuildWidgetParams) (*objects.GuildWidget, error)

func (*Client) ModifyWebhook

func (c *Client) ModifyWebhook(ctx context.Context, id objects.SnowflakeObject, params *ModifyWebhookParams) (*objects.Webhook, error)

func (*Client) ModifyWebhookWithToken

func (c *Client) ModifyWebhookWithToken(ctx context.Context, id objects.SnowflakeObject, token string, params *ModifyWebhookWithTokenParams) (*objects.Webhook, error)

func (*Client) RemoveGuildBan

func (c *Client) RemoveGuildBan(ctx context.Context, guild, user objects.SnowflakeObject, reason string) error

func (*Client) RemoveGuildMember

func (c *Client) RemoveGuildMember(ctx context.Context, guild, user objects.SnowflakeObject, reason string) error

func (*Client) RemoveGuildMemberRole

func (c *Client) RemoveGuildMemberRole(ctx context.Context, guild, user, role objects.SnowflakeObject, reason string) error

func (*Client) RemoveThreadMember

func (c *Client) RemoveThreadMember(ctx context.Context, thread, user objects.SnowflakeObject) error

func (*Client) StartThread

func (c *Client) StartThread(ctx context.Context, channel objects.SnowflakeObject, params *StartThreadParams) (*objects.Channel, error)

func (*Client) StartThreadWithMessage

func (c *Client) StartThreadWithMessage(ctx context.Context, channel, message objects.SnowflakeObject, params *StartThreadParams) (*objects.Channel, error)

func (*Client) StartTyping

func (c *Client) StartTyping(ctx context.Context, channel objects.SnowflakeObject) error

func (*Client) SyncGuildTemplate

func (c *Client) SyncGuildTemplate(ctx context.Context, guild objects.SnowflakeObject, code string) (*objects.Template, error)

func (*Client) UpdateCommand

func (c *Client) UpdateCommand(ctx context.Context, app, commandID objects.SnowflakeObject, command *objects.ApplicationCommand) (*objects.ApplicationCommand, error)

func (*Client) UpdateGuildCommand

func (c *Client) UpdateGuildCommand(ctx context.Context, app, guild, commandID objects.SnowflakeObject, command *objects.ApplicationCommand) (*objects.ApplicationCommand, error)

type Config

type Config struct {
	Authorization string
	UserAgent     string
	Ratelimiter   Ratelimiter
	Cache         Cache
	Proxy         func(*http.Request) (*url.URL, error)
	Logger        *zerolog.Logger
}

type CreateDMParams

type CreateDMParams struct {
	RecipientID objects.Snowflake `json:"recipient_id"`
	Reason      string            `json:"-"`
}

type CreateFollowupMessageParams

type CreateFollowupMessageParams struct {
	Content string                 `json:"content,omitempty" url:"-"`
	TTS     bool                   `json:"tts,omitempty" url:"-"`
	Files   []*objects.DiscordFile `json:"-" url:"-"`
	Embeds  []*objects.Embed       `json:"embeds,omitempty" url:"-"`

	AllowedMentions *objects.AllowedMentions `json:"allowed_mentions,omitempty" url:"-"`
	Components      []*objects.Component     `json:"components,omitempty" url:"-"`
	Attachments     []*objects.Attachment    `json:"attachments,omitempty" url:"-"`
	Flags           objects.MessageFlag      `json:"flags,omitempty" url:"-"`
}

type CreateGroupDMParams

type CreateGroupDMParams struct {
	AccessTokens []string                     `json:"access_tokens"`
	Nicks        map[objects.Snowflake]string `json:"nicks"`
	Reason       string                       `json:"reason,omitempty"`
}

type CreateGuildBanParams

type CreateGuildBanParams struct {
	DeleteMessageDays int    `json:"delete_message_days,omitempty"`
	Reason            string `json:"reason,omitempty"`
}

type CreateGuildParams

type CreateGuildParams struct {
	Name                        string                              `json:"name"`
	Region                      string                              `json:"region,omitempty"`
	Icon                        string                              `json:"icon,omitempty"`
	VerificationLevel           *objects.VerificationLevel          `json:"verification_level,omitempty"`
	DefaultMessageNotifications *objects.MessageNotificationsLevel  `json:"default_message_notifications,omitempty"`
	ExplicitContentFilter       *objects.ExplicitContentFilterLevel `json:"explicit_content_filter,omitempty"`
	Roles                       []*objects.Role                     `json:"roles,omitempty"`
	Channels                    []*objects.Channel                  `json:"channels,omitempty"`
	AFKChannelID                objects.Snowflake                   `json:"afk_channel_id,omitempty"`
	AFKTimeout                  int64                               `json:"afk_timeout,omitempty"`
	SystemChannelID             objects.Snowflake                   `json:"system_channel_id,omitempty"`
	Reason                      string                              `json:"-"`
}

type CreateGuildRoleParams

type CreateGuildRoleParams struct {
	Name        string                    `json:"name,omitempty"`
	Permissions permissions.PermissionBit `json:"permissions,omitempty"`
	Color       int                       `json:"color,omitempty"`
	Hoist       bool                      `json:"hoist,omitempty"`
	Mentionable bool                      `json:"mentionable,omitempty"`
	Reason      string                    `json:"-"`
}

type CreateGuildScheduledEventParams added in v0.1.0

type CreateGuildScheduledEventParams struct {
	ChannelID          *objects.Snowflake                         `json:"channel_id,omitempty"`
	EntityMetadata     *objects.GuildScheduledEventEntityMetadata `json:"entity_metadata,omitempty"`
	Name               string                                     `json:"name"`
	PrivacyLevel       objects.PrivacyLevel                       `json:"privacy_level"`
	ScheduledStartTime objects.Time                               `json:"scheduled_start_time"`
	ScheduledEndTime   *objects.Time                              `json:"scheduled_end_time,omitempty"`
	Description        string                                     `json:"description,omitempty"`
	EntityType         objects.GuildScheduledEventEntityType      `json:"entity_type"`
	Image              []byte                                     `json:"image,omitempty"`
	Reason             string                                     `json:"-"`
}

type CreateGuildStickerParams added in v0.1.0

type CreateGuildStickerParams struct {
	BaseStickerParams
	File io.Reader
}

type CreateGuildTemplateParams

type CreateGuildTemplateParams struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Reason      string `json:"-"`
}

type CreateInviteParams

type CreateInviteParams struct {
	MaxAge            int64                    `json:"max_age,omitempty"`
	MaxUses           int64                    `json:"max_uses,omitempty"`
	Temporary         bool                     `json:"temporary,,omitempty"`
	Unique            bool                     `json:"unique,omitempty"`
	TargetUser        objects.Snowflake        `json:"target_user_id,omitempty"`
	TargetType        objects.InviteTargetType `json:"target_type,omitempty"`
	TargetApplication objects.Snowflake        `json:"target_application_id,omitempty"`
	Reason            string                   `json:"-"`
}

type CreateMessageParams

type CreateMessageParams struct {
	Content          string                    `json:"content,omitempty"`
	TTS              bool                      `json:"tts,omitempty"`
	Embeds           []*objects.Embed          `json:"embeds,omitempty"`
	AllowedMentions  *objects.AllowedMentions  `json:"allowed_mentions,omitempty"`
	MessageReference *objects.MessageReference `json:"message_reference,omitempty"`
	Components       []*objects.Component      `json:"components,omitempty"`
	StickerIDs       []objects.Snowflake       `json:"sticker_ids,omitempty"`
	Attachments      []*objects.Attachment     `json:"attachments,omitempty"`
	Flags            objects.MessageFlag       `json:"flags,omitempty"`
	Files            []*objects.DiscordFile    `json:"-"`
}

type CreateWebhookParams

type CreateWebhookParams struct {
	Name   string `json:"name"`
	Avatar string `json:"avatar"`
	Reason string `json:"-"`
}

type CurrentUserGuildsParams

type CurrentUserGuildsParams struct {
	Before objects.Snowflake `url:"before,omitempty"`
	After  objects.Snowflake `url:"after,omitempty"`
	Limit  int               `url:"limit,omitempty"`
}

type DefaultHTTPClient

type DefaultHTTPClient struct {
	// contains filtered or unexported fields
}

func (*DefaultHTTPClient) Request

func (c *DefaultHTTPClient) Request(req *request) (*DiscordResponse, error)

type DeleteMessagesParams

type DeleteMessagesParams struct {
	Messages []objects.Snowflake `json:"messages"`
}

type DiscordResponse

type DiscordResponse struct {
	Body       []byte
	StatusCode int
	Header     http.Header
}

func (*DiscordResponse) JSON

func (r *DiscordResponse) JSON(v interface{}) error

type Doer added in v0.0.12

type Doer interface {
	Do(r *http.Request) (*http.Response, error)
}

type EditChannelParams

type EditChannelParams struct {
	Allow  permissions.PermissionBit `json:"allow"`
	Deny   permissions.PermissionBit `json:"deny"`
	Type   int                       `json:"type"`
	Reason string                    `json:"-"`
}

type EditMessageParams

type EditMessageParams struct {
	Content         string                   `json:"content"`
	Embed           *objects.Embed           `json:"embed"`
	Flags           objects.MessageFlag      `json:"flags,omitempty"`
	AllowedMentions *objects.AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []*objects.Component     `json:"components"`
}

type EditWebhookMessageParams

type EditWebhookMessageParams struct {
	Content         string                   `json:"content"`
	Embeds          []*objects.Embed         `json:"embeds"`
	AllowedMentions *objects.AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []*objects.Component     `json:"components"`
}

type ErrorREST

type ErrorREST struct {
	Message string
	Status  int
	Body    json.RawMessage
}

func (*ErrorREST) Error

func (r *ErrorREST) Error() string

type ExecuteWebhookParams

type ExecuteWebhookParams struct {
	Wait     bool              `json:"-" url:"wait"`
	ThreadID objects.Snowflake `json:"-" url:"thread_id,omitempty"`

	Content   string                 `json:"content,omitempty" url:"-"`
	Username  string                 `json:"username,omitempty" url:"-"`
	AvatarURL string                 `json:"avatar_url,omitempty" url:"-"`
	TTS       bool                   `json:"tts,omitempty" url:"-"`
	Files     []*objects.DiscordFile `json:"-" url:"-"`
	Embeds    []*objects.Embed       `json:"embeds,omitempty" url:"-"`

	AllowedMentions *objects.AllowedMentions `json:"allowed_mentions,omitempty" url:"-"`
	Components      []*objects.Component     `json:"components,omitempty" url:"-"`
	Attachments     []*objects.Attachment    `json:"attachments,omitempty" url:"-"`
	Flags           objects.MessageFlag      `json:"flags,omitempty" url:"-"`
}

type GetAuditLogParams

type GetAuditLogParams struct {
	UserID     objects.Snowflake     `url:"user_id,omitempty"`
	ActionType objects.AuditLogEvent `url:"action_type,omitempty"`
	Before     objects.Snowflake     `url:"before,omitempty"`
	Limit      int                   `url:"limit,omitempty"`
}

type GetChannelMessagesParams

type GetChannelMessagesParams struct {
	Around objects.Snowflake `url:"around,omitempty"`
	Before objects.Snowflake `url:"before,omitempty"`
	After  objects.Snowflake `url:"after,omitempty"`
	Limit  int               `url:"limit,omitempty"`
}

type GetGuildPruneCountParams

type GetGuildPruneCountParams struct {
	Days         int                 `url:"days,omitempty"`
	IncludeRoles []objects.Snowflake `url:"include_roles,omitempty"`
}

type GetGuildScheduledEventParams added in v0.1.0

type GetGuildScheduledEventParams struct {
	WithUserCount bool `url:"with_user_count,omitempty"`
}

type GetGuildScheduledEventUsersParams added in v0.1.0

type GetGuildScheduledEventUsersParams struct {
	Limit      int                `url:"limit,omitempty"`
	WithMember bool               `url:"with_member,omitempty"`
	Before     *objects.Snowflake `url:"before,omitempty"`
	After      *objects.Snowflake `url:"after,omitempty"`
}

type GetInviteParams

type GetInviteParams struct {
	WithCounts bool `url:"with_counts"`
}

type GetReactionsParams

type GetReactionsParams struct {
	Before objects.Snowflake `url:"before,omitempty"`
	After  objects.Snowflake `url:"after,omitempty"`
	Limit  int               `url:"limit"`
}

type GuildWidgetImageParams

type GuildWidgetImageParams struct {
	Style string
}

type GuildWidgetParams

type GuildWidgetParams struct {
	Enabled   *bool             `json:"enabled,omitempty"`
	ChannelID objects.Snowflake `json:"channel_id,omitempty"`
	Reason    string            `json:"-"`
}

type HTTPClient

type HTTPClient interface {
	Request(req *request) (*DiscordResponse, error)
}

type LeakyBucketRatelimiter added in v0.0.12

type LeakyBucketRatelimiter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewLeakyBucketRatelimiter added in v0.0.12

func NewLeakyBucketRatelimiter() *LeakyBucketRatelimiter

func (*LeakyBucketRatelimiter) GetBucket added in v0.0.12

func (c *LeakyBucketRatelimiter) GetBucket(path string) *rate.Limiter

func (*LeakyBucketRatelimiter) Request added in v0.0.12

func (c *LeakyBucketRatelimiter) Request(httpClient HTTPClient, req *request) (*DiscordResponse, error)

type ListGuildMembersParams

type ListGuildMembersParams struct {
	Limit int               `url:"limit,omitempty"`
	After objects.Snowflake `url:"after,omitempty"`
}

type ListThreadsParams

type ListThreadsParams struct {
	Before objects.Time `json:"before,omitempty"`
	Limit  int          `json:"limit,omitempty"`
}

type ListThreadsResponse

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

type MemoryCache

type MemoryCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Reference in-memory implementation

func NewMemoryCache

func NewMemoryCache() *MemoryCache

func (*MemoryCache) Get

func (m *MemoryCache) Get(key string) (*DiscordResponse, error)

func (*MemoryCache) Put

func (m *MemoryCache) Put(key string, resp *DiscordResponse) error

type MemoryCacheConfig

type MemoryCacheConfig struct {
	// contains filtered or unexported fields
}

type MemoryConf

type MemoryConf struct {
	MaxRetries int
}

type MemoryRatelimiter

type MemoryRatelimiter struct {
	sync.Mutex
	MaxRetries int
	// contains filtered or unexported fields
}

func NewMemoryRatelimiter

func NewMemoryRatelimiter(conf *MemoryConf) *MemoryRatelimiter

func (*MemoryRatelimiter) Request

func (m *MemoryRatelimiter) Request(httpClient HTTPClient, req *request) (*DiscordResponse, error)

type ModifyChannelParams

type ModifyChannelParams struct {
	Name                 *string                        `json:"name,omitempty"`
	Type                 *objects.ChannelType           `json:"type,omitempty"`
	Position             *int64                         `json:"position,omitempty"`
	Topic                *string                        `json:"topic,omitempty"`
	NSFW                 *bool                          `json:"nsfw,omitempty"`
	RateLimitPerUser     *int64                         `json:"rate_limit_per_user,omitempty"`
	Bitrate              *int64                         `json:"bitrate,omitempty"`
	UserLimit            *int64                         `json:"user_limit,omitempty"`
	PermissionOverwrites *[]objects.PermissionOverwrite `json:"permission_overwrites,omitempty"`
	Parent               *objects.Snowflake             `json:"parent_id,omitempty"`
	Reason               string                         `json:"-"`
}

type ModifyChannelPositionParams

type ModifyChannelPositionParams struct {
	ID       objects.Snowflake `json:"id"`
	Position int               `json:"position"`
}

type ModifyCurrentUserNickParams

type ModifyCurrentUserNickParams struct {
	Nick   string `json:"nick"`
	Reason string `json:"-"`
}

type ModifyCurrentUserParams

type ModifyCurrentUserParams struct {
	Name   string `json:"name,omitempty"`
	Avatar string `json:"avatar,omitempty"`
	Reason string `json:"-"`
}

type ModifyGuildMemberParams

type ModifyGuildMemberParams struct {
	Nick                       *string              `json:"nick,omitempty"`
	Roles                      *[]objects.Snowflake `json:"roles,omitempty"`
	Mute                       *bool                `json:"mute,omitempty"`
	Deaf                       *bool                `json:"deaf,omitempty"`
	ChannelID                  *objects.Snowflake   `json:"channel_id,omitempty"`
	CommunicationDisabledUntil *objects.Time        `json:"communication_disabled_until,omitempty"`
	Reason                     string               `json:"-"`
}

type ModifyGuildMembershipScreeningParams

type ModifyGuildMembershipScreeningParams struct {
	Enabled     *bool  `json:"enabled,omitempty"`
	FormFields  string `json:"form_fields,omitempty"`
	Description string `json:"description,omitempty"`
	Reason      string `json:"-"`
}

type ModifyGuildParams

type ModifyGuildParams struct {
	Name                        string                              `json:"name,omitempty"`
	Region                      string                              `json:"region,omitempty"`
	VerificationLevel           *objects.VerificationLevel          `json:"verification_level,omitempty"`
	DefaultMessageNotifications *objects.MessageNotificationsLevel  `json:"default_message_notifications,omitempty"`
	ExplicitContentFilter       *objects.ExplicitContentFilterLevel `json:"explicit_content_filter,omitempty"`
	AFKChannelID                objects.Snowflake                   `json:"afk_channel_id,omitempty"`
	AFKTimeout                  int64                               `json:"afk_timeout,omitempty"`
	Icon                        string                              `json:"icon,omitempty"`
	OwnerID                     objects.Snowflake                   `json:"owner_id,omitempty"`
	Splash                      string                              `json:"splash,omitempty"`
	Banner                      string                              `json:"banner,omitempty"`
	SystemChannelID             objects.Snowflake                   `json:"system_channel_id,omitempty"`
	RulesChannelID              objects.Snowflake                   `json:"rules_channel_id,omitempty"`
	PublicUpdatesChannelID      objects.Snowflake                   `json:"public_updates_channel_id,omitempty"`
	PreferredLocale             string                              `json:"preferred_locale,omitempty"`
	Reason                      string                              `json:"-"`
}

type ModifyGuildRoleParams

type ModifyGuildRoleParams struct {
	Name        string                    `json:"name,omitempty"`
	Permissions permissions.PermissionBit `json:"permissions,omitempty"`
	Color       int                       `json:"color,omitempty"`
	Hoist       *bool                     `json:"hoist,omitempty"`
	Mentionable *bool                     `json:"mentionable,omitempty"`
	Reason      string                    `json:"-"`
}

type ModifyGuildRolePositionsParams

type ModifyGuildRolePositionsParams struct {
	ID objects.Snowflake `json:"id"`
}

type ModifyGuildScheduledEventParams added in v0.1.0

type ModifyGuildScheduledEventParams struct {
	CreateGuildScheduledEventParams
	Status objects.GuildScheduledEventStatus `json:"status,omitempty"`
}

type ModifyGuildTemplateParams

type ModifyGuildTemplateParams struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Reason      string `json:"-"`
}

type ModifyWebhookParams

type ModifyWebhookParams struct {
	Name      string            `json:"name,omitempty"`
	Avatar    string            `json:"avatar,omitempty"`
	ChannelID objects.Snowflake `json:"channel_id,omitempty"`
	Reason    string            `json:"-"`
}

type ModifyWebhookWithTokenParams

type ModifyWebhookWithTokenParams struct {
	Name   string `json:"name,omitempty"`
	Avatar string `json:"avatar,omitempty"`
	Reason string `json:"-"`
}

type ProxyClient added in v0.0.12

type ProxyClient struct {
	// contains filtered or unexported fields
}

func NewProxyClient added in v0.0.12

func NewProxyClient(proxy func(*http.Request) (*url.URL, error)) *ProxyClient

func (*ProxyClient) Do added in v0.0.12

func (c *ProxyClient) Do(r *http.Request) (*http.Response, error)

type RESTClient added in v0.1.0

type RESTClient interface {
	AddGuildCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *objects.ApplicationCommand) (*objects.ApplicationCommand, error)
	AddGuildMember(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *AddGuildMemberParams) (*objects.GuildMember, error)
	AddGuildMemberRole(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	AddPinnedMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	AddThreadMember(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	BatchEditApplicationCommandPermissions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, []*objects.GuildApplicationCommandPermissions) ([]*objects.GuildApplicationCommandPermissions, error)
	BeginGuildPrune(context.Context, objects.SnowflakeObject, *BeginGuildPruneParams) (int, error)
	BulkDeleteMessages(context.Context, objects.SnowflakeObject, *DeleteMessagesParams) error
	BulkOverwriteGlobalCommands(context.Context, objects.SnowflakeObject, []*objects.ApplicationCommand) ([]*objects.ApplicationCommand, error)
	BulkOverwriteGuildCommands(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, []*objects.ApplicationCommand) ([]*objects.ApplicationCommand, error)
	CreateBan(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *CreateGuildBanParams) error
	CreateChannelInvite(context.Context, objects.SnowflakeObject, *CreateInviteParams) (*objects.Invite, error)
	CreateCommand(context.Context, objects.SnowflakeObject, *objects.ApplicationCommand) (*objects.ApplicationCommand, error)
	CreateDM(context.Context, *CreateDMParams) (*objects.Channel, error)
	CreateFollowupMessage(context.Context, objects.SnowflakeObject, string, *CreateFollowupMessageParams) (*objects.Message, error)
	CreateGroupDM(context.Context, *CreateGroupDMParams) (*objects.Channel, error)
	CreateGuild(context.Context, *CreateGuildParams) (*objects.Guild, error)
	CreateGuildChannel(context.Context, objects.SnowflakeObject, *ChannelCreateParams) (*objects.Channel, error)
	CreateGuildFromTemplate(context.Context, string, string) (*objects.Guild, error)
	CreateGuildRole(context.Context, objects.SnowflakeObject, *CreateGuildRoleParams) (*objects.Role, error)
	CreateGuildScheduledEvent(context.Context, objects.SnowflakeObject, *CreateGuildScheduledEventParams) (*objects.GuildScheduledEvent, error)
	CreateGuildSticker(context.Context, objects.SnowflakeObject, *CreateGuildStickerParams) (*objects.Sticker, error)
	CreateGuildTemplate(context.Context, objects.SnowflakeObject, *CreateGuildTemplateParams) (*objects.Template, error)
	CreateInteractionResponse(context.Context, objects.SnowflakeObject, string, *objects.InteractionResponse) error
	CreateMessage(context.Context, objects.SnowflakeObject, *CreateMessageParams) (*objects.Message, error)
	CreateReaction(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, interface{}) error
	CreateWebhook(context.Context, objects.SnowflakeObject, *CreateWebhookParams) (*objects.Webhook, error)
	CrossPostMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.Message, error)
	DeleteAllReactions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	DeleteChannel(context.Context, objects.SnowflakeObject, string) (*objects.Channel, error)
	DeleteChannelPermission(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	DeleteCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	DeleteEmojiReactions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, interface{}) error
	DeleteFollowupMessage(context.Context, objects.SnowflakeObject, string, objects.SnowflakeObject) error
	DeleteGuild(context.Context, objects.SnowflakeObject) error
	DeleteGuildCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject) error
	DeleteGuildIntegration(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	DeleteGuildRole(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	DeleteGuildScheduledEvent(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	DeleteGuildSticker(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, ...string) error
	DeleteGuildTemplate(context.Context, objects.SnowflakeObject, string, string) (*objects.Template, error)
	DeleteInvite(context.Context, string, string) (*objects.Invite, error)
	DeleteMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	DeleteOriginalInteractionResponse(context.Context, objects.SnowflakeObject, string) error
	DeleteOwnReaction(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, interface{}) error
	DeletePinnedMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	DeleteUserReaction(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject, interface{}) error
	DeleteWebhook(context.Context, objects.SnowflakeObject) error
	DeleteWebhookMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	DeleteWebhookWithToken(context.Context, objects.SnowflakeObject, string) error
	EditApplicationCommandPermissions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject, []*objects.ApplicationCommandPermissions) (*objects.GuildApplicationCommandPermissions, error)
	EditChannelPermissions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *EditChannelParams) error
	EditFollowupMessage(context.Context, objects.SnowflakeObject, string, objects.SnowflakeObject, *EditWebhookMessageParams) (*objects.Message, error)
	EditMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *EditMessageParams) (*objects.Message, error)
	EditOriginalInteractionResponse(context.Context, objects.SnowflakeObject, string, *EditWebhookMessageParams) (*objects.Message, error)
	EditWebhookMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string, *EditWebhookMessageParams) (*objects.Message, error)
	ExecuteWebhook(context.Context, objects.SnowflakeObject, string, *ExecuteWebhookParams) (*objects.Message, error)
	FollowNewsChannel(context.Context, objects.SnowflakeObject) (*objects.FollowedChannel, error)
	Gateway(context.Context) (*objects.Gateway, error)
	GatewayBot(context.Context) (*objects.Gateway, error)
	GetApplicationCommandPermissions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.GuildApplicationCommandPermissions, error)
	GetAuditLogs(context.Context, objects.SnowflakeObject, *GetAuditLogParams) (*objects.AuditLog, error)
	GetChannel(context.Context, objects.SnowflakeObject) (*objects.Channel, error)
	GetChannelInvites(context.Context, objects.SnowflakeObject) ([]*objects.Invite, error)
	GetChannelMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.Message, error)
	GetChannelMessages(context.Context, objects.SnowflakeObject, *GetChannelMessagesParams) ([]*objects.Message, error)
	GetChannelWebhooks(context.Context, objects.SnowflakeObject) ([]*objects.Webhook, error)
	GetCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.ApplicationCommand, error)
	GetCommands(context.Context, objects.SnowflakeObject) ([]*objects.ApplicationCommand, error)
	GetCurrentUser(context.Context) (*objects.User, error)
	GetCurrentUserGuildMember(context.Context, objects.SnowflakeObject) (*objects.GuildMember, error)
	GetCurrentUserGuilds(context.Context, *CurrentUserGuildsParams) ([]*objects.Guild, error)
	GetFollowupMessage(context.Context, objects.SnowflakeObject, string, objects.SnowflakeObject) (*objects.Message, error)
	GetGuild(context.Context, objects.SnowflakeObject) (*objects.Guild, error)
	GetGuildApplicationCommandPermissions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) ([]*objects.GuildApplicationCommandPermissions, error)
	GetGuildBan(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.Ban, error)
	GetGuildBans(context.Context, objects.SnowflakeObject) ([]*objects.Ban, error)
	GetGuildChannels(context.Context, objects.SnowflakeObject) ([]*objects.Channel, error)
	GetGuildCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.ApplicationCommand, error)
	GetGuildCommands(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) ([]*objects.ApplicationCommand, error)
	GetGuildIntegrations(context.Context, objects.SnowflakeObject) ([]*objects.Integration, error)
	GetGuildInvites(context.Context, objects.SnowflakeObject) ([]*objects.Invite, error)
	GetGuildMember(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.GuildMember, error)
	GetGuildPreview(context.Context, objects.SnowflakeObject) (*objects.GuildPreview, error)
	GetGuildPruneCount(context.Context, objects.SnowflakeObject, *GetGuildPruneCountParams) (int, error)
	GetGuildRoles(context.Context, objects.SnowflakeObject) ([]*objects.Role, error)
	GetGuildScheduledEvent(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, ...*GetGuildScheduledEventParams) (*objects.GuildScheduledEvent, error)
	GetGuildScheduledEventUsers(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, ...*GetGuildScheduledEventUsersParams) ([]*objects.GuildScheduledEventUser, error)
	GetGuildSticker(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) (*objects.Sticker, error)
	GetGuildTemplates(context.Context, objects.SnowflakeObject) ([]*objects.Template, error)
	GetGuildVanityURL(context.Context, objects.SnowflakeObject) (*objects.Invite, error)
	GetGuildVoiceRegions(context.Context, objects.SnowflakeObject) ([]*objects.VoiceRegion, error)
	GetGuildWebhooks(context.Context, objects.SnowflakeObject) ([]*objects.Webhook, error)
	GetGuildWelcomeScreen(context.Context, objects.SnowflakeObject) (*objects.MembershipScreening, error)
	GetGuildWidget(context.Context, objects.SnowflakeObject) (*objects.GuildWidgetJSON, error)
	GetGuildWidgetImage(context.Context, objects.SnowflakeObject, *GuildWidgetImageParams) (image.Image, error)
	GetGuildWidgetSettings(context.Context, objects.SnowflakeObject) (*objects.GuildWidget, error)
	GetInvite(context.Context, string, *GetInviteParams) (*objects.Invite, error)
	GetOriginalInteractionResponse(context.Context, objects.SnowflakeObject, string) (*objects.Message, error)
	GetPinnedMessages(context.Context, objects.SnowflakeObject) ([]*objects.Message, error)
	GetReactions(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, interface{}, *GetReactionsParams) ([]*objects.User, error)
	GetSticker(context.Context, objects.SnowflakeObject) (*objects.Sticker, error)
	GetTemplate(context.Context, string) (*objects.Template, error)
	GetUser(context.Context, objects.SnowflakeObject) (*objects.User, error)
	GetUserConnections(context.Context) ([]*objects.Connection, error)
	GetVoiceRegions(context.Context) ([]*objects.VoiceRegion, error)
	GetWebhook(context.Context, objects.SnowflakeObject) (*objects.Webhook, error)
	GetWebhookWithToken(context.Context, objects.SnowflakeObject, string) (*objects.Webhook, error)
	JoinThread(context.Context, objects.SnowflakeObject) error
	LeaveGuild(context.Context, objects.SnowflakeObject) error
	LeaveThread(context.Context, objects.SnowflakeObject) error
	ListActiveThreads(context.Context, objects.SnowflakeObject) ([]*ListThreadsResponse, error)
	ListGuildMembers(context.Context, objects.SnowflakeObject, *ListGuildMembersParams) ([]*objects.GuildMember, error)
	ListGuildStickers(context.Context, objects.SnowflakeObject) ([]*objects.Sticker, error)
	ListJoinedPrivateArchivedThreads(context.Context, objects.SnowflakeObject, ...*ListThreadsParams) (*ListThreadsResponse, error)
	ListNitroStickerPacks(context.Context) ([]*objects.StickerPack, error)
	ListPrivateArchivedThreads(context.Context, objects.SnowflakeObject, ...*ListThreadsParams) (*ListThreadsResponse, error)
	ListPublicArchivedThreads(context.Context, objects.SnowflakeObject, ...*ListThreadsParams) (*ListThreadsResponse, error)
	ListThreadMembers(context.Context, objects.SnowflakeObject) ([]*objects.ThreadMember, error)
	ModifyChannel(context.Context, objects.SnowflakeObject, *ModifyChannelParams) (*objects.Channel, error)
	ModifyCurrentUser(context.Context, *ModifyCurrentUserParams) (*objects.User, error)
	ModifyCurrentUserNick(context.Context, objects.SnowflakeObject, *ModifyCurrentUserNickParams) (*ModifyCurrentUserNickParams, error)
	ModifyGuild(context.Context, objects.SnowflakeObject, *ModifyGuildParams) (*objects.Guild, error)
	ModifyGuildChannelPositions(context.Context, objects.SnowflakeObject, []*ModifyChannelPositionParams, string) error
	ModifyGuildMember(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *ModifyGuildMemberParams) (*objects.GuildMember, error)
	ModifyGuildRole(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *ModifyGuildRoleParams) (*objects.Role, error)
	ModifyGuildRolePositions(context.Context, objects.SnowflakeObject, []*ModifyGuildRolePositionsParams) ([]*objects.Role, error)
	ModifyGuildScheduledEvent(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *ModifyGuildScheduledEventParams) (*objects.GuildScheduledEvent, error)
	ModifyGuildSticker(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *BaseStickerParams) (*objects.Sticker, error)
	ModifyGuildTemplate(context.Context, objects.SnowflakeObject, string, *ModifyGuildTemplateParams) (*objects.Template, error)
	ModifyGuildWelcomeScreen(context.Context, objects.SnowflakeObject, *ModifyGuildMembershipScreeningParams) (*objects.MembershipScreening, error)
	ModifyGuildWidget(context.Context, objects.SnowflakeObject, *GuildWidgetParams) (*objects.GuildWidget, error)
	ModifyWebhook(context.Context, objects.SnowflakeObject, *ModifyWebhookParams) (*objects.Webhook, error)
	ModifyWebhookWithToken(context.Context, objects.SnowflakeObject, string, *ModifyWebhookWithTokenParams) (*objects.Webhook, error)
	RemoveGuildBan(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	RemoveGuildMember(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	RemoveGuildMemberRole(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject, string) error
	RemoveThreadMember(context.Context, objects.SnowflakeObject, objects.SnowflakeObject) error
	StartThread(context.Context, objects.SnowflakeObject, *StartThreadParams) (*objects.Channel, error)
	StartThreadWithMessage(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *StartThreadParams) (*objects.Channel, error)
	StartTyping(context.Context, objects.SnowflakeObject) error
	SyncGuildTemplate(context.Context, objects.SnowflakeObject, string) (*objects.Template, error)
	UpdateCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, *objects.ApplicationCommand) (*objects.ApplicationCommand, error)
	UpdateGuildCommand(context.Context, objects.SnowflakeObject, objects.SnowflakeObject, objects.SnowflakeObject, *objects.ApplicationCommand) (*objects.ApplicationCommand, error)
}

RESTClient is the interface that contains all functions in *rest.Client.

type Ratelimiter

type Ratelimiter interface {
	Request(httpClient HTTPClient, req *request) (*DiscordResponse, error)
}

type RedisConf

type RedisConf struct {
	Options    *redis.Options
	MaxRetries int
}

type RedisRatelimiter

type RedisRatelimiter struct {
	MaxRetries int
	// contains filtered or unexported fields
}

func NewRedisRatelimiter

func NewRedisRatelimiter(conf *RedisConf) (*RedisRatelimiter, error)

func (*RedisRatelimiter) Request

func (r *RedisRatelimiter) Request(httpClient HTTPClient, req *request) (*DiscordResponse, error)

type StartThreadParams

type StartThreadParams struct {
	Name                string `json:"name"`
	AutoArchiveDuration int    `json:"auto_archive_duration"`
	Type                int    `json:"type,omitempty"`
	Invitable           bool   `json:"invitable,omitempty"`
}

type TestHTTPClient

type TestHTTPClient struct {
	T               *testing.T
	ExpectedRequest *request
	Response        *DiscordResponse
	Error           error
}

TestHTTPClient is a replacement HTTP client that can be used during testing.

func (*TestHTTPClient) Request

func (c *TestHTTPClient) Request(req *request) (*DiscordResponse, error)

Jump to

Keyboard shortcuts

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