discord

package
v0.0.0-...-2a2497c Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 15 Imported by: 13

Documentation

Index

Constants

View Source
const (
	DiscordEventReady                      = "READY"
	DiscordEventResumed                    = "RESUMED"
	DiscordEventApplicationCommandCreate   = "APPLICATION_COMMAND_CREATE"
	DiscordEventApplicationCommandUpdate   = "APPLICATION_COMMAND_UPDATE"
	DiscordEventApplicationCommandDelete   = "APPLICATION_COMMAND_DELETE"
	DiscordEventGuildMembersChunk          = "GUILD_MEMBERS_CHUNK"
	DiscordEventChannelCreate              = "CHANNEL_CREATE"
	DiscordEventChannelUpdate              = "CHANNEL_UPDATE"
	DiscordEventChannelDelete              = "CHANNEL_DELETE"
	DiscordEventChannelPinsUpdate          = "CHANNEL_PINS_UPDATE"
	DiscordEventThreadCreate               = "THREAD_CREATE"
	DiscordEventThreadUpdate               = "THREAD_UPDATE"
	DiscordEventThreadDelete               = "THREAD_DELETE"
	DiscordEventThreadListSync             = "THREAD_LIST_SYNC"
	DiscordEventThreadMemberUpdate         = "THREAD_MEMBER_UPDATE"
	DiscordEventThreadMembersUpdate        = "THREAD_MEMBERS_UPDATE"
	DiscordEventGuildCreate                = "GUILD_CREATE"
	DiscordEventGuildUpdate                = "GUILD_UPDATE"
	DiscordEventGuildDelete                = "GUILD_DELETE"
	DiscordEventGuildBanAdd                = "GUILD_BAN_ADD"
	DiscordEventGuildBanRemove             = "GUILD_BAN_REMOVE"
	DiscordEventGuildEmojisUpdate          = "GUILD_EMOJIS_UPDATE"
	DiscordEventGuildStickersUpdate        = "GUILD_STICKERS_UPDATE"
	DiscordEventGuildIntegrationsUpdate    = "GUILD_INTEGRATIONS_UPDATE"
	DiscordEventGuildMemberAdd             = "GUILD_MEMBER_ADD"
	DiscordEventGuildMemberRemove          = "GUILD_MEMBER_REMOVE"
	DiscordEventGuildMemberUpdate          = "GUILD_MEMBER_UPDATE"
	DiscordEventGuildRoleCreate            = "GUILD_ROLE_CREATE"
	DiscordEventGuildRoleUpdate            = "GUILD_ROLE_UPDATE"
	DiscordEventGuildRoleDelete            = "GUILD_ROLE_DELETE"
	DiscordEventIntegrationCreate          = "INTEGRATION_CREATE"
	DiscordEventIntegrationUpdate          = "INTEGRATION_UPDATE"
	DiscordEventIntegrationDelete          = "INTEGRATION_DELETE"
	DiscordEventInteractionCreate          = "INTERACTION_CREATE"
	DiscordEventInviteCreate               = "INVITE_CREATE"
	DiscordEventInviteDelete               = "INVITE_DELETE"
	DiscordEventMessageCreate              = "MESSAGE_CREATE"
	DiscordEventMessageUpdate              = "MESSAGE_UPDATE"
	DiscordEventMessageDelete              = "MESSAGE_DELETE"
	DiscordEventMessageDeleteBulk          = "MESSAGE_DELETE_BULK"
	DiscordEventMessageReactionAdd         = "MESSAGE_REACTION_ADD"
	DiscordEventMessageReactionRemove      = "MESSAGE_REACTION_REMOVE"
	DiscordEventMessageReactionRemoveAll   = "MESSAGE_REACTION_REMOVE_ALL"
	DiscordEventMessageReactionRemoveEmoji = "MESSAGE_REACTION_REMOVE_EMOJI"
	DiscordEventPresenceUpdate             = "PRESENCE_UPDATE"
	DiscordEventStageInstanceCreate        = "STAGE_INSTANCE_CREATE"
	DiscordEventStageInstanceUpdate        = "STAGE_INSTANCE_UPDATE"
	DiscordEventStageInstanceDelete        = "STAGE_INSTANCE_DELETE"
	DiscordEventTypingStart                = "TYPING_START"
	DiscordEventUserUpdate                 = "USER_UPDATE"
	DiscordEventVoiceStateUpdate           = "VOICE_STATE_UPDATE"
	DiscordEventVoiceServerUpdate          = "VOICE_SERVER_UPDATE"
	DiscordEventWebhookUpdate              = "WEBHOOKS_UPDATE"
	DiscordEventGuildJoinRequestDelete     = "GUILD_JOIN_REQUEST_DELETE"

	DiscordEventEntitlementCreate = "ENTITLEMENT_CREATE"
	DiscordEventEntitlementUpdate = "ENTITLEMENT_UPDATE"
	DiscordEventEntitlementDelete = "ENTITLEMENT_DELETE"

	DiscordEventGuildJoin        = "GUILD_JOIN"
	DiscordEventGuildAvailable   = "GUILD_AVAILABLE"
	DiscordEventGuildLeave       = "GUILD_LEAVE"
	DiscordEventGuildUnavailable = "GUILD_UNAVAILABLE"
)
View Source
const (
	CloseUnknownError = 4000 + iota
	CloseUnknownOpCode
	CloseDecodeError
	CloseNotAuthenticated
	CloseAuthenticationFailed
	CloseAlreadyAuthenticated

	CloseInvalidSeq
	CloseRateLimited
	CloseSessionTimeout
	CloseInvalidShard
	CloseShardingRequired
	CloseInvalidAPIVersion
	CloseInvalidIntents
	CloseDisallowedIntents
)

Gateway close codes.

View Source
const (
	PermissionCreateInstantInvite              = iota << 1          // Allows creation of instant invites.
	PermissionKickMembers                      = 0x0000000000000002 // Allows kicking members.
	PermissionBanMembers                       = 0x0000000000000004 // Allows banning members.
	PermissionAdministrator                    = 0x0000000000000008 // Allows all permissions and bypasses channel permission overwrites.
	PermissionManageChannels                   = 0x0000000000000010 // Allows management and editing of channels.
	PermissionManageServer                     = 0x0000000000000020 // Allows management and editing of the guild.
	PermissionAddReactions                     = 0x0000000000000040 // Allows for the addition of reactions to messages.
	PermissionViewAuditLogs                    = 0x0000000000000080 // Allows for viewing of audit logs.
	PermissionVoicePrioritySpeaker             = 0x0000000000000100 // Allows for using priority speaker in a voice channel.
	PermissionVoiceStreamVideo                 = 0x0000000000000200 // Allows the user to go live.
	PermissionViewChannel                      = 0x0000000000000400 // Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels.
	PermissionSendMessages                     = 0x0000000000000800 // Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads).
	PermissionSendTTSMessages                  = 0x0000000000001000 // Allows for sending of /tts messages.
	PermissionManageMessages                   = 0x0000000000002000 // Allows for deletion of other users messages.
	PermissionEmbedLinks                       = 0x0000000000004000 // Links sent by users with this permission will be auto-embedded.
	PermissionAttachFiles                      = 0x0000000000008000 // Allows for uploading images and files.
	PermissionReadMessageHistory               = 0x0000000000010000 // Allows for reading of message history.
	PermissionMentionEveryone                  = 0x0000000000020000 // Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel.
	PermissionUseExternalEmojis                = 0x0000000000040000 // Allows the usage of custom emojis from other servers.
	PermissionViewGuildInsights                = 0x0000000000080000 // Allows for viewing guild insights.
	PermissionVoiceConnect                     = 0x0000000000100000 // Allows for joining of a voice channel.
	PermissionVoiceSpeak                       = 0x0000000000200000 // Allows for speaking in a voice channel.
	PermissionVoiceMuteMembers                 = 0x0000000000400000 // Allows for muting members in a voice channel.
	PermissionVoiceDeafenMembers               = 0x0000000000800000 // Allows for deafening of members in a voice channel.
	PermissionVoiceMoveMembers                 = 0x0000000001000000 // Allows for moving of members between voice channels.
	PermissionVoiceUseVAD                      = 0x0000000002000000 // Allows for using voice-activity-detection in a voice channel.
	PermissionChangeNickname                   = 0x0000000004000000 // Allows for modification of own nickname.
	PermissionManageNicknames                  = 0x0000000008000000 // Allows for modification of other users nicknames.
	PermissionManageRoles                      = 0x0000000010000000 // Allows management and editing of roles.
	PermissionManageWebhooks                   = 0x0000000020000000 // Allows management and editing of webhooks.
	PermissionManageEmojis                     = 0x0000000040000000 // Allows management and editing of emojis and stickers.
	PermissionUseSlashCommands                 = 0x0000000080000000 // Allows members to use application commands, including slash commands and context menu commands.
	PermissionVoiceRequestToSpeak              = 0x0000000100000000 // Allows for requesting to speak in stage channels.
	PermissionManageEvents                     = 0x0000000200000000 // Allows for creating, editing, and deleting scheduled events.
	PermissionManageThreads                    = 0x0000000400000000 // Allows for deleting and archiving threads, and viewing all private threads.
	PermissionCreatePublicThreads              = 0x0000000800000000 // Allows for creating public and announcement threads.
	PermissionCreatePrivateThreads             = 0x0000001000000000 // Allows for creating private threads.
	PermissionUseExternalStickers              = 0x0000002000000000 // Allows the usage of custom stickers from other servers.
	PermissionSendMessagesInThreads            = 0x0000004000000000 // Allows for sending messages in threads.
	PermissionUseActivities                    = 0x0000008000000000 // Allows for using Activities (applications with the EMBEDDED flag) in a voice channel.
	PermissionModerateMembers                  = 0x0000010000000000 // Allows for timing out users to prevent them from sending or reacting to messages.
	PermissionViewCreatorMonetizationAnalytics = 0x0000020000000000 // Allows for viewing role subscription insights
	PermissionUseSoundboard                    = 0x0000040000000000 // Allows for using soundboard in a voice channel
	PermissionCreateGuildExpressions           = 0x0000080000000000 // Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user. Not yet available to developers, see changelog.
	PermissionCreateEvents                     = 0x0000100000000000 // Allows for creating scheduled events, and editing and deleting those created by the current user. Not yet available to developers, see changelog.
	PermissionUseExternalSounds                = 0x0000200000000000 // Allows the usage of custom soundboard sounds from other servers.
	PermissionSendVoiceMessages                = 0x0000400000000000 // Allows sending voice messages.

	PermissionAllText = PermissionViewChannel |
		PermissionSendMessages |
		PermissionSendTTSMessages |
		PermissionManageMessages |
		PermissionEmbedLinks |
		PermissionAttachFiles |
		PermissionReadMessageHistory |
		PermissionMentionEveryone

	PermissionAllVoice = PermissionViewChannel |
		PermissionVoiceConnect |
		PermissionVoiceSpeak |
		PermissionVoiceMuteMembers |
		PermissionVoiceDeafenMembers |
		PermissionVoiceMoveMembers |
		PermissionVoiceUseVAD |
		PermissionVoicePrioritySpeaker

	PermissionAllChannel = PermissionAllText |
		PermissionAllVoice |
		PermissionCreateInstantInvite |
		PermissionManageRoles |
		PermissionManageChannels |
		PermissionAddReactions |
		PermissionViewAuditLogs

	PermissionAll = PermissionAllChannel |
		PermissionKickMembers |
		PermissionBanMembers |
		PermissionManageServer |
		PermissionAdministrator |
		PermissionManageWebhooks |
		PermissionManageEmojis

	PermissionElevated = PermissionKickMembers |
		PermissionBanMembers |
		PermissionAdministrator |
		PermissionManageChannels |
		PermissionManageServer |
		PermissionManageMessages |
		PermissionManageRoles |
		PermissionManageWebhooks |
		PermissionManageEmojis |
		PermissionManageThreads |
		PermissionModerateMembers
)
View Source
const (
	APIVersion = "v10"
	UserAgent  = "Sandwich (github.com/WelcomerTeam/Discord)"
)
View Source
const AuditLogReasonHeader = "X-Audit-Log-Reason"

Variables

View Source
var (
	EndpointDiscord = "https://discord.com"
	EndpointCDN     = "https://cdn.discordapp.com"

	EndpointGuilds     = "/guilds/"
	EndpointChannels   = "/channels/"
	EndpointUsers      = "/users/"
	EndpointGateway    = "/gateway"
	EndpointGatewayBot = EndpointGateway + "/bot"
	EndpointWebhooks   = "/webhooks/"

	EndpointCDNAttachments  = "/attachments/"
	EndpointCDNAvatars      = "/avatars/"
	EndpointCDNIcons        = "/icons/"
	EndpointCDNSplashes     = "/splashes/"
	EndpointCDNChannelIcons = "/channel-icons/"
	EndpointCDNBanners      = "/banners/"

	EndpointUser = func(userID string) string {
		return EndpointUsers + userID
	}
	EndpointUserAvatar = func(userID string, avatarID string) string {
		return EndpointCDNAvatars + userID + "/" + avatarID + ".png"
	}
	EndpointUserAvatarAnimated = func(userID string, avatarID string) string {
		return EndpointCDNAvatars + userID + "/" + avatarID + ".gif"
	}
	EndpointDefaultUserAvatar = func(index string) string {
		return "/embed/avatars/" + index + ".png"
	}
	EndpointUserGuilds = func(userID string) string {
		return EndpointUsers + userID + "/guilds"
	}
	EndpointUserGuild = func(userID, guildID string) string {
		return EndpointUsers + userID + "/guilds/" + guildID
	}
	EndpointUserGuildMember = func(userID, guildID string) string {
		return EndpointUserGuild(userID, guildID) + "/member"
	}
	EndpointUserChannels = func(userID string) string {
		return EndpointUsers + userID + "/channels"
	}

	EndpointGuild = func(guildID string) string {
		return EndpointGuilds + guildID
	}
	EndpointGuildVanityURL = func(guildID string) string {
		return EndpointGuilds + guildID + "/vanity-url"
	}
	EndpointGuildPreview = func(guildID string) string {
		return EndpointGuilds + guildID + "/preview"
	}
	EndpointGuildChannels = func(guildID string) string {
		return EndpointGuilds + guildID + "/channels"
	}
	EndpointGuildMembers = func(guildID string) string {
		return EndpointGuilds + guildID + "/members"
	}
	EndpointGuildMembersSearch = func(guildID string) string {
		return EndpointGuildMembers(guildID) + "/search"
	}
	EndpointGuildMember = func(guildID, userID string) string {
		return EndpointGuilds + guildID + "/members/" + userID
	}
	EndpointGuildMemberRole = func(guildID, userID, roleID string) string {
		return EndpointGuilds + guildID + "/members/" + userID + "/roles/" + roleID
	}
	EndpointGuildBans = func(guildID string) string {
		return EndpointGuilds + guildID + "/bans"
	}
	EndpointGuildBan = func(guildID, userID string) string {
		return EndpointGuilds + guildID + "/bans/" + userID
	}
	EndpointGuildIntegrations = func(guildID string) string {
		return EndpointGuilds + guildID + "/integrations"
	}
	EndpointGuildIntegration = func(guildID, integrationID string) string {
		return EndpointGuilds + guildID + "/integrations/" + integrationID
	}
	EndpointGuildIntegrationSync = func(guildID, integrationID string) string {
		return EndpointGuilds + guildID + "/integrations/" + integrationID + "/sync"
	}
	EndpointGuildRoles = func(guildID string) string {
		return EndpointGuilds + guildID + "/roles"
	}
	EndpointGuildRole = func(guildID, roleID string) string {
		return EndpointGuilds + guildID + "/roles/" + roleID
	}
	EndpointGuildInvites = func(guildID string) string {
		return EndpointGuilds + guildID + "/invites"
	}
	EndpointGuildWidget = func(guildID string) string {
		return EndpointGuilds + guildID + "/widget"
	}

	EndpointGuildEmbed = EndpointGuildWidget

	EndpointGuildPrune = func(guildID string) string {
		return EndpointGuilds + guildID + "/prune"
	}
	EndpointGuildIcon = func(guildID string, hash string) string {
		return EndpointCDNIcons + guildID + "/" + hash + ".png"
	}
	EndpointGuildIconAnimated = func(guildID string, hash string) string {
		return EndpointCDNIcons + guildID + "/" + hash + ".gif"
	}
	EndpointGuildSplash = func(guildID string, hash string) string {
		return EndpointCDNSplashes + guildID + "/" + hash + ".png"
	}
	EndpointGuildWebhooks = func(guildID string) string {
		return EndpointGuilds + guildID + "/webhooks"
	}
	EndpointGuildAuditLogs = func(guildID string) string {
		return EndpointGuilds + guildID + "/audit-logs"
	}
	EndpointGuildEmojis = func(guildID string) string {
		return EndpointGuilds + guildID + "/emojis"
	}
	EndpointGuildEmoji = func(guildID, emojiID string) string {
		return EndpointGuilds + guildID + "/emojis/" + emojiID
	}
	EndpointGuildBanner = func(guildID string, hash string) string {
		return EndpointCDNBanners + guildID + "/" + hash + ".png"
	}

	EndpointGuildScheduledEvents = func(guildID string) string {
		return EndpointGuilds + guildID + "/scheduled-events"
	}
	EndpointGuildScheduledEvent = func(guildID, eventID string) string {
		return EndpointGuilds + guildID + "/scheduled-events/" + eventID
	}
	EndpointGuildScheduledEventUsers = func(guildID, eventID string) string {
		return EndpointGuildScheduledEvent(guildID, eventID) + "/users"
	}

	EndpointChannel = func(channelID string) string {
		return EndpointChannels + channelID
	}
	EndpointChannelPermissions = func(channelID string) string {
		return EndpointChannels + channelID + "/permissions"
	}
	EndpointChannelPermission = func(channelID, overwriteID string) string {
		return EndpointChannels + channelID + "/permissions/" + overwriteID
	}
	EndpointChannelInvites = func(channelID string) string {
		return EndpointChannels + channelID + "/invites"
	}
	EndpointChannelTyping = func(channelID string) string {
		return EndpointChannels + channelID + "/typing"
	}
	EndpointChannelMessages = func(channelID string) string {
		return EndpointChannels + channelID + "/messages"
	}
	EndpointChannelMessage = func(channelID, messageID string) string {
		return EndpointChannels + channelID + "/messages/" + messageID
	}
	EndpointChannelMessageAck = func(channelID, messageID string) string {
		return EndpointChannels + channelID + "/messages/" + messageID + "/ack"
	}
	EndpointChannelMessagesBulkDelete = func(channelID string) string {
		return EndpointChannel(channelID) + "/messages/bulk-delete"
	}
	EndpointChannelMessagesPins = func(channelID string) string {
		return EndpointChannel(channelID) + "/pins"
	}
	EndpointChannelMessagePin = func(channelID, messageID string) string {
		return EndpointChannel(channelID) + "/pins/" + messageID
	}
	EndpointChannelMessageCrosspost = func(channelID, messageID string) string {
		return EndpointChannel(channelID) + "/messages/" + messageID + "/crosspost"
	}
	EndpointChannelFollow = func(channelID string) string {
		return EndpointChannel(channelID) + "/followers"
	}

	EndpointGroupIcon = func(channelID string, hash string) string {
		return EndpointCDNChannelIcons + channelID + "/" + hash + ".png"
	}

	EndpointChannelWebhooks = func(channelID string) string {
		return EndpointChannel(channelID) + "/webhooks"
	}
	EndpointWebhook = func(webhookID string) string {
		return EndpointWebhooks + webhookID
	}
	EndpointWebhookToken = func(webhookID string, token string) string {
		return EndpointWebhooks + webhookID + "/" + token
	}
	EndpointWebhookMessage = func(webhookID string, token string, messageID string) string {
		return EndpointWebhookToken(webhookID, token) + "/messages/" + messageID
	}

	EndpointMessageReactionsAll = func(channelID, messageID string) string {
		return EndpointChannelMessage(channelID, messageID) + "/reactions"
	}
	EndpointMessageReactions = func(channelID, messageID, emojiID string) string {
		return EndpointChannelMessage(channelID, messageID) + "/reactions/" + emojiID
	}
	EndpointMessageReaction = func(channelID, messageID, emojiID, targetID string) string {
		return EndpointMessageReactions(channelID, messageID, emojiID) + "/" + targetID
	}

	EndpointApplicationGlobalCommands = func(applicationID string) string {
		return EndpointApplication(applicationID) + "/commands"
	}
	EndpointApplicationGlobalCommand = func(applicationID, channelID string) string {
		return EndpointApplicationGlobalCommands(applicationID) + "/" + channelID
	}

	EndpointApplicationGuildCommands = func(applicationID, guildID string) string {
		return EndpointApplication(applicationID) + "/guilds/" + guildID + "/commands"
	}
	EndpointApplicationGuildCommandsPermissions = func(applicationID, guildID string) string {
		return EndpointApplication(applicationID) + "/guilds/" + guildID + "/commands/permissions"
	}
	EndpointApplicationGuildCommand = func(applicationID, guildID, commandID string) string {
		return EndpointApplicationGuildCommands(applicationID, guildID) + "/" + commandID
	}
	EndpointApplicationGuildCommandPermissions = func(applicationID, guildID, commandID string) string {
		return EndpointApplicationGuildCommands(applicationID, guildID) + "/" + commandID + "/permissions"
	}
	EndpointInteraction = func(applicationID string, interactionToken string) string {
		return "/interactions/" + applicationID + "/" + interactionToken
	}
	EndpointInteractionResponse = func(interactionID string, interactionToken string) string {
		return EndpointInteraction(interactionID, interactionToken) + "/callback"
	}
	EndpointInteractionResponseActions = func(applicationID string, interactionToken string) string {
		return EndpointWebhookMessage(applicationID, interactionToken, "@original")
	}
	EndpointFollowupMessage = func(applicationID string, interactionToken string) string {
		return EndpointWebhookToken(applicationID, interactionToken)
	}
	EndpointFollowupMessageActions = func(applicationID string, interactionToken string, messageID string) string {
		return EndpointWebhookMessage(applicationID, interactionToken, messageID)
	}

	EndpointGuildCreate = "/guilds"

	EndpointInvite = func(inviteID string) string {
		return "/invites/" + inviteID
	}

	EndpointIntegrationsJoin = func(interactionID string) string {
		return "/integrations/" + interactionID + "/join"
	}

	EndpointEmoji = func(emojiID string) string {
		return "/emojis/" + emojiID + ".png"
	}
	EndpointEmojiAnimated = func(emojiID string) string {
		return "/emojis/" + emojiID + ".gif"
	}

	EndpointApplications = "/applications"
	EndpointApplication  = func(applicationID string) string {
		return EndpointApplications + "/" + applicationID
	}

	EndpointEntitlements = func(applicationID string) string {
		return EndpointApplication(applicationID) + "/entitlements"
	}

	EndpointEntitlement = func(applicationID, entitlementID string) string {
		return EndpointEntitlements(applicationID) + "/" + entitlementID
	}

	EndpointOAuth2             = "/oauth2"
	EndpointOAuth2Me           = EndpointOAuth2 + "/@me"
	EndpointOAuth2Applications = EndpointOAuth2 + "/applications"
	EndpointOAuth2Authorize    = EndpointOAuth2 + "/authorize"
	EndpointOAuth2Token        = EndpointOAuth2 + "/token"
	EndpointOAuth2TokenRevoke  = EndpointOAuth2Token + "/revoke"

	EndpointOAuth2Application = func(applicationID string) string {
		return EndpointOAuth2Applications + "/" + applicationID
	}
	EndpointOAuth2ApplicationsBot = func(applicationID string) string {
		return EndpointOAuth2Applications + "/" + applicationID + "/bot"
	}
	EndpointOAuth2ApplicationAssets = func(applicationID string) string {
		return EndpointOAuth2Applications + "/" + applicationID + "/assets"
	}
)

