Documentation ¶
Overview ¶
Package api provides an interface to interact with the Discord REST API. It handles rate limiting, as well as authorizing and more.
Index ¶
- Constants
- Variables
- func GatewayURL(ctx context.Context) (string, error)
- type Ack
- type ActiveThreads
- type AddMemberData
- type AddRoleData
- type AllowedMentionType
- type AllowedMentions
- type ArchivedThreads
- type AuditLogData
- type AuditLogReason
- type AutocompleteChoices
- type AutocompleteIntegerChoices
- type AutocompleteNumberChoices
- type AutocompleteStringChoices
- type BanData
- type BatchEditCommandPermissionsData
- type BotData
- type Client
- func (c *Client) Ack(channelID discord.ChannelID, messageID discord.MessageID, ack *Ack) error
- func (c *Client) ActiveThreads(guildID discord.GuildID) (*ActiveThreads, error)
- func (c *Client) AddMember(guildID discord.GuildID, userID discord.UserID, data AddMemberData) (*discord.Member, error)
- func (c *Client) AddRecipient(channelID discord.ChannelID, userID discord.UserID, ...) error
- func (c *Client) AddRole(guildID discord.GuildID, userID discord.UserID, roleID discord.RoleID, ...) error
- func (c *Client) AddThreadMember(threadID discord.ChannelID, userID discord.UserID) error
- func (c *Client) AttachIntegration(guildID discord.GuildID, integrationID discord.IntegrationID, ...) error
- func (c *Client) AuditLog(guildID discord.GuildID, data AuditLogData) (*discord.AuditLog, error)
- func (c *Client) Ban(guildID discord.GuildID, userID discord.UserID, data BanData) error
- func (c *Client) Bans(guildID discord.GuildID) ([]discord.Ban, error)
- func (c *Client) BatchEditCommandPermissions(appID discord.AppID, guildID discord.GuildID, ...) ([]discord.GuildCommandPermissions, error)
- func (c *Client) BotURL() (*BotData, error)
- func (c *Client) BulkOverwriteCommands(appID discord.AppID, commands []CreateCommandData) ([]discord.Command, error)
- func (c *Client) BulkOverwriteGuildCommands(appID discord.AppID, guildID discord.GuildID, commands []CreateCommandData) ([]discord.Command, error)
- func (c *Client) Channel(channelID discord.ChannelID) (*discord.Channel, error)
- func (c *Client) ChannelInvites(channelID discord.ChannelID) ([]discord.Invite, error)
- func (c *Client) ChannelWebhooks(channelID discord.ChannelID) ([]discord.Webhook, error)
- func (c *Client) Channels(guildID discord.GuildID) ([]discord.Channel, error)
- func (c *Client) Command(appID discord.AppID, commandID discord.CommandID) (*discord.Command, error)
- func (c *Client) CommandPermissions(appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID) (*discord.GuildCommandPermissions, error)
- func (c *Client) Commands(appID discord.AppID) ([]discord.Command, error)
- func (c *Client) CreateAutoModerationRule(guildID discord.GuildID, rule discord.AutoModerationRule) (*discord.AutoModerationRule, error)
- func (c *Client) CreateChannel(guildID discord.GuildID, data CreateChannelData) (*discord.Channel, error)
- func (c *Client) CreateCommand(appID discord.AppID, data CreateCommandData) (*discord.Command, error)
- func (c *Client) CreateEmoji(guildID discord.GuildID, data CreateEmojiData) (*discord.Emoji, error)
- func (c *Client) CreateGuild(data CreateGuildData) (*discord.Guild, error)
- func (c *Client) CreateGuildCommand(appID discord.AppID, guildID discord.GuildID, data CreateCommandData) (*discord.Command, error)
- func (c *Client) CreateInteractionFollowup(appID discord.AppID, token string, data InteractionResponseData) (*discord.Message, error)deprecated
- func (c *Client) CreateInvite(channelID discord.ChannelID, data CreateInviteData) (*discord.Invite, error)
- func (c *Client) CreatePrivateChannel(recipientID discord.UserID) (*discord.Channel, error)
- func (c *Client) CreateRole(guildID discord.GuildID, data CreateRoleData) (*discord.Role, error)
- func (c *Client) CreateScheduledEvent(guildID discord.GuildID, reason AuditLogReason, data CreateScheduledEventData) (*discord.GuildScheduledEvent, error)
- func (c *Client) CreateStageInstance(data CreateStageInstanceData) (*discord.StageInstance, error)
- func (c *Client) CreateWebhook(channelID discord.ChannelID, data CreateWebhookData) (*discord.Webhook, error)
- func (c *Client) CrosspostMessage(channelID discord.ChannelID, messageID discord.MessageID) (*discord.Message, error)
- func (c *Client) CurrentApplication() (*discord.Application, error)
- func (c *Client) DeleteAllReactions(channelID discord.ChannelID, messageID discord.MessageID) error
- func (c *Client) DeleteAutoModerationRule(GuildID discord.GuildID, RuleID discord.AutoModerationRuleID, ...) error
- func (c *Client) DeleteChannel(channelID discord.ChannelID, reason AuditLogReason) error
- func (c *Client) DeleteChannelPermission(channelID discord.ChannelID, overwriteID discord.Snowflake, ...) error
- func (c *Client) DeleteCommand(appID discord.AppID, commandID discord.CommandID) error
- func (c *Client) DeleteEmoji(guildID discord.GuildID, emojiID discord.EmojiID, reason AuditLogReason) error
- func (c *Client) DeleteGuild(id discord.GuildID) error
- func (c *Client) DeleteGuildCommand(appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID) error
- func (c *Client) DeleteInteractionFollowup(appID discord.AppID, messageID discord.MessageID, token string) error
- func (c *Client) DeleteInteractionResponse(appID discord.AppID, token string) error
- func (c *Client) DeleteInvite(code string, reason AuditLogReason) (*discord.Invite, error)
- func (c *Client) DeleteMessage(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) DeleteMessages(channelID discord.ChannelID, messageIDs []discord.MessageID, ...) error
- func (c *Client) DeleteReactions(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) DeleteRelationship(userID discord.UserID) error
- func (c *Client) DeleteRole(guildID discord.GuildID, roleID discord.RoleID, reason AuditLogReason) error
- func (c *Client) DeleteScheduledEvent(guildID discord.GuildID, eventID discord.EventID) error
- func (c *Client) DeleteStageInstance(channelID discord.ChannelID, reason AuditLogReason) error
- func (c *Client) DeleteUserReaction(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) DeleteWebhook(webhookID discord.WebhookID) error
- func (c *Client) EditChannelPermission(channelID discord.ChannelID, overwriteID discord.Snowflake, ...) error
- func (c *Client) EditCommand(appID discord.AppID, commandID discord.CommandID, data CreateCommandData) (*discord.Command, error)
- func (c *Client) EditCommandPermissions(appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID, ...) (*discord.GuildCommandPermissions, error)
- func (c *Client) EditEmbeds(channelID discord.ChannelID, messageID discord.MessageID, ...) (*discord.Message, error)
- func (c *Client) EditGuildCommand(appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID, ...) (*discord.Command, error)
- func (c *Client) EditInteractionFollowup(appID discord.AppID, messageID discord.MessageID, token string, ...) (*discord.Message, error)
- func (c *Client) EditInteractionResponse(appID discord.AppID, token string, data EditInteractionResponseData) (*discord.Message, error)
- func (c *Client) EditMessage(channelID discord.ChannelID, messageID discord.MessageID, content string, ...) (*discord.Message, error)
- func (c *Client) EditMessageComplex(channelID discord.ChannelID, messageID discord.MessageID, data EditMessageData) (*discord.Message, error)
- func (c *Client) EditScheduledEvent(guildID discord.GuildID, eventID discord.EventID, reason AuditLogReason, ...) (*discord.GuildScheduledEvent, error)
- func (c *Client) EditText(channelID discord.ChannelID, messageID discord.MessageID, content string) (*discord.Message, error)
- func (c *Client) Emoji(guildID discord.GuildID, emojiID discord.EmojiID) (*discord.Emoji, error)
- func (c *Client) Emojis(guildID discord.GuildID) ([]discord.Emoji, error)
- func (c *Client) FollowUpInteraction(appID discord.AppID, token string, data InteractionResponseData) (*discord.Message, error)
- func (c *Client) GetAutoModerationRule(guildID discord.GuildID, ruleID discord.AutoModerationRuleID) (discord.AutoModerationRule, error)
- func (c *Client) GetBan(guildID discord.GuildID, userID discord.UserID) (*discord.Ban, error)
- func (c *Client) Guild(id discord.GuildID) (*discord.Guild, error)
- func (c *Client) GuildCommand(appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID) (*discord.Command, error)
- func (c *Client) GuildCommandPermissions(appID discord.AppID, guildID discord.GuildID) ([]discord.GuildCommandPermissions, error)
- func (c *Client) GuildCommands(appID discord.AppID, guildID discord.GuildID) ([]discord.Command, error)
- func (c *Client) GuildInvites(guildID discord.GuildID) ([]discord.Invite, error)
- func (c *Client) GuildPreview(id discord.GuildID) (*discord.GuildPreview, error)
- func (c *Client) GuildVanityInvite(guildID discord.GuildID) (*discord.Invite, error)
- func (c *Client) GuildWebhooks(guildID discord.GuildID) ([]discord.Webhook, error)
- func (c *Client) GuildWidget(guildID discord.GuildID) (*discord.GuildWidget, error)
- func (c *Client) GuildWidgetImage(guildID discord.GuildID, img GuildWidgetImageStyle) (io.ReadCloser, error)
- func (c *Client) GuildWidgetImageURL(guildID discord.GuildID, img GuildWidgetImageStyle) string
- func (c *Client) GuildWidgetSettings(guildID discord.GuildID) (*discord.GuildWidgetSettings, error)
- func (c *Client) GuildWithCount(id discord.GuildID) (*discord.Guild, error)
- func (c *Client) Guilds(limit uint) ([]discord.Guild, error)
- func (c *Client) GuildsAfter(after discord.GuildID, limit uint) ([]discord.Guild, error)
- func (c *Client) GuildsBefore(before discord.GuildID, limit uint) ([]discord.Guild, error)
- func (c *Client) InjectRequest(r httpdriver.Request) error
- func (c *Client) Integrations(guildID discord.GuildID) ([]discord.Integration, error)
- func (c *Client) InteractionResponse(appID discord.AppID, token string) (*discord.Message, error)
- func (c *Client) Invite(code string) (*discord.Invite, error)
- func (c *Client) InviteWithCounts(code string) (*discord.Invite, error)
- func (c *Client) JoinInvite(code string) (*JoinedInvite, error)
- func (c *Client) JoinThread(threadID discord.ChannelID) error
- func (c *Client) JoinedPrivateArchivedThreads(channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
- func (c *Client) JoinedPrivateArchivedThreadsBefore(channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)deprecated
- func (c *Client) Kick(guildID discord.GuildID, userID discord.UserID, reason AuditLogReason) error
- func (c *Client) LeaveGuild(id discord.GuildID) error
- func (c *Client) LeaveThread(threadID discord.ChannelID) error
- func (c *Client) ListAutoModerationRules(guildID discord.GuildID) ([]discord.AutoModerationRule, error)
- func (c *Client) ListScheduledEventUsers(guildID discord.GuildID, eventID discord.EventID, limit option.NullableInt, ...) ([]GuildScheduledEventUser, error)
- func (c *Client) ListScheduledEvents(guildID discord.GuildID, withUserCount bool) ([]discord.GuildScheduledEvent, error)
- func (c *Client) Login(email, password string) (*LoginResponse, error)
- func (c *Client) Me() (*discord.User, error)
- func (c *Client) Member(guildID discord.GuildID, userID discord.UserID) (*discord.Member, error)
- func (c *Client) Members(guildID discord.GuildID, limit uint) ([]discord.Member, error)
- func (c *Client) MembersAfter(guildID discord.GuildID, after discord.UserID, limit uint) ([]discord.Member, error)
- func (c *Client) Message(channelID discord.ChannelID, messageID discord.MessageID) (*discord.Message, error)
- func (c *Client) Messages(channelID discord.ChannelID, limit uint) ([]discord.Message, error)
- func (c *Client) MessagesAfter(channelID discord.ChannelID, after discord.MessageID, limit uint) ([]discord.Message, error)
- func (c *Client) MessagesAround(channelID discord.ChannelID, around discord.MessageID, limit uint) ([]discord.Message, error)
- func (c *Client) MessagesBefore(channelID discord.ChannelID, before discord.MessageID, limit uint) ([]discord.Message, error)
- func (c *Client) ModifyAutoModerationRule(GuildID discord.GuildID, RuleID discord.AutoModerationRuleID, ...) (*discord.AutoModerationRule, error)
- func (c *Client) ModifyChannel(channelID discord.ChannelID, data ModifyChannelData) error
- func (c *Client) ModifyCurrentMember(guildID discord.GuildID, nick string) error
- func (c *Client) ModifyCurrentUser(data ModifyCurrentUserData) (*discord.User, error)
- func (c *Client) ModifyEmoji(guildID discord.GuildID, emojiID discord.EmojiID, data ModifyEmojiData) error
- func (c *Client) ModifyGuild(id discord.GuildID, data ModifyGuildData) (*discord.Guild, error)
- func (c *Client) ModifyGuildWidget(guildID discord.GuildID, data ModifyGuildWidgetData) (*discord.GuildWidgetSettings, error)
- func (c *Client) ModifyIntegration(guildID discord.GuildID, integrationID discord.IntegrationID, ...) error
- func (c *Client) ModifyMember(guildID discord.GuildID, userID discord.UserID, data ModifyMemberData) error
- func (c *Client) ModifyRole(guildID discord.GuildID, roleID discord.RoleID, data ModifyRoleData) (*discord.Role, error)
- func (c *Client) ModifyWebhook(webhookID discord.WebhookID, data ModifyWebhookData) (*discord.Webhook, error)
- func (c *Client) MoveChannels(guildID discord.GuildID, data MoveChannelsData) error
- func (c *Client) MoveRoles(guildID discord.GuildID, data MoveRolesData) ([]discord.Role, error)
- func (c *Client) Note(userID discord.UserID) (string, error)
- func (c *Client) OnResponse(r httpdriver.Request, resp httpdriver.Response) error
- func (c *Client) PinMessage(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) PinnedMessages(channelID discord.ChannelID) ([]discord.Message, error)
- func (c *Client) PrivateArchivedThreads(channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
- func (c *Client) PrivateArchivedThreadsBefore(channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)deprecated
- func (c *Client) PrivateChannels() ([]discord.Channel, error)
- func (c *Client) Prune(guildID discord.GuildID, data PruneData) (uint, error)
- func (c *Client) PruneCount(guildID discord.GuildID, data PruneCountData) (uint, error)
- func (c *Client) PublicArchivedThreads(channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
- func (c *Client) PublicArchivedThreadsBefore(channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)deprecated
- func (c *Client) React(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) Reactions(channelID discord.ChannelID, messageID discord.MessageID, ...) ([]discord.User, error)
- func (c *Client) ReactionsAfter(channelID discord.ChannelID, messageID discord.MessageID, after discord.UserID, ...) ([]discord.User, error)
- func (c *Client) ReactionsBefore(channelID discord.ChannelID, messageID discord.MessageID, ...) ([]discord.User, error)
- func (c *Client) RemoveRecipient(channelID discord.ChannelID, userID discord.UserID) error
- func (c *Client) RemoveRole(guildID discord.GuildID, userID discord.UserID, roleID discord.RoleID, ...) error
- func (c *Client) RemoveThreadMember(threadID discord.ChannelID, userID discord.UserID) error
- func (c *Client) RespondInteraction(id discord.InteractionID, token string, resp InteractionResponse) error
- func (c *Client) Roles(guildID discord.GuildID) ([]discord.Role, error)
- func (c *Client) ScheduledEvent(guildID discord.GuildID, eventID discord.EventID, withUserCount bool) (*discord.GuildScheduledEvent, error)
- func (c *Client) Search(guildID discord.GuildID, data SearchData) (SearchResponse, error)
- func (c *Client) SearchDirectMessages(data SearchData) (SearchResponse, error)
- func (c *Client) SendEmbedReply(channelID discord.ChannelID, referenceID discord.MessageID, ...) (*discord.Message, error)
- func (c *Client) SendEmbeds(channelID discord.ChannelID, e ...discord.Embed) (*discord.Message, error)
- func (c *Client) SendMessage(channelID discord.ChannelID, content string, embeds ...discord.Embed) (*discord.Message, error)
- func (c *Client) SendMessageComplex(channelID discord.ChannelID, data SendMessageData) (*discord.Message, error)
- func (c *Client) SendMessageReply(channelID discord.ChannelID, content string, referenceID discord.MessageID, ...) (*discord.Message, error)
- func (c *Client) SendTextReply(channelID discord.ChannelID, content string, referenceID discord.MessageID) (*discord.Message, error)
- func (c *Client) SetNote(userID discord.UserID, note string) error
- func (c *Client) SetRelationship(userID discord.UserID, t discord.RelationshipType) error
- func (c *Client) StartThreadWithMessage(channelID discord.ChannelID, messageID discord.MessageID, data StartThreadData) (*discord.Channel, error)
- func (c *Client) StartThreadWithoutMessage(channelID discord.ChannelID, data StartThreadData) (*discord.Channel, error)
- func (c *Client) SyncIntegration(guildID discord.GuildID, integrationID discord.IntegrationID) error
- func (c *Client) TOTP(code, ticket string) (*LoginResponse, error)
- func (c *Client) ThreadMember(threadID discord.ChannelID, userID discord.UserID) (*discord.ThreadMember, error)
- func (c *Client) ThreadMembers(threadID discord.ChannelID) ([]discord.ThreadMember, error)
- func (c *Client) Typing(channelID discord.ChannelID) error
- func (c *Client) Unban(guildID discord.GuildID, userID discord.UserID, reason AuditLogReason) error
- func (c *Client) UnpinMessage(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) Unreact(channelID discord.ChannelID, messageID discord.MessageID, ...) error
- func (c *Client) UpdateStageInstance(channelID discord.ChannelID, data UpdateStageInstanceData) error
- func (c *Client) User(userID discord.UserID) (*discord.User, error)
- func (c *Client) UserConnections() ([]discord.Connection, error)
- func (c *Client) VoiceRegionsGuild(guildID discord.GuildID) ([]discord.VoiceRegion, error)
- func (c *Client) Webhook(webhookID discord.WebhookID) (*discord.Webhook, error)
- func (c *Client) WithContext(ctx context.Context) *Client
- func (c *Client) WithLocale(language discord.Language) *Client
- type CreateChannelData
- type CreateCommandData
- type CreateEmojiData
- type CreateGuildData
- type CreateInviteData
- type CreateRoleData
- type CreateScheduledEventData
- type CreateStageInstanceData
- type CreateWebhookData
- type DeleteAutoModerationRuleData
- type EditChannelPermissionData
- type EditInteractionResponseData
- type EditMessageData
- type EditScheduledEventData
- type GuildScheduledEventUser
- type GuildWidgetImageStyle
- type Image
- type ImageTooLargeError
- type InteractionResponse
- type InteractionResponseData
- type InteractionResponseFlagsdeprecated
- type InteractionResponseType
- type JoinedInvite
- type LoginResponse
- type ModifyAutoModerationRuleData
- type ModifyChannelData
- type ModifyCurrentUserData
- type ModifyEmojiData
- type ModifyGuildData
- type ModifyGuildWidgetData
- type ModifyIntegrationData
- type ModifyMemberData
- type ModifyRoleData
- type ModifyWebhookData
- type MoveChannelData
- type MoveChannelsData
- type MoveRoleData
- type MoveRolesData
- type PruneCountData
- type PruneData
- type SearchData
- type SearchResponse
- type SendMessageData
- type Session
- type SessionStartLimit
- type StartThreadData
- type UpdateStageInstanceData
Constants ¶
const AttachmentSpoilerPrefix = "SPOILER_"
const MaxGuildFetchLimit = 100
MaxGuildFetchLimit is the limit of max guilds per request, as imposed by Discord.
const MaxMemberFetchLimit = 1000
const MaxMessageReactionFetchLimit = 100
Variables ¶
var ( BaseEndpoint = "https://discord.com" Version = "9" Path = "/api/v" + Version Endpoint = BaseEndpoint + Path + "/" EndpointGateway = Endpoint + "gateway" EndpointGatewayBot = EndpointGateway + "/bot" )
var ( EndpointAuth = Endpoint + "auth/" EndpointLogin = EndpointAuth + "login" EndpointTOTP = EndpointAuth + "mfa/totp" )
var ( EndpointUsers = Endpoint + "users/" EndpointMe = EndpointUsers + "@me" )
var EndpointApplications = Endpoint + "applications/"
var EndpointChannels = Endpoint + "channels/"
var EndpointGuilds = Endpoint + "guilds/"
var EndpointInteractions = Endpoint + "interactions/"
var EndpointInvites = Endpoint + "invites/"
var EndpointStageInstances = Endpoint + "stage-instances/"
var EndpointWebhooks = Endpoint + "webhooks/"
var ErrEmptyMessage = errors.New("message is empty")
ErrEmptyMessage is returned if either a SendMessageData or an ExecuteWebhookData is missing content, embeds, and files.
var ErrInvalidImageCT = errors.New("unknown image content-type")
var ErrInvalidImageData = errors.New("invalid image data")
var NullImage = &Image{}
NullImage is an *Image value that marshals to a null value. Use this to unset the image. It exists mostly for documentation purposes.
var UserAgent = "DiscordBot (https://github.com/diamondburned/arikawa/v3)"
Functions ¶
Types ¶
type Ack ¶
type Ack struct {
Token *string `json:"token"`
}
Ack is the read state of a channel. This is undocumented.
type ActiveThreads ¶
type ActiveThreads struct { // Threads are the active threads, ordered by descending ID. Threads []discord.Channel `json:"threads"` // Members contains a thread member for each of the Threads the current // user has joined. Members []discord.ThreadMember `json:"members"` }
https://discord.com/developers/docs/resources/guild#list-active-threads-response-body
type AddMemberData ¶
type AddMemberData struct { // Token is an oauth2 access token granted with the guilds.join to the // bot's application for the user you want to add to the guild. Token string `json:"access_token"` // Nick is the value to set users nickname to. // // Requires MANAGE_NICKNAMES. Nick option.String `json:"nick,omitempty"` // Roles is an array of role ids the member is assigned. // // Requires MANAGE_ROLES. Roles *[]discord.RoleID `json:"roles,omitempty"` // Mute specifies whether the user is muted in voice channels. // // Requires MUTE_MEMBERS. Mute option.Bool `json:"mute,omitempty"` // Deaf specifies whether the user is deafened in voice channels. // // Requires DEAFEN_MEMBERS. Deaf option.Bool `json:"deaf,omitempty"` }
https://discord.com/developers/docs/resources/guild#add-guild-member-json-params
type AddRoleData ¶
type AddRoleData struct {
AuditLogReason
}
type AllowedMentionType ¶
type AllowedMentionType string
AllowedMentionType is a constant that tells Discord what is allowed to parse from a message content. This can help prevent things such as an unintentional @everyone mention.
const ( // AllowRoleMention makes Discord parse roles in the content. AllowRoleMention AllowedMentionType = "roles" // AllowUserMention makes Discord parse user mentions in the content. AllowUserMention AllowedMentionType = "users" // AllowEveryoneMention makes Discord parse @everyone mentions. AllowEveryoneMention AllowedMentionType = "everyone" )
https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types
type AllowedMentions ¶
type AllowedMentions struct { // Parse is an array of allowed mention types to parse from the content. Parse []AllowedMentionType `json:"parse"` // Roles is an array of role_ids to mention (Max size of 100). Roles []discord.RoleID `json:"roles,omitempty"` // Users is an array of user_ids to mention (Max size of 100). Users []discord.UserID `json:"users,omitempty"` // RepliedUser is used specifically for inline replies to specify, whether // to mention the author of the message you are replying to or not. RepliedUser option.Bool `json:"replied_user,omitempty"` }
AllowedMentions is a allowlist of mentions for a message.
Allowlists ¶
Roles and Users are slices that act as allowlists for IDs that are allowed to be mentioned. For example, if only 1 ID is provided in Users, then only that ID will be parsed in the message. No other IDs will be. The same example also applies for roles.
If Parse is an empty slice and both Users and Roles are empty slices, then no mentions will be parsed.
Constraints ¶
If the Users slice is not empty, then Parse must not have AllowUserMention. Likewise, if the Roles slice is not empty, then Parse must not have AllowRoleMention. This is because everything provided in Parse will make Discord parse it completely, meaning they would be mutually exclusive with Roles and Users.
https://discord.com/developers/docs/resources/channel#allowed-mentions-object
func (AllowedMentions) Verify ¶
func (am AllowedMentions) Verify() error
Verify checks the AllowedMentions against constraints mentioned in AllowedMentions' documentation. This will be called on SendMessageComplex.
type ArchivedThreads ¶ added in v3.2.0
type ArchivedThreads struct { ActiveThreads // More specifies whether there are potentially additional threads that // could be returned on a subsequent call. More bool `json:"has_more"` }
https://discord.com/developers/docs/resources/channel#list-public-archived-threads-response-body and https://discord.com/developers/docs/resources/channel#list-private-archived-threads-response-body and https://discord.com/developers/docs/resources/channel#list-private-archived-threads-response-body
type AuditLogData ¶
type AuditLogData struct { // UserID filters the log for actions made by a user. UserID discord.UserID `schema:"user_id,omitempty"` // ActionType is the type of audit log event. ActionType discord.AuditLogEvent `schema:"action_type,omitempty"` // Before filters the log before a certain entry ID. Before discord.AuditLogEntryID `schema:"before,omitempty"` // Limit limits how many entries are returned (default 50, minimum 1, // maximum 100). Limit uint `schema:"limit"` }
https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters
type AuditLogReason ¶
type AuditLogReason string
AuditLogReason is the type embedded in data structs when the action performed by calling that api endpoint supports attaching a custom audit log reason.
func (AuditLogReason) Header ¶
func (r AuditLogReason) Header() http.Header
Header returns a http.Header containing the reason, or nil if the reason is empty.
type AutocompleteChoices ¶
type AutocompleteChoices interface {
// contains filtered or unexported methods
}
AutocompleteChoices are the choices to send back to Discord when sending a ApplicationCommandAutocompleteResult interaction response.
The following types implement this interface:
- AutocompleteStringChoices
- AutocompleteIntegerChoices
- AutocompleteNumberChoices
type AutocompleteIntegerChoices ¶
type AutocompleteIntegerChoices []discord.IntegerChoice
AutocompleteIntegerChoices are integer choices to send back to Discord as autocomplete results.
type AutocompleteNumberChoices ¶
type AutocompleteNumberChoices []discord.NumberChoice
AutocompleteNumberChoices are number choices to send back to Discord as autocomplete results.
type AutocompleteStringChoices ¶
type AutocompleteStringChoices []discord.StringChoice
AutocompleteStringChoices are string choices to send back to Discord as autocomplete results.
type BanData ¶
type BanData struct { // DeleteDays is the number of days to delete messages for (0-7). DeleteDays option.Uint `schema:"delete_message_days,omitempty"` AuditLogReason `schema:"-"` }
https://discord.com/developers/docs/resources/guild#create-guild-ban-query-string-params
type BatchEditCommandPermissionsData ¶
type BatchEditCommandPermissionsData struct { ID discord.CommandID `json:"id"` Permissions []discord.CommandPermissions `json:"permissions"` }
type BotData ¶
type BotData struct { URL string `json:"url"` Shards int `json:"shards,omitempty"` StartLimit *SessionStartLimit `json:"session_start_limit"` }
BotData contains the GatewayURL as well as extra metadata on how to shard bots.
type Client ¶
type Client struct { *httputil.Client *Session AcquireOptions rate.AcquireOptions }
func (*Client) Ack ¶
Ack marks the read state of a channel. This is undocumented. The method will write to the ack variable passed in. If this method is called asynchronously, then ack should be mutex guarded.
func (*Client) ActiveThreads ¶
func (c *Client) ActiveThreads(guildID discord.GuildID) (*ActiveThreads, error)
ActiveThreads returns all the active threads in the guild, including public and private threads.
func (*Client) AddMember ¶
func (c *Client) AddMember( guildID discord.GuildID, userID discord.UserID, data AddMemberData) (*discord.Member, error)
AddMember adds a user to the guild, provided you have a valid oauth2 access token for the user with the guilds.join scope. Returns a 201 Created with the guild member as the body, or 204 No Content if the user is already a member of the guild.
Fires a Guild Member Add Gateway event.
The Authorization header must be a Bot token (belonging to the same application used for authorization), and the bot must be a member of the guild with CREATE_INSTANT_INVITE permission.
func (*Client) AddRecipient ¶
func (c *Client) AddRecipient( channelID discord.ChannelID, userID discord.UserID, accessToken, nickname string) error
AddRecipient adds a user to a group direct message. As accessToken is needed, clearly this endpoint should only be used for OAuth. AccessToken can be obtained with the "gdm.join" scope.
func (*Client) AddRole ¶
func (c *Client) AddRole( guildID discord.GuildID, userID discord.UserID, roleID discord.RoleID, data AddRoleData) error
AddRole adds a role to a guild member.
Requires the MANAGE_ROLES permission.
func (*Client) AddThreadMember ¶
AddThreadMember adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived.
Fires a Thread Members Update Gateway event.
func (*Client) AttachIntegration ¶
func (c *Client) AttachIntegration( guildID discord.GuildID, integrationID discord.IntegrationID, integrationType discord.Service) error
AttachIntegration attaches an integration object from the current user to the guild.
Requires the MANAGE_GUILD permission.
Fires a Guild Integrations Update Gateway event.
func (*Client) AuditLog ¶
AuditLog returns an audit log object for the guild.
Requires the VIEW_AUDIT_LOG permission.
func (*Client) Ban ¶
Ban creates a guild ban, and optionally delete previous messages sent by the banned user.
Requires the BAN_MEMBERS permission.
Fires a Guild Ban Add Gateway event.
func (*Client) Bans ¶
Bans returns a list of ban objects for the users banned from this guild.
Requires the BAN_MEMBERS permission.
func (*Client) BatchEditCommandPermissions ¶
func (c *Client) BatchEditCommandPermissions( appID discord.AppID, guildID discord.GuildID, data []BatchEditCommandPermissionsData) ([]discord.GuildCommandPermissions, error)
BatchEditCommandPermissions batch edits permissions for all commands in a guild. Up to 10 permission overwrites can be added for a command.
Existing permissions for the command will be overwritten in that guild. Deleting or renaming a command will permanently delete all permissions for that command.
func (*Client) BotURL ¶
BotURL fetches the Gateway URL along with extra metadata. The token passed in will NOT be prefixed with Bot.
func (*Client) BulkOverwriteCommands ¶
func (c *Client) BulkOverwriteCommands( appID discord.AppID, commands []CreateCommandData) ([]discord.Command, error)
BulkOverwriteCommands takes a slice of application commands, overwriting existing commands that are registered globally for this application. Updates will be available in all guilds after 1 hour.
Commands that do not already exist will count toward daily application command create limits.
func (*Client) BulkOverwriteGuildCommands ¶
func (c *Client) BulkOverwriteGuildCommands( appID discord.AppID, guildID discord.GuildID, commands []CreateCommandData) ([]discord.Command, error)
BulkOverwriteGuildCommands takes a slice of application commands, overwriting existing commands that are registered for the guild.
func (*Client) ChannelInvites ¶
ChannelInvites returns a list of invite objects (with invite metadata) for the channel. Only usable for guild channels.
Requires the MANAGE_CHANNELS permission.
func (*Client) ChannelWebhooks ¶
ChannelWebhooks returns the webhooks of the channel with the given ID.
Requires the MANAGE_WEBHOOKS permission.
func (*Client) CommandPermissions ¶
func (c *Client) CommandPermissions( appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID) (*discord.GuildCommandPermissions, error)
CommandPermissions fetches command permissions for a specific command for the application in a guild.
func (*Client) CreateAutoModerationRule ¶ added in v3.4.0
func (c *Client) CreateAutoModerationRule(guildID discord.GuildID, rule discord.AutoModerationRule) (*discord.AutoModerationRule, error)
CreateAutoModerationRule creates a new rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Create Gateway event.
This endpoint requires the MANAGE_GUILD permission.
This endpoint supports the X-Audit-Log-Reason header.
func (*Client) CreateChannel ¶
func (c *Client) CreateChannel( guildID discord.GuildID, data CreateChannelData) (*discord.Channel, error)
CreateChannel creates a new channel object for the guild.
Requires the MANAGE_CHANNELS permission. If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. Setting MANAGE_ROLES permission in channels is only possible for guild administrators. Returns the new channel object on success.
Fires a ChannelCreate Gateway event.
func (*Client) CreateCommand ¶
func (*Client) CreateEmoji ¶
func (c *Client) CreateEmoji( guildID discord.GuildID, data CreateEmojiData) (*discord.Emoji, error)
CreateEmoji creates a new emoji in the guild. This endpoint requires MANAGE_EMOJIS. ContentType must be "image/jpeg", "image/png", or "image/gif". However, ContentType can also be automatically detected (though shouldn't be relied on).
Emojis and animated emojis have a maximum file size of 256kb.
func (*Client) CreateGuild ¶
func (c *Client) CreateGuild(data CreateGuildData) (*discord.Guild, error)
CreateGuild creates a new guild. Returns a guild object on success. Fires a Guild Create Gateway event.
This endpoint can be used only by bots in less than 10 guilds.
func (*Client) CreateGuildCommand ¶
func (*Client) CreateInteractionFollowup
deprecated
func (*Client) CreateInvite ¶
func (c *Client) CreateInvite( channelID discord.ChannelID, data CreateInviteData) (*discord.Invite, error)
CreateInvite creates a new invite object for the channel. Only usable for guild channels.
Requires the CREATE_INSTANT_INVITE permission.
func (*Client) CreatePrivateChannel ¶
CreatePrivateChannel creates a new DM channel with a user.
func (*Client) CreateRole ¶
CreateRole creates a new role for the guild.
Requires the MANAGE_ROLES permission.
Fires a Guild Role Create Gateway event.
func (*Client) CreateScheduledEvent ¶
func (c *Client) CreateScheduledEvent(guildID discord.GuildID, reason AuditLogReason, data CreateScheduledEventData) (*discord.GuildScheduledEvent, error)
CreateScheduledEvent creates a new scheduled event.
https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
func (*Client) CreateStageInstance ¶
func (c *Client) CreateStageInstance( data CreateStageInstanceData) (*discord.StageInstance, error)
CreateStageInstance creates a new Stage instance associated to a Stage channel.
It requires the user to be a moderator of the Stage channel.
func (*Client) CreateWebhook ¶
func (c *Client) CreateWebhook( channelID discord.ChannelID, data CreateWebhookData) (*discord.Webhook, error)
CreateWebhook creates a new webhook.
Webhooks cannot be named "clyde".
Requires the MANAGE_WEBHOOKS permission.
func (*Client) CrosspostMessage ¶
func (c *Client) CrosspostMessage( channelID discord.ChannelID, messageID discord.MessageID) (*discord.Message, error)
CrosspostMessage crossposts a message in a news channel to following channels. This endpoint requires the SEND_MESSAGES permission if the current user sent the message, or additionally the MANAGE_MESSAGES permission for all other messages.
func (*Client) CurrentApplication ¶
func (c *Client) CurrentApplication() (*discord.Application, error)
CurrentApplication returns the current bot account's Discord application. It can be used to get the application ID.
func (*Client) DeleteAllReactions ¶
func (c *Client) DeleteAllReactions( channelID discord.ChannelID, messageID discord.MessageID) error
DeleteAllReactions deletes all reactions on a message.
This endpoint requires the MANAGE_MESSAGES permission to be present on the current user.
Fires a Message Reaction Remove All Gateway event.
func (*Client) DeleteAutoModerationRule ¶ added in v3.4.0
func (c *Client) DeleteAutoModerationRule(GuildID discord.GuildID, RuleID discord.AutoModerationRuleID, data DeleteAutoModerationRuleData) error
DeleteAutoModerationRule deletes a rule. Returns a 204 on success. Fires an Auto Moderation Rule Delete Gateway event.
This endpoint requires the MANAGE_GUILD permission.
This endpoint supports the X-Audit-Log-Reason header.
func (*Client) DeleteChannel ¶
func (c *Client) DeleteChannel( channelID discord.ChannelID, reason AuditLogReason) error
DeleteChannel deletes a channel, or closes a private message. Requires the MANAGE_CHANNELS permission for the guild. Deleting a category does not delete its child channels: they will have their parent_id removed and a Channel Update Gateway event will fire for each of them.
Fires a Channel Delete Gateway event.
func (*Client) DeleteChannelPermission ¶
func (c *Client) DeleteChannelPermission( channelID discord.ChannelID, overwriteID discord.Snowflake, reason AuditLogReason) error
DeleteChannelPermission deletes a channel permission overwrite for a user or role in a channel. Only usable for guild channels.
Requires the MANAGE_ROLES permission.
func (*Client) DeleteCommand ¶
func (*Client) DeleteEmoji ¶
func (c *Client) DeleteEmoji( guildID discord.GuildID, emojiID discord.EmojiID, reason AuditLogReason) error
DeleteEmoji deletes the given emoji.
Requires the MANAGE_EMOJIS permission.
Fires a Guild Emojis Update Gateway event.
func (*Client) DeleteGuild ¶
DeleteGuild deletes a guild permanently. The User must be owner.
Fires a Guild Delete Gateway event.
func (*Client) DeleteGuildCommand ¶
func (*Client) DeleteInteractionFollowup ¶
func (c *Client) DeleteInteractionFollowup( appID discord.AppID, messageID discord.MessageID, token string) error
DeleteInteractionFollowup deletes a followup message for an interaction.
func (*Client) DeleteInteractionResponse ¶
DeleteInteractionResponse deletes the initial interaction response.
func (*Client) DeleteInvite ¶
DeleteInvite deletes an invite.
Requires the MANAGE_CHANNELS permission on the channel this invite belongs to, or MANAGE_GUILD to remove any invite across the guild.
Fires an Invite Delete Gateway event.
func (*Client) DeleteMessage ¶
func (c *Client) DeleteMessage( channelID discord.ChannelID, messageID discord.MessageID, reason AuditLogReason) error
DeleteMessage delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the MANAGE_MESSAGES permission.
func (*Client) DeleteMessages ¶
func (c *Client) DeleteMessages( channelID discord.ChannelID, messageIDs []discord.MessageID, reason AuditLogReason) error
DeleteMessages deletes multiple messages in a single request. This endpoint can only be used on guild channels and requires the MANAGE_MESSAGES permission. This endpoint only works for bots.
This endpoint will not delete messages older than 2 weeks, and will fail if any message provided is older than that or if any duplicate message IDs are provided.
Because the underlying endpoint only supports a maximum of 100 message IDs per request, DeleteMessages will make a total of messageIDs/100 rounded up requests.
Fires a Message Delete Bulk Gateway event.
func (*Client) DeleteReactions ¶
func (c *Client) DeleteReactions( channelID discord.ChannelID, messageID discord.MessageID, emoji discord.APIEmoji) error
DeleteReactions deletes all the reactions for a given emoji on a message.
This endpoint requires the MANAGE_MESSAGES permission to be present on the current user.
Fires a Message Reaction Remove Emoji Gateway event.
func (*Client) DeleteRelationship ¶
DeleteRelationship deletes the relationship between the current user and the given user.
func (*Client) DeleteRole ¶
func (c *Client) DeleteRole( guildID discord.GuildID, roleID discord.RoleID, reason AuditLogReason) error
DeleteRole deletes a guild role.
Requires the MANAGE_ROLES permission.
func (*Client) DeleteScheduledEvent ¶
DeleteScheduledEvent deletes a scheduled event.
https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event
func (*Client) DeleteStageInstance ¶
func (c *Client) DeleteStageInstance(channelID discord.ChannelID, reason AuditLogReason) error
func (*Client) DeleteUserReaction ¶
func (c *Client) DeleteUserReaction( channelID discord.ChannelID, messageID discord.MessageID, userID discord.UserID, emoji discord.APIEmoji) error
DeleteUserReaction deletes another user's reaction.
This endpoint requires the MANAGE_MESSAGES permission to be present on the current user.
func (*Client) DeleteWebhook ¶
DeleteWebhook deletes a webhook permanently.
Requires the MANAGE_WEBHOOKS permission.
func (*Client) EditChannelPermission ¶
func (c *Client) EditChannelPermission( channelID discord.ChannelID, overwriteID discord.Snowflake, data EditChannelPermissionData) error
EditChannelPermission edits the channel's permission overwrites for a user or role in a channel. Only usable for guild channels.
Requires the MANAGE_ROLES permission.
func (*Client) EditCommand ¶
func (*Client) EditCommandPermissions ¶
func (c *Client) EditCommandPermissions( appID discord.AppID, guildID discord.GuildID, commandID discord.CommandID, permissions []discord.CommandPermissions) (*discord.GuildCommandPermissions, error)
EditCommandPermissions edits command permissions for a specific command for the application in a guild. Up to 10 permission overwrites can be added for a command.
Existing permissions for the command will be overwritten in that guild. Deleting or renaming a command will permanently delete all permissions for that command.
func (*Client) EditEmbeds ¶
func (c *Client) EditEmbeds( channelID discord.ChannelID, messageID discord.MessageID, embeds ...discord.Embed) (*discord.Message, error)
EditEmbeds edits the embed of a previously sent message. For more documentation, refer to EditMessageComplex.
func (*Client) EditGuildCommand ¶
func (*Client) EditInteractionFollowup ¶
func (*Client) EditInteractionResponse ¶
func (c *Client) EditInteractionResponse( appID discord.AppID, token string, data EditInteractionResponseData) (*discord.Message, error)
EditInteractionResponse edits the initial Interaction response.
func (*Client) EditMessage ¶
func (c *Client) EditMessage( channelID discord.ChannelID, messageID discord.MessageID, content string, embeds ...discord.Embed) (*discord.Message, error)
EditMessage edits a previously sent message. If content or embeds are empty the original content or embed will remain untouched. This means EditMessage will only update, but not remove parts of the message.
For more documentation, refer to EditMessageComplex.
func (*Client) EditMessageComplex ¶
func (c *Client) EditMessageComplex( channelID discord.ChannelID, messageID discord.MessageID, data EditMessageData) (*discord.Message, error)
EditMessageComplex edits a previously sent message. The fields Content, Embed, AllowedMentions and Flags can be edited by the original message author. Other users can only edit flags and only if they have the MANAGE_MESSAGES permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only flags documented in EditMessageData may be modified by users (unsupported flag changes are currently ignored without error).
Fires a Message Update Gateway event.
func (*Client) EditScheduledEvent ¶
func (c *Client) EditScheduledEvent(guildID discord.GuildID, eventID discord.EventID, reason AuditLogReason, data EditScheduledEventData) (*discord.GuildScheduledEvent, error)
EditScheduledEvent modifies the attributes of a scheduled event.
https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
func (*Client) EditText ¶
func (c *Client) EditText( channelID discord.ChannelID, messageID discord.MessageID, content string) (*discord.Message, error)
EditText edits the contents of a previously sent message. For more documentation, refer to EditMessageComplex.
func (*Client) FollowUpInteraction ¶ added in v3.1.0
func (c *Client) FollowUpInteraction( appID discord.AppID, token string, data InteractionResponseData) (*discord.Message, error)
FollowUpInteraction creates a followup message for an interaction.
func (*Client) GetAutoModerationRule ¶ added in v3.4.0
func (c *Client) GetAutoModerationRule(guildID discord.GuildID, ruleID discord.AutoModerationRuleID) (discord.AutoModerationRule, error)
GetAutoModerationRule gets a single rule. Returns an auto moderation rule object.
This endpoint requires the MANAGE_GUILD permission.
func (*Client) GetBan ¶
GetBan returns a ban object for the given user.
Requires the BAN_MEMBERS permission.
func (*Client) Guild ¶
Guild returns the guild object for the given id.
ApproximateMembers and ApproximatePresences will not be set.
func (*Client) GuildCommand ¶
func (*Client) GuildCommandPermissions ¶
func (c *Client) GuildCommandPermissions( appID discord.AppID, guildID discord.GuildID) ([]discord.GuildCommandPermissions, error)
GuildCommandPermissions fetches command permissions for all commands for the application in a guild.
func (*Client) GuildCommands ¶
func (*Client) GuildInvites ¶
GuildInvites returns a list of invite objects (with invite metadata) for the guild.
Requires the MANAGE_GUILD permission.
func (*Client) GuildPreview ¶
GuildPreview returns the guild preview object for the given id, even if the user is not in the guild.
This endpoint is only for public guilds.
func (*Client) GuildVanityInvite ¶
GuildVanityInvite returns the vanity invite for guilds that have that feature enabled. Only Code and Uses are filled. Code will be "" if a vanity url for the guild is not set.
Requires MANAGE_GUILD.
func (*Client) GuildWebhooks ¶
GuildWebhooks returns the webhooks of the guild with the given ID.
Requires the MANAGE_WEBHOOKS permission.
func (*Client) GuildWidget ¶
GuildWidget returns the widget for the guild.
func (*Client) GuildWidgetImage ¶
func (c *Client) GuildWidgetImage( guildID discord.GuildID, img GuildWidgetImageStyle) (io.ReadCloser, error)
GuildWidgetImage returns a PNG image widget for the guild. Requires no permissions or authentication.
func (*Client) GuildWidgetImageURL ¶
func (c *Client) GuildWidgetImageURL(guildID discord.GuildID, img GuildWidgetImageStyle) string
GuildWidgetImageURL returns a link to the PNG image widget for the guild.
Requires no permissions or authentication.
func (*Client) GuildWidgetSettings ¶
func (c *Client) GuildWidgetSettings( guildID discord.GuildID) (*discord.GuildWidgetSettings, error)
GuildWidgetSettings returns the guild widget object.
Requires the MANAGE_GUILD permission.
func (*Client) GuildWithCount ¶
GuildWithCount returns the guild object for the given id. This will also set the ApproximateMembers and ApproximatePresences fields of the guild struct.
func (*Client) Guilds ¶
Guilds returns a list of partial guild objects the current user is a member of. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all guilds the user has joined.
As the underlying endpoint has a maximum of 100 guilds per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more guilds are available.
When fetching the guilds, those with the smallest ID will be fetched first.
Also note that 100 is the maximum number of guilds a non-bot user can join. Therefore, pagination is not needed for integrations that need to get a list of the users' guilds.
Requires the guilds OAuth2 scope.
func (*Client) GuildsAfter ¶
GuildsAfter returns a list of partial guild objects the current user is a member of. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all guilds with an id higher than after.
As the underlying endpoint has a maximum of 100 guilds per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more guilds are available.
Requires the guilds OAuth2 scope.
func (*Client) GuildsBefore ¶
GuildsBefore returns a list of partial guild objects the current user is a member of. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all guilds with an id smaller than before.
As the underlying endpoint has a maximum of 100 guilds per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more guilds are available.
Requires the guilds OAuth2 scope.
func (*Client) InjectRequest ¶
func (c *Client) InjectRequest(r httpdriver.Request) error
func (*Client) Integrations ¶
Integrations returns a list of integration objects for the guild.
Requires the MANAGE_GUILD permission.
func (*Client) InteractionResponse ¶
InteractionResponse returns the initial interaction response.
func (*Client) Invite ¶
Invite returns an invite object for the given code.
ApproxMembers will not get filled.
func (*Client) InviteWithCounts ¶
InviteWithCounts returns an invite object for the given code and fills ApproxMembers.
func (*Client) JoinInvite ¶
func (c *Client) JoinInvite(code string) (*JoinedInvite, error)
JoinInvite joins a guild using the given invite code. This endpoint is undocumented.
func (*Client) JoinThread ¶
JoinThread adds the current user to a thread. Also requires the thread is not archived.
Fires a Thread Members Update Gateway event.
func (*Client) JoinedPrivateArchivedThreads ¶ added in v3.2.0
func (c *Client) JoinedPrivateArchivedThreads( channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
JoinedPrivateArchivedThreads returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD, and the user has joined.
Threads are ordered by their ID, in descending order.
Requires the READ_MESSAGE_HISTORY permission
func (*Client) JoinedPrivateArchivedThreadsBefore
deprecated
func (c *Client) JoinedPrivateArchivedThreadsBefore( channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
JoinedPrivateArchivedThreadsBefore returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD, and the user has joined.
Deprecated: Use JoinedPrivateArchivedThreads instead.
func (*Client) Kick ¶
Kick removes a member from a guild.
Requires KICK_MEMBERS permission.
Fires a Guild Member Remove Gateway event.
func (*Client) LeaveGuild ¶
LeaveGuild leaves a guild.
func (*Client) LeaveThread ¶
LeaveThread removes the current user from a thread. Also requires the thread is not archived.
Fires a Thread Members Update Gateway event.
func (*Client) ListAutoModerationRules ¶ added in v3.4.0
func (c *Client) ListAutoModerationRules(guildID discord.GuildID) ([]discord.AutoModerationRule, error)
ListAutoModerationRules gets a list of all rules currently configured for the guild. Returns a list of auto moderation rule objects for the given guild.
This endpoint requires the MANAGE_GUILD permission.
func (*Client) ListScheduledEventUsers ¶
func (c *Client) ListScheduledEventUsers( guildID discord.GuildID, eventID discord.EventID, limit option.NullableInt, withMember bool, before, after discord.UserID) ([]GuildScheduledEventUser, error)
ListScheduledEventUsers returns a list of users currently in a scheduled event.
https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
func (*Client) ListScheduledEvents ¶
func (c *Client) ListScheduledEvents(guildID discord.GuildID, withUserCount bool) ([]discord.GuildScheduledEvent, error)
ListScheduledEvents lists the scheduled events in a guild.
https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
func (*Client) Me ¶
Me returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.
func (*Client) Members ¶
Members returns a list of members of the guild with the passed id. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all members in the guild.
As the underlying endpoint has a maximum of 1000 members per request, at maximum a total of limit/1000 rounded up requests will be made, although they may be less if no more members are available.
When fetching the members, those with the smallest ID will be fetched first.
func (*Client) MembersAfter ¶
func (c *Client) MembersAfter( guildID discord.GuildID, after discord.UserID, limit uint) ([]discord.Member, error)
MembersAfter returns a list of members of the guild with the passed id. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all members with an id higher than after.
As the underlying endpoint has a maximum of 1000 members per request, at maximum a total of limit/1000 rounded up requests will be made, although they may be less, if no more members are available.
func (*Client) Message ¶
func (c *Client) Message( channelID discord.ChannelID, messageID discord.MessageID) (*discord.Message, error)
Message returns a specific message in the channel.
If operating on a guild channel, this endpoint requires the READ_MESSAGE_HISTORY permission to be present on the current user.
func (*Client) Messages ¶
Messages returns a slice filled with the most recent messages sent in the channel with the passed ID. The method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all messages in the channel.
As the underlying endpoint is capped at a maximum of 100 messages per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more messages are available.
When fetching the messages, those with the highest ID, will be fetched first. The returned slice will be sorted from latest to oldest.
func (*Client) MessagesAfter ¶
func (c *Client) MessagesAfter( channelID discord.ChannelID, after discord.MessageID, limit uint) ([]discord.Message, error)
MessagesAfter returns a slice filled with the messages sent in the channel with the passed ID. The method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all messages in the channel with an id higher than after.
As the underlying endpoint has a maximum of 100 messages per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more messages are available.
The returned slice will be sorted from latest to oldest.
func (*Client) MessagesAround ¶
func (c *Client) MessagesAround( channelID discord.ChannelID, around discord.MessageID, limit uint) ([]discord.Message, error)
MessagesAround returns messages around the ID, with a limit of 100.
func (*Client) MessagesBefore ¶
func (c *Client) MessagesBefore( channelID discord.ChannelID, before discord.MessageID, limit uint) ([]discord.Message, error)
MessagesBefore returns a slice filled with the messages sent in the channel with the passed id. The method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all messages in the channel with an id smaller than before.
As the underlying endpoint has a maximum of 100 messages per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more messages are available.
The returned slice will be sorted from latest to oldest.
func (*Client) ModifyAutoModerationRule ¶ added in v3.4.0
func (c *Client) ModifyAutoModerationRule(GuildID discord.GuildID, RuleID discord.AutoModerationRuleID, data ModifyAutoModerationRuleData) (*discord.AutoModerationRule, error)
ModifyAutoModerationRule modifies an existing rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Update Gateway event.
Requires MANAGE_GUILD permissions.
All parameters for this endpoint are optional.
This endpoint supports the X-Audit-Log-Reason header.
func (*Client) ModifyChannel ¶
func (c *Client) ModifyChannel(channelID discord.ChannelID, data ModifyChannelData) error
ModifyChannel updates a channel's settings.
If modifying a guild channel, requires the MANAGE_CHANNELS permission for that guild. If modifying a thread, requires the MANAGE_THREADS permission. Furthermore, if modifying permission overwrites, the MANAGE_ROLES permission is required. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel).
Fires a Channel Update event when modifying a guild channel, and a Thread Update event when modifying a thread.
func (*Client) ModifyCurrentMember ¶
ModifyCurrentMember modifies the nickname of the current user in a guild.
Fires a Guild Member Update Gateway event.
func (*Client) ModifyCurrentUser ¶
func (c *Client) ModifyCurrentUser(data ModifyCurrentUserData) (*discord.User, error)
ModifyCurrentUser modifies the requester's user account settings.
func (*Client) ModifyEmoji ¶
func (c *Client) ModifyEmoji( guildID discord.GuildID, emojiID discord.EmojiID, data ModifyEmojiData) error
ModifyEmoji changes an existing emoji. This requires MANAGE_EMOJIS. Name and roles are optional fields (though you'd want to change either though).
Fires a Guild Emojis Update Gateway event.
func (*Client) ModifyGuild ¶
ModifyGuild modifies a guild's settings.
Requires the MANAGE_GUILD permission.
Fires a Guild Update Gateway event.
func (*Client) ModifyGuildWidget ¶
func (c *Client) ModifyGuildWidget( guildID discord.GuildID, data ModifyGuildWidgetData) (*discord.GuildWidgetSettings, error)
ModifyGuildWidget modifies a guild widget object for the guild.
Requires the MANAGE_GUILD permission.
func (*Client) ModifyIntegration ¶
func (c *Client) ModifyIntegration( guildID discord.GuildID, integrationID discord.IntegrationID, data ModifyIntegrationData) error
ModifyIntegration modifies the behavior and settings of an integration object for the guild.
Requires the MANAGE_GUILD permission. Fires a Guild Integrations Update Gateway event.
func (*Client) ModifyMember ¶
func (c *Client) ModifyMember( guildID discord.GuildID, userID discord.UserID, data ModifyMemberData) error
ModifyMember modifies attributes of a guild member. If the channel_id is set to null, this will force the target user to be disconnected from voice.
Fires a Guild Member Update Gateway event.
func (*Client) ModifyRole ¶
func (c *Client) ModifyRole( guildID discord.GuildID, roleID discord.RoleID, data ModifyRoleData) (*discord.Role, error)
ModifyRole modifies a guild role.
Requires the MANAGE_ROLES permission.
func (*Client) ModifyWebhook ¶
func (c *Client) ModifyWebhook( webhookID discord.WebhookID, data ModifyWebhookData) (*discord.Webhook, error)
ModifyWebhook modifies a webhook.
Requires the MANAGE_WEBHOOKS permission.
func (*Client) MoveChannels ¶
func (c *Client) MoveChannels(guildID discord.GuildID, data MoveChannelsData) error
MoveChannels modifies the position of channels in the guild.
Requires MANAGE_CHANNELS.
Fires multiple Channel Update Gateway events.
func (*Client) MoveRoles ¶
MoveRoles modifies the positions of a set of role objects for the guild.
Requires the MANAGE_ROLES permission.
Fires multiple Guild Role Update Gateway events.
func (*Client) Note ¶
Note gets the note for the given user. This endpoint is undocumented and might only work for user accounts.
func (*Client) OnResponse ¶
func (c *Client) OnResponse(r httpdriver.Request, resp httpdriver.Response) error
func (*Client) PinMessage ¶
func (c *Client) PinMessage( channelID discord.ChannelID, messageID discord.MessageID, reason AuditLogReason) error
PinMessage pins a message in a channel.
Requires the MANAGE_MESSAGES permission.
func (*Client) PinnedMessages ¶
PinnedMessages returns all pinned messages in the channel as an array of message objects.
func (*Client) PrivateArchivedThreads ¶ added in v3.2.0
func (c *Client) PrivateArchivedThreads( channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
PrivateArchivedThreads returns archived threads in the channel that are of type GUILD_PRIVATE_THREAD.
Threads are ordered by ArchiveTimestamp, in descending order.
Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.
func (*Client) PrivateArchivedThreadsBefore
deprecated
func (*Client) PrivateChannels ¶
PrivateChannels returns a list of DM channel objects. For bots, this is no longer a supported method of getting recent DMs, and will return an empty array.
func (*Client) Prune ¶
Prune begins a prune. Days must be 1 or more, default 7.
By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the IncludedRoles parameter. Any inactive user that has a subset of the provided role(s) will be included in the prune and users with additional roles will not.
Requires KICK_MEMBERS.
Fires multiple Guild Member Remove Gateway events.
func (*Client) PruneCount ¶
PruneCount returns the number of members that would be removed in a prune operation. Days must be 1 or more, default 7.
By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the IncludedRoles parameter. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.
Requires KICK_MEMBERS.
func (*Client) PublicArchivedThreads ¶ added in v3.2.0
func (c *Client) PublicArchivedThreads( channelID discord.ChannelID, before discord.Timestamp, limit uint) (*ArchivedThreads, error)
PublicArchivedThreads returns archived threads in the channel that are public.
When called on a GUILD_TEXT channel, returns threads of type GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel returns threads of type GUILD_NEWS_THREAD.
Threads are ordered by ArchiveTimestamp, in descending order.
Requires the READ_MESSAGE_HISTORY permission.
func (*Client) PublicArchivedThreadsBefore
deprecated
func (*Client) React ¶
func (c *Client) React( channelID discord.ChannelID, messageID discord.MessageID, emoji discord.APIEmoji) error
React creates a reaction for the message.
This endpoint requires the READ_MESSAGE_HISTORY permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the 'ADD_REACTIONS' permission to be present on the current user.
func (*Client) Reactions ¶
func (c *Client) Reactions( channelID discord.ChannelID, messageID discord.MessageID, emoji discord.APIEmoji, limit uint) ([]discord.User, error)
Reactions returns a list of users that reacted with the passed Emoji. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all users within the passed range.
As the underlying endpoint has a maximum of 100 users per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more guilds are available.
When fetching the users, those with the smallest ID will be fetched first.
func (*Client) ReactionsAfter ¶
func (c *Client) ReactionsAfter( channelID discord.ChannelID, messageID discord.MessageID, after discord.UserID, emoji discord.APIEmoji, limit uint) ([]discord.User, error)
ReactionsAfter returns a list of users that reacted with the passed Emoji. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all users with an id higher than after.
As the underlying endpoint has a maximum of 100 users per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more guilds are available.
func (*Client) ReactionsBefore ¶
func (c *Client) ReactionsBefore( channelID discord.ChannelID, messageID discord.MessageID, before discord.UserID, emoji discord.APIEmoji, limit uint) ([]discord.User, error)
ReactionsBefore returns a list of users that reacted with the passed Emoji. This method automatically paginates until it reaches the passed limit, or, if the limit is set to 0, has fetched all users with an id smaller than before.
As the underlying endpoint has a maximum of 100 users per request, at maximum a total of limit/100 rounded up requests will be made, although they may be less, if no more guilds are available.
func (*Client) RemoveRecipient ¶
RemoveRecipient removes a user from a group direct message.
func (*Client) RemoveRole ¶
func (c *Client) RemoveRole( guildID discord.GuildID, userID discord.UserID, roleID discord.RoleID, reason AuditLogReason) error
RemoveRole removes a role from a guild member.
Requires the MANAGE_ROLES permission.
Fires a Guild Member Update Gateway event.
func (*Client) RemoveThreadMember ¶
RemoveThreadMember removes another member from a thread. Requires the MANAGE_THREADS permission, or the creator of the thread if it is a discord.GuildPrivateThread. Also requires the thread is not archived.
Fires a Thread Members Update Gateway event.
func (*Client) RespondInteraction ¶
func (c *Client) RespondInteraction( id discord.InteractionID, token string, resp InteractionResponse) error
RespondInteraction responds to an incoming interaction. It is also known as an "interaction callback".
func (*Client) ScheduledEvent ¶
func (c *Client) ScheduledEvent(guildID discord.GuildID, eventID discord.EventID, withUserCount bool) (*discord.GuildScheduledEvent, error)
ScheduledEvent retrieves the information on the scheduled event
https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
func (*Client) Search ¶
func (c *Client) Search(guildID discord.GuildID, data SearchData) (SearchResponse, error)
Search searches through a guild's messages. It only works for user accounts.
func (*Client) SearchDirectMessages ¶ added in v3.4.0
func (c *Client) SearchDirectMessages(data SearchData) (SearchResponse, error)
SearchDirectMessages searches through a direct message channel. SearchData.ChannelID must be a valid channel ID.
func (*Client) SendEmbedReply ¶
func (c *Client) SendEmbedReply( channelID discord.ChannelID, referenceID discord.MessageID, embeds ...discord.Embed) (*discord.Message, error)
SendEmbedReply posts an Embed reply to a message ID in a guild text or DM channel.
If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
Fires a Message Create Gateway event.
func (*Client) SendEmbeds ¶
func (c *Client) SendEmbeds( channelID discord.ChannelID, e ...discord.Embed) (*discord.Message, error)
SendEmbeds sends embeds to a guild text or DM channel.
If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
Fires a Message Create Gateway event.
func (*Client) SendMessage ¶
func (c *Client) SendMessage( channelID discord.ChannelID, content string, embeds ...discord.Embed) (*discord.Message, error)
SendMessage posts a message to a guild text or DM channel.
If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
Fires a Message Create Gateway event.
func (*Client) SendMessageComplex ¶
func (c *Client) SendMessageComplex( channelID discord.ChannelID, data SendMessageData) (*discord.Message, error)
SendMessageComplex posts a message to a guild text or DM channel. If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user. If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken. Returns a message object. Fires a Message Create Gateway event.
The maximum request size when sending a message is 8MB.
This endpoint supports requests with Content-Types of both application/json and multipart/form-data. You must however use multipart/form-data when uploading files. Note that when sending multipart/form-data requests the embed field cannot be used, however you can pass a JSON encoded body as form value for payload_json, where additional request parameters such as embed can be set.
Note that when sending application/json you must send at least one of content or embed, and when sending multipart/form-data, you must send at least one of content, embed or file. For a file attachment, the Content-Disposition subpart header MUST contain a filename parameter.
func (*Client) SendMessageReply ¶
func (c *Client) SendMessageReply( channelID discord.ChannelID, content string, referenceID discord.MessageID, embeds ...discord.Embed) (*discord.Message, error)
SendMessageReply posts a reply to a message ID in a guild text or DM channel.
If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
Fires a Message Create Gateway event.
func (*Client) SendTextReply ¶
func (c *Client) SendTextReply( channelID discord.ChannelID, content string, referenceID discord.MessageID) (*discord.Message, error)
SendTextReply posts a text-only reply to a message ID in a guild text or DM channel
If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
Fires a Message Create Gateway event.
func (*Client) SetNote ¶
SetNote sets a note for the user. This endpoint is undocumented and might only work for user accounts.
func (*Client) SetRelationship ¶
SetRelationship sets the relationship type between the current user and the given user.
func (*Client) StartThreadWithMessage ¶
func (c *Client) StartThreadWithMessage( channelID discord.ChannelID, messageID discord.MessageID, data StartThreadData) (*discord.Channel, error)
StartThreadWithMessage creates a new thread from an existing message.
When called on a GUILD_TEXT channel, creates a GUILD_PUBLIC_THREAD. When called on a GUILD_NEWS channel, creates a GUILD_NEWS_THREAD. The id of the created thread will be the same as the id of the message, and as such a message can only have a single thread created from it.
Fires a Thread Create Gateway event.
func (*Client) StartThreadWithoutMessage ¶
func (c *Client) StartThreadWithoutMessage( channelID discord.ChannelID, data StartThreadData) (*discord.Channel, error)
StartThreadWithoutMessage creates a new thread that is not connected to an existing message.
Fires a Thread Create Gateway event.
func (*Client) SyncIntegration ¶
func (c *Client) SyncIntegration( guildID discord.GuildID, integrationID discord.IntegrationID) error
SyncIntegration syncs an integration.
Requires the MANAGE_GUILD permission.
func (*Client) ThreadMember ¶ added in v3.3.6
func (c *Client) ThreadMember( threadID discord.ChannelID, userID discord.UserID) (*discord.ThreadMember, error)
ThreadMember returns a thread member for the user ID if the user is a member of the thread.
func (*Client) ThreadMembers ¶
ThreadMembers list all members of the thread.
This endpoint is restricted according to whether the GUILD_MEMBERS Privileged Intent is enabled for your application.
func (*Client) Typing ¶
Typing posts a typing indicator to the channel. Undocumented, but the client usually clears the typing indicator after 8-10 seconds (or after a message).
func (*Client) Unban ¶
func (c *Client) Unban( guildID discord.GuildID, userID discord.UserID, reason AuditLogReason) error
Unban removes the ban for a user.
Requires the BAN_MEMBERS permissions.
Fires a Guild Ban Remove Gateway event.
func (*Client) UnpinMessage ¶
func (c *Client) UnpinMessage( channelID discord.ChannelID, messageID discord.MessageID, reason AuditLogReason) error
UnpinMessage deletes a pinned message in a channel.
Requires the MANAGE_MESSAGES permission.
func (*Client) Unreact ¶
func (c *Client) Unreact( channelID discord.ChannelID, messageID discord.MessageID, emoji discord.APIEmoji) error
Unreact removes a reaction the current user has made for the message.
func (*Client) UpdateStageInstance ¶
func (c *Client) UpdateStageInstance( channelID discord.ChannelID, data UpdateStageInstanceData) error
UpdateStageInstance updates fields of an existing Stage instance.
It requires the user to be a moderator of the Stage channel.
func (*Client) UserConnections ¶
func (c *Client) UserConnections() ([]discord.Connection, error)
UserConnections returns a list of connection objects. Requires the connections OAuth2 scope.
func (*Client) VoiceRegionsGuild ¶
VoiceRegionsGuild is the same as /voice, but returns VIP ones as well if available.
func (*Client) WithContext ¶
WithContext returns a shallow copy of Client with the given context. It's used for method timeouts and such. This method is thread-safe.
type CreateChannelData ¶
type CreateChannelData struct { // Name is the channel name (2-100 characters). // // Channel Type: All Name string `json:"name"` // Type is the type of channel. // // Channel Type: All Type discord.ChannelType `json:"type,omitempty"` // Topic is the channel topic (0-1024 characters). // // Channel Types: Text, News Topic string `json:"topic,omitempty"` // Flags is a bitmask that contains if a thread is pinned for example Flags discord.ChannelFlags `json:"flags,omitempty"` // VoiceBitrate is the bitrate (in bits) of the voice channel. // 8000 to 96000 (128000 for VIP servers) // // Channel Types: Voice VoiceBitrate uint `json:"bitrate,omitempty"` // VoiceUserLimit is the user limit of the voice channel. // 0 refers to no limit, 1 to 99 refers to a user limit. // // Channel Types: Voice VoiceUserLimit uint `json:"user_limit,omitempty"` // UserRateLimit is the amount of seconds a user has to wait before sending // another message (0-21600). // Bots, as well as users with the permission manage_messages or // manage_channel, are unaffected. // // Channel Types: Text UserRateLimit discord.Seconds `json:"rate_limit_per_user,omitempty"` // Position is the sorting position of the channel. // // Channel Types: All Position option.Int `json:"position,omitempty"` // Overwrites are the channel's permission overwrites. // // Channel Types: All Overwrites []discord.Overwrite `json:"permission_overwrites,omitempty"` // CategoryID is the id of the parent category for a channel. // // Channel Types: Text, News, Store, Voice CategoryID discord.ChannelID `json:"parent_id,string,omitempty"` // NSFW specifies whether the channel is nsfw. // // Channel Types: Text, News, Store NSFW bool `json:"nsfw,omitempty"` // RTCRegionID is the channel voice region id. It will be determined // automatically set, if omitted. // // Channel Types: Voice RTCRegionID string `json:"rtc_region,omitempty"` // VideoQualityMode is the camera video quality mode of the voice channel. // This defaults to discord.AutoVideoQuality, if not set. // // ChannelTypes: Voice VoiceQualityMode discord.VideoQualityMode `json:"voice_quality_mode,omitempty"` AvailableTags []discord.Tag `json:"available_tags,omitempty"` DefaultReactionEmoji *discord.ForumReaction `json:"default_reaction_emoji,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/guild#create-guild-channel-json-params
type CreateCommandData ¶
type CreateCommandData struct { ID discord.CommandID `json:"id,omitempty"` Name string `json:"name"` NameLocalizations discord.StringLocales `json:"name_localizations,omitempty"` Description string `json:"description"` DescriptionLocalizations discord.StringLocales `json:"description_localizations,omitempty"` Options discord.CommandOptions `json:"options,omitempty"` DefaultMemberPermissions *discord.Permissions `json:"default_member_permissions,string,omitempty"` NoDMPermission bool `json:"-"` NoDefaultPermission bool `json:"-"` Type discord.CommandType `json:"type,omitempty"` }
https://discord.com/developers/docs/interactions/application-commands#create-global-application-command https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
func (CreateCommandData) MarshalJSON ¶
func (c CreateCommandData) MarshalJSON() ([]byte, error)
func (*CreateCommandData) UnmarshalJSON ¶
func (c *CreateCommandData) UnmarshalJSON(data []byte) error
type CreateEmojiData ¶
type CreateEmojiData struct { // Name is the name of the emoji. Name string `json:"name"` // Image is the the 128x128 emoji image. Image Image `json:"image"` // Roles are the roles that can use the emoji. Roles *[]discord.RoleID `json:"roles,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
type CreateGuildData ¶
type CreateGuildData struct { // Name is the name of the guild (2-100 characters) Name string `json:"name"` // VoiceRegion is the voice region id. VoiceRegion string `json:"region,omitempty"` // Icon is the base64 128x128 image for the guild icon. Icon *Image `json:"image,omitempty"` // Verification is the verification level. Verification *discord.Verification `json:"verification_level,omitempty"` // Notification is the default message notification level. Notification *discord.Notification `json:"default_message_notifications,omitempty"` // ExplicitFilter is the explicit content filter level. ExplicitFilter *discord.ExplicitFilter `json:"explicit_content_filter,omitempty"` // Roles are the new guild roles. // // When using the roles parameter, the first member of the array is used to // change properties of the guild's @everyone role. If you are trying to // bootstrap a guild with additional roles, keep this in mind. // // When using the roles parameter, the required id field within each role // object is an integer placeholder, and will be replaced by the API upon // consumption. Its purpose is to allow you to overwrite a role's // permissions in a channel when also passing in channels with the channels // array. Roles []discord.Role `json:"roles,omitempty"` // Channels are the new guild's channels. // Assigning a channel to a channel category is not supported by this // endpoint, i.e. a channel can't have the parent_id field. // // When using the channels parameter, the position field is ignored, // and none of the default channels are created. // // When using the channels parameter, the id field within each channel // object may be set to an integer placeholder, and will be replaced by the // API upon consumption. Its purpose is to allow you to create // GUILD_CATEGORY channels by setting the parent_id field on any children // to the category's id field. Category channels must be listed before any // children. Channels []discord.Channel `json:"channels,omitempty"` // AFKChannelID is the id for the afk channel. AFKChannelID discord.ChannelID `json:"afk_channel_id,omitempty"` // AFKTimeout is the afk timeout in seconds. AFKTimeout discord.OptionalSeconds `json:"afk_timeout,omitempty"` // SystemChannelID is the id of the channel where guild notices such as // welcome messages and boost events are posted. SystemChannelID discord.ChannelID `json:"system_channel_id,omitempty"` }
https://discord.com/developers/docs/resources/guild#create-guild-json-params
type CreateInviteData ¶
type CreateInviteData struct { // MaxAge is the duration of invite in seconds before expiry, or 0 for // never. // // Default: 86400 (24 hours) MaxAge option.Uint `json:"max_age,omitempty"` // MaxUses is the max number of uses or 0 for unlimited. // // Default: 0 MaxUses uint `json:"max_uses,omitempty"` // Temporary specifies whether this invite only grants temporary membership. // // Default: false Temporary bool `json:"temporary,omitempty"` // Unique has the following behavior: if true, don't try to reuse a similar // invite (useful for creating many unique one time use invites). // // Default: false Unique bool `json:"unique,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/channel#create-channel-invite-json-params
type CreateRoleData ¶
type CreateRoleData struct { // Name is the name of the role. // // Default: "new role" Name string `json:"name,omitempty"` // Permissions is the bitwise value of the enabled/disabled permissions. // // Default: @everyone permissions in guild Permissions discord.Permissions `json:"permissions,string,omitempty"` // Color is the RGB color value of the role. // // Default: 0 Color discord.Color `json:"color,omitempty"` // Hoist specifies whether the role should be displayed separately in the // sidebar. // // Default: false Hoist bool `json:"hoist,omitempty"` // Mentionable specifies whether the role should be mentionable. // // Default: false Mentionable bool `json:"mentionable,omitempty"` // Icon is the icon of the role. Requires the guild to have the ROLE_ICONS feature. // // Default: null Icon *Image `json:"icon,omitempty"` // UnicodeEmoji is the role's unicode emoji. Requires the guild to have the ROLE_ICONS feature. // // Default: null UnicodeEmoji string `json:"unicode_emoji,omitempty"` AddRoleData `json:"-"` }
https://discord.com/developers/docs/resources/guild#create-guild-role-json-params
type CreateScheduledEventData ¶
type CreateScheduledEventData struct { // ChannelID is the channel id of the scheduled event. ChannelID discord.ChannelID `json:"channel_id"` // EntityMetadata is the entity metadata of the scheduled event. EntityMetadata *discord.EntityMetadata `json:"entity_metadata"` // Name is the name of the scheduled event. Name string `json:"name"` // PrivacyLevel is the privacy level of the scheduled event. PrivacyLevel discord.ScheduledEventPrivacyLevel `json:"privacy_level"` // StartTime is when the scheduled event begins. StartTime discord.Timestamp `json:"scheduled_start_time"` // EndTime is when the scheduled event ends, if it does. EndTime *discord.Timestamp `json:"scheduled_end_time,omitempty"` // Description is the description of the schduled event. Description string `json:"description"` // EntityType is the entity type of the scheduled event. EntityType discord.EntityType `json:"entity_type"` // Image is the cover image of the scheduled event. Image Image `json:"image"` }
CreateScheduledEventData is the structure for creating a scheduled event.
type CreateStageInstanceData ¶
type CreateStageInstanceData struct { // ChannelID is the id of the Stage channel. ChannelID discord.ChannelID `json:"channel_id"` // Topic is the topic of the Stage instance (1-120 characters). Topic string `json:"topic"` // PrivacyLevel is the privacy level of the Stage instance. // // Defaults to discord.GuildOnlyStage. PrivacyLevel discord.PrivacyLevel `json:"privacy_level,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/stage-instance#create-stage-instance-json-params
type CreateWebhookData ¶
type CreateWebhookData struct { // Name is the name of the webhook (1-80 characters). Name string `json:"name"` // Avatar is the image for the default webhook avatar. Avatar *Image `json:"avatar"` }
https://discord.com/developers/docs/resources/webhook#create-webhook-json-params
type DeleteAutoModerationRuleData ¶ added in v3.4.0
type DeleteAutoModerationRuleData struct {
AuditLogReason `json:"-"`
}
type EditChannelPermissionData ¶
type EditChannelPermissionData struct { // Type is either "role" or "member". Type discord.OverwriteType `json:"type"` // Allow is a permission bit set for granted permissions. Allow discord.Permissions `json:"allow,string"` // Deny is a permission bit set for denied permissions. Deny discord.Permissions `json:"deny,string"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/channel#edit-channel-permissions-json-params
type EditInteractionResponseData ¶
type EditInteractionResponseData struct { // Content are the new message contents (up to 2000 characters). Content option.NullableString `json:"content,omitempty"` // Embeds contains embedded rich content. Embeds *[]discord.Embed `json:"embeds,omitempty"` // Components contains the new components to attach. Components *discord.ContainerComponents `json:"components,omitempty"` // AllowedMentions are the allowed mentions for the message. AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // Attachments are the attached files to keep. Attachments *[]discord.Attachment `json:"attachments,omitempty"` // Files represents a list of files to upload. This will not be // JSON-encoded and will only be available through WriteMultipart. Files []sendpart.File `json:"-"` }
func (EditInteractionResponseData) NeedsMultipart ¶
func (data EditInteractionResponseData) NeedsMultipart() bool
NeedsMultipart returns true if the SendMessageData has files.
func (EditInteractionResponseData) WriteMultipart ¶
func (data EditInteractionResponseData) WriteMultipart(body *multipart.Writer) error
type EditMessageData ¶
type EditMessageData struct { // Content is the new message contents (up to 2000 characters). Content option.NullableString `json:"content,omitempty"` // Embeds contains embedded rich content. Embeds *[]discord.Embed `json:"embeds,omitempty"` // Components contains the new components to attach. Components *discord.ContainerComponents `json:"components,omitempty"` // AllowedMentions are the allowed mentions for a message. AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // Attachments are the attached files to keep Attachments *[]discord.Attachment `json:"attachments,omitempty"` // Flags edits the flags of a message (only SUPPRESS_EMBEDS can currently // be set/unset) // // This field is nullable. Flags *discord.MessageFlags `json:"flags,omitempty"` Files []sendpart.File `json:"-"` }
https://discord.com/developers/docs/resources/channel#edit-message
func (EditMessageData) NeedsMultipart ¶
func (data EditMessageData) NeedsMultipart() bool
NeedsMultipart returns true if the SendMessageData has files.
func (EditMessageData) WriteMultipart ¶
func (data EditMessageData) WriteMultipart(body *multipart.Writer) error
type EditScheduledEventData ¶
type EditScheduledEventData struct { // ChannelID is the new channel id of the scheduled event. ChannelID discord.ChannelID `json:"channel_id,omitempty"` // EntityMetadata is the new entity metadata of the scheduled event. EntityMetadata *discord.EntityMetadata `json:"entity_metadata,omitempty"` // Name is the new name of the scheduled event. Name option.NullableString `json:"name,omitempty"` // PrivacyLevel is the new privacy level of the scheduled event. PrivacyLevel discord.ScheduledEventPrivacyLevel `json:"privacy_level,omitempty"` // StartTime is the new starting time for when the scheduled event begins. StartTime *discord.Timestamp `json:"scheduled_start_time,omitempty"` // EndTime is the new time of which the scheduled event ends EndTime *discord.Timestamp `json:"scheduled_end_time,omitempty"` // Description is the new description of the scheduled event. Description option.NullableString `json:"description,omitempty"` // EntityType is the new entity type of the scheduled event. EntityType discord.EntityType `json:"entity_type,omitempty"` // Status is the new event status of the scheduled event. Status discord.EventStatus `json:"status,omitempty"` // Image is the new image of the scheduled event. Image *Image `json:"image,omitempty"` }
EditScheduledEventData is the structure for modifying a scheduled event.
type GuildScheduledEventUser ¶
type GuildScheduledEventUser struct { // EventID is the id of the scheduled event. EventID discord.EventID `json:"guild_scheduled_event_id"` // User is the user object of the user. User discord.User `json:"user"` // Member is the member object of the user. Member *discord.Member `json:"member"` }
GuildScheduledEventUser represents a user interested in a scheduled event.
type GuildWidgetImageStyle ¶
type GuildWidgetImageStyle string
https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
const ( // GuildShield is a shield style widget with Discord icon and guild members // online count. // // Example: https://discordapp.com/api/guilds/81384788765712384/widget.png?style=shield GuildShield GuildWidgetImageStyle = "shield" // GuildBanner1 is a large image with guild icon, name and online count. // "POWERED BY DISCORD" as the footer of the widget. // // Example: https://discordapp.com/api/guilds/81384788765712384/widget.png?style=banner1 GuildBanner1 GuildWidgetImageStyle = "banner1" // GuildBanner2 is a smaller widget style with guild icon, name and online // count. Split on the right with Discord logo. // // Example: https://discordapp.com/api/guilds/81384788765712384/widget.png?style=banner2 GuildBanner2 GuildWidgetImageStyle = "banner2" // GuildBanner3 is a large image with guild icon, name and online count. In // the footer, Discord logo on the left and "Chat Now" on the right. // // Example: https://discordapp.com/api/guilds/81384788765712384/widget.png?style=banner3 GuildBanner3 GuildWidgetImageStyle = "banner3" // GuildBanner4 is a large Discord logo at the top of the widget. // Guild icon, name and online count in the middle portion of the widget // and a "JOIN MY SERVER" button at the bottom. // // Example: https://discordapp.com/api/guilds/81384788765712384/widget.png?style=banner4 GuildBanner4 GuildWidgetImageStyle = "banner4" )
type Image ¶
type Image struct { // ContentType is optional and will be automatically detected. However, it // should always return "image/jpeg," "image/png" or "image/gif". ContentType string // Just raw content of the file. Content []byte }
Image wraps around the Data URI Scheme that Discord uses: https://discord.com/developers/docs/reference#image-data
func DecodeImage ¶
func (Image) MarshalJSON ¶
func (*Image) UnmarshalJSON ¶
type ImageTooLargeError ¶
type ImageTooLargeError struct {
Size, Max int
}
func (ImageTooLargeError) Error ¶
func (err ImageTooLargeError) Error() string
type InteractionResponse ¶
type InteractionResponse struct { Type InteractionResponseType `json:"type"` Data *InteractionResponseData `json:"data,omitempty"` }
func (InteractionResponse) NeedsMultipart ¶
func (resp InteractionResponse) NeedsMultipart() bool
NeedsMultipart returns true if the InteractionResponse has files.
func (InteractionResponse) WriteMultipart ¶
func (resp InteractionResponse) WriteMultipart(body *multipart.Writer) error
type InteractionResponseData ¶
type InteractionResponseData struct { // Content are the message contents (up to 2000 characters). // // Required: one of content, file, embeds Content option.NullableString `json:"content,omitempty"` // TTS is true if this is a TTS message. TTS bool `json:"tts,omitempty"` // Embeds contains embedded rich content. // // Required: one of content, file, embeds Embeds *[]discord.Embed `json:"embeds,omitempty"` // Components is the list of components (such as buttons) to be attached to // the message. Components *discord.ContainerComponents `json:"components,omitempty"` // AllowedMentions are the allowed mentions for the message. AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // Flags are the interaction application command callback data flags. // Only SuppressEmbeds and EphemeralMessage may be set. Flags discord.MessageFlags `json:"flags,omitempty"` // Files represents a list of files to upload. This will not be // JSON-encoded and will only be available through WriteMultipart. Files []sendpart.File `json:"-"` // Choices are the results to display on autocomplete interaction events. // // During all other events, this should not be provided. Choices AutocompleteChoices `json:"choices,omitempty"` // CustomID used with the modal CustomID option.NullableString `json:"custom_id,omitempty"` // Title is the heading of the modal window Title option.NullableString `json:"title,omitempty"` }
InteractionResponseData is InteractionApplicationCommandCallbackData in the official documentation.
func (InteractionResponseData) NeedsMultipart ¶
func (d InteractionResponseData) NeedsMultipart() bool
NeedsMultipart returns true if the InteractionResponseData has files.
func (InteractionResponseData) WriteMultipart ¶
func (d InteractionResponseData) WriteMultipart(body *multipart.Writer) error
type InteractionResponseFlags
deprecated
type InteractionResponseFlags = discord.MessageFlags
InteractionResponseFlags implements flags for an InteractionApplicationCommandCallbackData.
Deprecated: use discord.MessageFlags instead.
const EphemeralResponse InteractionResponseFlags = discord.EphemeralMessage
EphemeralMessage specifies whether the message is only visible to the user who invoked the Interaction.
Deprecated: use discord.EphemeralMessage instead.
type InteractionResponseType ¶
type InteractionResponseType uint
const ( PongInteraction InteractionResponseType = iota + 1 MessageInteractionWithSource DeferredMessageInteractionWithSource DeferredMessageUpdate UpdateMessage AutocompleteResult ModalResponse )
type JoinedInvite ¶
type JoinedInvite struct { Code string `json:"code"` NewMember bool `json:"new_member"` Guild discord.Guild `json:"guild"` Channel discord.Channel `json:"channel"` // id, name, type only }
JoinedInvite is returned after joining an invite.
type LoginResponse ¶
type ModifyAutoModerationRuleData ¶ added in v3.4.0
type ModifyAutoModerationRuleData struct { // the rule name Name option.String `json:"name,omitempty"` // the event type EventType option.Optional[discord.AutoModerationEventType] `json:"event_type,omitempty"` // the trigger metadata TriggerMetadata option.Optional[discord.AutoModerationTriggerMetadata] `json:"triggr_metadata,omitempty"` // the actions which will execute when the rule is triggered Actions option.Optional[[]discord.AutoModerationAction] `json:"actions,omitempty"` // whether the rule is enabled Enabled option.Bool `json:"enabled,omitempty"` // the role ids that should not be affected by the rule (Maximum of 20) ExemptRules option.Optional[[]discord.RoleID] `json:"exempt_roles,omitempty"` // the channel ids that should not be affected by the rule (Maximum of 50) ExemptChannels option.Optional[[]discord.ChannelID] `json:"exempt_channels,omitempty"` AuditLogReason }
type ModifyChannelData ¶
type ModifyChannelData struct { // Name is the 2-100 character channel name. // // Channel Types: All Name string `json:"name,omitempty"` // Type is the type of the channel. // Only conversion between text and news is supported and only in guilds // with the "NEWS" feature // // Channel Types: Text, News Type *discord.ChannelType `json:"type,omitempty"` // Position is the position of the channel in the left-hand listing. // // Channel Types: Text, News, Voice, Store, Category Position option.NullableInt `json:"position,omitempty"` // Topic is the 0-1024 character channel topic. // // Channel Types: Text, News Topic option.NullableString `json:"topic,omitempty"` // Flags is a bitmask that contains if a thread is pinned for example Flags *discord.ChannelFlags `json:"flags,omitempty"` // NSFW specifies whether the channel is nsfw. // // Channel Types: Text, News, Store NSFW option.NullableBool `json:"nsfw,omitempty"` // UserRateLimit is the amount of seconds a user has to wait before sending // another message (0-21600). // Bots, as well as users with the permission manage_messages or // manage_channel, are unaffected. // // Channel Types: Text, Thread UserRateLimit option.NullableUint `json:"rate_limit_per_user,omitempty"` // VoiceBitrate is the bitrate (in bits) of the voice channel. // 8000 to 96000 (128000 for VIP servers) // // Channel Types: Voice VoiceBitrate option.NullableUint `json:"bitrate,omitempty"` // VoiceUserLimit is the user limit of the voice channel. // 0 refers to no limit, 1 to 99 refers to a user limit. // // Channel Types: Voice VoiceUserLimit option.NullableUint `json:"user_limit,omitempty"` // RTCRegionID is the channel voice region id. It will be determined // automatically set, if omitted. // // Channel Types: Voice RTCRegionID option.NullableString `json:"rtc_region,omitempty"` // Overwrites are the channel or category-specific permissions. // // Channel Types: Text, News, Store, Voice, Category Overwrites *[]discord.Overwrite `json:"permission_overwrites,omitempty"` // CategoryID is the id of the new parent category for a channel. // // Channel Types: Text, News, Store, Voice CategoryID discord.ChannelID `json:"parent_id,string,omitempty"` // Icon is a base64 encoded icon. // // Channel Types: Group DM Icon string `json:"icon,omitempty"` // Archived specifies whether the thread is archived. Archived option.Bool `json:"archived,omitempty"` // AutoArchiveDuration is the duration in minutes to automatically archive // the thread after recent activity. // // Note that the three and seven day archive durations require the server // to be boosted. AutoArchiveDuration discord.ArchiveDuration `json:"auto_archive_duration,omitempty"` // Locked specifies whether the thread is locked. When a thread is locked, // only users with MANAGE_THREADS can unarchive it. Locked option.Bool `json:"locked,omitempty"` // Invitable specifies whether non-moderators can add other // non-moderators to a thread; only available on private threads Invitable option.Bool `json:"invitable,omitempty"` AvailableTags *[]discord.Tag `json:"available_tags,omitempty"` AppliedTags *[]discord.TagID `json:"applied_tags,omitempty"` DefaultReactionEmoji **discord.ForumReaction `json:"default_reaction_emoji,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/channel#modify-channel-json-params
type ModifyCurrentUserData ¶
type ModifyCurrentUserData struct { // Username is the user's username, if changed may cause the user's // discriminator to be randomized. Username option.String `json:"username,omitempty"` // Avatar modifies the user's avatar. Avatar *Image `json:"image,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/user#modify-current-user-json-params
type ModifyEmojiData ¶
type ModifyEmojiData struct { // Name is the name of the emoji. Name string `json:"name,omitempty"` // Roles are the roles that can use the emoji. Roles *[]discord.RoleID `json:"roles,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/emoji#modify-guild-emoji-json-params
type ModifyGuildData ¶
type ModifyGuildData struct { // Name is the guild's name. Name string `json:"name,omitempty"` // Region is the guild's voice region id. Region option.NullableString `json:"region,omitempty"` // Verification is the verification level. // // This field is nullable. Verification *discord.Verification `json:"verification_level,omitempty"` // Notification is the default message notification level. // // This field is nullable. Notification *discord.Notification `json:"default_message_notifications,omitempty"` // ExplicitFilter is the explicit content filter level. // // This field is nullable. ExplicitFilter *discord.ExplicitFilter `json:"explicit_content_filter,omitempty"` // AFKChannelID is the id for the afk channel. // // This field is nullable. AFKChannelID discord.ChannelID `json:"afk_channel_id,string,omitempty"` // AFKTimeout is the afk timeout in seconds. AFKTimeout discord.OptionalSeconds `json:"afk_timeout,omitempty"` // Icon is the base64 1024x1024 png/jpeg/gif image for the guild icon // (can be animated gif when the server has the ANIMATED_ICON feature). Icon *Image `json:"icon,omitempty"` // Splash is the base64 16:9 png/jpeg image for the guild splash // (when the server has the INVITE_SPLASH feature). Splash *Image `json:"splash,omitempty"` // Banner is the base64 16:9 png/jpeg image for the guild banner (when the // server has BANNER feature). Banner *Image `json:"banner,omitempty"` // OwnerID is the user id to transfer guild ownership to (must be owner). OwnerID discord.UserID `json:"owner_id,omitempty"` // SystemChannelID is the id of the channel where guild notices such as // welcome messages and boost events are posted. // // This field is nullable. SystemChannelID discord.ChannelID `json:"system_channel_id,omitempty"` // RulesChannelID is the id of the channel where "PUBLIC" guilds display // rules and/or guidelines. // // This field is nullable. RulesChannelID discord.ChannelID `json:"rules_channel_id,omitempty"` // PublicUpdatesChannelID is the id of the channel where admins and // moderators of "PUBLIC" guilds receive notices from Discord. // // This field is nullable. PublicUpdatesChannelID discord.ChannelID `json:"public_updates_channel_id,omitempty"` // PreferredLocale is the preferred locale of a "PUBLIC" guild used in // server discovery and notices from Discord. // // This defaults to "en-US". PreferredLocale option.NullableString `json:"preferred_locale,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/guild#modify-guild-json-params
type ModifyGuildWidgetData ¶
type ModifyGuildWidgetData struct { // Enabled specifies whether the widget is enabled. Enabled option.Bool `json:"enabled,omitempty"` // ChannelID is the widget channel ID. ChannelID discord.ChannelID `json:"channel_id,omitempty"` AuditLogReason `json:"-"` }
ModifyGuildWidgetData is the structure to modify a guild widget object for the guild. All attributes may be passed in with JSON and modified.
https://discord.com/developers/docs/resources/guild#guild-widget-object
type ModifyIntegrationData ¶
type ModifyIntegrationData struct { // ExpireBehavior is the behavior when an integration subscription lapses // (see the integration expire behaviors documentation). ExpireBehavior *discord.ExpireBehavior `json:"expire_behavior,omitempty"` // ExpireGracePeriod is the period (in days) where the integration will // ignore lapsed subscriptions. ExpireGracePeriod option.NullableInt `json:"expire_grace_period,omitempty"` // EnableEmoticons specifies whether emoticons should be synced for this // integration (twitch only currently). EnableEmoticons option.NullableBool `json:"enable_emoticons,omitempty"` }
https://discord.com/developers/docs/resources/guild#modify-guild-integration-json-params
type ModifyMemberData ¶
type ModifyMemberData struct { // Nick is the value to set users nickname to. // // Requires MANAGE_NICKNAMES. Nick option.String `json:"nick,omitempty"` // Roles is an array of role ids the member is assigned. // // Requires MANAGE_ROLES. Roles *[]discord.RoleID `json:"roles,omitempty"` // Mute specifies whether the user is muted in voice channels. // // Requires MUTE_MEMBERS. Mute option.Bool `json:"mute,omitempty"` // Deaf specifies whether the user is deafened in voice channels. // // Requires DEAFEN_MEMBERS. Deaf option.Bool `json:"deaf,omitempty"` // Voice channel is the id of channel to move user to (if they are // connected to voice). // // Requires MOVE_MEMBER VoiceChannel discord.ChannelID `json:"channel_id,omitempty"` // CommunicationDisabledUntil specifies when the user's timeout will expire. // // Requires MODERATE_MEMBERS CommunicationDisabledUntil *discord.Timestamp `json:"communication_disabled_until,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/guild#add-guild-member-json-params
type ModifyRoleData ¶
type ModifyRoleData struct { // Name is the name of the role. Name option.NullableString `json:"name,omitempty"` // Permissions is the bitwise value of the enabled/disabled permissions. Permissions *discord.Permissions `json:"permissions,string,omitempty"` // Permissions is the bitwise value of the enabled/disabled permissions. // // This value is nullable. Color discord.Color `json:"color,omitempty"` // Hoist specifies whether the role should be displayed separately in the // sidebar. Hoist option.NullableBool `json:"hoist,omitempty"` // Mentionable specifies whether the role should be mentionable. Mentionable option.NullableBool `json:"mentionable,omitempty"` // Icon is the icon of the role. Requires the guild to have the ROLE_ICONS feature. // This value is nullable. // To reset the role's icon, set this to NullImage. Icon *Image `json:"icon,omitempty"` // UnicodeEmoji is the role's unicode emoji. Requires the guild to have the ROLE_ICONS feature. UnicodeEmoji option.NullableString `json:"unicode_emoji,omitempty"` AddRoleData `json:"-"` }
https://discord.com/developers/docs/resources/guild#modify-guild-role-json-params
type ModifyWebhookData ¶
type ModifyWebhookData struct { // Name is the default name of the webhook. Name option.String `json:"name,omitempty"` // Avatar is the image for the default webhook avatar. Avatar *Image `json:"avatar,omitempty"` // ChannelID is the new channel id this webhook should be moved to. ChannelID discord.ChannelID `json:"channel_id,omitempty"` }
https://discord.com/developers/docs/resources/webhook#modify-webhook-json-params
type MoveChannelData ¶
type MoveChannelData struct { // ID is the channel id. ID discord.ChannelID `json:"id"` // Position is the sorting position of the channel. Position option.Int `json:"position"` // LockPermissions syncs the permission overwrites with the new parent, // if moving to a new category. LockPermissions option.Bool `json:"lock_permissions"` // CategoryID is the new parent ID for the channel that is moved. CategoryID discord.ChannelID `json:"parent_id,string,omitempty"` }
type MoveChannelsData ¶
type MoveChannelsData struct { // Channels are the channels to be moved. Channels []MoveChannelData AuditLogReason }
type MoveRoleData ¶
type MoveRoleData struct { // ID is the id of the role. ID discord.RoleID `json:"id"` // Position is the sorting position of the role. Position option.NullableInt `json:"position,omitempty"` }
https://discord.com/developers/docs/resources/guild#modify-guild-role-positions-json-params
type MoveRolesData ¶
type MoveRolesData struct { Roles []MoveRoleData AuditLogReason }
type PruneCountData ¶
type PruneCountData struct { // Days is the number of days to count prune for (1 or more, default 7). Days uint `schema:"days"` // IncludedRoles are the role(s) to include. IncludedRoles []discord.RoleID `schema:"include_roles,omitempty"` }
https://discord.com/developers/docs/resources/guild#get-guild-prune-count-query-string-params
type PruneData ¶
type PruneData struct { // Days is the number of days to prune (1 or more, default 7). Days uint `schema:"days"` // ReturnCount specifies whether 'pruned' is returned. Discouraged for // large guilds. ReturnCount bool `schema:"compute_prune_count"` // IncludedRoles are the role(s) to include. IncludedRoles []discord.RoleID `schema:"include_roles,omitempty"` AuditLogReason `schema:"-"` }
https://discord.com/developers/docs/resources/guild#begin-guild-prune-query-string-params
type SearchData ¶
type SearchData struct { Offset uint `schema:"offset,omitempty"` Content string `schema:"content,omitempty"` Has string `schema:"has,omitempty"` SortBy string `schema:"sort_by,omitempty"` SortOrder string `schema:"sort_order,omitempty"` ChannelID discord.ChannelID `schema:"channel_id,omitempty"` AuthorID discord.UserID `schema:"author_id,omitempty"` Mentions discord.UserID `schema:"mentions,omitempty"` MaxID discord.MessageID `schema:"max_id,omitempty"` MinID discord.MessageID `schema:"min_id,omitempty"` IncludeNSFW bool `schema:"include_nsfw,omitempty"` }
type SearchResponse ¶
type SendMessageData ¶
type SendMessageData struct { // Content are the message contents (up to 2000 characters). Content string `json:"content,omitempty"` // Nonce is a nonce that can be used for optimistic message sending. Nonce string `json:"nonce,omitempty"` // TTS is true if this is a TTS message. TTS bool `json:"tts,omitempty"` // Embed is embedded rich content. Embeds []discord.Embed `json:"embeds,omitempty"` // Files is the list of file attachments to be uploaded. To reference a file // in an embed, use (sendpart.File).AttachmentURI(). Files []sendpart.File `json:"-"` // Components is the list of components (such as buttons) to be attached to // the message. Components discord.ContainerComponents `json:"components,omitempty"` // AllowedMentions are the allowed mentions for a message. AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // Reference allows you to reference another message to create a reply. The // referenced message must be from the same channel. // // Only MessageID is necessary. You may also include a channel_id and // guild_id in the reference. However, they are not necessary, but will be // validated if sent. Reference *discord.MessageReference `json:"message_reference,omitempty"` // Flags specifies the message flags to set (only `SuppressEmbeds` and `SuppressNotifications` can be set). Flags discord.MessageFlags `json:"flags"` }
SendMessageData is the full structure to send a new message to Discord with.
func (SendMessageData) NeedsMultipart ¶
func (data SendMessageData) NeedsMultipart() bool
NeedsMultipart returns true if the SendMessageData has files.
func (SendMessageData) WriteMultipart ¶
func (data SendMessageData) WriteMultipart(body *multipart.Writer) error
type SessionStartLimit ¶
type SessionStartLimit struct { Total int `json:"total"` Remaining int `json:"remaining"` ResetAfter discord.Milliseconds `json:"reset_after"` MaxConcurrency int `json:"max_concurrency"` }
SessionStartLimit is the information on the current session start limit. It's used in BotData.
type StartThreadData ¶
type StartThreadData struct { // Name is the 1-100 character channel name. Name string `json:"name"` // AutoArchiveDuration is the duration in minutes to automatically archive // the thread after recent activity. // // Note that the three and seven day archive durations require the server // to be boosted. AutoArchiveDuration discord.ArchiveDuration `json:"auto_archive_duration"` // Type is the type of thread to create. // // This field can only be used when starting a thread without a message Type discord.ChannelType `json:"type,omitempty"` // we can omit, since thread types start at 10 // Invitable specifies whether non-moderators can add other // non-moderators to a thread; only available on private threads. // // This field can only be used when starting a thread without a message Invitable bool `json:"invitable,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/channel#start-thread-with-message-json-params and https://discord.com/developers/docs/resources/channel#start-thread-without-message-json-params
type UpdateStageInstanceData ¶
type UpdateStageInstanceData struct { // Topic is the topic of the Stage instance (1-120 characters). Topic string `json:"topic,omitempty"` // PrivacyLevel is the privacy level of the Stage instance. PrivacyLevel discord.PrivacyLevel `json:"privacy_level,omitempty"` AuditLogReason `json:"-"` }
https://discord.com/developers/docs/resources/stage-instance#update-stage-instance-json-params