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 FormatEmojiAPI(id discord.Snowflake, name string) string
- type AnyMemberData
- type AnyRoleData
- type Client
- func (c *Client) AddMember(guildID, userID discord.Snowflake, token string, data AnyMemberData) (*discord.Member, error)
- func (c *Client) AddRecipient(channelID, userID discord.Snowflake, accessToken, nickname string) error
- func (c *Client) AddRole(guildID, userID, roleID discord.Snowflake) error
- func (c *Client) AttachIntegration(guildID, integrationID discord.Snowflake, integrationType discord.Service) error
- func (c *Client) Ban(guildID, userID discord.Snowflake, days uint, reason string) error
- func (c *Client) Bans(guildID discord.Snowflake) ([]discord.Ban, error)
- func (c *Client) ChangeOwnNickname(guildID discord.Snowflake, nick string) error
- func (c *Client) Channel(channelID discord.Snowflake) (*discord.Channel, error)
- func (c *Client) ChannelInvites(channelID discord.Snowflake) ([]discord.Invite, error)
- func (c *Client) Channels(guildID discord.Snowflake) ([]discord.Channel, error)
- func (c *Client) CreateChannel(guildID discord.Snowflake, data CreateChannelData) (*discord.Channel, error)
- func (c *Client) CreateEmoji(guildID discord.Snowflake, name string, image Image, roles []discord.Snowflake) (*discord.Emoji, error)
- func (c *Client) CreateGuild(data CreateGuildData) (*discord.Guild, error)
- func (c *Client) CreateInvite(channelID discord.Snowflake, maxAge discord.Seconds, maxUses uint, ...) (*discord.Invite, error)
- func (c *Client) CreatePrivateChannel(recipient discord.Snowflake) (*discord.Channel, error)
- func (c *Client) CreateRole(guildID discord.Snowflake, data AnyRoleData) (*discord.Role, error)
- func (c *Client) CreateWebhook(channelID discord.Snowflake, name string, avatar discord.Hash) (*discord.Webhook, error)
- func (c *Client) DeleteAllReactions(chID, msgID discord.Snowflake) error
- func (c *Client) DeleteChannel(channelID discord.Snowflake) error
- func (c *Client) DeleteChannelPermission(channelID, overwriteID discord.Snowflake) error
- func (c *Client) DeleteEmoji(guildID, emojiID discord.Snowflake) error
- func (c *Client) DeleteGuild(guildID discord.Snowflake) error
- func (c *Client) DeleteInvite(code string) (*discord.Invite, error)
- func (c *Client) DeleteMessage(channelID, messageID discord.Snowflake) error
- func (c *Client) DeleteMessages(channelID discord.Snowflake, messageIDs []discord.Snowflake) error
- func (c *Client) DeleteReactions(chID, msgID discord.Snowflake, emoji EmojiAPI) error
- func (c *Client) DeleteRole(guildID, roleID discord.Snowflake) error
- func (c *Client) DeleteUserReaction(chID, msgID, userID discord.Snowflake, emoji EmojiAPI) error
- func (c *Client) DeleteWebhook(webhookID discord.Snowflake) error
- func (c *Client) DeleteWebhookWithToken(webhookID discord.Snowflake, token string) error
- func (c *Client) EditChannelPermission(channelID discord.Snowflake, overwrite discord.Overwrite) error
- func (c *Client) EditMessage(channelID, messageID discord.Snowflake, content string, embed *discord.Embed, ...) (*discord.Message, error)
- func (c *Client) Emoji(guildID, emojiID discord.Snowflake) (*discord.Emoji, error)
- func (c *Client) Emojis(guildID discord.Snowflake) ([]discord.Emoji, error)
- func (c *Client) ExecuteWebhook(webhookID discord.Snowflake, token string, wait bool, data ExecuteWebhookData) (*discord.Message, error)
- func (c *Client) GetBan(guildID, userID discord.Snowflake) (*discord.Ban, error)
- func (c *Client) Guild(guildID discord.Snowflake) (*discord.Guild, error)
- func (c *Client) GuildEmbed(guildID discord.Snowflake) (*discord.GuildEmbed, error)
- func (c *Client) GuildImage(guildID discord.Snowflake, img GuildImageType) (io.ReadCloser, error)
- func (c *Client) GuildImageURL(guildID discord.Snowflake, img GuildImageType) string
- func (c *Client) GuildInvites(guildID discord.Snowflake) ([]discord.Invite, error)
- func (c *Client) GuildVanityURL(guildID discord.Snowflake) (*discord.Invite, error)
- func (c *Client) Guilds(max uint) ([]discord.Guild, error)
- func (c *Client) GuildsAfter(after discord.Snowflake, limit uint) ([]discord.Guild, error)
- func (c *Client) GuildsBefore(before discord.Snowflake, limit uint) ([]discord.Guild, error)
- func (c *Client) GuildsRange(before, after discord.Snowflake, limit uint) ([]discord.Guild, error)
- func (c *Client) Integrations(guildID discord.Snowflake) ([]discord.Integration, error)
- func (c *Client) Invite(code string) (*discord.Invite, error)
- func (c *Client) Kick(guildID, userID discord.Snowflake) error
- func (c *Client) LeaveGuild(guildID discord.Snowflake) error
- func (c *Client) Login(email, password string) (*LoginResponse, error)
- func (c *Client) Me() (*discord.User, error)
- func (c *Client) Member(guildID, userID discord.Snowflake) (*discord.Member, error)
- func (c *Client) Members(guildID discord.Snowflake, max uint) ([]discord.Member, error)
- func (c *Client) MembersAfter(guildID, after discord.Snowflake, limit uint) ([]discord.Member, error)
- func (c *Client) Message(channelID, messageID discord.Snowflake) (*discord.Message, error)
- func (c *Client) Messages(channelID discord.Snowflake, max uint) ([]discord.Message, error)
- func (c *Client) MessagesAfter(channelID, after discord.Snowflake, limit uint) ([]discord.Message, error)
- func (c *Client) MessagesAround(channelID, around discord.Snowflake, limit uint) ([]discord.Message, error)
- func (c *Client) MessagesBefore(channelID, before discord.Snowflake, limit uint) ([]discord.Message, error)
- func (c *Client) ModifyChannel(data ModifyChannelData) error
- func (c *Client) ModifyEmoji(guildID, emojiID discord.Snowflake, name string, roles []discord.Snowflake) error
- func (c *Client) ModifyGuild(guildID discord.Snowflake, data ModifyGuildData) (*discord.Guild, error)
- func (c *Client) ModifyGuildEmbed(guildID discord.Snowflake, data discord.GuildEmbed) (*discord.GuildEmbed, error)
- func (c *Client) ModifyIntegration(guildID, integrationID discord.Snowflake, ...) error
- func (c *Client) ModifyMe(data ModifySelfData) (*discord.User, error)
- func (c *Client) ModifyMember(guildID, userID discord.Snowflake, data AnyMemberData) error
- func (c *Client) ModifyRole(guildID, roleID discord.Snowflake, data AnyRoleData) (*discord.Role, error)
- func (c *Client) ModifyWebhook(webhookID discord.Snowflake, data ModifyWebhookData) (*discord.Webhook, error)
- func (c *Client) ModifyWebhookWithToken(webhookID discord.Snowflake, data ModifyWebhookData, token string) (*discord.Webhook, error)
- func (c *Client) MoveChannel(guildID, channelID discord.Snowflake, position int) error
- func (c *Client) MoveRole(guildID, roleID discord.Snowflake, position int) ([]discord.Role, error)
- func (c *Client) PinMessage(channelID, messageID discord.Snowflake) error
- func (c *Client) PinnedMessages(channelID discord.Snowflake) ([]discord.Message, error)
- func (c *Client) PrivateChannels() ([]discord.Channel, error)
- func (c *Client) Prune(guildID discord.Snowflake, days uint) (uint, error)
- func (c *Client) PruneCount(guildID discord.Snowflake, days uint) (uint, error)
- func (c *Client) React(channelID, messageID discord.Snowflake, emoji EmojiAPI) error
- func (c *Client) Reactions(channelID, messageID discord.Snowflake, max uint, emoji EmojiAPI) ([]discord.User, error)
- func (c *Client) ReactionsAfter(channelID, messageID, after discord.Snowflake, limit uint, emoji EmojiAPI) ([]discord.User, error)
- func (c *Client) ReactionsBefore(channelID, messageID, before discord.Snowflake, limit uint, emoji EmojiAPI) ([]discord.User, error)
- func (c *Client) ReactionsRange(channelID, messageID, before, after discord.Snowflake, limit uint, ...) ([]discord.User, error)
- func (c *Client) RemoveRecipient(channelID, userID discord.Snowflake) error
- func (c *Client) RemoveRole(guildID, userID, roleID discord.Snowflake) error
- func (c *Client) Roles(guildID discord.Snowflake) ([]discord.Role, error)
- func (c *Client) SendMessage(channelID discord.Snowflake, content string, embed *discord.Embed) (*discord.Message, error)
- func (c *Client) SendMessageComplex(channelID discord.Snowflake, data SendMessageData) (*discord.Message, error)
- func (c *Client) SyncIntegration(guildID, integrationID discord.Snowflake) error
- func (c *Client) TOTP(code, ticket string) (*LoginResponse, error)
- func (c *Client) Typing(channelID discord.Snowflake) error
- func (c *Client) Unban(guildID, userID discord.Snowflake) error
- func (c *Client) UnpinMessage(channelID, messageID discord.Snowflake) error
- func (c *Client) Unreact(chID, msgID discord.Snowflake, emoji EmojiAPI) error
- func (c *Client) User(userID discord.Snowflake) (*discord.User, error)
- func (c *Client) VoiceRegionsGuild(guildID discord.Snowflake) ([]discord.VoiceRegion, error)
- func (c *Client) Webhook(webhookID discord.Snowflake) (*discord.Webhook, error)
- func (c *Client) WebhookWithToken(webhookID discord.Snowflake, token string) (*discord.Webhook, error)
- func (c *Client) Webhooks(guildID discord.Snowflake) ([]discord.Webhook, error)
- type CreateChannelData
- type CreateGuildData
- type EmojiAPI
- type ErrImageTooLarge
- type ExecuteWebhookData
- type GuildImageType
- type Image
- type LoginResponse
- type MetaInvite
- type ModifyChannelData
- type ModifyGuildData
- type ModifySelfData
- type ModifyWebhookData
- type SendMessageData
- type SendMessageFile
Constants ¶
const ( BaseEndpoint = "https://discordapp.com/api" APIVersion = "6" Endpoint = BaseEndpoint + "/v" + APIVersion + "/" EndpointGateway = Endpoint + "gateway" EndpointGatewayBot = EndpointGateway + "/bot" )
const ( EndpointAuth = Endpoint + "auth/" EndpointLogin = EndpointAuth + "login" EndpointTOTP = EndpointAuth + "mfa/totp" )
const AttachmentSpoilerPrefix = "SPOILER_"
const EndpointChannels = Endpoint + "channels/"
const EndpointGuilds = Endpoint + "guilds/"
const EndpointInvites = Endpoint + "invites/"
const EndpointMe = EndpointUsers + "@me"
const EndpointUsers = Endpoint + "users/"
const EndpointWebhooks = Endpoint + "webhooks/"
Variables ¶
var (
ErrEmojiTooLarge = errors.New("Emoji is larger than 256k")
)
var ErrInvalidImageCT = errors.New("Unknown image content-type")
var ErrInvalidImageData = errors.New("Invalid image data")
var ErrNoImage = errors.New("null image")
var UserAgent = "DiscordBot (https://github.com/diamondburned/arikawa, v0.0.1)"
Functions ¶
Types ¶
type AnyMemberData ¶
type AnyMemberData struct { Nick string `json:"nick,omitempty"` Mute bool `json:"mute,omitempty"` Deaf bool `json:"deaf,omitempty"` Roles []discord.Snowflake `json:"roles,omitempty"` // Only for ModifyMember, requires MOVE_MEMBER VoiceChannel discord.Snowflake `json:"channel_id,omitempty"` }
AnyMemberData, all fields are optional.
type AnyRoleData ¶
type AnyRoleData struct { Name string `json:"name,omitempty"` // "new role" Color discord.Color `json:"color,omitempty"` // 0 Hoist bool `json:"hoist,omitempty"` // false (show role separately) Mentionable bool `json:"mentionable,omitempty"` // false Permissions discord.Permissions `json:"permissions,omitempty"` // @everyone }
type Client ¶
func (*Client) AddMember ¶
func (c *Client) AddMember( guildID, userID discord.Snowflake, token string, data AnyMemberData) (*discord.Member, error)
AddMember requires access(Token).
func (*Client) AddRecipient ¶
func (c *Client) AddRecipient( channelID, userID discord.Snowflake, 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) AttachIntegration ¶
func (c *Client) AttachIntegration( guildID, integrationID discord.Snowflake, integrationType discord.Service) error
AttachIntegration requires MANAGE_GUILD.
func (*Client) Ban ¶
Ban requires the BAN_MEMBERS permission. Days is the days back for Discord to delete the user's message, maximum 7 days.
func (*Client) ChangeOwnNickname ¶
ChangeOwnNickname only replies with the nickname back, so we're not even going to bother.
func (*Client) ChannelInvites ¶
ChannelInvites is only for guild channels. GuildInvites is for guilds.
func (*Client) CreateChannel ¶
func (*Client) CreateEmoji ¶
func (c *Client) CreateEmoji( guildID discord.Snowflake, name string, image Image, roles []discord.Snowflake) (*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). Roles slice is optional.
func (*Client) CreateGuild ¶
func (c *Client) CreateGuild(data CreateGuildData) (*discord.Guild, error)
func (*Client) CreateInvite ¶
func (c *Client) CreateInvite( channelID discord.Snowflake, maxAge discord.Seconds, maxUses uint, temp, unique bool) (*discord.Invite, error)
CreateInvite is only for guild channels. This endpoint requires CREATE_INSTANT_INVITE.
MaxAge is the duration before expiry, 0 for never. MaxUses is the maximum number of uses, 0 for unlimited. Temporary is whether this invite grants temporary membership. Unique, if true, tries not to reuse a similar invite, useful for creating unique one time use invites.
func (*Client) CreatePrivateChannel ¶
func (*Client) CreateRole ¶
func (*Client) CreateWebhook ¶
func (c *Client) CreateWebhook( channelID discord.Snowflake, name string, avatar discord.Hash) (*discord.Webhook, error)
CreateWebhook creates a new webhook; avatar hash is optional. Requires MANAGE_WEBHOOKS.
func (*Client) DeleteAllReactions ¶
DeleteAllReactions equires MANAGE_MESSAGE.
func (*Client) DeleteChannelPermission ¶
func (*Client) DeleteEmoji ¶
DeleteEmoji requires MANAGE_EMOJIS.
func (*Client) DeleteInvite ¶
DeleteInvite requires either MANAGE_CHANNELS on the target channel, or MANAGE_GUILD to remove any invite in the guild.
func (*Client) DeleteMessage ¶
DeleteMessage deletes a message. Requires MANAGE_MESSAGES if the message is not made by yourself.
func (*Client) DeleteMessages ¶
DeleteMessages only works for bots. It can't delete messages older than 2 weeks, and will fail if tried. This endpoint requires MANAGE_MESSAGES.
func (*Client) DeleteReactions ¶ added in v0.0.9
DeleteReactions equires MANAGE_MESSAGE.
func (*Client) DeleteUserReaction ¶ added in v0.0.9
DeleteReaction requires MANAGE_MESSAGES if not @me.
func (*Client) DeleteWebhookWithToken ¶
func (*Client) EditChannelPermission ¶
func (*Client) EditMessage ¶
func (*Client) ExecuteWebhook ¶
func (c *Client) ExecuteWebhook( webhookID discord.Snowflake, token string, wait bool, data ExecuteWebhookData) (*discord.Message, error)
ExecuteWebhook sends a message to the webhook. If wait is bool, Discord will wait for the message to be delivered and will return the message body. This also means the returned message will only be there if wait is true.
func (*Client) GuildEmbed ¶
func (*Client) GuildImage ¶
func (c *Client) GuildImage( guildID discord.Snowflake, img GuildImageType) (io.ReadCloser, error)
func (*Client) GuildImageURL ¶
func (c *Client) GuildImageURL( guildID discord.Snowflake, img GuildImageType) string
func (*Client) GuildInvites ¶
GuildInvites is for guilds.
func (*Client) GuildVanityURL ¶
GuildVanityURL returns *Invite, but only Code and Uses are filled. Requires MANAGE_GUILD.
func (*Client) Guilds ¶
Guilds returns all guilds, automatically paginating. Be careful, as this method may abuse the API by requesting thousands or millions of guilds. For lower-level access, usee GuildsRange. Guilds returned have some fields filled only (ID, Name, Icon, Owner, Permissions).
func (*Client) GuildsAfter ¶
GuildsAfter fetches guilds. Check GuildsRange.
func (*Client) GuildsBefore ¶
GuildsBefore fetches guilds. Check GuildsRange.
func (*Client) GuildsRange ¶
GuildsRange fetches guilds. The limit is 1-100.
func (*Client) Integrations ¶
Integrations requires MANAGE_GUILD.
func (*Client) Login ¶ added in v0.0.2
func (c *Client) Login(email, password string) (*LoginResponse, error)
func (*Client) Members ¶
Members returns members until it reaches max. This function automatically paginates, meaning the normal 1000 limit is handled internally. Max can be 0, in which the function will try and fetch everything.
func (*Client) MembersAfter ¶
func (c *Client) MembersAfter( guildID, after discord.Snowflake, limit uint) ([]discord.Member, error)
MembersAfter returns a list of all guild members, from 1-1000 for limits. The default limit is 1 and the maximum limit is 1000.
func (*Client) Messages ¶
Messages gets all mesesages, automatically paginating. Use with care, as this could get as many as hundred thousands of messages, making a lot of queries.
func (*Client) MessagesAfter ¶
func (c *Client) MessagesAfter( channelID, after discord.Snowflake, limit uint) ([]discord.Message, error)
MessagesAfter returns messages after the ID, with a limit of 1-100.
func (*Client) MessagesAround ¶
func (c *Client) MessagesAround( channelID, around discord.Snowflake, limit uint) ([]discord.Message, error)
MessagesAround returns messages around the ID, with a limit of 1-100.
func (*Client) MessagesBefore ¶
func (c *Client) MessagesBefore( channelID, before discord.Snowflake, limit uint) ([]discord.Message, error)
MessagesBefore returns messages before the ID, with a limit of 1-100.
func (*Client) ModifyChannel ¶
func (c *Client) ModifyChannel(data ModifyChannelData) error
func (*Client) ModifyEmoji ¶
func (c *Client) ModifyEmoji( guildID, emojiID discord.Snowflake, name string, roles []discord.Snowflake) error
ModifyEmoji changes an existing emoji. This requires MANAGE_EMOJIS. Name and roles are optional fields (though you'd want to change either though).
func (*Client) ModifyGuild ¶
func (*Client) ModifyGuildEmbed ¶
func (c *Client) ModifyGuildEmbed( guildID discord.Snowflake, data discord.GuildEmbed) (*discord.GuildEmbed, error)
ModifyGuildEmbed should be used with care: if you still want the embed enabled, you need to set the Enabled boolean, even if it's already enabled. If you don't, JSON will default it to false.
func (*Client) ModifyIntegration ¶
func (c *Client) ModifyIntegration( guildID, integrationID discord.Snowflake, expireBehavior, expireGracePeriod int, emoticons bool) error
ModifyIntegration requires MANAGE_GUILD.
func (*Client) ModifyMember ¶
func (c *Client) ModifyMember( guildID, userID discord.Snowflake, data AnyMemberData) error
func (*Client) ModifyRole ¶
func (*Client) ModifyWebhook ¶
func (*Client) ModifyWebhookWithToken ¶
func (*Client) MoveChannel ¶
func (*Client) PinMessage ¶
PinMessage pins a message, which requires MANAGE_MESSAGES/
func (*Client) PinnedMessages ¶
func (*Client) Prune ¶
Prune returns the number of members that is removed. Requires KICK_MEMBERS. Days must be 1 or more, default 7.
func (*Client) PruneCount ¶
PruneCount returns the number of members that would be removed in a prune operation. Requires KICK_MEMBERS. Days must be 1 or more, default 7.
func (*Client) React ¶
React adds a reaction to the message. This requires READ_MESSAGE_HISTORY (and additionally ADD_REACTIONS) to react.
func (*Client) Reactions ¶
func (c *Client) Reactions( channelID, messageID discord.Snowflake, max uint, emoji EmojiAPI) ([]discord.User, error)
Reactions returns all reactions. It will paginate automatically.
func (*Client) ReactionsAfter ¶
func (c *Client) ReactionsAfter( channelID, messageID, after discord.Snowflake, limit uint, emoji EmojiAPI) ([]discord.User, error)
Refer to ReactionsRange.
func (*Client) ReactionsBefore ¶
func (c *Client) ReactionsBefore( channelID, messageID, before discord.Snowflake, limit uint, emoji EmojiAPI) ([]discord.User, error)
Refer to ReactionsRange.
func (*Client) ReactionsRange ¶
func (c *Client) ReactionsRange( channelID, messageID, before, after discord.Snowflake, limit uint, emoji EmojiAPI) ([]discord.User, error)
ReactionsRange get users before and after IDs. Before, after, and limit are optional. A maximum limit of only 100 reactions could be returned.
func (*Client) RemoveRecipient ¶
RemoveRecipient removes a user from a group direct message.
func (*Client) RemoveRole ¶
func (*Client) SendMessage ¶
func (*Client) SendMessageComplex ¶
func (*Client) SyncIntegration ¶
func (*Client) TOTP ¶ added in v0.0.2
func (c *Client) TOTP(code, ticket string) (*LoginResponse, error)
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) UnpinMessage ¶
UnpinMessage also requires MANAGE_MESSAGES.
func (*Client) VoiceRegionsGuild ¶
GuildVoiceRegions is the same as /voice, but returns VIP ones as well if available.
func (*Client) WebhookWithToken ¶
type CreateChannelData ¶
type CreateChannelData struct { Name string `json:"name"` // 2-100 Topic string `json:"topic,omitempty"` Type discord.ChannelType `json:"type,omitempty"` VoiceBitrate uint `json:"bitrate,omitempty"` VoiceUserLimit uint `json:"user_limit,omitempty"` UserRateLimit discord.Seconds `json:"rate_limit_per_user,omitempty"` NSFW bool `json:"nsfw"` Position int `json:"position,omitempty"` Permissions []discord.Overwrite `json:"permission_overwrites,omitempty"` CategoryID discord.Snowflake `json:"parent_id,string,omitempty"` }
type CreateGuildData ¶
type CreateGuildData struct { Name string `json:"name"` Icon Image `json:"image,omitempty"` // package dc is just package discord Verification d.Verification `json:"verification_level"` Notification d.Notification `json:"default_message_notifications"` ExplicitFilter d.ExplicitFilter `json:"explicit_content_filter"` // [0] (First entry) is ALWAYS @everyone. Roles []discord.Role `json:"roles,omitempty"` // Voice only VoiceRegion string `json:"region,omitempty"` // Partial, id field is ignored. Usually only Name and Type are changed. Channels []discord.Channel `json:"channels,omitempty"` }
https://discordapp.com/developers/docs/resources/guild#create-guild-json-params
type ErrImageTooLarge ¶
type ErrImageTooLarge struct {
Size, Max int
}
func (ErrImageTooLarge) Error ¶
func (err ErrImageTooLarge) Error() string
type ExecuteWebhookData ¶
type ExecuteWebhookData struct { SendMessageData Username string `json:"username,omitempty"` AvatarURL discord.URL `json:"avatar_url,omitempty"` }
func (*ExecuteWebhookData) WriteMultipart ¶
type GuildImageType ¶
type GuildImageType string
const ( GuildShield GuildImageType = "shield" GuildBanner1 GuildImageType = "banner1" GuildBanner2 GuildImageType = "banner2" GuildBanner3 GuildImageType = "banner3" GuildBanner4 GuildImageType = "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 // Utility fields, not used for encoding MaxSize int // bytes }
Image wraps around the Data URI Scheme that Discord uses: https://discordapp.com/developers/docs/reference#image-data
func DecodeImage ¶
func (Image) MarshalJSON ¶
func (*Image) UnmarshalJSON ¶
type LoginResponse ¶ added in v0.0.2
type MetaInvite ¶
type MetaInvite struct { Inviter discord.User `json:"user"` Uses uint `json:"uses"` MaxUses uint `json:"max_uses"` MaxAge discord.Seconds `json:"max_age"` Temporary bool `json:"temporary"` CreatedAt discord.Timestamp `json:"created_at"` }
Still unsure what this is
type ModifyChannelData ¶
type ModifyChannelData struct { ChannelID discord.Snowflake `json:"id,string,omitempty"` // All types Name string `json:"name,omitempty"` Position json.OptionInt `json:"position,omitempty"` Permissions []discord.Overwrite `json:"permission_overwrites,omitempty"` // Text only Topic json.OptionString `json:"topic,omitempty"` NSFW json.OptionBool `json:"nsfw,omitempty"` // 0-21600, refer to Channel.UserRateLimit UserRateLimit discord.Seconds `json:"rate_limit_per_user,omitempty"` // Voice only // 8000 - 96000 (or 128000 for Nitro) VoiceBitrate json.OptionUint `json:"bitrate,omitempty"` // 0 no limit, 1-99 VoiceUserLimit json.OptionUint `json:"user_limit,omitempty"` // Text OR Voice CategoryID discord.Snowflake `json:"parent_id,string,omitempty"` }
type ModifyGuildData ¶
type ModifyGuildData struct { Name string `json:"name,omitempty"` Region string `json:"region,omitempty"` Icon Image `json:"image,omitempty"` // package d is just package discord Verification *d.Verification `json:"verification_level,omitempty"` Notification *d.Notification `json:"default_message_notifications,omitempty"` ExplicitFilter *d.ExplicitFilter `json:"explicit_content_filter,omitempty"` AFKChannelID *d.Snowflake `json:"afk_channel_id,string,omitempty"` AFKTimeout *d.Seconds `json:"afk_timeout,omitempty"` OwnerID d.Snowflake `json:"owner_id,string,omitempty"` Splash Image `json:"splash,omitempty"` Banner Image `json:"banner,omitempty"` SystemChannelID d.Snowflake `json:"system_channel_id,string,omitempty"` }
https://discordapp.com/developers/docs/resources/guild#modify-guild-json-params
type ModifySelfData ¶
type ModifyWebhookData ¶
type SendMessageData ¶
type SendMessageData struct { Content string `json:"content,omitempty"` Nonce string `json:"nonce,omitempty"` TTS bool `json:"tts"` Embed *discord.Embed `json:"embed,omitempty"` Files []SendMessageFile `json:"-"` }