Endpoints.

View Source
var (
	ErrUnauthorized         = errors.New("improper token was passed")
	ErrUnsupportedImageType = errors.New("unsupported image type given")
)

Functions

func AddGuildMemberRole

func AddGuildMemberRole(s *Session, guildID Snowflake, userID Snowflake, roleID Snowflake, reason *string) error

func BeginGuildPrune

func BeginGuildPrune(s *Session, guildID Snowflake, days *int32, includedRoles []Snowflake, computePruneCount bool, reason *string) (*int32, error)

func BulkDeleteMessages

func BulkDeleteMessages(s *Session, channelID Snowflake, messageIDs []Snowflake, reason *string) error

func CreateGuildBan

func CreateGuildBan(s *Session, guildID Snowflake, userID Snowflake, reason *string) error

func CreateInteractionResponse

func CreateInteractionResponse(s *Session, interactionID Snowflake, interactionToken string, interactionResponse InteractionResponse) error

func CreateReaction

func CreateReaction(s *Session, channelID Snowflake, messageID Snowflake, emoji string) error

func DeleteAllReactions

func DeleteAllReactions(s *Session, channelID Snowflake, messageID Snowflake) error

func DeleteAllReactionsEmoji

func DeleteAllReactionsEmoji(s *Session, channelID Snowflake, messageID Snowflake, emoji string) error

func DeleteChannel

func DeleteChannel(s *Session, channelID Snowflake, reason *string) error

func DeleteChannelPermission

func DeleteChannelPermission(s *Session, channelID Snowflake, overwriteID Snowflake, reason *string) error

func DeleteFollowupMessage

func DeleteFollowupMessage(s *Session, applicationID Snowflake, interactionToken string, messageID Snowflake) error

func DeleteGlobalApplicationCommand

func DeleteGlobalApplicationCommand(s *Session, applicationID Snowflake, commandID Snowflake) error

func DeleteGuild

func DeleteGuild(s *Session, guildID Snowflake) error

func DeleteGuildApplicationCommand

func DeleteGuildApplicationCommand(s *Session, applicationID Snowflake, guildID Snowflake, commandID Snowflake) error

func DeleteGuildEmoji

func DeleteGuildEmoji(s *Session, guildID Snowflake, emojiID Snowflake, reason *string) error

func DeleteGuildIntegration

func DeleteGuildIntegration(s *Session, guildID Snowflake, integrationID Snowflake, reason *string) error

func DeleteGuildRole

func DeleteGuildRole(s *Session, guildID Snowflake, roleID Snowflake, reason *string) error

func DeleteInvite

func DeleteInvite(s *Session, inviteCode string, reason *string) error

func DeleteMessage

func DeleteMessage(s *Session, channelID Snowflake, messageID Snowflake, reason *string) error

func DeleteOriginalInteractionResponse

func DeleteOriginalInteractionResponse(s *Session, applicationID Snowflake, interactionToken string) error

func DeleteOwnReaction

func DeleteOwnReaction(s *Session, channelID Snowflake, messageID Snowflake, emoji string) error

func DeleteTestEntitlement

func DeleteTestEntitlement(s *Session, applicationID Snowflake, entitlementID Snowflake) error

func DeleteUserReaction

func DeleteUserReaction(s *Session, channelID Snowflake, messageID Snowflake, emoji string, userID Snowflake) error

func DeleteWebhook

func DeleteWebhook(s *Session, webhookID Snowflake, reason *string) error

func DeleteWebhookMessage

func DeleteWebhookMessage(s *Session, webhookID Snowflake, webhookToken string, messageID Snowflake) error

func DeleteWebhookWithToken

func DeleteWebhookWithToken(s *Session, webhookID Snowflake, webhookToken string) error

func EditChannelPermissions

func EditChannelPermissions(s *Session, channelID Snowflake, overwriteID Snowflake, overwriteArg ChannelOverwrite, reason *string) error

func GetGuildPruneCount

func GetGuildPruneCount(s *Session, guildID Snowflake, days *int32, includedRoles []Snowflake) (*int32, error)

func LeaveGuild

func LeaveGuild(s *Session, guildID Snowflake) error

func ModifyGuildChannelPositions

func ModifyGuildChannelPositions(s *Session, guildID Snowflake, channelPermissionsArgs []ChannelPermissionsParams, reason *string) error

func PinMessage

func PinMessage(s *Session, channelID Snowflake, messageID Snowflake, reason *string) error

func RemoveGuildBan

func RemoveGuildBan(s *Session, guildID Snowflake, userID Snowflake, reason *string) error

func RemoveGuildMember

func RemoveGuildMember(s *Session, guildID Snowflake, userID Snowflake, reason *string) error

func RemoveGuildMemberRole

func RemoveGuildMemberRole(s *Session, guildID Snowflake, userID Snowflake, roleID Snowflake, reason *string) error

func TriggerTypingIndicator

func TriggerTypingIndicator(s *Session, channelID Snowflake) error

func UnpinMessage

func UnpinMessage(s *Session, channelID Snowflake, messageID Snowflake, reason *string) error

Types

type Activity

type Activity struct {
	Timestamps    *Timestamps   `json:"timestamps,omitempty"`
	ApplicationID *Snowflake    `json:"application_id"`
	Party         *Party        `json:"party,omitempty"`
	Assets        *Assets       `json:"assets,omitempty"`
	Secrets       *Secrets      `json:"secrets,omitempty"`
	Flags         *ActivityFlag `json:"flags,omitempty"`
	Name          string        `json:"name"`
	URL           string        `json:"url"`
	Details       string        `json:"details"`
	State         string        `json:"state"`
	Type          ActivityType  `json:"type"`
	Instance      bool          `json:"instance"`
}

Activity represents an activity as sent as part of other packets.

type ActivityFlag

type ActivityFlag uint16

ActivityFlag represents an activity's flags.

const (
	ActivityFlagInstance ActivityFlag = 1 << iota
	ActivityFlagJoin
	ActivityFlagSpectate
	ActivityFlagJoinRequest
	ActivityFlagSync
	ActivityFlagPlay
)

Activity flags.

type ActivityType

type ActivityType int

ActivityType represents an activity's type.

const (
	ActivityTypeGame ActivityType = iota
	ActivityTypeStreaming
	ActivityTypeListening
)

Activity types.

type Application

type Application struct {
	Owner               *User            `json:"owner,omitempty"`
	Bot                 *User            `json:"bot,omitempty"`
	PrimarySKUID        *Snowflake       `json:"primary_sku_id,omitempty"`
	GuildID             *Snowflake       `json:"guild_id,omitempty"`
	Team                *ApplicationTeam `json:"team,omitempty"`
	PrivacyPolicyURL    string           `json:"privacy_policy_url,omitempty"`
	TermsOfServiceURL   string           `json:"terms_of_service,omitempty"`
	VerifyKey           string           `json:"verify_key"`
	Description         string           `json:"description"`
	Icon                string           `json:"icon,omitempty"`
	Slug                string           `json:"slug,omitempty"`
	CoverImage          string           `json:"cover_image,omitempty"`
	Name                string           `json:"name"`
	RPCOrigins          []string         `json:"rpc_origins,omitempty"`
	ID                  Snowflake        `json:"id"`
	Flags               int32            `json:"flags,omitempty"`
	BotRequireCodeGrant bool             `json:"bot_require_code_grant"`
	BotPublic           bool             `json:"bot_public"`
}

Application response from REST.

func GetCurrentBotApplicationInformation

func GetCurrentBotApplicationInformation(s *Session) (*Application, error)

type ApplicationCommand

type ApplicationCommand struct {
	DefaultMemberPermission  *Int64                      `json:"default_member_permissions,omitempty"`
	Type                     *ApplicationCommandType     `json:"type,omitempty"`
	ApplicationID            *Snowflake                  `json:"application_id,omitempty"`
	GuildID                  *Snowflake                  `json:"guild_id,omitempty"`
	NameLocalizations        map[string]string           `json:"name_localizations,omitempty"`
	DescriptionLocalizations map[string]string           `json:"description_localizations,omitempty"`
	ID                       *Snowflake                  `json:"id,omitempty"`
	DMPermission             *bool                       `json:"dm_permission,omitempty"`
	DefaultPermission        *bool                       `json:"default_permission,omitempty"`
	Name                     string                      `json:"name"`
	Description              string                      `json:"description,omitempty"`
	Options                  []*ApplicationCommandOption `json:"options,omitempty"`
	Version                  Int64                       `json:"version,omitempty"`
}

ApplicationCommand represents an application's command.

func BulkOverwriteGlobalApplicationCommands

func BulkOverwriteGlobalApplicationCommands(s *Session, applicationID Snowflake, commandArgs []*ApplicationCommand) ([]*ApplicationCommand, error)

func BulkOverwriteGuildApplicationCommands

func BulkOverwriteGuildApplicationCommands(s *Session, applicationID Snowflake, guildID Snowflake, commandArgs []*ApplicationCommand) ([]*ApplicationCommand, error)

func CreateGlobalApplicationCommand

func CreateGlobalApplicationCommand(s *Session, applicationID Snowflake, commandArg ApplicationCommand) (*ApplicationCommand, error)

func CreateGuildApplicationCommand

func CreateGuildApplicationCommand(s *Session, applicationID Snowflake, guildID Snowflake, commandArg ApplicationCommand) (*ApplicationCommand, error)

func EditGlobalApplicationCommand

func EditGlobalApplicationCommand(s *Session, applicationID Snowflake, commandID Snowflake, commandArg ApplicationCommand) (*ApplicationCommand, error)

func EditGuildApplicationCommand

func EditGuildApplicationCommand(s *Session, applicationID Snowflake, guildID Snowflake, commandID Snowflake, commandArg ApplicationCommand) (*ApplicationCommand, error)

func GetGlobalApplicationCommand

func GetGlobalApplicationCommand(s *Session, applicationID Snowflake, commandID Snowflake, withLocalizations bool) (*ApplicationCommand, error)

func GetGlobalApplicationCommands

func GetGlobalApplicationCommands(s *Session, applicationID Snowflake, withLocalizations bool) ([]*ApplicationCommand, error)

func GetGuildApplicationCommand

func GetGuildApplicationCommand(s *Session, applicationID Snowflake, guildID Snowflake, commandID Snowflake) (*ApplicationCommand, error)

func GetGuildApplicationCommands

func GetGuildApplicationCommands(s *Session, applicationID Snowflake, guildID Snowflake) ([]*ApplicationCommand, error)

type ApplicationCommandCreate

type ApplicationCommandCreate *ApplicationCommand

ApplicationCommandCreate represents the application command create event.

type ApplicationCommandDelete

type ApplicationCommandDelete *ApplicationCommand

ApplicationCommandDelete represents the application command delete event.

type ApplicationCommandOption

type ApplicationCommandOption struct {
	MinValue                 *int32                            `json:"min_value,omitempty"`
	Autocomplete             *bool                             `json:"autocomplete,omitempty"`
	NameLocalizations        map[string]string                 `json:"name_localizations,omitempty"`
	MaxLength                *int32                            `json:"max_length,omitempty"`
	DescriptionLocalizations map[string]string                 `json:"description_localizations,omitempty"`
	MinLength                *int32                            `json:"min_length,omitempty"`
	MaxValue                 *int32                            `json:"max_value,omitempty"`
	Description              string                            `json:"description,omitempty"`
	Name                     string                            `json:"name"`
	ChannelTypes             []ChannelType                     `json:"channel_types,omitempty"`
	Options                  []*ApplicationCommandOption       `json:"options,omitempty"`
	Choices                  []*ApplicationCommandOptionChoice `json:"choices,omitempty"`
	Required                 bool                              `json:"required,omitempty"`
	Type                     ApplicationCommandOptionType      `json:"type"`
}

ApplicationCommandOption represents the options for an application command.

type ApplicationCommandOptionChoice

type ApplicationCommandOptionChoice struct {
	Name              string              `json:"name"`
	NameLocalizations map[string]string   `json:"name_localizations,omitempty"`
	Value             jsoniter.RawMessage `json:"value"`
}

ApplicationCommandOptionChoice represents the different choices.

type ApplicationCommandOptionType

type ApplicationCommandOptionType uint8

ApplicationCommandOptionType represents the different types of options.

const (
	ApplicationCommandOptionTypeSubCommand ApplicationCommandOptionType = 1 + iota
	ApplicationCommandOptionTypeSubCommandGroup
	ApplicationCommandOptionTypeString
	ApplicationCommandOptionTypeInteger
	ApplicationCommandOptionTypeBoolean
	ApplicationCommandOptionTypeUser
	ApplicationCommandOptionTypeChannel
	ApplicationCommandOptionTypeRole
	ApplicationCommandOptionTypeMentionable
	ApplicationCommandOptionTypeNumber
	ApplicationCommandOptionTypeAttachment
)

type ApplicationCommandPermissionType

type ApplicationCommandPermissionType uint8

ApplicationCommandPermissionType represents the target for a command permission.

const (
	ApplicationCommandPermissionTypeRole ApplicationCommandPermissionType = 1 + iota
	ApplicationCommandPermissionTypeUser
)

type ApplicationCommandPermissions

type ApplicationCommandPermissions struct {
	ID      Snowflake                        `json:"id"`
	Type    ApplicationCommandPermissionType `json:"type"`
	Allowed bool                             `json:"permission"`
}

ApplicationCommandPermissions represents the rules for enabling or disabling a command.

type ApplicationCommandType

type ApplicationCommandType uint8

ApplicationCommandType represents the different types of application command.

const (
	ApplicationCommandTypeChatInput ApplicationCommandType = 1 + iota
	ApplicationCommandTypeUser
	ApplicationCommandTypeMessage
)

type ApplicationCommandUpdate

type ApplicationCommandUpdate *ApplicationCommand

ApplicationCommandUpdate represents the application command update event.

type ApplicationSelectOption

type ApplicationSelectOption struct {
	Emoji       *Emoji `json:"emoji,omitempty"`
	Label       string `json:"label"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
	Default     bool   `json:"default,omitempty"`
}

ApplicationSelectOption represents the structure of select options.

type ApplicationTeam

type ApplicationTeam struct {
	Icon        string                   `json:"icon,omitempty"`
	Name        string                   `json:"name"`
	Members     []*ApplicationTeamMember `json:"members"`
	ID          Snowflake                `json:"id"`
	OwnerUserID Snowflake                `json:"owner_user_id"`
}

ApplicationTeam represents the team of an application.

type ApplicationTeamMember

type ApplicationTeamMember struct {
	User            User                        `json:"user"`
	MembershipState *ApplicationTeamMemberState `json:"membership_state"`
	Permissions     []string                    `json:"permissions"`
	TeamID          Snowflake                   `json:"team_id"`
}

ApplicationTeamMembers represents a member of a team.

type ApplicationTeamMemberState

type ApplicationTeamMemberState uint8

ApplicationTeamMemberState represents the state of a member in a team.

const (
	ApplicationTeamMemberStateInvited ApplicationTeamMemberState = 1 + iota
	ApplicationTeamMemberStateAccepted
)

type Assets

type Assets struct {
	LargeImage string `json:"large_image"`
	LargeText  string `json:"large_text"`
	SmallImage string `json:"small_image"`
	SmallText  string `json:"small_text"`
}

Assets represents an activity's images and their hover texts.

type AuditLogActionType

type AuditLogActionType uint8
const (
	AuditLogActionGuildUpdate AuditLogActionType = 1

	AuditLogActionChannelCreate          AuditLogActionType = 10
	AuditLogActionChannelUpdate          AuditLogActionType = 11
	AuditLogActionChannelDelete          AuditLogActionType = 12
	AuditLogActionChannelOverwriteCreate AuditLogActionType = 13
	AuditLogActionChannelOverwriteUpdate AuditLogActionType = 14
	AuditLogActionChannelOverwriteDelete AuditLogActionType = 15

	AuditLogActionMemberKick       AuditLogActionType = 20
	AuditLogActionMemberPrune      AuditLogActionType = 21
	AuditLogActionMemberBanAdd     AuditLogActionType = 22
	AuditLogActionMemberBanRemove  AuditLogActionType = 23
	AuditLogActionMemberUpdate     AuditLogActionType = 24
	AuditLogActionMemberRoleUpdate AuditLogActionType = 25
	AuditLogActionMemberMove       AuditLogActionType = 26
	AuditLogActionMemberDisconnect AuditLogActionType = 27
	AuditLogActionBotAdd           AuditLogActionType = 28

	AuditLogActionRoleCreate AuditLogActionType = 30
	AuditLogActionRoleUpdate AuditLogActionType = 31
	AuditLogActionRoleDelete AuditLogActionType = 32

	AuditLogActionInviteCreate AuditLogActionType = 40
	AuditLogActionInviteUpdate AuditLogActionType = 41
	AuditLogActionInviteDelete AuditLogActionType = 42

	AuditLogActionWebhookCreate AuditLogActionType = 50
	AuditLogActionWebhookUpdate AuditLogActionType = 51
	AuditLogActionWebhookDelete AuditLogActionType = 52

	AuditLogActionEmojiCreate AuditLogActionType = 60
	AuditLogActionEmojiUpdate AuditLogActionType = 61
	AuditLogActionEmojiDelete AuditLogActionType = 62

	AuditLogActionMessageDelete     AuditLogActionType = 72
	AuditLogActionMessageBulkDelete AuditLogActionType = 73
	AuditLogActionMessagePin        AuditLogActionType = 74
	AuditLogActionMessageUnpin      AuditLogActionType = 75

	AuditLogActionIntegrationCreate AuditLogActionType = 80
	AuditLogActionIntegrationUpdate AuditLogActionType = 81
	AuditLogActionIntegrationDelete AuditLogActionType = 82

	AuditLogActionStageInstanceCreate AuditLogActionType = 83
	AuditLogActionStageInstanceUpdate AuditLogActionType = 84
	AuditLogActionStageInstanceDelete AuditLogActionType = 85

	AuditLogActionStickerCreate AuditLogActionType = 90
	AuditLogActionStickerUpdate AuditLogActionType = 91
	AuditLogActionStickerDelete AuditLogActionType = 92

	AuditLogActionGuildScheduledEventCreate AuditLogActionType = 100
	AuditLogActionGuildScheduledEventUpdate AuditLogActionType = 101
	AuditLogActionGuildScheduledEventDelete AuditLogActionType = 102

	AuditLogActionThreadCreate AuditLogActionType = 110
	AuditLogActionThreadUpdate AuditLogActionType = 111
	AuditLogActionThreadDelete AuditLogActionType = 112
)

type AuditLogChangeKey

type AuditLogChangeKey string
const (
	AuditLogChangeKeyAfkChannelID                AuditLogChangeKey = "afk_channel_id"
	AuditLogChangeKeyAfkTimeout                  AuditLogChangeKey = "afk_timeout"
	AuditLogChangeKeyAllow                       AuditLogChangeKey = "allow"
	AuditLogChangeKeyApplicationID               AuditLogChangeKey = "application_id"
	AuditLogChangeKeyArchived                    AuditLogChangeKey = "archived"
	AuditLogChangeKeyAsset                       AuditLogChangeKey = "asset"
	AuditLogChangeKeyAutoArchiveDuration         AuditLogChangeKey = "auto_archive_duration"
	AuditLogChangeKeyAvailable                   AuditLogChangeKey = "available"
	AuditLogChangeKeyAvatarHash                  AuditLogChangeKey = "avatar_hash"
	AuditLogChangeKeyBannerHash                  AuditLogChangeKey = "banner_hash"
	AuditLogChangeKeyBitrate                     AuditLogChangeKey = "bitrate"
	AuditLogChangeKeyChannelID                   AuditLogChangeKey = "channel_id"
	AuditLogChangeKeyCode                        AuditLogChangeKey = "code"
	AuditLogChangeKeyColor                       AuditLogChangeKey = "color"
	AuditLogChangeKeyCommunicationDisabledUntil  AuditLogChangeKey = "communication_disabled_until"
	AuditLogChangeKeyDeaf                        AuditLogChangeKey = "deaf"
	AuditLogChangeKeyDefaultAutoArchiveDuration  AuditLogChangeKey = "default_auto_archive_duration"
	AuditLogChangeKeyDefaultMessageNotifications AuditLogChangeKey = "default_message_notifications"
	AuditLogChangeKeyDeny                        AuditLogChangeKey = "deny"
	AuditLogChangeKeyDescription                 AuditLogChangeKey = "description"
	AuditLogChangeKeyDiscoverySplashHash         AuditLogChangeKey = "discovery_splash_hash"
	AuditLogChangeKeyEnableEmoticons             AuditLogChangeKey = "enable_emoticons"
	AuditLogChangeKeyEntityType                  AuditLogChangeKey = "entity_type"
	AuditLogChangeKeyExpireBehavior              AuditLogChangeKey = "expire_behavior"
	AuditLogChangeKeyExpireGracePeriod           AuditLogChangeKey = "expire_grace_period"
	AuditLogChangeKeyExplicitContentFilter       AuditLogChangeKey = "explicit_content_filter"
	AuditLogChangeKeyFormatType                  AuditLogChangeKey = "format_type"
	AuditLogChangeKeyGuildID                     AuditLogChangeKey = "guild_id"
	AuditLogChangeKeyHoist                       AuditLogChangeKey = "hoist"
	AuditLogChangeKeyIconHash                    AuditLogChangeKey = "icon_hash"
	AuditLogChangeKeyID                          AuditLogChangeKey = "id"
	AuditLogChangeKeyInvitable                   AuditLogChangeKey = "invitable"
	AuditLogChangeKeyInviterID                   AuditLogChangeKey = "inviter_id"
	AuditLogChangeKeyLocation                    AuditLogChangeKey = "location"
	AuditLogChangeKeyLocked                      AuditLogChangeKey = "locked"
	AuditLogChangeKeyMaxAge                      AuditLogChangeKey = "max_age"
	AuditLogChangeKeyMaxUses                     AuditLogChangeKey = "max_uses"
	AuditLogChangeKeyMentionable                 AuditLogChangeKey = "mentionable"
	AuditLogChangeKeyMfaLevel                    AuditLogChangeKey = "mfa_level"
	AuditLogChangeKeyMute                        AuditLogChangeKey = "mute"
	AuditLogChangeKeyName                        AuditLogChangeKey = "name"
	AuditLogChangeKeyNick                        AuditLogChangeKey = "nick"
	AuditLogChangeKeyNsfw                        AuditLogChangeKey = "nsfw"
	AuditLogChangeKeyOwnerID                     AuditLogChangeKey = "owner_id"
	AuditLogChangeKeyPermissionOverwrites        AuditLogChangeKey = "permission_overwrites"
	AuditLogChangeKeyPermissions                 AuditLogChangeKey = "permissions"
	AuditLogChangeKeyPosition                    AuditLogChangeKey = "position"
	AuditLogChangeKeyPreferredLocale             AuditLogChangeKey = "preferred_locale"
	AuditLogChangeKeyPrivacyLevel                AuditLogChangeKey = "privacy_level"
	AuditLogChangeKeyPruneDeleteDays             AuditLogChangeKey = "prune_delete_days"
	AuditLogChangeKeyPublicUpdatesChannelID      AuditLogChangeKey = "public_updates_channel_id"
	AuditLogChangeKeyRateLimitPerUser            AuditLogChangeKey = "rate_limit_per_user"
	AuditLogChangeKeyRegion                      AuditLogChangeKey = "region"
	AuditLogChangeKeyRulesChannelID              AuditLogChangeKey = "rules_channel_id"
	AuditLogChangeKeySplashHash                  AuditLogChangeKey = "splash_hash"
	AuditLogChangeKeyStatus                      AuditLogChangeKey = "status"
	AuditLogChangeKeySystemChannelID             AuditLogChangeKey = "system_channel_id"
	AuditLogChangeKeyTags                        AuditLogChangeKey = "tags"
	AuditLogChangeKeyTemporary                   AuditLogChangeKey = "temporary"
	AuditLogChangeKeyTopic                       AuditLogChangeKey = "topic"
	AuditLogChangeKeyType                        AuditLogChangeKey = "type"
	AuditLogChangeKeyUnicodeEmoji                AuditLogChangeKey = "unicode_emoji"
	AuditLogChangeKeyUserLimit                   AuditLogChangeKey = "user_limit"
	AuditLogChangeKeyUses                        AuditLogChangeKey = "uses"
	AuditLogChangeKeyVanityURLCode               AuditLogChangeKey = "vanity_url_code"
	AuditLogChangeKeyVerificationLevel           AuditLogChangeKey = "verification_level"
	AuditLogChangeKeyWidgetChannelID             AuditLogChangeKey = "widget_channel_id"
	AuditLogChangeKeyWidgetEnabled               AuditLogChangeKey = "widget_enabled"
	AuditLogChangeKeyRoleAdd                     AuditLogChangeKey = "$add"
	AuditLogChangeKeyRoleRemove                  AuditLogChangeKey = "$remove"
)

type AuditLogChanges

type AuditLogChanges struct {
	NewValue interface{}       `json:"new_value"`
	OldValue interface{}       `json:"old_value"`
	Key      AuditLogChangeKey `json:"key"`
}

type AuditLogEntry

type AuditLogEntry struct {
	TargetID   *Snowflake         `json:"target_id,omitempty"`
	UserID     *Snowflake         `json:"user_id,omitempty"`
	Options    *AuditLogOptions   `json:"options,omitempty"`
	Reason     string             `json:"reason,omitempty"`
	Changes    []*AuditLogChanges `json:"changes,omitempty"`
	ID         Snowflake          `json:"id"`
	ActionType AuditLogActionType `json:"action_type"`
}

func GetGuildAuditLog

func GetGuildAuditLog(s *Session, guildID Snowflake, userID *Snowflake, actionType *AuditLogActionType, before *Snowflake, limit *int32) ([]*AuditLogEntry, error)

type AuditLogOptions

type AuditLogOptions struct {
	ChannelID        *Snowflake           `json:"channel_id,omitempty"`
	ID               *Snowflake           `json:"id,omitempty"`
	MessageID        *Snowflake           `json:"message_id,omitempty"`
	Type             *ChannelOverrideType `json:"type,omitempty"`
	RoleName         string               `json:"role_name,omitempty"`
	Count            int32                `json:"count,omitempty"`
	DeleteMemberDays int32                `json:"delete_member_days,omitempty"`
	MembersRemoved   int32                `json:"members_removed,omitempty"`
}

type AuthorizationInformation

type AuthorizationInformation struct {
	Expires     time.Time    `json:"expires"`
	Application *Application `json:"application"`
	User        *User        `json:"user"`
	Scopes      []string     `json:"scopes"`
}

AuthorizationInformation represents the current oauth authorization.

func GetCurrentAuthorizationInformation

func GetCurrentAuthorizationInformation(s *Session) (*AuthorizationInformation, error)

type BaseInterface

type BaseInterface struct {
	HTTP       *http.Client
	APIVersion string
	URLHost    string
	URLScheme  string
	UserAgent  string

	Debug bool
}

BaseInterface is the default HTTP Interface and simply handles routing to discord. Careful, this does not handle rate limiting.

func (*BaseInterface) Fetch

func (bi *BaseInterface) Fetch(session *Session, method, endpoint, contentType string, body []byte, headers http.Header) ([]byte, error)

func (*BaseInterface) FetchBJ

func (bi *BaseInterface) FetchBJ(session *Session, method, endpoint, contentType string, body []byte, headers http.Header, response interface{}) error

func (*BaseInterface) FetchJJ

func (bi *BaseInterface) FetchJJ(session *Session, method, endpoint string, payload interface{}, headers http.Header, response interface{}) error

func (*BaseInterface) SetDebug

func (bi *BaseInterface) SetDebug(value bool)

type Channel

type Channel struct {
	OwnerID                    *Snowflake          `json:"owner_id,omitempty"`
	GuildID                    *Snowflake          `json:"guild_id,omitempty"`
	Permissions                *Int64              `json:"permissions,omitempty"`
	ThreadMember               *ThreadMember       `json:"member,omitempty"`
	ThreadMetadata             *ThreadMetadata     `json:"thread_metadata,omitempty"`
	VideoQualityMode           *VideoQualityMode   `json:"video_quality_mode,omitempty"`
	LastPinTimestamp           *time.Time          `json:"last_pin_timestamp,omitempty"`
	ParentID                   *Snowflake          `json:"parent_id,omitempty"`
	ApplicationID              *Snowflake          `json:"application_id,omitempty"`
	RTCRegion                  string              `json:"rtc_region,omitempty"`
	Topic                      string              `json:"topic,omitempty"`
	Icon                       string              `json:"icon,omitempty"`
	Name                       string              `json:"name,omitempty"`
	LastMessageID              string              `json:"last_message_id,omitempty"`
	PermissionOverwrites       []*ChannelOverwrite `json:"permission_overwrites,omitempty"`
	Recipients                 []*User             `json:"recipients,omitempty"`
	ID                         Snowflake           `json:"id"`
	UserLimit                  int32               `json:"user_limit,omitempty"`
	Bitrate                    int32               `json:"bitrate,omitempty"`
	MessageCount               int32               `json:"message_count,omitempty"`
	MemberCount                int32               `json:"member_count,omitempty"`
	RateLimitPerUser           int32               `json:"rate_limit_per_user,omitempty"`
	Position                   int32               `json:"position,omitempty"`
	DefaultAutoArchiveDuration int32               `json:"default_auto_archive_duration,omitempty"`
	NSFW                       bool                `json:"nsfw"`
	Type                       ChannelType         `json:"type"`
}

Channel represents a Discord channel.

func CreateDM

func CreateDM(s *Session, recipientID Snowflake) (*Channel, error)

func CreateGuildChannel

func CreateGuildChannel(s *Session, guildID Snowflake, channelParams ChannelParams, reason *string) (*Channel, error)

func GetChannel

func GetChannel(s *Session, channelID Snowflake) (*Channel, error)

func GetGuildChannels

func GetGuildChannels(s *Session, guildID Snowflake) ([]*Channel, error)

func ModifyChannel

func ModifyChannel(s *Session, channelID Snowflake, channelParams ChannelParams, reason *string) (*Channel, error)

func (*Channel) CreateInvite

func (c *Channel) CreateInvite(s *Session, inviteParams InviteParams, reason *string) (*Invite, error)

CreateInvite creates an invite to a channel. inviteArg: Parameters passed for creating an invite. reason: Reason for creating the invite.

func (*Channel) CreateWebhook

func (c *Channel) CreateWebhook(s *Session, webhookArg WebhookParam, reason *string) (*Webhook, error)

CreateWebhook creates a webhook for a channel. webhookArg: Parameters passed for creating a webhook. reason: Reason for creating the webhook

func (*Channel) Delete

func (c *Channel) Delete(s *Session, reason *string) error

Delete deletes a webhook channel. reason: Reason for deleting the channel.

func (*Channel) DeleteMessages

func (c *Channel) DeleteMessages(s *Session, messageIDs []Snowflake, reason *string) error

DeleteMessages bulk deletes messages in a channel. messageIDs: List of message IDs to remove. reason: Reason for bulk delete.

func (*Channel) Edit

func (c *Channel) Edit(s *Session, channelParams ChannelParams, reason *string) error

Edit edits a channel. channelArg: Parameters passed for editing a channel. reason: Reason for editing the channel.

func (*Channel) History

func (c *Channel) History(s *Session, around *Snowflake, before *Snowflake, after *Snowflake, limit *int32) ([]*Message, error)

History returns channel messages. around: Get messages around this message ID. before: Get messages before this message ID. after: Get messages after this message ID. limit: Maximum number of messages to return.

func (*Channel) Invites

func (c *Channel) Invites(s *Session) ([]*Invite, error)

Invites returns all invites for this channel.

func (*Channel) Pins

func (c *Channel) Pins(s *Session) ([]*Message, error)

Pins returns all pinned messages in this channel.

func (*Channel) Purge

func (c *Channel) Purge(s *Session, around *Snowflake, before *Snowflake, after *Snowflake, limit *int32, reason *string) ([]*Message, error)

Purge acts similar to History() however the resulting messages are deleted. around: Get messages around this message ID. before: Get messages before this message ID. after: Get messages after this message ID. limit: Maximum number of messages to return.

func (*Channel) Send

func (c *Channel) Send(s *Session, messageParams MessageParams) (*Message, error)

Sends a message in a channel. messageArg: Parameters used to send a message.

func (*Channel) SetPermissions

func (c *Channel) SetPermissions(s *Session, overwriteID Snowflake, overwriteArg ChannelOverwrite, reason *string) error

SetPermissions sets permission overwrites. overwriteID: The role or user ID to overwrite permissions for. overwriteArg: Parameters used to to overwrite permissions. reason: Reason for setting permission overwrite.

func (*Channel) TriggerTyping

func (c *Channel) TriggerTyping(s *Session) error

TriggerTyping will show a typing indicator in the channel.

func (*Channel) Webhooks

func (c *Channel) Webhooks(s *Session) ([]*Webhook, error)

Webhooks returns all webhooks for a channel.

type ChannelCreate

type ChannelCreate *Channel

ChannelCreate represents a channel create event.

type ChannelDelete

type ChannelDelete *Channel

ChannelDelete represents a channel delete event.

type ChannelOverrideType

type ChannelOverrideType uint8

ChannelOverrideType represents the target of a channel override.

const (
	ChannelOverrideTypeRole ChannelOverrideType = iota
	ChannelOverrideTypeMember
)

type ChannelOverwrite

type ChannelOverwrite struct {
	Type  *ChannelOverrideType `json:"type"`
	ID    Snowflake            `json:"id"`
	Allow Int64                `json:"allow"`
	Deny  Int64                `json:"deny"`
}

ChannelOverwrite represents a permission overwrite for a channel.

type ChannelParams

type ChannelParams struct {
	ParentID             *Snowflake          `json:"parent_id,omitempty"`
	Name                 string              `json:"name"`
	Topic                string              `json:"topic,omitempty"`
	PermissionOverwrites []*ChannelOverwrite `json:"permission_overwrites,omitempty"`
	Bitrate              int32               `json:"bitrate,omitempty"`
	UserLimit            int32               `json:"user_limit,omitempty"`
	RateLimitPerUser     int32               `json:"rate_limit_per_user,omitempty"`
	Position             int32               `json:"position,omitempty"`
	Type                 ChannelType         `json:"type"`
	NSFW                 bool                `json:"nsfw"`
}

ChannelParams the data that is provided when creating a channel.

type ChannelPermissionsParams

type ChannelPermissionsParams struct {
	ID              Snowflake `json:"id"`
	Position        int32     `json:"position"`
	LockPermissions bool      `json:"lock_permissions"`
	ParentID        Snowflake `json:"parent_id"`
}

ChannelPermissionsParams represents the arguments to modify guild channel permissions.

type ChannelPinsUpdate

type ChannelPinsUpdate struct {
	LastPinTimestamp time.Time `json:"last_pin_timestamp"`
	GuildID          Snowflake `json:"guild_id"`
	ChannelID        Snowflake `json:"channel_id"`
}

ChannelPinsUpdate represents a channel pins update event.

type ChannelType

type ChannelType uint8

ChannelType represents a channel's type.

const (
	ChannelTypeGuildText ChannelType = iota
	ChannelTypeDM
	ChannelTypeGuildVoice
	ChannelTypeGroupDM
	ChannelTypeGuildCategory
	ChannelTypeGuildNews
	ChannelTypeGuildStore

	ChannelTypeGuildNewsThread
	ChannelTypeGuildPublicThread
	ChannelTypeGuildPrivateThread
	ChannelTypeGuildStageVoice
)

type ChannelUpdate

type ChannelUpdate *Channel

ChannelUpdate represents a channel update event.

type ClientStatus

type ClientStatus struct {
	Desktop string `json:"desktop"`
	Mobile  string `json:"mobile"`
	Web     string `json:"web"`
}

ClientStatus represent's the status of a client.

type ClientUser

type ClientUser User

ClientUser aliases User to provide current user specific methods.

func (*ClientUser) Edit

func (u *ClientUser) Edit(s *Session, username *string, avatar *[]byte) error

Edit modifies the current user. username: The new username to change to. avatar: File of new avatar to change to.

type Embed

type Embed struct {
	Video       *EmbedVideo     `json:"video,omitempty"`
	Timestamp   *time.Time      `json:"timestamp,omitempty"`
	Footer      *EmbedFooter    `json:"footer,omitempty"`
	Image       *EmbedImage     `json:"image,omitempty"`
	Thumbnail   *EmbedThumbnail `json:"thumbnail,omitempty"`
	Provider    *EmbedProvider  `json:"provider,omitempty"`
	Author      *EmbedAuthor    `json:"author,omitempty"`
	Type        EmbedType       `json:"type,omitempty"`
	Description string          `json:"description,omitempty"`
	URL         string          `json:"url,omitempty"`
	Title       string          `json:"title,omitempty"`
	Fields      []*EmbedField   `json:"fields,omitempty"`
	Color       int32           `json:"color,omitempty"`
}

Embed represents a message embed.

func NewEmbed

func NewEmbed(embedType EmbedType) *Embed

func (*Embed) AddField

func (e *Embed) AddField(field *EmbedField) *Embed

func (*Embed) SetAuthor

func (e *Embed) SetAuthor(author *EmbedAuthor) *Embed

func (*Embed) SetColor

func (e *Embed) SetColor(color int32) *Embed

func (*Embed) SetDescription

func (e *Embed) SetDescription(description string) *Embed

func (*Embed) SetFooter

func (e *Embed) SetFooter(footer *EmbedFooter) *Embed

func (*Embed) SetImage

func (e *Embed) SetImage(image *EmbedImage) *Embed

func (*Embed) SetProvider

func (e *Embed) SetProvider(provider *EmbedProvider) *Embed

func (*Embed) SetThumbnail

func (e *Embed) SetThumbnail(thumbnail *EmbedThumbnail) *Embed

func (*Embed) SetTimestamp

func (e *Embed) SetTimestamp(timestamp *time.Time) *Embed

func (*Embed) SetTitle

func (e *Embed) SetTitle(title string) *Embed

func (*Embed) SetURL

func (e *Embed) SetURL(url string) *Embed

func (*Embed) SetVideo

func (e *Embed) SetVideo(video *EmbedVideo) *Embed

type EmbedAuthor

type EmbedAuthor struct {
	Name         string `json:"name"`
	URL          string `json:"url,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

EmbedAuthor represents the author of an embed.

func NewEmbedAuthor

func NewEmbedAuthor(name, url, iconURL string) *EmbedAuthor

type EmbedField

type EmbedField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline"`
}

EmbedField represents a field in an embed.

func NewEmbedField

func NewEmbedField(name, value string, inline bool) *EmbedField

type EmbedFooter

type EmbedFooter struct {
	Text         string `json:"text"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

EmbedFooter represents the footer of an embed.

func NewEmbedFooter

func NewEmbedFooter(text, iconURL string) *EmbedFooter

type EmbedImage

type EmbedImage struct {
	URL      string `json:"url"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Height   int32  `json:"height,omitempty"`
	Width    int32  `json:"width,omitempty"`
}

EmbedImage represents an image in an embed.

func NewEmbedImage

func NewEmbedImage(url string) *EmbedImage

type EmbedProvider

type EmbedProvider struct {
	Name string `json:"name,omitempty"`
	URL  string `json:"url,omitempty"`
}

EmbedProvider represents the provider of an embed.

func NewEmbedProvider

func NewEmbedProvider(name, url string) *EmbedProvider

type EmbedThumbnail

type EmbedThumbnail struct {
	URL      string `json:"url"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Height   int32  `json:"height,omitempty"`
	Width    int32  `json:"width,omitempty"`
}

EmbedThumbnail represents the thumbnail of an embed.

func NewEmbedThumbnail

func NewEmbedThumbnail(url string) *EmbedThumbnail

type EmbedType

type EmbedType string
const (
	EmbedTypeDefault EmbedType = "rich"
	EmbedTypeRich    EmbedType = "rich"
	EmbedTypeImage   EmbedType = "image"
	EmbedTypeVideo   EmbedType = "video"
	EmbedTypeGif     EmbedType = "gifv"
	EmbedTypeArticle EmbedType = "article"
	EmbedTypeLink    EmbedType = "link"
)

type EmbedVideo

type EmbedVideo struct {
	URL    string `json:"url,omitempty"`
	Height int32  `json:"height,omitempty"`
	Width  int32  `json:"width,omitempty"`
}

EmbedVideo represents the video of an embed.

func NewEmbedVideo

func NewEmbedVideo(url string) *EmbedVideo

type Emoji

type Emoji struct {
	GuildID       *Snowflake  `json:"guild_id,omitempty"`
	User          *User       `json:"user,omitempty"`
	Name          string      `json:"name"`
	Roles         []Snowflake `json:"roles,omitempty"`
	ID            Snowflake   `json:"id"`
	RequireColons bool        `json:"require_colons"`
	Managed       bool        `json:"managed"`
	Animated      bool        `json:"animated"`
	Available     bool        `json:"available"`
}

Emoji represents an Emoji on discord.

func CreateGuildEmoji

func CreateGuildEmoji(s *Session, guildID Snowflake, emojiParams EmojiParams, reason *string) (*Emoji, error)

func GetGuildEmoji

func GetGuildEmoji(s *Session, guildID Snowflake, emojiID Snowflake) (*Emoji, error)

func ListGuildEmojis

func ListGuildEmojis(s *Session, guildID Snowflake) ([]*Emoji, error)

func ModifyGuildEmoji

func ModifyGuildEmoji(s *Session, guildID Snowflake, emojiID Snowflake, emojiParams EmojiParams, reason *string) (*Emoji, error)

func (*Emoji) Delete

func (e *Emoji) Delete(s *Session, reason *string) error

Delete deletes the emoji. reason: Reason for deleting the emoji.

func (*Emoji) Edit

func (e *Emoji) Edit(s *Session, name string, roles []*Snowflake, reason *string) error

Edit edits the emoji. name: The name of the emoji roles: Roles this emoji is limited to. reason: Reason for editing the emoji.

type EmojiParams

type EmojiParams struct {
	Name  string       `json:"name"`
	Image string       `json:"image,omitempty"`
	Roles []*Snowflake `json:"roles"`
}

EmojiParams represents the payload sent to discord.

type Entitlement

type Entitlement struct {
	UserID         *Snowflake      `json:"user_id,omitempty"`
	GiftCodeFlags  *GiftCodeFlags  `json:"gift_code_flags,omitempty"`
	StartsAt       *time.Time      `json:"starts_at,omitempty"`
	EndsAt         *time.Time      `json:"ends_at,omitempty"`
	GuildID        *Snowflake      `json:"guild_id,omitempty"`
	SubscriptionID *Snowflake      `json:"subscription_id,omitempty"`
	ID             Snowflake       `json:"id"`
	SkuID          Snowflake       `json:"sku_id"`
	ApplicationID  Snowflake       `json:"application_id"`
	Type           EntitlementType `json:"type"`
	Deleted        bool            `json:"deleted"`
}

func CreateTestEntitlement

func CreateTestEntitlement(s *Session, applicationID Snowflake, entitlementParams EntitlementParams) (*Entitlement, error)

func ListEntitlements

func ListEntitlements(s *Session, applicationID Snowflake) ([]*Entitlement, error)

type EntitlementParams

type EntitlementParams struct {
	SkuID     Snowflake `json:"sku_id"`
	OwnerId   Snowflake `json:"owner_id"`
	OwnerType OwnerType `json:"owner_type"`
}

EntitlementParams represents the payload sent to discord.

type EntitlementType

type EntitlementType uint8

EntitlementType represents the type of an entitlement.

const (
	EntitlementTypeApplicationSubscription EntitlementType = 8
)

type ErrorMessage

type ErrorMessage struct {
	Message string              `json:"message"`
	Errors  jsoniter.RawMessage `json:"errors"`
	Code    int32               `json:"code"`
}

ErrorMessage represents a basic error message.

type EventMetadata

type EventMetadata struct {
	Location string `json:"location,omitempty"`
}

EventMetadata contains extra information about a scheduled event.

type EventStatus

type EventStatus uint8

EventStatus represents the status of an event.

const (
	EventStatusScheduled EventStatus = 1 + iota
	EventStatusActive
	EventStatusCompleted
	EventStatusCanceled
)

type ExplicitContentFilterLevel

type ExplicitContentFilterLevel int

ExplicitContentFilterLevel represents a guild's explicit content filter level.

const (
	ExplicitContentFilterDisabled ExplicitContentFilterLevel = iota
	ExplicitContentFilterMembersWithoutRoles
	ExplicitContentFilterAllMembers
)

Explicit content filter levels.

type File

type File struct {
	Reader      io.Reader
	Name        string
	ContentType string
}

File stores information about a file sent in a message.

type FollowedChannel

type FollowedChannel struct {
	ChannelID Snowflake `json:"channel_id"`
	WebhookID Snowflake `json:"webhook_id"`
}

FollowedChannel represents a followed channel.

func FollowNewsChannel

func FollowNewsChannel(s *Session, channelID Snowflake, webhookChannelID Snowflake) (*FollowedChannel, error)

type GatewayBotResponse

type GatewayBotResponse struct {
	URL               string `json:"url"`
	Shards            int32  `json:"shards"`
	SessionStartLimit struct {
		Total          int32 `json:"total"`
		Remaining      int32 `json:"remaining"`
		ResetAfter     int32 `json:"reset_after"`
		MaxConcurrency int32 `json:"max_concurrency"`
	} `json:"session_start_limit"`
}

GatewayBot represents a GET /gateway/bot response.

type GatewayIntent

type GatewayIntent uint32

IntentFlag represents a bitflag for intents.

const (
	IntentGuilds GatewayIntent = 1 << iota
	IntentGuildMembers
	IntentGuildBans
	IntentGuildEmojis
	IntentGuildIntegrations
	IntentGuildWebhooks
	IntentGuildInvites
	IntentGuildVoiceStates
	IntentGuildPresences
	IntentGuildMessages
	IntentGuildMessageReactions
	IntentGuildMessageTyping
	IntentDirectMessages
	IntentDirectMessageReactions
	IntentDirectMessageTyping
	IntentMessageContent
)

type GatewayOp

type GatewayOp uint8

GatewayOp represents the operation codes of a gateway message.

const (
	GatewayOpDispatch GatewayOp = iota
	GatewayOpHeartbeat
	GatewayOpIdentify
	GatewayOpStatusUpdate
	GatewayOpVoiceStateUpdate

	GatewayOpResume
	GatewayOpReconnect
	GatewayOpRequestGuildMembers
	GatewayOpInvalidSession
	GatewayOpHello
	GatewayOpHeartbeatACK
)

type GatewayPayload

type GatewayPayload struct {
	Type     string              `json:"t"`
	Data     jsoniter.RawMessage `json:"d"`
	Sequence int32               `json:"s"`
	Op       GatewayOp           `json:"op"`
}

GatewayPayload represents the base payload received from discord gateway.

type GatewayResponse

type GatewayResponse struct {
	URL string `json:"url"`
}

Gateway represents a GET /gateway response.

type GiftCodeFlags

type GiftCodeFlags uint8

GiftCodeFlags is undocumented, but present in the API.

type Guild

type Guild struct {
	JoinedAt                    time.Time                  `json:"joined_at"`
	WidgetChannelID             *Snowflake                 `json:"widget_channel_id,omitempty"`
	NSFWLevel                   *GuildNSFWLevelType        `json:"nsfw_level"`
	PublicUpdatesChannelID      *Snowflake                 `json:"public_updates_channel_id,omitempty"`
	PremiumTier                 *PremiumTier               `json:"premium_tier,omitempty"`
	RulesChannelID              *Snowflake                 `json:"rules_channel_id,omitempty"`
	SystemChannelFlags          *SystemChannelFlags        `json:"system_channel_flags,omitempty"`
	OwnerID                     *Snowflake                 `json:"owner_id,omitempty"`
	Permissions                 *Int64                     `json:"permissions,omitempty"`
	SystemChannelID             *Snowflake                 `json:"system_channel_id,omitempty"`
	AFKChannelID                *Snowflake                 `json:"afk_channel_id,omitempty"`
	ApplicationID               *Snowflake                 `json:"application_id,omitempty"`
	Description                 string                     `json:"description"`
	PreferredLocale             string                     `json:"preferred_locale"`
	Name                        string                     `json:"name"`
	Icon                        string                     `json:"icon"`
	IconHash                    string                     `json:"icon_hash"`
	Banner                      string                     `json:"banner"`
	VanityURLCode               string                     `json:"vanity_url_code"`
	Splash                      string                     `json:"splash"`
	DiscoverySplash             string                     `json:"discovery_splash"`
	Region                      string                     `json:"region"`
	Presences                   []*Activity                `json:"presences,omitempty"`
	GuildScheduledEvents        []*ScheduledEvent          `json:"guild_scheduled_events"`
	Stickers                    []*Sticker                 `json:"stickers"`
	Features                    []string                   `json:"features"`
	StageInstances              []*StageInstance           `json:"stage_instances,omitempty"`
	Roles                       []*Role                    `json:"roles"`
	Emojis                      []*Emoji                   `json:"emojis"`
	VoiceStates                 []*VoiceState              `json:"voice_states,omitempty"`
	Members                     []*GuildMember             `json:"members,omitempty"`
	Channels                    []*Channel                 `json:"channels,omitempty"`
	ID                          Snowflake                  `json:"id"`
	ExplicitContentFilter       ExplicitContentFilterLevel `json:"explicit_content_filter"`
	DefaultMessageNotifications MessageNotificationLevel   `json:"default_message_notifications"`
	ApproximateMemberCount      int32                      `json:"approximate_member_count"`
	MaxMembers                  int32                      `json:"max_members"`
	MemberCount                 int32                      `json:"member_count"`
	AFKTimeout                  int32                      `json:"afk_timeout"`
	MaxPresences                int32                      `json:"max_presences"`
	PremiumSubscriptionCount    int32                      `json:"premium_subscription_count"`
	ApproximatePresenceCount    int32                      `json:"approximate_presence_count"`
	MaxVideoChannelUsers        int32                      `json:"max_video_channel_users"`
	Unavailable                 bool                       `json:"unavailable"`
	WidgetEnabled               bool                       `json:"widget_enabled"`
	VerificationLevel           VerificationLevel          `json:"verification_level"`
	Large                       bool                       `json:"large"`
	MFALevel                    MFALevel                   `json:"mfa_level"`
	Owner                       bool                       `json:"owner"`
	PremiumProgressBarEnabled   bool                       `json:"premium_progress_bar_enabled"`
}

Guild represents a guild on discord.

func CreateGuild

func CreateGuild(s *Session, guildArg Guild) (*Guild, error)

func GetCurrentUserGuilds

func GetCurrentUserGuilds(s *Session) ([]*Guild, error)

func GetGuild

func GetGuild(s *Session, guildID Snowflake) (*Guild, error)

func GetGuildPreview

func GetGuildPreview(s *Session, guildID Snowflake) (*Guild, error)

func ModifyGuild

func ModifyGuild(s *Session, guildID Snowflake, guildArg GuildParam, reason *string) (*Guild, error)

func (*Guild) AuditLogs

func (g *Guild) AuditLogs(s *Session, guildID Snowflake, userID *Snowflake, actionType *AuditLogActionType, before *Snowflake, limit *int32) ([]*AuditLogEntry, error)

AuditLogs returns all audit logs matching query. userID: Filters audit logs by the userID provided. actionType: The action type to filter audit logs by. before: Only show audit logs before a certain snowflake. limit: Maximum number of audit log entries to return.

func (*Guild) Ban

func (g *Guild) Ban(s *Session, userID Snowflake, reason *string) error

Ban bans a user. userID: ID of user that is getting banned. reason: Reason for ban.

func (*Guild) Bans

func (g *Guild) Bans(s *Session) ([]*GuildBan, error)

Bans returns a list of guild bans.

func (*Guild) CloneChannel

func (g *Guild) CloneChannel(s *Session, c *Channel, reason *string) (*Channel, error)

CloneChannel creates a copy of the target channel. reason: Reason for creating the channel.

func (*Guild) CreateChannel

func (g *Guild) CreateChannel(s *Session, channelParams ChannelParams, reason *string) (*Channel, error)

CreateChannel creates a channel. channelArg: Parameters passed for creating a channel. reason: Reason for creating the channel.

func (*Guild) CreateCustomEmoji

func (g *Guild) CreateCustomEmoji(s *Session, name string, image []byte, roles []*Snowflake, reason *string) (*Emoji, error)

CreateCustomEmojis creates an emoji for a guild. name: Name of the custom emoji. image: Bytes representing the image file to upload. roles: Roles that this emoji is limited to. reason: Reason for creating the emoji.

func (*Guild) CreateRole

func (g *Guild) CreateRole(s *Session, roleParams RoleParams, reason *string) (*Role, error)

CreateRole creates a role. roleArg: Parameters passed for creating a role. reason: Reason for creating the role.

func (*Guild) Delete

func (g *Guild) Delete(s *Session) error

Delete deletes a guild.

func (*Guild) Edit

func (g *Guild) Edit(s *Session, guildArg GuildParam, reason *string) error

Edit edits a guild. guildArg: Parameters passed for editing a guild. reason: Reason for editing the guild.

func (*Guild) EditRolePositions

func (g *Guild) EditRolePositions(s *Session, guildRolePositionArgs []ModifyGuildRolePosition, reason *string) ([]*Role, error)

EditRolePositions edits role positions in a guild. guildRolePositionArgs: List of roles and their new role position.

func (*Guild) EstimatePrunedMembers

func (g *Guild) EstimatePrunedMembers(s *Session, days *int32, includedRoles []Snowflake) (*int32, error)

EstimatePrunedMembers returns an estimate of how many people will be pruned from a guild based on arguments. days: The number of days since speaking. includedRoles: By default pruning only removes users with no roles, any role in this list will be included.

func (*Guild) Integrations

func (g *Guild) Integrations(s *Session) ([]*Integration, error)

Integrations returns all guild integrations.

func (*Guild) Invites

func (g *Guild) Invites(s *Session) ([]*Invite, error)

Invites returns all guild invites.

func (*Guild) Kick

func (g *Guild) Kick(s *Session, userID Snowflake, reason *string) error

Kick kicks a user from the guild. userID: ID of user to kick. reason: Reason for kicking the user.

func (*Guild) Leave

func (g *Guild) Leave(s *Session) error

Leave leaves a guild.

func (*Guild) PruneMembers

func (g *Guild) PruneMembers(s *Session, guildID Snowflake, days *int32, includedRoles []Snowflake, computePruneCount bool, reason *string) (*int32, error)

PruneMembers prunes users from a guild based on arguments. days: The number of days since speaking. includedRoles: By default pruning only removes users with no roles, any role in this list will be included. computePruneCount: Returns how many users were pruned, usage on larger guilds is discouraged. reason: Reason for pruning members.

func (*Guild) QueryMembers

func (g *Guild) QueryMembers(s *Session, query string, limit *int32) ([]*GuildMember, error)

QueryMembers returns guild members whose username or nickname matches query. query: Query string to match usernames and nicknames against. limit: Maximum number of members to return.

func (*Guild) Unban

func (g *Guild) Unban(s *Session, userID Snowflake, reason *string) error

Unban unbans a user from a guild. userID: ID of user to unban. reason: Reason for unbanning.

func (*Guild) VanityInvite

func (g *Guild) VanityInvite(s *Session) (*Invite, error)

VanityInvite returns the vanity invite for a guild.

func (*Guild) Webhooks

func (g *Guild) Webhooks(s *Session) ([]*Webhook, error)

Webhooks returns all webhooks for a guild.

type GuildApplicationCommandPermissions

type GuildApplicationCommandPermissions struct {
	Permissions   []*ApplicationCommandPermissions `json:"permissions"`
	ID            Snowflake                        `json:"id"`
	ApplicationID Snowflake                        `json:"application_id"`
	GuildID       Snowflake                        `json:"guild_id"`
}

GuildApplicationCommandPermissions represent a guilds application permissions.

func BatchEditApplicationCommandPermissions

func BatchEditApplicationCommandPermissions(s *Session, applicationID Snowflake, guildID Snowflake, permissionsArg []GuildApplicationCommandPermissions) ([]*GuildApplicationCommandPermissions, error)

func EditApplicationCommandPermissions

func EditApplicationCommandPermissions(s *Session, applicationID Snowflake, guildID Snowflake, commandID Snowflake, permissionsArg []*GuildApplicationCommandPermissions) ([]*GuildApplicationCommandPermissions, error)

func GetApplicationCommandPermissions

func GetApplicationCommandPermissions(s *Session, applicationID Snowflake, guildID Snowflake, commandID Snowflake) ([]*GuildApplicationCommandPermissions, error)

func GetGuildApplicationCommandPermissions

func GetGuildApplicationCommandPermissions(s *Session, applicationID Snowflake, guildID Snowflake) ([]GuildApplicationCommandPermissions, error)

type GuildAuditLog

type GuildAuditLog struct {
	AuditLogEntries []*AuditLogEntry  `json:"audit_log_entries"`
	ScheduledEvents []*ScheduledEvent `json:"guild_scheduled_events"`
	Integrations    []*Integration    `json:"integrations"`
	Threads         []*Channel        `json:"threads"`
	Users           []*User           `json:"users"`
	Webhooks        []*Webhook        `json:"webhooks"`
}

type GuildBan

type GuildBan struct {
	GuildID *Snowflake `json:"guild_id,omitempty"`
	User    *User      `json:"user"`
	Reason  string
}

GuildBan represents a ban entry.

func GetGuildBan

func GetGuildBan(s *Session, guildID Snowflake, userID Snowflake) (*GuildBan, error)

func GetGuildBans

func GetGuildBans(s *Session, guildID Snowflake) ([]*GuildBan, error)

type GuildBanAdd

type GuildBanAdd *GuildBan

GuildBanAdd represents a guild ban add event.

type GuildBanRemove

type GuildBanRemove *GuildBan

GuildBanRemove represents a guild ban remove event.

type GuildCreate

type GuildCreate *Guild

GuildCreate represents a guild create event.

type GuildDelete

type GuildDelete *UnavailableGuild

GuildDelete represents a guild delete event.

type GuildEmojisUpdate

type GuildEmojisUpdate struct {
	Emojis  []*Emoji  `json:"emojis"`
	GuildID Snowflake `json:"guild_id"`
}

GuildEmojisUpdate represents a guild emojis update event.

type GuildIntegrationsUpdate

type GuildIntegrationsUpdate struct {
	GuildID Snowflake `json:"guild_id"`
}

GuildIntegrationsUpdate represents a guild integrations update event.

type GuildJoinRequestDelete

type GuildJoinRequestDelete struct {
	UserID  Snowflake `json:"user_id"`
	GuildID Snowflake `json:"guild_id"`
}

GuildJoinRequestDelete represents a guild join request delete event.

type GuildMember

type GuildMember struct {
	JoinedAt                   time.Time   `json:"joined_at"`
	User                       *User       `json:"user,omitempty"`
	GuildID                    *Snowflake  `json:"guild_id,omitempty"`
	Permissions                *Int64      `json:"permissions"`
	Nick                       string      `json:"nick,omitempty"`
	Avatar                     string      `json:"avatar,omitempty"`
	PremiumSince               string      `json:"premium_since,omitempty"`
	CommunicationDisabledUntil string      `json:"communication_disabled_until,omitempty"`
	Roles                      []Snowflake `json:"roles"`
	Deaf                       bool        `json:"deaf"`
	Mute                       bool        `json:"mute"`
	Pending                    bool        `json:"pending"`
}

GuildMember represents a guild member on discord.

func GetCurrentUserGuildMember

func GetCurrentUserGuildMember(s *Session, guildID Snowflake) (*GuildMember, error)

func GetGuildMember

func GetGuildMember(s *Session, guildID Snowflake, userID Snowflake) (*GuildMember, error)

func ListGuildMembers

func ListGuildMembers(s *Session, guildID Snowflake, limit *int32, after *Snowflake) ([]*GuildMember, error)

func ModifyCurrentMember

func ModifyCurrentMember(s *Session, guildID Snowflake, userID Snowflake, guildMemberArg GuildMember, reason *string) (*GuildMember, error)

func ModifyGuildMember

func ModifyGuildMember(s *Session, guildID Snowflake, userID Snowflake, guildMemberParams GuildMemberParams, reason *string) (*GuildMember, error)

func SearchGuildMembers

func SearchGuildMembers(s *Session, guildID Snowflake, query string, limit *int32) ([]*GuildMember, error)

func (*GuildMember) AddRoles

func (gm *GuildMember) AddRoles(s *Session, roles []Snowflake, reason *string, atomic bool) error

AddRoles adds roles to a guild member. roles: List of roles to add to the guild member. reason: Reason for adding the roles to the guild member. atomic: When true, will send multiple AddGuildMemberRole requests instead of at once.

func (*GuildMember) Ban

func (gm *GuildMember) Ban(s *Session, reason *string) error

Ban bans the guild member from the guild. reason: Reason for banning the guild member.

func (*GuildMember) CreateDM

func (gm *GuildMember) CreateDM(s *Session) (*Channel, error)

CreateDM creates a DMChannel with a user. This should not need to be called as Send() transparently does this. If the user already has a DMChannel created, this will return a partial channel with just an ID set.

func (*GuildMember) Edit

func (gm *GuildMember) Edit(s *Session, guildMemberParams GuildMemberParams, reason *string) error

Edit edits a guild member. guildMemberArg: Parameters used to update a guild member. reason: Reason for editing the guild member.

func (*GuildMember) Kick

func (gm *GuildMember) Kick(s *Session, reason *string) error

Kick kicks the guild member. reason: Reason for kicking the guild member.

func (*GuildMember) MoveTo

func (gm *GuildMember) MoveTo(s *Session, channelID *Snowflake, reason *string) error

MoveTo moves the guild member to a different voice channel. channelID: Channel to move the user to, if nil they are removed from voice. reason: Reason for moving the guild member

func (*GuildMember) RemoveRoles

func (gm *GuildMember) RemoveRoles(s *Session, roles []Snowflake, reason *string, atomic bool) error

RemoveRoles removes roles from a guild member.

func (*GuildMember) Send

func (gm *GuildMember) Send(s *Session, params MessageParams) (*Message, error)

Send sends a DM message to a user. This will create a DMChannel if one is not present. params: The message parameters used to send the message.

type GuildMemberAdd

type GuildMemberAdd *GuildMember

GuildMemberAdd represents a guild member add event.

type GuildMemberParams

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

GuildMemberParams represents the arguments used to modify a guild member.

type GuildMemberRemove

type GuildMemberRemove struct {
	User    *User     `json:"user"`
	GuildID Snowflake `json:"guild_id"`
}

GuildMemberRemove represents a guild member remove event.

type GuildMemberUpdate

type GuildMemberUpdate struct {
	*GuildMember
}

GuildMemberUpdate represents a guild member update event.

type GuildMembersChunk

type GuildMembersChunk struct {
	Nonce      string           `json:"nonce"`
	Members    []*GuildMember   `json:"members"`
	NotFound   []Snowflake      `json:"not_found,omitempty"`
	Presences  []PresenceStatus `json:"presences,omitempty"`
	GuildID    Snowflake        `json:"guild_id"`
	ChunkIndex int32            `json:"chunk_index"`
	ChunkCount int32            `json:"chunk_count"`
}

GuildMembersChunk represents a guild members chunk event.

type GuildNSFWLevelType

type GuildNSFWLevelType uint8

GuildNSFWLevelType represents the level of the guild.

const (
	GuildNSFWLevelTypDefault GuildNSFWLevelType = iota
	GuildNSFWLevelTypeExplicit
	GuildNSFWLevelTypeSafe
	GuildNSFWLevelTypeAgeRestricted
)

type GuildParam

type GuildParam struct {
	AFKChannelID                *Snowflake                  `json:"afk_channel_id,omitempty"`
	SystemChannelFlags          *SystemChannelFlags         `json:"system_channel_flags,omitempty"`
	VerificationLevel           *VerificationLevel          `json:"verification_level,omitempty"`
	DefaultMessageNotifications *MessageNotificationLevel   `json:"default_message_notifications,omitempty"`
	ExplicitContentFilter       *ExplicitContentFilterLevel `json:"explicit_content_filter,omitempty"`
	Icon                        *string                     `json:"icon,omitempty"`
	OwnerID                     *Snowflake                  `json:"owner_id,omitempty"`
	Name                        *string                     `json:"name,omitempty"`
	PremiumProgressBarEnabled   *bool                       `json:"premium_progress_bar_enabled,omitempty"`
	Banner                      *string                     `json:"banner,omitempty"`
	Splash                      *string                     `json:"splash,omitempty"`
	AFKTimeout                  *int32                      `json:"afk_timeout,omitempty"`
	SystemChannelID             *Snowflake                  `json:"system_channel_id,omitempty"`
	Region                      *string                     `json:"region,omitempty"`
	RulesChannelID              *Snowflake                  `json:"rules_channel_id,omitempty"`
	PublicUpdatesChannelID      *Snowflake                  `json:"public_updates_channel_id,omitempty"`
	PreferredLocale             *string                     `json:"preferred_locale,omitempty"`
	DiscoverySplash             *string                     `json:"discovery_splash,omitempty"`
	Description                 *string                     `json:"description,omitempty"`
	Features                    []string                    `json:"features,omitempty"`
}

GuildParams represents the parameters sent when modifying a guild.

type GuildPruneParam

type GuildPruneParam struct {
	Days              *int32       `json:"days,omitempty"`
	IncludeRoles      []*Snowflake `json:"include_roles"`
	ComputePruneCount bool         `json:"compute_prune_count"`
}

GuildPruneParam represents the arguments for a guild prune.

type GuildRoleCreate

type GuildRoleCreate *Role

GuildRoleCreate represents a guild role create event.

type GuildRoleDelete

type GuildRoleDelete struct {
	GuildID Snowflake `json:"guild_id"`
	RoleID  Snowflake `json:"role_id"`
}

GuildRoleDelete represents a guild role delete event.

type GuildRoleUpdate

type GuildRoleUpdate *Role

GuildRoleUpdate represents a guild role update event.

type GuildStickersUpdate

type GuildStickersUpdate struct {
	Stickers []*Sticker `json:"stickers"`
	GuildID  Snowflake  `json:"guild_id"`
}

GuildStickersUpdate represents a guild stickers update event.

type GuildUpdate

type GuildUpdate *Guild

GuildUpdate represents a guild update event.

type Heartbeat

type Heartbeat int

Heartbeat represents the heartbeat packet.

type Hello

type Hello struct {
	HeartbeatInterval int32 `json:"heartbeat_interval"`
}

Hello represents a hello event when connecting.

type Identify

type Identify struct {
	Properties     *IdentifyProperties `json:"properties"`
	Presence       *UpdateStatus       `json:"presence,omitempty"`
	Token          string              `json:"token"`
	Shard          [2]int32            `json:"shard,omitempty"`
	LargeThreshold int32               `json:"large_threshold"`
	Intents        int32               `json:"intents"`
	Compress       bool                `json:"compress"`
}

Identify represents the initial handshake with the gateway.

type IdentifyProperties

type IdentifyProperties struct {
	OS      string `json:"$os"`
	Browser string `json:"$browser"`
	Device  string `json:"$device"`
}

IdentifyProperties are the extra properties sent in the identify packet.

type Int64

type Int64 int64

int64 to allow for marshalling support.

func (Int64) MarshalJSON

func (in Int64) MarshalJSON() ([]byte, error)

func (Int64) String

func (in Int64) String() string

func (*Int64) UnmarshalJSON

func (in *Int64) UnmarshalJSON(b []byte) error

type Integration

type Integration struct {
	SyncedAt          time.Time                  `json:"synced_at,omitempty"`
	ExpireBehavior    *IntegrationExpireBehavior `json:"expire_behavior,omitempty"`
	User              *User                      `json:"user,omitempty"`
	Application       *Application               `json:"application,omitempty"`
	GuildID           *Snowflake                 `json:"guild_id,omitempty"`
	RoleID            *Snowflake                 `json:"role_id,omitempty"`
	Account           IntegrationAccount         `json:"account"`
	Type              IntegrationType            `json:"type"`
	Name              string                     `json:"name"`
	ID                Snowflake                  `json:"id"`
	ExpireGracePeriod int32                      `json:"expire_grace_period,omitempty"`
	SubscriberCount   int32                      `json:"subscriber_count,omitempty"`
	EnableEmoticons   bool                       `json:"enable_emoticons"`
	Syncing           bool                       `json:"syncing"`
	Revoked           bool                       `json:"revoked"`
	Enabled           bool                       `json:"enabled"`
}

Integration represents the structure of an integration.

func GetGuildIntegrations

func GetGuildIntegrations(s *Session, guildID Snowflake) ([]*Integration, error)

type IntegrationAccount

type IntegrationAccount struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

IntegrationAccount represents the account of the integration.

type IntegrationCreate

type IntegrationCreate *Integration

IntegrationCreate represents the integration create event.

type IntegrationDelete

type IntegrationDelete struct {
	ApplicationID *Snowflake `json:"application_id"`
	ID            Snowflake  `json:"id"`
	GuildID       Snowflake  `json:"guild_id"`
}

IntegrationDelete represents the integration delete event.

type IntegrationExpireBehavior

type IntegrationExpireBehavior uint8

IntegrationExpireBehavior represents the integration expiration.

const (
	IntegrationExpireBehaviorRemoveRole IntegrationExpireBehavior = iota
	IntegrationExpireBehaviorKick
)

type IntegrationType

type IntegrationType string

IntegrationType represents the type of integration.

const (
	IntegrationTypeTwitch  IntegrationType = "twitch"
	IntegrationTypeYoutube IntegrationType = "youtube"
	IntegrationTypeDiscord IntegrationType = "discord"
)

type IntegrationUpdate

type IntegrationUpdate *Integration

IntegrationUpdate represents the integration update event.

type Interaction

type Interaction struct {
	Member         *GuildMember     `json:"member,omitempty"`
	Message        *Message         `json:"message,omitempty"`
	AppPermissions *Int64           `json:"app_permissions"`
	Data           *InteractionData `json:"data,omitempty"`
	GuildID        *Snowflake       `json:"guild_id,omitempty"`
	ChannelID      *Snowflake       `json:"channel_id,omitempty"`
	User           *User            `json:"user,omitempty"`
	Token          string           `json:"token"`
	Locale         string           `json:"locale,omitempty"`
	GuildLocale    string           `json:"guild_locale,omitempty"`
	Entitlements   []*Entitlement   `json:"entitlements,omitempty"`
	ID             Snowflake        `json:"id"`
	ApplicationID  Snowflake        `json:"application_id"`
	Version        int32            `json:"version"`
	Type           InteractionType  `json:"type"`
}

Interaction represents the structure of an interaction.

func (*Interaction) DeleteOriginalResponse

func (i *Interaction) DeleteOriginalResponse(s *Session) error

DeleteOriginalResponse deletes the original interaction response.

func (*Interaction) EditOriginalResponse

func (i *Interaction) EditOriginalResponse(s *Session, messageParams WebhookMessageParams) (*Message, error)

EditOriginalResponse edits the original interaction response. messageArg: arguments for editing message.

func (*Interaction) SendFollowup

func (i *Interaction) SendFollowup(s *Session, messageParams WebhookMessageParams) (*InteractionFollowup, error)

SendFollowup sends a followup message. messageArg: arguments for sending message.

func (*Interaction) SendResponse

func (i *Interaction) SendResponse(s *Session, interactionType InteractionCallbackType, interactionCallbackData *InteractionCallbackData) error

SendResponse sends an interacion response. interactionType: The type of interaction callback. messageArg: arguments for sending message. choices: optional autocomplete choices.

type InteractionCallbackData

type InteractionCallbackData struct {
	Content         string                            `json:"content,omitempty"`
	Title           string                            `json:"title,omitempty"`
	CustomID        string                            `json:"custom_id,omitempty"`
	Embeds          []*Embed                          `json:"embeds,omitempty"`
	AllowedMentions []*MessageAllowedMentions         `json:"allowed_mentions,omitempty"`
	Attachments     []*MessageAttachment              `json:"attachments,omitempty"`
	Files           []*File                           `json:"-"`
	Components      []*InteractionComponent           `json:"components,omitempty"`
	Choices         []*ApplicationCommandOptionChoice `json:"choices,omitempty"`
	Flags           uint32                            `json:"flags,omitempty"`
	TTS             bool                              `json:"tts,omitempty"`
}

InteractionData represents the structure of the interaction callback data. Not all message fields are supported, allowed fields are: tts, content embeds, allowed_mentions, flags, components and attachments.

type InteractionCallbackType

type InteractionCallbackType uint8

InteractionCallbackType represents the type of interaction callbacks.

const (
	InteractionCallbackTypePong InteractionCallbackType = 1 + iota

	// InteractionCallbackTypeChannelMessageSource responds to an interaction with a message.
	InteractionCallbackTypeChannelMessageSource

	// InteractionCallbackTypeDeferredChannelMessageSource acknowledges an interaction and
	// edits a response later, users see a loading state.
	InteractionCallbackTypeDeferredChannelMessageSource

	// InteractionCallbackTypeDeferredUpdateMessage acknowledges an interaction and edits
	// a response later, users do not see a loading state.
	InteractionCallbackTypeDeferredUpdateMessage

	// InteractionCallbackTypeUpdateMessage edits the message the component was attached to.
	InteractionCallbackTypeUpdateMessage

	// InteractionCallbackTypeAutocompleteResult responds to an autocomplete interaction.
	InteractionCallbackTypeAutocompleteResult

	// InteractionCallbackTypeModal responds to an interaction with a popup modal.
	InteractionCallbackTypeModal

	// InteractionCallbackTypePremiumRequired creates an ephemeral message shown to the
	// user that ran the interaction, instructing them that whatever they tried to do requires
	// the premium benefits of your app. It also contains an "Upgrade" button to subscribe.
	InteractionCallbackTypePremiumRequired
)

type InteractionComponent

type InteractionComponent struct {
	Emoji        *Emoji                     `json:"emoji,omitempty"`
	MaxValues    *int32                     `json:"max_values,omitempty"`
	MinValues    *int32                     `json:"min_values,omitempty"`
	Placeholder  string                     `json:"placeholder,omitempty"`
	CustomID     string                     `json:"custom_id,omitempty"`
	URL          string                     `json:"url,omitempty"`
	Label        string                     `json:"label,omitempty"`
	Options      []*ApplicationSelectOption `json:"options,omitempty"`
	ChannelTypes []ChannelType              `json:"channel_types,omitempty"`
	Components   []*InteractionComponent    `json:"components,omitempty"`
	Disabled     bool                       `json:"disabled,omitempty"`
	Type         InteractionComponentType   `json:"type"`
	Style        InteractionComponentStyle  `json:"style,omitempty"`
}

InteractionComponent represents the structure of a component.

func NewInteractionComponent

func NewInteractionComponent(componentType InteractionComponentType) *InteractionComponent

func (*InteractionComponent) AddComponent

func (ic *InteractionComponent) AddComponent(component *InteractionComponent) *InteractionComponent

func (*InteractionComponent) AddOption

func (*InteractionComponent) SetCustomID

func (ic *InteractionComponent) SetCustomID(customID string) *InteractionComponent

func (*InteractionComponent) SetDisabled

func (ic *InteractionComponent) SetDisabled(disabled bool) *InteractionComponent

func (*InteractionComponent) SetEmoji

func (ic *InteractionComponent) SetEmoji(emoji *Emoji) *InteractionComponent

func (*InteractionComponent) SetLabel

func (ic *InteractionComponent) SetLabel(label string) *InteractionComponent

func (*InteractionComponent) SetMinMaxValues

func (ic *InteractionComponent) SetMinMaxValues(minValue *int32, maxValue *int32) *InteractionComponent

func (*InteractionComponent) SetPlaceholder

func (ic *InteractionComponent) SetPlaceholder(placeholder string) *InteractionComponent

func (*InteractionComponent) SetStyle

func (*InteractionComponent) SetURL

type InteractionComponentStyle

type InteractionComponentStyle uint8

InteractionComponentStyle represents the style of a component.

const (
	InteractionComponentStylePrimary InteractionComponentStyle = 1 + iota
	InteractionComponentStyleSecondary
	InteractionComponentStyleSuccess
	InteractionComponentStyleDanger
	InteractionComponentStyleLink
)
const (
	// InteractionComponentStyleShort allows for a single-line input on text inputs.
	InteractionComponentStyleShort InteractionComponentStyle = 1 + iota
	// InteractionComponentParagraph allows for a multi-line input on text inputs.
	InteractionComponentStyleParagraph
)

type InteractionComponentType

type InteractionComponentType uint8

InteractionComponentType represents the type of component.

const (
	// InteractionComponentTypeActionRow is a non-interactive container for other components.
	// You can have up to 5 action rows per message and cannot contain other action rows.
	// No extra attributes are required, just type and components.
	InteractionComponentTypeActionRow InteractionComponentType = 1 + iota
	// InteractionComponentTypeButton is an interactive component that renders in messages.
	// They can be clicked by users and must be in an action row. There is a limit of 5 buttons
	// per action row and cannot be in an action row with any select menu component.
	InteractionComponentTypeButton
	// InteractionComponentTypeStringSelect allows for users to select from predefined text options.
	InteractionComponentTypeStringSelect
	// InteractionComponentTypeTextInput allows for users to freely input text.
	InteractionComponentTypeTextInput
	InteractionComponentTypeUserInput
	InteractionComponentTypeRoleSelect
	InteractionComponentTypeMentionableSelect
	InteractionComponentTypeChannelSelect
)

type InteractionCreate

type InteractionCreate *Interaction

InteractionCreate represents the interaction create event.

type InteractionData

type InteractionData struct {
	TargetID      *Snowflake                 `json:"target_id,omitempty"`
	Resolved      *InteractionResolvedData   `json:"resolved,omitempty"`
	GuildID       *Snowflake                 `json:"guild_id,omitempty"`
	ComponentType *InteractionComponentType  `json:"component_type,omitempty"`
	Name          string                     `json:"name"`
	CustomID      string                     `json:"custom_id,omitempty"`
	Options       []*InteractionDataOption   `json:"options,omitempty"`
	Values        []*ApplicationSelectOption `json:"values,omitempty"`
	Components    []*InteractionComponent    `json:"components,omitempty"`
	Value         jsoniter.RawMessage        `json:"value,omitempty"`
	ID            Snowflake                  `json:"id"`
	Type          ApplicationCommandType     `json:"type"`
	Focused       bool                       `json:"focused,omitempty"`
}

InteractionData represents the structure of interaction data.

type InteractionDataOption

type InteractionDataOption struct {
	Name    string                       `json:"name"`
	Value   jsoniter.RawMessage          `json:"value,omitempty"`
	Options []*InteractionDataOption     `json:"options,omitempty"`
	Type    ApplicationCommandOptionType `json:"type"`
	Focused bool                         `json:"focused,omitempty"`
}

InteractionDataOption represents the structure of an interaction option.

type InteractionFollowup

type InteractionFollowup struct {
	*Message
	*Interaction
}

InteractionFollowup represents a follow up message containing both message and the interaction parent.

func (*InteractionFollowup) DeleteFollowup

func (inf *InteractionFollowup) DeleteFollowup(s *Session) error

DeleteFollowup deletes the followup message.

func (*InteractionFollowup) EditFollowup

func (inf *InteractionFollowup) EditFollowup(s *Session, messageParams WebhookMessageParams) (*Message, error)

EditFollowup edits the followup message. messageArg: arguments for editing message.

type InteractionResolvedData

type InteractionResolvedData struct {
	Users       map[Snowflake]*User              `json:"users,omitempty"`
	Members     map[Snowflake]*GuildMember       `json:"members,omitempty"`
	Roles       map[Snowflake]*Role              `json:"roles,omitempty"`
	Channels    map[Snowflake]*Channel           `json:"channels,omitempty"`
	Messages    map[Snowflake]*Message           `json:"messages,omitempty"`
	Attachments map[Snowflake]*MessageAttachment `json:"attachments,omitempty"`
}

InteractionResolvedData represents any extra payload data for an interaction.

type InteractionResponse

type InteractionResponse struct {
	Data *InteractionCallbackData `json:"data,omitempty"`
	Type InteractionCallbackType  `json:"type"`
}

InteractionResponse represents the interaction response object.

type InteractionType

type InteractionType uint8

InteractionType represents the type of interaction.

const (
	InteractionTypePing InteractionType = 1 + iota
	InteractionTypeApplicationCommand
	InteractionTypeMessageComponent
	InteractionTypeApplicationCommandAutocomplete
	InteractionTypeModalSubmit
)

type InvalidSession

type InvalidSession struct {
	Resumable bool `json:"d"`
}

Invalid Session represents the invalid session event.

type Invite

type Invite struct {
	ExpiresAt                time.Time            `json:"expires_at,omitempty"`
	CreatedAt                time.Time            `json:"created_at"`
	ScheduledEvent           *ScheduledEvent      `json:"guild_scheduled_event,omitempty"`
	StageInstance            *InviteStageInstance `json:"stage_instance,omitempty"`
	Inviter                  *User                `json:"inviter,omitempty"`
	TargetType               *InviteTargetType    `json:"target_type,omitempty"`
	TargetUser               *User                `json:"target_user,omitempty"`
	TargetApplication        *Application         `json:"target_application"`
	Guild                    *Guild               `json:"guild,omitempty"`
	Channel                  *Channel             `json:"channel,omitempty"`
	GuildID                  *Snowflake           `json:"guild_id,omitempty"`
	Code                     string               `json:"code"`
	ApproximateMemberCount   int32                `json:"approximate_member_count,omitempty"`
	Uses                     int32                `json:"uses"`
	MaxUses                  int32                `json:"max_uses"`
	MaxAge                   int32                `json:"max_age"`
	ApproximatePresenceCount int32                `json:"approximate_presence_count,omitempty"`
	Temporary                bool                 `json:"temporary"`
}

Invite represents the structure of Invite data.

func CreateChannelInvite

func CreateChannelInvite(s *Session, channelID Snowflake, inviteParams InviteParams, reason *string) (*Invite, error)

func GetChannelInvites

func GetChannelInvites(s *Session, channelID Snowflake) ([]*Invite, error)

func GetGuildInvites

func GetGuildInvites(s *Session, guildID Snowflake) ([]*Invite, error)

func GetGuildVanityURL

func GetGuildVanityURL(s *Session, guildID Snowflake) (*Invite, error)

func GetInvite

func GetInvite(s *Session, inviteCode string, withCounts *bool, withExpiration *bool, guildScheduledEventID *Snowflake) (*Invite, error)

func (*Invite) Delete

func (i *Invite) Delete(s *Session, reason *string) error

Delete deletes an invite. reason: Reason for deleting an invite.

type InviteCreate

type InviteCreate *Invite

InviteCreate represents the invite create event.

type InviteDelete

type InviteDelete *Invite

InviteDelete represents the invite delete event.

type InviteParams

type InviteParams struct {
	MaxAge    int32 `json:"max_age"`
	MaxUses   int32 `json:"max_uses"`
	Temporary bool  `json:"temporary"`
	Unique    bool  `json:"unique"`
}

InviteParams represents the params to create an invite.

type InviteStageInstance

type InviteStageInstance struct {
	Topic            string         `json:"topic"`
	Members          []*GuildMember `json:"members"`
	ParticipantCount int32          `json:"participant_count"`
	SpeakerCount     int32          `json:"speaker_count"`
}

InviteStageInstance represents the structure of an invite stage instance.

type InviteTargetType

type InviteTargetType uint8

InviteTargetType represents the type of an invites target.

const (
	InviteTargetTypeStream InviteTargetType = 1 + iota
	InviteTargetTypeEmbeddedApplication
)

type MFALevel

type MFALevel uint8

MFALevel represents a guild's MFA level.

const (
	MFALevelNone MFALevel = iota
	MFALevelElevated
)

MFA levels.

type Message

type Message struct {
	Timestamp         time.Time                `json:"timestamp"`
	EditedTimestamp   time.Time                `json:"edited_timestamp"`
	Author            *User                    `json:"author"`
	WebhookID         *Snowflake               `json:"webhook_id,omitempty"`
	Member            *GuildMember             `json:"member,omitempty"`
	GuildID           *Snowflake               `json:"guild_id,omitempty"`
	Thread            *Channel                 `json:"thread,omitempty"`
	Interaction       *MessageInteraction      `json:"interaction,omitempty"`
	ReferencedMessage *Message                 `json:"referenced_message,omitempty"`
	Flags             *MessageFlags            `json:"flags,omitempty"`
	Application       *Application             `json:"application,omitempty"`
	Activity          *MessageActivity         `json:"activity,omitempty"`
	Content           string                   `json:"content"`
	Embeds            []*Embed                 `json:"embeds"`
	MentionRoles      []*Snowflake             `json:"mention_roles"`
	Reactions         []*MessageReaction       `json:"reactions"`
	StickerItems      []*MessageSticker        `json:"sticker_items,omitempty"`
	Attachments       []*MessageAttachment     `json:"attachments"`
	Components        []*InteractionComponent  `json:"components,omitempty"`
	MentionChannels   []*MessageChannelMention `json:"mention_channels,omitempty"`
	Mentions          []*User                  `json:"mentions"`
	MessageReference  []*MessageReference      `json:"message_referenced,omitempty"`
	ID                Snowflake                `json:"id"`
	ChannelID         Snowflake                `json:"channel_id"`
	MentionEveryone   bool                     `json:"mention_everyone"`
	TTS               bool                     `json:"tts"`
	Type              MessageType              `json:"type"`
	Pinned            bool                     `json:"pinned"`
}

Message represents a message on discord.

func CreateFollowupMessage

func CreateFollowupMessage(s *Session, applicationID Snowflake, interactionToken string, messageParams WebhookMessageParams) (*Message, error)

func CreateMessage

func CreateMessage(s *Session, channelID Snowflake, messageParams MessageParams) (*Message, error)

func CrosspostMessage

func CrosspostMessage(s *Session, channelID Snowflake, messageID Snowflake) (*Message, error)

func EditFollowupMessage

func EditFollowupMessage(s *Session, applicationID Snowflake, interactionToken string, messageID Snowflake, messageParams WebhookMessageParams) (*Message, error)

func EditMessage

func EditMessage(s *Session, channelID Snowflake, messageID Snowflake, messageParams MessageParams) (*Message, error)

func EditOriginalInteractionResponse

func EditOriginalInteractionResponse(s *Session, applicationID Snowflake, interactionToken string, messageParam WebhookMessageParams) (*Message, error)

func GetChannelMessage

func GetChannelMessage(s *Session, channelID Snowflake, messageID Snowflake) (*Message, error)

func GetChannelMessages

func GetChannelMessages(s *Session, channelID Snowflake, around *Snowflake, before *Snowflake, after *Snowflake, limit *int32) ([]*Message, error)

func GetFollowupMessage

func GetFollowupMessage(s *Session, applicationID Snowflake, interactionToken string, messageID Snowflake) (*Message, error)

func GetOriginalInteractionResponse

func GetOriginalInteractionResponse(s *Session, applicationID Snowflake, interactionToken string) (*Message, error)

func GetPinnedMessages

func GetPinnedMessages(s *Session, channelID Snowflake) ([]*Message, error)

func (*Message) AddReaction

func (m *Message) AddReaction(s *Session, emoji string) error

AddReaction adds a reaction to a message emoji: unicode representation or emoji id.

func (*Message) ClearReaction

func (m *Message) ClearReaction(s *Session, emoji string) error

ClearReaction clears a specific reaction from a message. emoji: unicode representation or emoji id.

func (*Message) ClearReactions

func (m *Message) ClearReactions(s *Session) error

ClearReactions clears all reactions from a message.

func (*Message) Delete

func (m *Message) Delete(s *Session, reason *string) error

Delete deletes a message. reason: reason for deleting the message.

func (*Message) Edit

func (m *Message) Edit(s *Session, messageParams MessageParams) (*Message, error)

Edit edits a message. messageArg: arguments for editing the message.

func (*Message) Pin

func (m *Message) Pin(s *Session, reason *string) error

Pin pins a message in a channel. reason: reason for pinning a message.

func (*Message) Publish

func (m *Message) Publish(s *Session) (*Message, error)

Publish publishes a message. This must be in an announcement channel.

func (*Message) RemoveReaction

func (m *Message) RemoveReaction(s *Session, emoji string, user User) error

RemoveReaction removes a specific reaction from a specific user. emoji: unicode representation or emoji id. user: The user to remove the reaction from.

func (*Message) Reply

func (m *Message) Reply(s *Session, messageParams MessageParams) (*Message, error)

Reply will send a new message in the same channel as the target message and references the target. This is the same as using Send() and setting the message as the MessageReference. messageArg: arguments for sending a message.

func (*Message) Unpin

func (m *Message) Unpin(s *Session, reason *string) error

Unpin unpins a message. reason: Reason for unpinning.

type MessageActivity

type MessageActivity struct {
	PartyID string              `json:"party_id,omitempty"`
	Type    MessageActivityType `json:"type"`
}

MessageActivity represents a message activity on discord.

type MessageActivityType

type MessageActivityType uint8

MessageActivityType represents the type of message activity.

const (
	MessageActivityTypeJoin MessageActivityType = 1 + iota
	MessageActivityTypeSpectate
	MessageActivityTypeListen
	MessageActivityTypeJoinRequest
)

type MessageAllowedMentions

type MessageAllowedMentions struct {
	Parse       []MessageAllowedMentionsType `json:"parse"`
	Roles       []Snowflake                  `json:"roles"`
	Users       []Snowflake                  `json:"users"`
	RepliedUser bool                         `json:"replied_user"`
}

MessageAllowedMentions is the structure of the allowed mentions entry.

type MessageAllowedMentionsType

type MessageAllowedMentionsType string

MessageAllowedMentionsType represents all the allowed mention types.

const (
	MessageAllowedMentionsTypeRoles    MessageAllowedMentionsType = "roles"
	MessageAllowedMentionsTypeUsers    MessageAllowedMentionsType = "users"
	MessageAllowedMentionsTypeEveryone MessageAllowedMentionsType = "everyone"
)

type MessageAttachment

type MessageAttachment struct {
	Filename  string    `json:"filename"`
	URL       string    `json:"url"`
	ProxyURL  string    `json:"proxy_url"`
	ID        Snowflake `json:"id"`
	Size      int32     `json:"size"`
	Height    int32     `json:"height"`
	Width     int32     `json:"width"`
	Ephemeral bool      `json:"ephemeral"`
}

MessageAttachment represents a message attachment on discord.

type MessageChannelMention

type MessageChannelMention struct {
	Name    string      `json:"name"`
	ID      Snowflake   `json:"id"`
	GuildID Snowflake   `json:"guild_id"`
	Type    ChannelType `json:"type"`
}

MessageChannelMention represents a mentioned channel.

type MessageCreate

type MessageCreate *Message

MessageCreate represents the message create event.

type MessageDelete

type MessageDelete struct {
	GuildID   *Snowflake `json:"guild_id,omitempty"`
	ID        Snowflake  `json:"id"`
	ChannelID Snowflake  `json:"channel_id"`
}

MessageCreate represents the message delete event.

type MessageDeleteBulk

type MessageDeleteBulk struct {
	GuildID   *Snowflake  `json:"guild_id,omitempty"`
	IDs       []Snowflake `json:"ids"`
	ChannelID Snowflake   `json:"channel_id"`
}

MessageCreate represents the message bulk delete event.

type MessageFlags

type MessageFlags uint16

MessageFlags represents the extra information on a message.

const (
	MessageFlagCrossposted MessageFlags = 1 << iota
	MessageFlagIsCrosspost
	MessageFlagSuppressEmbeds
	MessageFlagSourceMessageDeleted
	MessageFlagUrgent
	MessageFlagHasThread
	MessageFlagEphemeral
	MessageFlagLoading
	MessageFlagFailedToMentionSomeRolesInThread
)

type MessageInteraction

type MessageInteraction struct {
	User User             `json:"user"`
	Type *InteractionType `json:"type"`
	Name string           `json:"name"`
	ID   Snowflake        `json:"id"`
}

MessageInteraction represents an executed interaction.

type MessageNotificationLevel

type MessageNotificationLevel int

MessageNotificationLevel represents a guild's message notification level.

const (
	MessageNotificationsAllMessages MessageNotificationLevel = iota
	MessageNotificationsOnlyMentions
)

Message notification levels.

type MessageParams

type MessageParams struct {
	MessageReference *MessageReference         `json:"message_reference,omitempty"`
	PayloadJSON      *jsoniter.RawMessage      `json:"payload_json,omitempty"`
	Content          string                    `json:"content"`
	Embeds           []*Embed                  `json:"embeds,omitempty"`
	AllowedMentions  []*MessageAllowedMentions `json:"allowed_mentions,omitempty"`
	Components       []*InteractionComponent   `json:"components,omitempty"`
	StickerIDs       []*Snowflake              `json:"sticker_ids,omitempty"`
	Files            []*File                   `json:"-"`
	Attachments      []*MessageAttachment      `json:"attachments,omitempty"`
	Flags            MessageFlags              `json:"flags,omitempty"`
	TTS              bool                      `json:"tts"`
}

MessageParams represents the structure for sending a message on discord.

func NewMessage

func NewMessage(content string) *MessageParams

func (*MessageParams) AddAllowedMention

func (m *MessageParams) AddAllowedMention(allowedMention MessageAllowedMentions) *MessageParams

func (*MessageParams) AddComponent

func (m *MessageParams) AddComponent(component InteractionComponent) *MessageParams

func (*MessageParams) AddEmbed

func (m *MessageParams) AddEmbed(embed Embed) *MessageParams

func (*MessageParams) AddFile

func (m *MessageParams) AddFile(file File) *MessageParams

func (*MessageParams) SetTTS

func (m *MessageParams) SetTTS(tts bool) *MessageParams

type MessageReaction

type MessageReaction struct {
	Emoji        Emoji                       `json:"emoji"`
	BurstColors  []string                    `json:"burst_colors"`
	CountDetails MessageReactionCountDetails `json:"count_details"`
	Count        int32                       `json:"count"`
	BurstCount   int32                       `json:"burst_count"`
	MeBurst      bool                        `json:"me_burst"`
	BurstMe      bool                        `json:"burst_me"`
	Me           bool                        `json:"me"`
}

MessageReaction represents a reaction to a message on discord.

type MessageReactionAdd

type MessageReactionAdd struct {
	Member    *GuildMember `json:"member,omitempty"`
	Emoji     *Emoji       `json:"emoji"`
	UserID    Snowflake    `json:"user_id"`
	ChannelID Snowflake    `json:"channel_id"`
	MessageID Snowflake    `json:"message_id"`
	GuildID   Snowflake    `json:"guild_id,omitempty"`
}

MessageReactionAdd represents a message reaction add event.

type MessageReactionCountDetails

type MessageReactionCountDetails struct {
	Burst  int32 `json:"burst"`
	Normal int32 `json:"normal"`
}

MessageReactionCountDetails represents the count details of a message reaction.

type MessageReactionRemove

type MessageReactionRemove struct {
	GuildID   *Snowflake `json:"guild_id,omitempty"`
	Emoji     *Emoji     `json:"emoji"`
	UserID    Snowflake  `json:"user_id"`
	ChannelID Snowflake  `json:"channel_id"`
	MessageID Snowflake  `json:"message_id"`
}

MessageReactionRemove represents a message reaction remove event.

type MessageReactionRemoveAll

type MessageReactionRemoveAll struct {
	ChannelID Snowflake `json:"channel_id"`
	MessageID Snowflake `json:"message_id"`
	GuildID   Snowflake `json:"guild_id,omitempty"`
}

MessageReactionRemoveAll represents a message reaction remove all event.

type MessageReactionRemoveEmoji

type MessageReactionRemoveEmoji struct {
	GuildID   *Snowflake `json:"guild_id,omitempty"`
	Emoji     *Emoji     `json:"emoji"`
	ChannelID Snowflake  `json:"channel_id"`
	MessageID Snowflake  `json:"message_id"`
}

MessageReactionRemoveEmoji represents a message reaction remove emoji event.

type MessageReference

type MessageReference struct {
	ID              *Snowflake `json:"message_id,omitempty"`
	ChannelID       *Snowflake `json:"channel_id,omitempty"`
	GuildID         *Snowflake `json:"guild_id,omitempty"`
	FailIfNotExists bool       `json:"fail_if_not_exists"`
}

MessageReference represents crossposted messages or replys.

type MessageSticker

type MessageSticker struct {
	FormatType *StickerFormatType `json:"format_type"`
	Name       string             `json:"name"`
	ID         Snowflake          `json:"id"`
}

MessageSticker represents a sticker in a message.

type MessageType

type MessageType uint8

MessageType represents the type of message that has been sent.

const (
	MessageTypeDefault MessageType = iota
	MessageTypeRecipientAdd
	MessageTypeRecipientRemove
	MessageTypeCall
	MessageTypeChannelNameChange
	MessageTypeChannelIconChange
	MessageTypeChannelPinnedMessage
	MessageTypeGuildMemberJoin
	MessageTypeUserPremiumGuildSubscription
	MessageTypeUserPremiumGuildSubscriptionTier1
	MessageTypeUserPremiumGuildSubscriptionTier2
	MessageTypeUserPremiumGuildSubscriptionTier3
	MessageTypeChannelFollowAdd

	MessageTypeGuildDiscoveryDisqualified
	MessageTypeGuildDiscoveryRequalified
	MessageTypeGuildDiscoveryGracePeriodInitialWarning
	MessageTypeGuildDiscoveryGracePeriodFinalWarning
	MessageTypeThreadCreated
	MessageTypeReply
	MessageTypeApplicationCommand
	MessageTypeThreadStarterMessage
	MessageTypeGuildInviteReminder
)

type MessageUpdate

type MessageUpdate *Message

MessageUpdate represents the message update event.

type ModifyGuildRolePosition

type ModifyGuildRolePosition struct {
	Position *int32    `json:"position,omitempty"`
	ID       Snowflake `json:"id"`
}

ModifyGuildRolePosition represents the argument for modifying guild role positions.

type OwnerType

type OwnerType uint8

OwnerType represents who owns the entitlement.

const (
	OwnerTypeGuild OwnerType = 1
	OwnerTypeUser  OwnerType = 2
)

type Party

type Party struct {
	ID   string  `json:"id,omitempty"`
	Size []int32 `json:"size,omitempty"`
}

Party represents an activity's current party information.

type PremiumTier

type PremiumTier uint8

PremiumTier represents the current boosting tier of a guild.

const (
	PremiumTierNone PremiumTier = iota
	PremiumTier1
	PremiumTier2
	PremiumTier3
)

type PresenceStatus

type PresenceStatus string

PresenceStatus represents a presence's status.

const (
	PresenceStatusIdle    PresenceStatus = "idle"
	PresenceStatusDND     PresenceStatus = "dnd"
	PresenceStatusOnline  PresenceStatus = "online"
	PresenceStatusOffline PresenceStatus = "offline"
)

Presence statuses.

type PresenceUpdate

type PresenceUpdate struct {
	User         *User          `json:"user"`
	ClientStatus *ClientStatus  `json:"clienbt_status"`
	Status       PresenceStatus `json:"status"`
	Activities   []*Activity    `json:"activities"`
	GuildID      Snowflake      `json:"guild_id"`
}

PresenceUpdate represents a presence update event.

type RESTInterface

type RESTInterface interface {
	// Fetch constructs a request. It will return a response body along with any errors.
	// Errors can include ErrInvalidToken, ErrRateLimited,
	Fetch(s *Session, method, endpoint, contentType string, body []byte, headers http.Header) ([]byte, error)
	FetchBJ(s *Session, method, endpoint, contentType string, body []byte, headers http.Header, response interface{}) error
	FetchJJ(s *Session, method, endpoint string, payload interface{}, headers http.Header, response interface{}) error

	SetDebug(value bool)
}

func NewBaseInterface

func NewBaseInterface() RESTInterface

func NewInterface

func NewInterface(httpClient *http.Client, endpoint string, version string, useragent string) RESTInterface

func NewTwilightProxy

func NewTwilightProxy(url url.URL) RESTInterface

type Ready

type Ready struct {
	Application Application         `json:"application"`
	User        User                `json:"user"`
	SessionID   string              `json:"session_id"`
	Guilds      []*UnavailableGuild `json:"guilds"`
	Shard       []int32             `json:"shard,omitempty"`
	Version     int32               `json:"v"`
}

Ready represents when the client has completed the initial handshake.

type Reconnect

type Reconnect void

Reconnect represents the reconnect event.

type RequestGuildMembers

type RequestGuildMembers struct {
	Query     string      `json:"query"`
	Nonce     string      `json:"nonce"`
	UserIDs   []Snowflake `json:"user_ids"`
	GuildID   Snowflake   `json:"guild_id"`
	Limit     int32       `json:"limit"`
	Presences bool        `json:"presences"`
}

Request guild members requests members for a guild.

type RestError

type RestError struct {
	Request      *http.Request
	Response     *http.Response
	Message      *ErrorMessage
	ResponseBody []byte
}

RestError contains the error structure that is returned by discord.

func NewRestError

func NewRestError(req *http.Request, resp *http.Response, body []byte) *RestError

func (*RestError) Error

func (r *RestError) Error() string

type Resume

type Resume struct {
	Token     string `json:"token"`
	SessionID string `json:"session_id"`
	Sequence  int32  `json:"seq"`
}

Resume resumes a dropped gateway connection.

type Resumed

type Resumed void

Resumed represents the response to a resume event.

type Role

type Role struct {
	GuildID      *Snowflake `json:"guild_id,omitempty"`
	Tags         *RoleTag   `json:"tags,omitempty"`
	Name         string     `json:"name"`
	Icon         string     `json:"icon,omitempty"`
	UnicodeEmoji string     `json:"unicode_emoji,omitempty"`
	ID           Snowflake  `json:"id"`
	Permissions  Int64      `json:"permissions"`
	Color        int32      `json:"color"`
	Position     int32      `json:"position"`
	Hoist        bool       `json:"hoist"`
	Managed      bool       `json:"managed"`
	Mentionable  bool       `json:"mentionable"`
}

Role represents a role on discord.

func CreateGuildRole

func CreateGuildRole(s *Session, guildID Snowflake, roleParams RoleParams, reason *string) (*Role, error)

func GetGuildRoles

func GetGuildRoles(s *Session, guildID Snowflake) ([]*Role, error)

func ModifyGuildRole

func ModifyGuildRole(s *Session, guildID Snowflake, roleID Snowflake, roleArg Role, reason *string) (*Role, error)

func ModifyGuildRolePositions

func ModifyGuildRolePositions(s *Session, guildID Snowflake, guildRolePositionArgs []ModifyGuildRolePosition, reason *string) ([]*Role, error)

func (*Role) Delete

func (r *Role) Delete(s *Session, reason *string) error

Delete deletes a guild role. reason: Reason for deleting a guild role.

func (*Role) Edit

func (r *Role) Edit(s *Session, params Role, reason *string) error

Edit edits a guild role. params: The role parameters to update the role with. reason: Reason for editing a guild role.

type RoleParams

type RoleParams struct {
	Name         *string `json:"name,omitempty"`
	Permissions  *Int64  `json:"permissions,omitempty"`
	Color        *int32  `json:"color,omitempty"`
	Hoist        *bool   `json:"hoist,omitempty"`
	Icon         *string `json:"icon,omitempty"`
	UnicodeEmoji *string `json:"unicode_emoji,omitempty"`
	Mentionable  *bool   `json:"mentionable,omitempty"`
}

RoleParams represents the structure used to create a role.

type RoleTag

type RoleTag struct {
	BotID             *Snowflake `json:"bot_id,omitempty"`
	IntegrationID     *Snowflake `json:"integration_id,omitempty"`
	PremiumSubscriber bool       `json:"premium_subscriber"`
}

RoleTag represents extra information about a role.

type ScheduledEntityType

type ScheduledEntityType uint8

ScheduledEntityType represents the type of event.

const (
	ScheduledEntityTypeStage ScheduledEntityType = 1 + iota
	ScheduledEntityTypeVoice
	ScheduledEntityTypeExternal
)

type ScheduledEvent

type ScheduledEvent struct {
	Status             *EventStatus              `json:"status"`
	EntityType         *ScheduledEntityType      `json:"entity_type"`
	ChannelID          *Snowflake                `json:"channel_id,omitempty"`
	CreatorID          *Snowflake                `json:"creator_id,omitempty"`
	Creator            *User                     `json:"creator,omitempty"`
	EntityMetadata     *EventMetadata            `json:"entity_metadata,omitempty"`
	EntityID           *Snowflake                `json:"entity_id,omitempty"`
	PrivacyLevel       *StageChannelPrivacyLevel `json:"privacy_level"`
	ScheduledStartTime string                    `json:"scheduled_start_time"`
	ScheduledEndTime   string                    `json:"scheduled_end_time"`
	Description        string                    `json:"description,omitempty"`
	Name               string                    `json:"name"`
	ID                 Snowflake                 `json:"id"`
	GuildID            Snowflake                 `json:"guild_id"`
	UserCount          int32                     `json:"user_count,omitempty"`
}

ScheduledEvent represents an scheduled event.

type ScheduledEventUser

type ScheduledEventUser struct {
	User    User         `json:"user"`
	Member  *GuildMember `json:"member,omitempty"`
	EventID Snowflake    `json:"guild_scheduled_event_id"`
}

ScheduledEventUser represents a user subscribed to an event.

type Secrets

type Secrets struct {
	Join     string `json:"join"`
	Spectate string `json:"spectate"`
	Match    string `json:"match"`
}

Secrets represents an activity's secrets for Rich Presence joining and spectating.

type SentPayload

type SentPayload struct {
	Data interface{} `json:"d"`
	Op   GatewayOp   `json:"op"`
}

SentPayload represents the base payload we send to discords gateway.

type Session

type Session struct {
	Context   context.Context
	Interface RESTInterface
	Token     string
}

Session contains the context for the discord rest interface.

func NewSession

func NewSession(context context.Context, token string, httpInterface RESTInterface) *Session

type Snowflake

type Snowflake int64

Placeholder type for easy identification.

func (Snowflake) MarshalJSON

func (s Snowflake) MarshalJSON() ([]byte, error)

func (Snowflake) String

func (s Snowflake) String() string

func (Snowflake) Time

func (s Snowflake) Time() time.Time

Time returns the creation time of the Snowflake.

func (*Snowflake) UnmarshalJSON

func (s *Snowflake) UnmarshalJSON(b []byte) error

type StageChannelPrivacyLevel

type StageChannelPrivacyLevel uint8

StageChannelPrivacyLevel represents the privacy level of a stage channel.

const (
	StageChannelPrivacyLevelPublic StageChannelPrivacyLevel = 1 + iota
	StageChannelPrivacyLevelGuildOnly
)

type StageInstance

type StageInstance struct {
	PrivacyLabel         *StageChannelPrivacyLevel `json:"privacy_level"`
	Topic                string                    `json:"topic"`
	ID                   Snowflake                 `json:"id"`
	GuildID              Snowflake                 `json:"guild_id"`
	ChannelID            Snowflake                 `json:"channel_id"`
	DiscoverableDisabled bool                      `json:"discoverable_disabled"`
}

StageInstance represents a stage channel instance.

type StageInstanceCreate

type StageInstanceCreate *StageInstance

StageInstanceCreate represents a stage instance create event.

type StageInstanceDelete

type StageInstanceDelete *StageInstance

StageInstanceDelete represents a stage instance delete event.

type StageInstanceUpdate

type StageInstanceUpdate *StageInstance

StageInstanceUpdate represents a stage instance update event.

type Sticker

type Sticker struct {
	PackID      *Snowflake         `json:"pack_id,omitempty"`
	Type        *StickerType       `json:"type"`
	FormatType  *StickerFormatType `json:"format_type"`
	GuildID     *Snowflake         `json:"guild_id,omitempty"`
	User        *User              `json:"user,omitempty"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Tags        string             `json:"tags"`
	ID          Snowflake          `json:"id"`
	SortValue   int32              `json:"sort_value"`
	Available   bool               `json:"available"`
}

Sticker represents a sticker object.

type StickerFormatType

type StickerFormatType uint8

StickerFormatType represents the sticker format.

const (
	StickerFormatTypePNG StickerFormatType = 1 + iota
	StickerFormatTypeAPNG
	StickerFormatTypeLOTTIE
)

type StickerType

type StickerType uint8

StickerType represents the type of sticker.

const (
	StickerTypeStandard StickerType = 1 + iota
	StickerTypeGuild
)

type SystemChannelFlags

type SystemChannelFlags uint16

SystemChannelFlags represents the flags of a system channel.

const (
	SystemChannelFlagsSuppressJoin SystemChannelFlags = 1 << iota
	SystemChannelFlagsPremiumSubscriptions
	SystemChannelFlagsSuppressSetupTips
	SystemChannelFlagsHideMemberJoinStickerReplyButtons
	SystemChannelFlagsSuppressSubscriptionNotifications
	SystemChannelFlagsHideRoleSubscriptionReplyButtons
)

type ThreadCreate

type ThreadCreate *Channel

ThreadCreate represents a thread create event.

type ThreadDelete

type ThreadDelete *Channel

ThreadDelete represents a thread delete event.

type ThreadListSync

type ThreadListSync struct {
	ChannelIDs []Snowflake     `json:"channel_ids,omitempty"`
	Threads    []*Channel      `json:"threads"`
	Members    []*ThreadMember `json:"members"`
	GuildID    Snowflake       `json:"guild_id"`
}

ThreadListSync represents a thread list sync event.

type ThreadMember

type ThreadMember struct {
	ID            *Snowflake `json:"id,omitempty"`
	UserID        *Snowflake `json:"user_id,omitempty"`
	GuildID       *Snowflake `json:"guild_id,omitempty"`
	JoinTimestamp time.Time  `json:"join_timestamp"`
	Flags         int32      `json:"flags"`
}

ThreadMember is used to indicate whether a user has joined a thread or not.

type ThreadMemberUpdate

type ThreadMemberUpdate *ThreadMember

ThreadMemberUpdate represents a thread member update event.

type ThreadMembersUpdate

type ThreadMembersUpdate struct {
	AddedMembers     []*ThreadMember `json:"added_members,omitempty"`
	RemovedMemberIDs []Snowflake     `json:"removed_member_ids,omitempty"`
	ID               Snowflake       `json:"id"`
	GuildID          Snowflake       `json:"guild_id"`
	MemberCount      int32           `json:"member_count"`
}

ThreadMembersUpdate represents a thread members update event.

type ThreadMetadata

type ThreadMetadata struct {
	ArchiveTimestamp    time.Time `json:"archive_timestamp"`
	AutoArchiveDuration int32     `json:"auto_archive_duration"`
	Archived            bool      `json:"archived"`
	Locked              bool      `json:"locked"`
}

ThreadMetadata contains thread-specific channel fields.

type ThreadUpdate

type ThreadUpdate *Channel

ThreadUpdate represents a thread update event.

type Timestamps

type Timestamps struct {
	Start int32 `json:"start"`
	End   int32 `json:"end"`
}

Timestamps represents the starting and ending timestamp of an activity.

type TwilightProxy

type TwilightProxy struct {
	HTTP       *http.Client
	APIVersion string
	URLHost    string
	URLScheme  string
	UserAgent  string

	Debug bool
}

TwilightProxy is a proxy that requests are sent through, instead of directly to discord that will handle distributed requests and ratelimits automatically. See more at: https://github.com/twilight-rs/http-proxy

func (*TwilightProxy) Fetch

func (tl *TwilightProxy) Fetch(session *Session, method, endpoint, contentType string, body []byte, headers http.Header) ([]byte, error)

func (*TwilightProxy) FetchBJ

func (tl *TwilightProxy) FetchBJ(session *Session, method, endpoint, contentType string, body []byte, headers http.Header, response interface{}) error

func (*TwilightProxy) FetchJJ

func (tl *TwilightProxy) FetchJJ(session *Session, method, endpoint string, payload interface{}, headers http.Header, response interface{}) error

func (*TwilightProxy) SetDebug

func (tl *TwilightProxy) SetDebug(value bool)

type TypingStart

type TypingStart struct {
	GuildID   *Snowflake   `json:"guild_id,omitempty"`
	Member    *GuildMember `json:"member,omitempty"`
	ChannelID Snowflake    `json:"channel_id"`
	UserID    Snowflake    `json:"user_id"`
	Timestamp int32        `json:"timestamp"`
}

TypingStart represents a typing start event.

type UnavailableGuild

type UnavailableGuild struct {
	ID          Snowflake `json:"id"`
	Unavailable bool      `json:"unavailable"`
}

UnavailableGuild represents an unavailable guild.

type UpdateStatus

type UpdateStatus struct {
	Status     string      `json:"status"`
	Activities []*Activity `json:"activities,omitempty"`
	Since      int32       `json:"since,omitempty"`
	AFK        bool        `json:"afk"`
}

Update Presence updates a client's presence.

type User

type User struct {
	DMChannelID   *Snowflake      `json:"dm_channel_id,omitempty"`
	Banner        string          `json:"banner,omitempty"`
	GlobalName    string          `json:"global_name"`
	Avatar        string          `json:"avatar"`
	Username      string          `json:"username"`
	Discriminator string          `json:"discriminator"`
	Locale        string          `json:"locale,omitempty"`
	Email         string          `json:"email,omitempty"`
	ID            Snowflake       `json:"id"`
	PremiumType   UserPremiumType `json:"premium_type,omitempty"`
	Flags         UserFlags       `json:"flags,omitempty"`
	AccentColor   int32           `json:"accent_color"`
	PublicFlags   UserFlags       `json:"public_flags,omitempty"`
	MFAEnabled    bool            `json:"mfa_enabled,omitempty"`
	Verified      bool            `json:"verified,omitempty"`
	Bot           bool            `json:"bot"`
	System        bool            `json:"system,omitempty"`
}

User represents a user on discord.

func GetCurrentUser

func GetCurrentUser(s *Session) (*User, error)

func GetReactions

func GetReactions(s *Session, channelID Snowflake, messageID Snowflake, emoji string, after *Snowflake, limit *int) ([]*User, error)

func GetUser

func GetUser(s *Session, userID Snowflake) (*User, error)

func ModifyCurrentUser

func ModifyCurrentUser(s *Session, userParam UserParam) (*User, error)

func (*User) CreateDM

func (u *User) CreateDM(s *Session) (*Channel, error)

CreateDM creates a DMChannel with a user. This should not need to be called as Send() transparently does this. If the user already has a DMChannel created, this will return a partial channel with just an ID set.

func (*User) Send

func (u *User) Send(s *Session, params MessageParams) (*Message, error)

Send sends a DM message to a user. This will create a DMChannel if one is not present. params: The message parameters used to send the message.

type UserFlags

type UserFlags uint32

UserFlags represents the flags on a user's account.

const (
	UserFlagsDiscordEmployee UserFlags = 1 << iota
	UserFlagsPartneredServerOwner
	UserFlagsHypeSquadEvents
	UserFlagsBugHunterLevel1

	UserFlagsHouseBravery
	UserFlagsHouseBrilliance
	UserFlagsHouseBalance
	UserFlagsEarlySupporter
	UserFlagsTeamUser

	UserFlagsBugHunterLevel2

	UserFlagsVerifiedBot
	UserFlagsVerifiedDeveloper
	UserFlagsCertifiedModerator
	UserFlagsBotHTTPInteractions

	UserFlagsActiveDeveloper
)

User flags.

type UserParam

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

UserParam represents the payload sent to modify a user.

type UserPremiumType

type UserPremiumType int

UserPremiumType represents the type of Nitro on a user's account.

const (
	UserPremiumTypeNone UserPremiumType = iota
	UserPremiumTypeNitroClassic
	UserPremiumTypeNitro
)

User premium type.

type UserUpdate

type UserUpdate *User

UserUpdate represents a user update event.

type VerificationLevel

type VerificationLevel uint8

VerificationLevel represents a guild's verification level.

const (
	VerificationLevelNone VerificationLevel = iota
	VerificationLevelLow
	VerificationLevelMedium
	VerificationLevelHigh
	VerificationLevelVeryHigh
)

type VideoQualityMode

type VideoQualityMode uint8

VideoQualityMode represents the quality of the video.

const (
	VideoQualityModeAuto VideoQualityMode = 1 + iota
	VideoqualityModeFull
)

type VoiceServerUpdate

type VoiceServerUpdate struct {
	Token    string    `json:"token"`
	Endpoint string    `json:"endpoint"`
	GuildID  Snowflake `json:"guild_id"`
}

VoiceServerUpdate represents a voice server update event.

type VoiceState

type VoiceState struct {
	RequestToSpeakTimestamp time.Time    `json:"request_to_speak_timestamp"`
	GuildID                 *Snowflake   `json:"guild_id,omitempty"`
	Member                  *GuildMember `json:"member,omitempty"`
	SessionID               string       `json:"session_id"`
	UserID                  Snowflake    `json:"user_id"`
	ChannelID               Snowflake    `json:"channel_id"`
	Mute                    bool         `json:"mute"`
	SelfDeaf                bool         `json:"self_deaf"`
	SelfMute                bool         `json:"self_mute"`
	SelfStream              bool         `json:"self_stream"`
	SelfVideo               bool         `json:"self_video"`
	Suppress                bool         `json:"suppress"`
	Deaf                    bool         `json:"deaf"`
}

VoiceState represents the voice state on discord.

type VoiceStateUpdate

type VoiceStateUpdate *VoiceState

VoiceStateUpdate represents the voice state update event.

type Webhook

type Webhook struct {
	GuildID       *Snowflake  `json:"guild_id,omitempty"`
	ChannelID     *Snowflake  `json:"channel_id,omitempty"`
	User          *User       `json:"user,omitempty"`
	ApplicationID *Snowflake  `json:"application_id,omitempty"`
	Name          string      `json:"name"`
	Avatar        string      `json:"avatar"`
	Token         string      `json:"token"`
	ID            Snowflake   `json:"id"`
	Type          WebhookType `json:"type"`
}

Webhook represents a webhook on discord.

func CreateWebhook

func CreateWebhook(s *Session, channelID Snowflake, webhookParam WebhookParam, reason *string) (*Webhook, error)

func GetChannelWebhooks

func GetChannelWebhooks(s *Session, channelID Snowflake) ([]*Webhook, error)

func GetGuildWebhooks

func GetGuildWebhooks(s *Session, guildID Snowflake) ([]*Webhook, error)

func GetWebhook

func GetWebhook(s *Session, webhookID Snowflake) (*Webhook, error)

func GetWebhookWithToken

func GetWebhookWithToken(s *Session, webhookID Snowflake, webhookToken string) (*Webhook, error)

func ModifyWebhook

func ModifyWebhook(s *Session, webhookID Snowflake, webhookParam WebhookParam, reason *string) (*Webhook, error)

func ModifyWebhookWithToken

func ModifyWebhookWithToken(s *Session, webhookID Snowflake, webhookToken string, webhookParam WebhookParam) (*Webhook, error)

func (*Webhook) Delete

func (w *Webhook) Delete(s *Session, reason *string) error

Delete deletes this webhook. reason: The reason for deleting this webhook.

func (*Webhook) DeleteMessage

func (w *Webhook) DeleteMessage(s *Session, messageID Snowflake) error

DeleteMessage deletes a webhook message. messageID: The message id you are deleting.

func (*Webhook) Edit

func (w *Webhook) Edit(s *Session, name *string, avatar *[]byte, reason *string) error

Edit edits this webhook. name: The webhooks new default name. avatar: bytes representing the webhooks new avatar. reason: The reason for editing this webhook.

func (*Webhook) EditMessage

func (w *Webhook) EditMessage(s *Session, messageID Snowflake, params WebhookMessageParams) (*WebhookMessage, error)

EditMessage edits a webhook message. messageID: The message id you are editing. params: The message parameters used to update the message.

func (*Webhook) Send

func (w *Webhook) Send(s *Session, params WebhookMessageParams, wait bool) (*WebhookMessage, error)

Send sends a webhook message. params: The message parameters to send.

type WebhookMessage

type WebhookMessage Message

WebhookMessage aliases Message to provide webhook specific methods.

func EditWebhookMessage

func EditWebhookMessage(s *Session, webhookID Snowflake, webhookToken string, messageID Snowflake, messageParam WebhookMessageParams) (*WebhookMessage, error)

func ExecuteWebhook

func ExecuteWebhook(s *Session, webhookID Snowflake, webhookToken string, messageParams WebhookMessageParams, wait bool) (*WebhookMessage, error)

func GetWebhookMessage

func GetWebhookMessage(s *Session, webhookID Snowflake, webhookToken string, messageID Snowflake) (*WebhookMessage, error)

func (*WebhookMessage) Delete

func (wm *WebhookMessage) Delete(s *Session, token string) error

Delete deletes a webhook message. token: The token of the parent webhook.

func (*WebhookMessage) Edit

func (wm *WebhookMessage) Edit(s *Session, token string, params WebhookMessageParams) (*WebhookMessage, error)

Edit edits a webhook message. token: The token of the parent webhook. params: The message parameters used to update the message.

type WebhookMessageParams

type WebhookMessageParams struct {
	PayloadJSON     *jsoniter.RawMessage      `json:"payload_json,omitempty"`
	Content         string                    `json:"content,omitempty"`
	Username        string                    `json:"username,omitempty"`
	AvatarURL       string                    `json:"avatar_url,omitempty"`
	Embeds          []*Embed                  `json:"embeds,omitempty"`
	AllowedMentions []*MessageAllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []*InteractionComponent   `json:"components,omitempty"`
	Files           []*File                   `json:"-"`
	Attachments     []*MessageAttachment      `json:"attachments,omitempty"`
	TTS             bool                      `json:"tts,omitempty"`
}

WebhookMessage represents the structure for sending a webhook message.

type WebhookParam

type WebhookParam struct {
	Name   *string `json:"name,omitempty"`
	Avatar *string `json:"avatar,omitempty"`
}

WebhookParam represents the data sent to discord to create a webhook.

type WebhookType

type WebhookType uint8

WebhookType is the type of webhook.

const (
	WebhookTypeIncoming WebhookType = iota + 1
	WebhookTypeChannelFollower
)

Webhook type.

type WebhookUpdate

type WebhookUpdate struct {
	ChannelID Snowflake `json:"channel_id"`
	GuildID   Snowflake `json:"guild_id"`
}

WebhookUpdate represents a webhook update packet.

Jump to

Keyboard shortcuts

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