Documentation ¶
Overview ¶
Package discordgo provides Discord binding for Go
Index ¶
- Constants
- Variables
- func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType string, requestBody []byte, err error)
- func SnowflakeTimestamp(ID string) (t time.Time, err error)
- func VerifyInteraction(r *http.Request, key ed25519.PublicKey) bool
- type APIErrorMessage
- type Ack
- type ActionsRow
- type Activity
- type ActivityType
- type AllowedMentionType
- type Application
- type ApplicationCommand
- type ApplicationCommandInteractionData
- type ApplicationCommandInteractionDataOption
- func (o ApplicationCommandInteractionDataOption) BoolValue() bool
- func (o ApplicationCommandInteractionDataOption) ChannelValue(s *Session) *Channel
- func (o ApplicationCommandInteractionDataOption) FloatValue() float64
- func (o ApplicationCommandInteractionDataOption) IntValue() int64
- func (o ApplicationCommandInteractionDataOption) RoleValue(s *Session, gID string) *Role
- func (o ApplicationCommandInteractionDataOption) StringValue() string
- func (o ApplicationCommandInteractionDataOption) UintValue() uint64
- func (o ApplicationCommandInteractionDataOption) UserValue(s *Session) *User
- type ApplicationCommandInteractionDataResolved
- type ApplicationCommandOption
- type ApplicationCommandOptionChoice
- type ApplicationCommandOptionType
- type ApplicationCommandType
- type Asset
- type Assets
- type AuditLogAction
- type AuditLogChange
- type AuditLogChangeKey
- type AuditLogEntry
- type AuditLogOptions
- type AuditLogOptionsType
- type Bucket
- type Button
- type ButtonStyle
- type Channel
- type ChannelCreate
- type ChannelDelete
- type ChannelEdit
- type ChannelFollow
- type ChannelPinsUpdate
- type ChannelType
- type ChannelUpdate
- type ComponentEmoji
- type ComponentType
- type Connect
- type Disconnect
- type EmbedType
- type Emoji
- type Event
- type EventHandler
- type EventInterfaceProvider
- type ExpireBehavior
- type ExplicitContentFilterLevel
- type File
- type FriendSourceFlags
- type GatewayBotResponse
- type GatewayStatusUpdate
- type Guild
- type GuildAuditLog
- type GuildBan
- type GuildBanAdd
- type GuildBanRemove
- type GuildChannelCreateData
- type GuildCreate
- type GuildDelete
- type GuildEmbed
- type GuildEmojisUpdate
- type GuildIntegrationsUpdate
- type GuildMemberAdd
- type GuildMemberRemove
- type GuildMemberUpdate
- type GuildMembersChunk
- type GuildParams
- type GuildPreview
- type GuildRole
- type GuildRoleCreate
- type GuildRoleDelete
- type GuildRoleUpdate
- type GuildUpdate
- type ICEServer
- type Identify
- type IdentifyProperties
- type Integration
- type IntegrationAccount
- type Intent
- type Interaction
- type InteractionCreate
- type InteractionData
- type InteractionResponse
- type InteractionResponseData
- type InteractionResponseType
- type InteractionType
- type Invite
- type Member
- type MembershipState
- type Message
- type MessageAck
- type MessageActivity
- type MessageActivityType
- type MessageAllowedMentions
- type MessageApplication
- type MessageAttachment
- type MessageComponent
- type MessageComponentInteractionData
- type MessageCreate
- type MessageDelete
- type MessageDeleteBulk
- type MessageEdit
- type MessageEmbed
- type MessageEmbedAuthor
- type MessageEmbedField
- type MessageEmbedFooter
- type MessageEmbedImage
- type MessageEmbedProvider
- type MessageEmbedThumbnail
- type MessageEmbedVideo
- type MessageFlags
- type MessageNotifications
- type MessageReaction
- type MessageReactionAdd
- type MessageReactionRemove
- type MessageReactionRemoveAll
- type MessageReactions
- type MessageReference
- type MessageSend
- type MessageType
- type MessageUpdate
- type MfaLevel
- type Packet
- type Party
- type PermissionOverwrite
- type PermissionOverwriteType
- type PremiumTier
- type Presence
- type PresenceUpdate
- type PresencesReplace
- type RESTError
- type RateLimit
- type RateLimiter
- type ReadState
- type Ready
- type Relationship
- type RelationshipAdd
- type RelationshipRemove
- type Resumed
- type Role
- type Roles
- type Secrets
- type SelectMenu
- type SelectMenuOption
- type Session
- func (s *Session) AddHandler(handler interface{}) func()
- func (s *Session) AddHandlerOnce(handler interface{}) func()
- func (s *Session) Application(appID string) (st *Application, err error)
- func (s *Session) ApplicationAssets(appID string) (ass []*Asset, err error)
- func (s *Session) ApplicationBotCreate(appID string) (st *User, err error)
- func (s *Session) ApplicationCommand(appID, guildID, cmdID string) (cmd *ApplicationCommand, err error)
- func (s *Session) ApplicationCommandBulkOverwrite(appID string, guildID string, commands []*ApplicationCommand) (createdCommands []*ApplicationCommand, err error)
- func (s *Session) ApplicationCommandCreate(appID string, guildID string, cmd *ApplicationCommand) (ccmd *ApplicationCommand, err error)
- func (s *Session) ApplicationCommandDelete(appID, guildID, cmdID string) error
- func (s *Session) ApplicationCommandEdit(appID, guildID, cmdID string, cmd *ApplicationCommand) (updated *ApplicationCommand, err error)
- func (s *Session) ApplicationCommands(appID, guildID string) (cmd []*ApplicationCommand, err error)
- func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error)
- func (s *Session) ApplicationDelete(appID string) (err error)
- func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Application, err error)
- func (s *Session) Applications() (st []*Application, err error)
- func (s *Session) Channel(channelID string) (st *Channel, err error)
- func (s *Session) ChannelDelete(channelID string) (st *Channel, err error)
- func (s *Session) ChannelEdit(channelID, name string) (*Channel, error)
- func (s *Session) ChannelEditComplex(channelID string, data *ChannelEdit) (st *Channel, err error)
- func (s *Session) ChannelFileSend(channelID, name string, r io.Reader) (*Message, error)
- func (s *Session) ChannelFileSendWithMessage(channelID, content string, name string, r io.Reader) (*Message, error)
- func (s *Session) ChannelInviteCreate(channelID string, i Invite) (st *Invite, err error)
- func (s *Session) ChannelInvites(channelID string) (st []*Invite, err error)
- func (s *Session) ChannelMessage(channelID, messageID string) (st *Message, err error)
- func (s *Session) ChannelMessageAck(channelID, messageID, lastToken string) (st *Ack, err error)
- func (s *Session) ChannelMessageCrosspost(channelID, messageID string) (st *Message, err error)
- func (s *Session) ChannelMessageDelete(channelID, messageID string) (err error)
- func (s *Session) ChannelMessageEdit(channelID, messageID, content string) (*Message, error)
- func (s *Session) ChannelMessageEditComplex(m *MessageEdit) (st *Message, err error)
- func (s *Session) ChannelMessageEditEmbed(channelID, messageID string, embed *MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageEditEmbeds(channelID, messageID string, embeds []*MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessagePin(channelID, messageID string) (err error)
- func (s *Session) ChannelMessageSend(channelID string, content string) (*Message, error)
- func (s *Session) ChannelMessageSendComplex(channelID string, data *MessageSend) (st *Message, err error)
- func (s *Session) ChannelMessageSendEmbed(channelID string, embed *MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageSendEmbeds(channelID string, embeds []*MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageSendReply(channelID string, content string, reference *MessageReference) (*Message, error)
- func (s *Session) ChannelMessageSendTTS(channelID string, content string) (*Message, error)
- func (s *Session) ChannelMessageUnpin(channelID, messageID string) (err error)
- func (s *Session) ChannelMessages(channelID string, limit int, beforeID, afterID, aroundID string) (st []*Message, err error)
- func (s *Session) ChannelMessagesBulkDelete(channelID string, messages []string) (err error)
- func (s *Session) ChannelMessagesPinned(channelID string) (st []*Message, err error)
- func (s *Session) ChannelNewsFollow(channelID, targetID string) (st *ChannelFollow, err error)
- func (s *Session) ChannelPermissionDelete(channelID, targetID string) (err error)
- func (s *Session) ChannelPermissionSet(channelID, targetID string, targetType PermissionOverwriteType, ...) (err error)
- func (s *Session) ChannelTyping(channelID string) (err error)
- func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *VoiceConnection, err error)
- func (s *Session) ChannelVoiceJoinManual(gID, cID string, mute, deaf bool) (err error)
- func (s *Session) ChannelWebhooks(channelID string) (st []*Webhook, err error)
- func (s *Session) Close() error
- func (s *Session) CloseWithCode(closeCode int) (err error)
- func (s *Session) FollowupMessageCreate(appID string, interaction *Interaction, wait bool, data *WebhookParams) (*Message, error)
- func (s *Session) FollowupMessageDelete(appID string, interaction *Interaction, messageID string) error
- func (s *Session) FollowupMessageEdit(appID string, interaction *Interaction, messageID string, data *WebhookEdit) (*Message, error)
- func (s *Session) Gateway() (gateway string, err error)
- func (s *Session) GatewayBot() (st *GatewayBotResponse, err error)
- func (s *Session) Guild(guildID string) (st *Guild, err error)
- func (s *Session) GuildAuditLog(guildID, userID, beforeID string, actionType, limit int) (st *GuildAuditLog, err error)
- func (s *Session) GuildBan(guildID, userID string) (st *GuildBan, err error)
- func (s *Session) GuildBanCreate(guildID, userID string, days int) (err error)
- func (s *Session) GuildBanCreateWithReason(guildID, userID, reason string, days int) (err error)
- func (s *Session) GuildBanDelete(guildID, userID string) (err error)
- func (s *Session) GuildBans(guildID string) (st []*GuildBan, err error)
- func (s *Session) GuildChannelCreate(guildID, name string, ctype ChannelType) (st *Channel, err error)
- func (s *Session) GuildChannelCreateComplex(guildID string, data GuildChannelCreateData) (st *Channel, err error)
- func (s *Session) GuildChannels(guildID string) (st []*Channel, err error)
- func (s *Session) GuildChannelsReorder(guildID string, channels []*Channel) (err error)
- func (s *Session) GuildCreate(name string) (st *Guild, err error)
- func (s *Session) GuildDelete(guildID string) (st *Guild, err error)
- func (s *Session) GuildEdit(guildID string, g GuildParams) (st *Guild, err error)
- func (s *Session) GuildEmbed(guildID string) (st *GuildEmbed, err error)
- func (s *Session) GuildEmbedEdit(guildID string, enabled bool, channelID string) (err error)
- func (s *Session) GuildEmojiCreate(guildID, name, image string, roles []string) (emoji *Emoji, err error)
- func (s *Session) GuildEmojiDelete(guildID, emojiID string) (err error)
- func (s *Session) GuildEmojiEdit(guildID, emojiID, name string, roles []string) (emoji *Emoji, err error)
- func (s *Session) GuildEmojis(guildID string) (emoji []*Emoji, err error)
- func (s *Session) GuildIcon(guildID string) (img image.Image, err error)
- func (s *Session) GuildIntegrationCreate(guildID, integrationType, integrationID string) (err error)
- func (s *Session) GuildIntegrationDelete(guildID, integrationID string) (err error)
- func (s *Session) GuildIntegrationEdit(guildID, integrationID string, expireBehavior, expireGracePeriod int, ...) (err error)
- func (s *Session) GuildIntegrationSync(guildID, integrationID string) (err error)
- func (s *Session) GuildIntegrations(guildID string) (st []*Integration, err error)
- func (s *Session) GuildInvites(guildID string) (st []*Invite, err error)
- func (s *Session) GuildLeave(guildID string) (err error)
- func (s *Session) GuildMember(guildID, userID string) (st *Member, err error)
- func (s *Session) GuildMemberAdd(accessToken, guildID, userID, nick string, roles []string, mute, deaf bool) (err error)
- func (s *Session) GuildMemberDeafen(guildID string, userID string, deaf bool) (err error)
- func (s *Session) GuildMemberDelete(guildID, userID string) (err error)
- func (s *Session) GuildMemberDeleteWithReason(guildID, userID, reason string) (err error)
- func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err error)
- func (s *Session) GuildMemberMove(guildID string, userID string, channelID *string) (err error)
- func (s *Session) GuildMemberMute(guildID string, userID string, mute bool) (err error)
- func (s *Session) GuildMemberNickname(guildID, userID, nickname string) (err error)
- func (s *Session) GuildMemberRoleAdd(guildID, userID, roleID string) (err error)
- func (s *Session) GuildMemberRoleRemove(guildID, userID, roleID string) (err error)
- func (s *Session) GuildMemberTimeout(guildID string, userID string, until *time.Time) (err error)
- func (s *Session) GuildMembers(guildID string, after string, limit int) (st []*Member, err error)
- func (s *Session) GuildPreview(guildID string) (st *GuildPreview, err error)
- func (s *Session) GuildPrune(guildID string, days uint32) (count uint32, err error)
- func (s *Session) GuildPruneCount(guildID string, days uint32) (count uint32, err error)
- func (s *Session) GuildRoleCreate(guildID string) (st *Role, err error)
- func (s *Session) GuildRoleDelete(guildID, roleID string) (err error)
- func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int64, mention bool) (st *Role, err error)
- func (s *Session) GuildRoleReorder(guildID string, roles []*Role) (st []*Role, err error)
- func (s *Session) GuildRoles(guildID string) (st []*Role, err error)
- func (s *Session) GuildSplash(guildID string) (img image.Image, err error)
- func (s *Session) GuildWebhooks(guildID string) (st []*Webhook, err error)
- func (s *Session) HeartbeatLatency() time.Duration
- func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse) (err error)
- func (s *Session) InteractionResponse(appID string, interaction *Interaction) (*Message, error)
- func (s *Session) InteractionResponseDelete(appID string, interaction *Interaction) error
- func (s *Session) InteractionResponseEdit(appID string, interaction *Interaction, newresp *WebhookEdit) (*Message, error)
- func (s *Session) Invite(inviteID string) (st *Invite, err error)
- func (s *Session) InviteAccept(inviteID string) (st *Invite, err error)
- func (s *Session) InviteDelete(inviteID string) (st *Invite, err error)
- func (s *Session) InviteWithCounts(inviteID string) (st *Invite, err error)
- func (s *Session) Login(email, password string) (err error)
- func (s *Session) Logout() (err error)
- func (s *Session) MessageReactionAdd(channelID, messageID, emojiID string) error
- func (s *Session) MessageReactionRemove(channelID, messageID, emojiID, userID string) error
- func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit int, beforeID, afterID string) (st []*User, err error)
- func (s *Session) MessageReactionsRemoveAll(channelID, messageID string) error
- func (s *Session) MessageReactionsRemoveEmoji(channelID, messageID, emojiID string) error
- func (s *Session) Open() error
- func (s *Session) Register(username string) (token string, err error)
- func (s *Session) RelationshipDelete(userID string) (err error)
- func (s *Session) RelationshipFriendRequestAccept(userID string) (err error)
- func (s *Session) RelationshipFriendRequestSend(userID string) (err error)
- func (s *Session) RelationshipUserBlock(userID string) (err error)
- func (s *Session) RelationshipsGet() (r []*Relationship, err error)
- func (s *Session) RelationshipsMutualGet(userID string) (mf []*User, err error)
- func (s *Session) Request(method, urlStr string, data interface{}) (response []byte, err error)
- func (s *Session) RequestGuildMembers(guildID string, query string, limit int, presences bool) (err error)
- func (s *Session) RequestGuildMembersBatch(guildIDs []string, query string, limit int, presences bool) (err error)
- func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, bucketID string) (response []byte, err error)
- func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b []byte, bucket *Bucket, sequence int) (response []byte, err error)
- func (s *Session) UpdateGameStatus(idle int, name string) (err error)
- func (s *Session) UpdateListeningStatus(name string) (err error)
- func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error)
- func (s *Session) UpdateStreamingStatus(idle int, name string, url string) (err error)
- func (s *Session) User(userID string) (st *User, err error)
- func (s *Session) UserAvatar(userID string) (img image.Image, err error)
- func (s *Session) UserAvatarDecode(u *User) (img image.Image, err error)
- func (s *Session) UserChannelCreate(recipientID string) (st *Channel, err error)
- func (s *Session) UserChannelPermissions(userID, channelID string) (apermissions int64, err error)
- func (s *Session) UserChannels() (st []*Channel, err error)
- func (s *Session) UserConnections() (conn []*UserConnection, err error)
- func (s *Session) UserGuildSettingsEdit(guildID string, settings *UserGuildSettingsEdit) (st *UserGuildSettings, err error)
- func (s *Session) UserGuilds(limit int, beforeID, afterID string) (st []*UserGuild, err error)
- func (s *Session) UserNoteSet(userID string, message string) (err error)
- func (s *Session) UserSettings() (st *Settings, err error)
- func (s *Session) UserUpdate(email, password, username, avatar, newPassword string) (st *User, err error)
- func (s *Session) UserUpdateStatus(status Status) (st *Settings, err error)
- func (s *Session) VoiceICE() (st *VoiceICE, err error)
- func (s *Session) VoiceRegions() (st []*VoiceRegion, err error)
- func (s *Session) Webhook(webhookID string) (st *Webhook, err error)
- func (s *Session) WebhookCreate(channelID, name, avatar string) (st *Webhook, err error)
- func (s *Session) WebhookDelete(webhookID string) (err error)
- func (s *Session) WebhookDeleteWithToken(webhookID, token string) (st *Webhook, err error)
- func (s *Session) WebhookEdit(webhookID, name, avatar, channelID string) (st *Role, err error)
- func (s *Session) WebhookEditWithToken(webhookID, token, name, avatar string) (st *Role, err error)
- func (s *Session) WebhookExecute(webhookID, token string, wait bool, data *WebhookParams) (st *Message, err error)
- func (s *Session) WebhookMessage(webhookID, token, messageID string) (message *Message, err error)
- func (s *Session) WebhookMessageDelete(webhookID, token, messageID string) (err error)
- func (s *Session) WebhookMessageEdit(webhookID, token, messageID string, data *WebhookEdit) (st *Message, err error)
- func (s *Session) WebhookWithToken(webhookID, token string) (st *Webhook, err error)
- type SessionInformation
- type Settings
- type State
- func (s *State) Channel(channelID string) (*Channel, error)
- func (s *State) ChannelAdd(channel *Channel) error
- func (s *State) ChannelRemove(channel *Channel) error
- func (s *State) Emoji(guildID, emojiID string) (*Emoji, error)
- func (s *State) EmojiAdd(guildID string, emoji *Emoji) error
- func (s *State) EmojisAdd(guildID string, emojis []*Emoji) error
- func (s *State) Guild(guildID string) (*Guild, error)
- func (s *State) GuildAdd(guild *Guild) error
- func (s *State) GuildChannel(guildID, channelID string) (*Channel, error)
- func (s *State) GuildRemove(guild *Guild) error
- func (s *State) Member(guildID, userID string) (*Member, error)
- func (s *State) MemberAdd(member *Member) error
- func (s *State) MemberRemove(member *Member) error
- func (s *State) Message(channelID, messageID string) (*Message, error)
- func (s *State) MessageAdd(message *Message) error
- func (s *State) MessageColor(message *Message) int
- func (s *State) MessagePermissions(message *Message) (apermissions int64, err error)
- func (s *State) MessageRemove(message *Message) error
- func (s *State) OnInterface(se *Session, i interface{}) (err error)
- func (s *State) Presence(guildID, userID string) (*Presence, error)
- func (s *State) PresenceAdd(guildID string, presence *Presence) error
- func (s *State) PresenceRemove(guildID string, presence *Presence) error
- func (s *State) PrivateChannel(channelID string) (*Channel, error)
- func (s *State) Role(guildID, roleID string) (*Role, error)
- func (s *State) RoleAdd(guildID string, role *Role) error
- func (s *State) RoleRemove(guildID, roleID string) error
- func (s *State) UserChannelPermissions(userID, channelID string) (apermissions int64, err error)
- func (s *State) UserColor(userID, channelID string) int
- func (s *State) VoiceState(guildID, userID string) (*VoiceState, error)
- type Status
- type SystemChannelFlag
- type TargetUserType
- type Team
- type TeamMember
- type TimeStamps
- type TooManyRequests
- type TypingStart
- type UpdateStatusData
- type User
- type UserConnection
- type UserFlags
- type UserGuild
- type UserGuildSettings
- type UserGuildSettingsChannelOverride
- type UserGuildSettingsEdit
- type UserGuildSettingsUpdate
- type UserNoteUpdate
- type UserSettingsUpdate
- type UserUpdate
- type VerificationLevel
- type VoiceConnection
- type VoiceICE
- type VoiceRegion
- type VoiceServerUpdate
- type VoiceSpeakingUpdate
- type VoiceSpeakingUpdateHandler
- type VoiceState
- type VoiceStateUpdate
- type Webhook
- type WebhookEdit
- type WebhookParams
- type WebhookType
- type WebhooksUpdate
Examples ¶
Constants ¶
const ( // LogError level is used for critical errors that could lead to data loss // or panic that would not be returned to a calling function. LogError int = iota // LogWarning level is used for very abnormal events and errors that are // also returned to a calling function. LogWarning // LogInformational level is used for normal non-error activity LogInformational // LogDebug level is for very detailed non-error activity. This is // very spammy and will impact performance. LogDebug )
const ( // Deprecated: PermissionReadMessages has been replaced with PermissionViewChannel for text and voice channels PermissionReadMessages = 0x0000000000000400 PermissionSendMessages = 0x0000000000000800 PermissionSendTTSMessages = 0x0000000000001000 PermissionManageMessages = 0x0000000000002000 PermissionEmbedLinks = 0x0000000000004000 PermissionAttachFiles = 0x0000000000008000 PermissionReadMessageHistory = 0x0000000000010000 PermissionMentionEveryone = 0x0000000000020000 PermissionUseExternalEmojis = 0x0000000000040000 PermissionUseSlashCommands = 0x0000000080000000 )
Constants for the different bit offsets of text channel permissions
const ( PermissionVoicePrioritySpeaker = 0x0000000000000100 PermissionVoiceStreamVideo = 0x0000000000000200 PermissionVoiceConnect = 0x0000000000100000 PermissionVoiceSpeak = 0x0000000000200000 PermissionVoiceMuteMembers = 0x0000000000400000 PermissionVoiceDeafenMembers = 0x0000000000800000 PermissionVoiceMoveMembers = 0x0000000001000000 PermissionVoiceUseVAD = 0x0000000002000000 PermissionVoiceRequestToSpeak = 0x0000000100000000 )
Constants for the different bit offsets of voice permissions
const ( PermissionChangeNickname = 0x0000000004000000 PermissionManageNicknames = 0x0000000008000000 PermissionManageRoles = 0x0000000010000000 PermissionManageWebhooks = 0x0000000020000000 PermissionManageEmojis = 0x0000000040000000 )
Constants for general management.
const ( PermissionCreateInstantInvite = 0x0000000000000001 PermissionKickMembers = 0x0000000000000002 PermissionBanMembers = 0x0000000000000004 PermissionAdministrator = 0x0000000000000008 PermissionManageChannels = 0x0000000000000010 PermissionManageServer = 0x0000000000000020 PermissionAddReactions = 0x0000000000000040 PermissionViewAuditLogs = 0x0000000000000080 PermissionViewChannel = 0x0000000000000400 PermissionViewGuildInsights = 0x0000000000080000 PermissionModerateMembers = 0x0000010000000000 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 )
Constants for the different bit offsets of general permissions
const ( ErrCodeUnknownAccount = 10001 ErrCodeUnknownApplication = 10002 ErrCodeUnknownChannel = 10003 ErrCodeUnknownGuild = 10004 ErrCodeUnknownIntegration = 10005 ErrCodeUnknownInvite = 10006 ErrCodeUnknownMember = 10007 ErrCodeUnknownMessage = 10008 ErrCodeUnknownOverwrite = 10009 ErrCodeUnknownProvider = 10010 ErrCodeUnknownRole = 10011 ErrCodeUnknownToken = 10012 ErrCodeUnknownUser = 10013 ErrCodeUnknownEmoji = 10014 ErrCodeUnknownWebhook = 10015 ErrCodeUnknownBan = 10026 ErrCodeBotsCannotUseEndpoint = 20001 ErrCodeOnlyBotsCanUseEndpoint = 20002 ErrCodeMaximumGuildsReached = 30001 ErrCodeMaximumFriendsReached = 30002 ErrCodeMaximumPinsReached = 30003 ErrCodeMaximumGuildRolesReached = 30005 ErrCodeTooManyReactions = 30010 ErrCodeMissingAccess = 50001 ErrCodeInvalidAccountType = 50002 ErrCodeCannotExecuteActionOnDMChannel = 50003 ErrCodeEmbedDisabled = 50004 ErrCodeCannotEditFromAnotherUser = 50005 ErrCodeCannotSendEmptyMessage = 50006 ErrCodeCannotSendMessagesToThisUser = 50007 ErrCodeCannotSendMessagesInVoiceChannel = 50008 ErrCodeChannelVerificationLevelTooHigh = 50009 ErrCodeOAuth2ApplicationDoesNotHaveBot = 50010 ErrCodeOAuth2ApplicationLimitReached = 50011 ErrCodeInvalidOAuthState = 50012 ErrCodeMissingPermissions = 50013 ErrCodeInvalidAuthenticationToken = 50014 ErrCodeNoteTooLong = 50015 ErrCodeTooFewOrTooManyMessagesToDelete = 50016 ErrCodeCanOnlyPinMessageToOriginatingChannel = 50019 ErrCodeCannotExecuteActionOnSystemMessage = 50021 ErrCodeMessageProvidedTooOldForBulkDelete = 50034 ErrCodeInvalidFormBody = 50035 ErrCodeInviteAcceptedToGuildApplicationsBotNotIn = 50036 ErrCodeReactionBlocked = 90001 )
Block contains Discord JSON Error Response codes
const FailedHeartbeatAcks time.Duration = 5 * time.Millisecond
FailedHeartbeatAcks is the Number of heartbeat intervals to wait until forcing a connection restart.
const InteractionDeadline = time.Second * 3
InteractionDeadline is the time allowed to respond to an interaction.
const VERSION = "0.23.0"
VERSION of DiscordGo, follows Semantic Versioning. (http://semver.org/)
Variables ¶
var ( EndpointStatus = "https://status.discord.com/api/v2/" EndpointSm = EndpointStatus + "scheduled-maintenances/" EndpointSmActive = EndpointSm + "active.json" EndpointSmUpcoming = EndpointSm + "upcoming.json" EndpointDiscord = "https://discord.com/" EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/" EndpointGuilds = EndpointAPI + "guilds/" EndpointChannels = EndpointAPI + "channels/" EndpointUsers = EndpointAPI + "users/" EndpointGateway = EndpointAPI + "gateway" EndpointGatewayBot = EndpointGateway + "/bot" EndpointWebhooks = EndpointAPI + "webhooks/" EndpointCDN = "https://cdn.discordapp.com/" EndpointCDNAttachments = EndpointCDN + "attachments/" EndpointCDNAvatars = EndpointCDN + "avatars/" EndpointCDNIcons = EndpointCDN + "icons/" EndpointCDNSplashes = EndpointCDN + "splashes/" EndpointCDNChannelIcons = EndpointCDN + "channel-icons/" EndpointCDNBanners = EndpointCDN + "banners/" EndpointAuth = EndpointAPI + "auth/" EndpointLogin = EndpointAuth + "login" EndpointLogout = EndpointAuth + "logout" EndpointVerify = EndpointAuth + "verify" EndpointVerifyResend = EndpointAuth + "verify/resend" EndpointForgotPassword = EndpointAuth + "forgot" EndpointResetPassword = EndpointAuth + "reset" EndpointRegister = EndpointAuth + "register" EndpointVoice = EndpointAPI + "/voice/" EndpointVoiceRegions = EndpointVoice + "regions" EndpointVoiceIce = EndpointVoice + "ice" EndpointTutorial = EndpointAPI + "tutorial/" EndpointTutorialIndicators = EndpointTutorial + "indicators" EndpointTrack = EndpointAPI + "track" EndpointSso = EndpointAPI + "sso" EndpointReport = EndpointAPI + "report" EndpointIntegrations = EndpointAPI + "integrations" EndpointUser = func(uID string) string { return EndpointUsers + uID } EndpointUserAvatar = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".png" } EndpointUserAvatarAnimated = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".gif" } EndpointDefaultUserAvatar = func(uDiscriminator string) string { uDiscriminatorInt, _ := strconv.Atoi(uDiscriminator) return EndpointCDN + "embed/avatars/" + strconv.Itoa(uDiscriminatorInt%5) + ".png" } EndpointUserSettings = func(uID string) string { return EndpointUsers + uID + "/settings" } EndpointUserGuilds = func(uID string) string { return EndpointUsers + uID + "/guilds" } EndpointUserGuild = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID } EndpointUserGuildSettings = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID + "/settings" } EndpointUserChannels = func(uID string) string { return EndpointUsers + uID + "/channels" } EndpointUserDevices = func(uID string) string { return EndpointUsers + uID + "/devices" } EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" } EndpointUserNotes = func(uID string) string { return EndpointUsers + "@me/notes/" + uID } EndpointGuild = func(gID string) string { return EndpointGuilds + gID } EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" } EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" } EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" } EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID } EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID } EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" } EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID } EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" } EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID } EndpointGuildIntegrationSync = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID + "/sync" } EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" } EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID } EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" } EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" } EndpointGuildEmbed = EndpointGuildWidget EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" } EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" } EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" } EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" } EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" } EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" } EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" } EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID } EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" } EndpointChannel = func(cID string) string { return EndpointChannels + cID } EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" } EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID } EndpointChannelInvites = func(cID string) string { return EndpointChannels + cID + "/invites" } EndpointChannelTyping = func(cID string) string { return EndpointChannels + cID + "/typing" } EndpointChannelMessages = func(cID string) string { return EndpointChannels + cID + "/messages" } EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID } EndpointChannelMessageAck = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/ack" } EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" } EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" } EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID } EndpointChannelMessageCrosspost = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" } EndpointChannelFollow = func(cID string) string { return EndpointChannel(cID) + "/followers" } EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" } EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" } EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID } EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token } EndpointWebhookMessage = func(wID, token, messageID string) string { return EndpointWebhookToken(wID, token) + "/messages/" + messageID } EndpointMessageReactionsAll = func(cID, mID string) string { return EndpointChannelMessage(cID, mID) + "/reactions" } EndpointMessageReactions = func(cID, mID, eID string) string { return EndpointChannelMessage(cID, mID) + "/reactions/" + eID } EndpointMessageReaction = func(cID, mID, eID, uID string) string { return EndpointMessageReactions(cID, mID, eID) + "/" + uID } EndpointApplicationGlobalCommands = func(aID string) string { return EndpointApplication(aID) + "/commands" } EndpointApplicationGlobalCommand = func(aID, cID string) string { return EndpointApplicationGlobalCommands(aID) + "/" + cID } EndpointApplicationGuildCommands = func(aID, gID string) string { return EndpointApplication(aID) + "/guilds/" + gID + "/commands" } EndpointApplicationGuildCommand = func(aID, gID, cID string) string { return EndpointApplicationGuildCommands(aID, gID) + "/" + cID } EndpointInteraction = func(aID, iToken string) string { return EndpointAPI + "interactions/" + aID + "/" + iToken } EndpointInteractionResponse = func(iID, iToken string) string { return EndpointInteraction(iID, iToken) + "/callback" } EndpointInteractionResponseActions = func(aID, iToken string) string { return EndpointWebhookMessage(aID, iToken, "@original") } EndpointFollowupMessage = func(aID, iToken string) string { return EndpointWebhookToken(aID, iToken) } EndpointFollowupMessageActions = func(aID, iToken, mID string) string { return EndpointWebhookMessage(aID, iToken, mID) } EndpointRelationships = func() string { return EndpointUsers + "@me" + "/relationships" } EndpointRelationship = func(uID string) string { return EndpointRelationships() + "/" + uID } EndpointRelationshipsMutual = func(uID string) string { return EndpointUsers + uID + "/relationships" } EndpointGuildCreate = EndpointAPI + "guilds" EndpointInvite = func(iID string) string { return EndpointAPI + "invites/" + iID } EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" } EndpointEmoji = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" } EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" } EndpointApplications = EndpointAPI + "applications" EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID } EndpointOAuth2 = EndpointAPI + "oauth2/" EndpointOAuth2Applications = EndpointOAuth2 + "applications" EndpointOAuth2Application = func(aID string) string { return EndpointOAuth2Applications + "/" + aID } EndpointOAuth2ApplicationsBot = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/bot" } EndpointOAuth2ApplicationAssets = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/assets" } // TODO: Deprecated, remove in the next release EndpointOauth2 = EndpointOAuth2 EndpointOauth2Applications = EndpointOAuth2Applications EndpointOauth2Application = EndpointOAuth2Application EndpointOauth2ApplicationsBot = EndpointOAuth2ApplicationsBot EndpointOauth2ApplicationAssets = EndpointOAuth2ApplicationAssets )
Known Discord API Endpoints.
var ( ErrJSONUnmarshal = errors.New("json unmarshal") ErrStatusOffline = errors.New("You can't set your Status to offline") ErrVerificationLevelBounds = errors.New("VerificationLevel out of bounds, should be between 0 and 3") ErrPruneDaysBounds = errors.New("the number of days should be more than or equal to 1") ErrGuildNoIcon = errors.New("guild does not have an icon set") ErrGuildNoSplash = errors.New("guild does not have a splash set") )
All error constants
var APIVersion = "8"
APIVersion is the Discord API version used for the REST and Websocket API.
var (
EmojiRegex = regexp.MustCompile(`<(a|):[A-z0-9_~]+:[0-9]{18}>`)
)
EmojiRegex is the regex used to find and identify emojis in messages
var ErrMFA = errors.New("account has 2FA enabled")
ErrMFA will be risen by New when the user has 2FA.
var ErrMessageIncompletePermissions = errors.New("message incomplete, unable to determine permissions")
ErrMessageIncompletePermissions is returned when the message requested for permissions does not contain enough data to generate the permissions.
var ErrNilState = errors.New("state not instantiated, please use discordgo.New() or assign Session.State")
ErrNilState is returned when the state is nil.
var ErrStateNotFound = errors.New("state cache not found")
ErrStateNotFound is returned when the state cache requested is not found
var ErrWSAlreadyOpen = errors.New("web socket already opened")
ErrWSAlreadyOpen is thrown when you attempt to open a websocket that already is open.
var ErrWSNotFound = errors.New("no websocket connection exists")
ErrWSNotFound is thrown when you attempt to use a websocket that doesn't exist
var ErrWSShardBounds = errors.New("ShardID must be less than ShardCount")
ErrWSShardBounds is thrown when you try to use a shard ID that is more than the total shard count
var Logger func(msgL, caller int, format string, a ...interface{})
Logger can be used to replace the standard logging for discordgo
Functions ¶
func MultipartBodyWithJSON ¶ added in v0.23.3
func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType string, requestBody []byte, err error)
MultipartBodyWithJSON returns the contentType and body for a discord request data : The object to encode for payload_json in the multipart request files : Files to include in the request
func SnowflakeTimestamp ¶ added in v0.23.3
SnowflakeTimestamp returns the creation time of a Snowflake ID relative to the creation of Discord.
func VerifyInteraction ¶ added in v0.23.3
VerifyInteraction implements message verification of the discord interactions api signing algorithm, as documented here: https://discord.com/developers/docs/interactions/receiving-and-responding#security-and-authorization
Types ¶
type APIErrorMessage ¶ added in v0.15.0
An APIErrorMessage is an api error message returned from discord
type Ack ¶ added in v0.15.0
type Ack struct {
Token string `json:"token"`
}
An Ack is used to ack messages
type ActionsRow ¶ added in v0.23.3
type ActionsRow struct {
Components []MessageComponent `json:"components"`
}
ActionsRow is a container for components within one row.
func (ActionsRow) MarshalJSON ¶ added in v0.23.3
func (r ActionsRow) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling ActionsRow to a JSON object.
func (ActionsRow) Type ¶ added in v0.23.3
func (r ActionsRow) Type() ComponentType
Type is a method to get the type of a component.
func (*ActionsRow) UnmarshalJSON ¶ added in v0.23.3
func (r *ActionsRow) UnmarshalJSON(data []byte) error
UnmarshalJSON is a helper function to unmarshal Actions Row.
type Activity ¶ added in v0.23.3
type Activity struct { Name string `json:"name"` Type ActivityType `json:"type"` URL string `json:"url,omitempty"` CreatedAt time.Time `json:"created_at"` ApplicationID string `json:"application_id,omitempty"` State string `json:"state,omitempty"` Details string `json:"details,omitempty"` Timestamps TimeStamps `json:"timestamps,omitempty"` Emoji Emoji `json:"emoji,omitempty"` Party Party `json:"party,omitempty"` Assets Assets `json:"assets,omitempty"` Secrets Secrets `json:"secrets,omitempty"` Instance bool `json:"instance,omitempty"` Flags int `json:"flags,omitempty"` }
Activity defines the Activity sent with GatewayStatusUpdate https://discord.com/developers/docs/topics/gateway#activity-object
func (*Activity) UnmarshalJSON ¶ added in v0.23.3
UnmarshalJSON is a custom unmarshaljson to make CreatedAt a time.Time instead of an int
type ActivityType ¶ added in v0.23.3
type ActivityType int
ActivityType is the type of Activity (see ActivityType* consts) in the Activity struct https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
const ( ActivityTypeGame ActivityType = 0 ActivityTypeStreaming ActivityType = 1 ActivityTypeListening ActivityType = 2 ActivityTypeWatching ActivityType = 3 ActivityTypeCustom ActivityType = 4 ActivityTypeCompeting ActivityType = 5 )
Valid ActivityType values
type AllowedMentionType ¶ added in v0.23.3
type AllowedMentionType string
AllowedMentionType describes the types of mentions used in the MessageAllowedMentions type.
const ( AllowedMentionTypeRoles AllowedMentionType = "roles" AllowedMentionTypeUsers AllowedMentionType = "users" AllowedMentionTypeEveryone AllowedMentionType = "everyone" )
The types of mentions used in MessageAllowedMentions.
type Application ¶ added in v0.12.0
type Application struct { ID string `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` Icon string `json:"icon,omitempty"` Secret string `json:"secret,omitempty"` RedirectURIs *[]string `json:"redirect_uris,omitempty"` BotRequireCodeGrant bool `json:"bot_require_code_grant,omitempty"` BotPublic bool `json:"bot_public,omitempty"` RPCApplicationState int `json:"rpc_application_state,omitempty"` Flags int `json:"flags,omitempty"` Owner *User `json:"owner"` Bot *User `json:"bot"` Team *Team `json:"team"` }
An Application struct stores values for a Discord OAuth2 Application
Example ¶
package main import ( "log" "os" "github.com/bwmarrin/discordgo" ) func main() { // Authentication Token pulled from environment variable DGU_TOKEN Token := os.Getenv("DGU_TOKEN") if Token == "" { return } // Create a new Discordgo session dg, err := discordgo.New(Token) if err != nil { log.Println(err) return } // Create an new Application ap := &discordgo.Application{} ap.Name = "TestApp" ap.Description = "TestDesc" ap, err = dg.ApplicationCreate(ap) log.Printf("ApplicationCreate: err: %+v, app: %+v\n", err, ap) // Get a specific Application by it's ID ap, err = dg.Application(ap.ID) log.Printf("Application: err: %+v, app: %+v\n", err, ap) // Update an existing Application with new values ap.Description = "Whooooa" ap, err = dg.ApplicationUpdate(ap.ID, ap) log.Printf("ApplicationUpdate: err: %+v, app: %+v\n", err, ap) // create a new bot account for this application bot, err := dg.ApplicationBotCreate(ap.ID) log.Printf("BotCreate: err: %+v, bot: %+v\n", err, bot) // Get a list of all applications for the authenticated user apps, err := dg.Applications() log.Printf("Applications: err: %+v, apps : %+v\n", err, apps) for k, v := range apps { log.Printf("Applications: %d : %+v\n", k, v) } // Delete the application we created. err = dg.ApplicationDelete(ap.ID) log.Printf("Delete: err: %+v\n", err) return }
Output:
type ApplicationCommand ¶ added in v0.23.3
type ApplicationCommand struct { ID string `json:"id,omitempty"` ApplicationID string `json:"application_id,omitempty"` Type ApplicationCommandType `json:"type,omitempty"` Name string `json:"name"` // NOTE: Chat commands only. Otherwise it mustn't be set. Description string `json:"description,omitempty"` Version string `json:"version,omitempty"` // NOTE: Chat commands only. Otherwise it mustn't be set. Options []*ApplicationCommandOption `json:"options"` }
ApplicationCommand represents an application's slash command.
type ApplicationCommandInteractionData ¶ added in v0.23.3
type ApplicationCommandInteractionData struct { ID string `json:"id"` Name string `json:"name"` Resolved *ApplicationCommandInteractionDataResolved `json:"resolved"` // Slash command options Options []*ApplicationCommandInteractionDataOption `json:"options"` // Target (user/message) id on which context menu command was called. // The details are stored in Resolved according to command type. TargetID string `json:"target_id"` }
ApplicationCommandInteractionData contains the data of application command interaction.
func (ApplicationCommandInteractionData) Type ¶ added in v0.23.3
func (ApplicationCommandInteractionData) Type() InteractionType
Type returns the type of interaction data.
type ApplicationCommandInteractionDataOption ¶ added in v0.23.3
type ApplicationCommandInteractionDataOption struct { Name string `json:"name"` Type ApplicationCommandOptionType `json:"type"` // NOTE: Contains the value specified by Type. Value interface{} `json:"value,omitempty"` Options []*ApplicationCommandInteractionDataOption `json:"options,omitempty"` // NOTE: autocomplete interaction only. Focused bool `json:"focused,omitempty"` }
ApplicationCommandInteractionDataOption represents an option of a slash command.
func (ApplicationCommandInteractionDataOption) BoolValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) BoolValue() bool
BoolValue is a utility function for casting option value to bool
func (ApplicationCommandInteractionDataOption) ChannelValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) ChannelValue(s *Session) *Channel
ChannelValue is a utility function for casting option value to channel object. s : Session object, if not nil, function additionally fetches all channel's data
func (ApplicationCommandInteractionDataOption) FloatValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) FloatValue() float64
FloatValue is a utility function for casting option value to float
func (ApplicationCommandInteractionDataOption) IntValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) IntValue() int64
IntValue is a utility function for casting option value to integer
func (ApplicationCommandInteractionDataOption) RoleValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) RoleValue(s *Session, gID string) *Role
RoleValue is a utility function for casting option value to role object. s : Session object, if not nil, function additionally fetches all role's data
func (ApplicationCommandInteractionDataOption) StringValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) StringValue() string
StringValue is a utility function for casting option value to string
func (ApplicationCommandInteractionDataOption) UintValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) UintValue() uint64
UintValue is a utility function for casting option value to unsigned integer
func (ApplicationCommandInteractionDataOption) UserValue ¶ added in v0.23.3
func (o ApplicationCommandInteractionDataOption) UserValue(s *Session) *User
UserValue is a utility function for casting option value to user object. s : Session object, if not nil, function additionally fetches all user's data
type ApplicationCommandInteractionDataResolved ¶ added in v0.23.3
type ApplicationCommandInteractionDataResolved struct { Users map[string]*User `json:"users"` Members map[string]*Member `json:"members"` Roles map[string]*Role `json:"roles"` Channels map[string]*Channel `json:"channels"` Messages map[string]*Message `json:"messages"` }
ApplicationCommandInteractionDataResolved contains resolved data of command execution. Partial Member objects are missing user, deaf and mute fields. Partial Channel objects only have id, name, type and permissions fields.
type ApplicationCommandOption ¶ added in v0.23.3
type ApplicationCommandOption struct { Type ApplicationCommandOptionType `json:"type"` Name string `json:"name"` Description string `json:"description,omitempty"` // NOTE: This feature was on the API, but at some point developers decided to remove it. // So I commented it, until it will be officially on the docs. // Default bool `json:"default"` ChannelTypes []ChannelType `json:"channel_types"` Required bool `json:"required"` Options []*ApplicationCommandOption `json:"options"` // NOTE: mutually exclusive with Choices. Autocomplete bool `json:"autocomplete"` Choices []*ApplicationCommandOptionChoice `json:"choices"` }
ApplicationCommandOption represents an option/subcommand/subcommands group.
type ApplicationCommandOptionChoice ¶ added in v0.23.3
type ApplicationCommandOptionChoice struct { Name string `json:"name"` Value interface{} `json:"value"` }
ApplicationCommandOptionChoice represents a slash command option choice.
type ApplicationCommandOptionType ¶ added in v0.23.3
type ApplicationCommandOptionType uint8
ApplicationCommandOptionType indicates the type of a slash command's option.
const ( ApplicationCommandOptionSubCommand ApplicationCommandOptionType = 1 ApplicationCommandOptionSubCommandGroup ApplicationCommandOptionType = 2 ApplicationCommandOptionString ApplicationCommandOptionType = 3 ApplicationCommandOptionInteger ApplicationCommandOptionType = 4 ApplicationCommandOptionBoolean ApplicationCommandOptionType = 5 ApplicationCommandOptionUser ApplicationCommandOptionType = 6 ApplicationCommandOptionChannel ApplicationCommandOptionType = 7 ApplicationCommandOptionRole ApplicationCommandOptionType = 8 ApplicationCommandOptionMentionable ApplicationCommandOptionType = 9 )
Application command option types.
func (ApplicationCommandOptionType) String ¶ added in v0.23.3
func (t ApplicationCommandOptionType) String() string
type ApplicationCommandType ¶ added in v0.23.3
type ApplicationCommandType uint8
ApplicationCommandType represents the type of application command.
const ( // ChatApplicationCommand is default command type. They are slash commands (i.e. called directly from the chat). ChatApplicationCommand ApplicationCommandType = 1 // UserApplicationCommand adds command to user context menu. UserApplicationCommand ApplicationCommandType = 2 // MessageApplicationCommand adds command to message context menu. MessageApplicationCommand ApplicationCommandType = 3 )
Application command types
type Assets ¶ added in v0.18.0
type Assets struct { LargeImageID string `json:"large_image,omitempty"` SmallImageID string `json:"small_image,omitempty"` LargeText string `json:"large_text,omitempty"` SmallText string `json:"small_text,omitempty"` }
An Assets struct contains assets and labels used in the rich presence "playing .." Game
type AuditLogAction ¶ added in v0.23.3
type AuditLogAction int
AuditLogAction is the Action of the AuditLog (see AuditLogAction* consts) https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
const ( AuditLogActionGuildUpdate AuditLogAction = 1 AuditLogActionChannelCreate AuditLogAction = 10 AuditLogActionChannelUpdate AuditLogAction = 11 AuditLogActionChannelDelete AuditLogAction = 12 AuditLogActionChannelOverwriteCreate AuditLogAction = 13 AuditLogActionChannelOverwriteUpdate AuditLogAction = 14 AuditLogActionChannelOverwriteDelete AuditLogAction = 15 AuditLogActionMemberKick AuditLogAction = 20 AuditLogActionMemberPrune AuditLogAction = 21 AuditLogActionMemberBanAdd AuditLogAction = 22 AuditLogActionMemberBanRemove AuditLogAction = 23 AuditLogActionMemberUpdate AuditLogAction = 24 AuditLogActionMemberRoleUpdate AuditLogAction = 25 AuditLogActionRoleCreate AuditLogAction = 30 AuditLogActionRoleUpdate AuditLogAction = 31 AuditLogActionRoleDelete AuditLogAction = 32 AuditLogActionInviteCreate AuditLogAction = 40 AuditLogActionInviteUpdate AuditLogAction = 41 AuditLogActionInviteDelete AuditLogAction = 42 AuditLogActionWebhookCreate AuditLogAction = 50 AuditLogActionWebhookUpdate AuditLogAction = 51 AuditLogActionWebhookDelete AuditLogAction = 52 AuditLogActionEmojiCreate AuditLogAction = 60 AuditLogActionEmojiUpdate AuditLogAction = 61 AuditLogActionEmojiDelete AuditLogAction = 62 AuditLogActionMessageDelete AuditLogAction = 72 AuditLogActionMessageBulkDelete AuditLogAction = 73 AuditLogActionMessagePin AuditLogAction = 74 AuditLogActionMessageUnpin AuditLogAction = 75 AuditLogActionIntegrationCreate AuditLogAction = 80 AuditLogActionIntegrationUpdate AuditLogAction = 81 AuditLogActionIntegrationDelete AuditLogAction = 82 )
Block contains Discord Audit Log Action Types
type AuditLogChange ¶ added in v0.23.3
type AuditLogChange struct { NewValue interface{} `json:"new_value"` OldValue interface{} `json:"old_value"` Key *AuditLogChangeKey `json:"key"` }
AuditLogChange for an AuditLogEntry
type AuditLogChangeKey ¶ added in v0.23.3
type AuditLogChangeKey string
AuditLogChangeKey value for AuditLogChange https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key
const ( AuditLogChangeKeyName AuditLogChangeKey = "name" AuditLogChangeKeyIconHash AuditLogChangeKey = "icon_hash" AuditLogChangeKeySplashHash AuditLogChangeKey = "splash_hash" AuditLogChangeKeyOwnerID AuditLogChangeKey = "owner_id" AuditLogChangeKeyRegion AuditLogChangeKey = "region" AuditLogChangeKeyAfkChannelID AuditLogChangeKey = "afk_channel_id" AuditLogChangeKeyAfkTimeout AuditLogChangeKey = "afk_timeout" AuditLogChangeKeyMfaLevel AuditLogChangeKey = "mfa_level" AuditLogChangeKeyVerificationLevel AuditLogChangeKey = "verification_level" AuditLogChangeKeyExplicitContentFilter AuditLogChangeKey = "explicit_content_filter" AuditLogChangeKeyDefaultMessageNotification AuditLogChangeKey = "default_message_notifications" AuditLogChangeKeyVanityURLCode AuditLogChangeKey = "vanity_url_code" AuditLogChangeKeyRoleAdd AuditLogChangeKey = "$add" AuditLogChangeKeyRoleRemove AuditLogChangeKey = "$remove" AuditLogChangeKeyPruneDeleteDays AuditLogChangeKey = "prune_delete_days" AuditLogChangeKeyWidgetEnabled AuditLogChangeKey = "widget_enabled" AuditLogChangeKeyWidgetChannelID AuditLogChangeKey = "widget_channel_id" AuditLogChangeKeySystemChannelID AuditLogChangeKey = "system_channel_id" AuditLogChangeKeyPosition AuditLogChangeKey = "position" AuditLogChangeKeyTopic AuditLogChangeKey = "topic" AuditLogChangeKeyBitrate AuditLogChangeKey = "bitrate" AuditLogChangeKeyPermissionOverwrite AuditLogChangeKey = "permission_overwrites" AuditLogChangeKeyNSFW AuditLogChangeKey = "nsfw" AuditLogChangeKeyApplicationID AuditLogChangeKey = "application_id" AuditLogChangeKeyRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user" AuditLogChangeKeyPermissions AuditLogChangeKey = "permissions" AuditLogChangeKeyColor AuditLogChangeKey = "color" AuditLogChangeKeyHoist AuditLogChangeKey = "hoist" AuditLogChangeKeyMentionable AuditLogChangeKey = "mentionable" AuditLogChangeKeyAllow AuditLogChangeKey = "allow" AuditLogChangeKeyDeny AuditLogChangeKey = "deny" AuditLogChangeKeyCode AuditLogChangeKey = "code" AuditLogChangeKeyChannelID AuditLogChangeKey = "channel_id" AuditLogChangeKeyInviterID AuditLogChangeKey = "inviter_id" AuditLogChangeKeyMaxUses AuditLogChangeKey = "max_uses" AuditLogChangeKeyUses AuditLogChangeKey = "uses" AuditLogChangeKeyMaxAge AuditLogChangeKey = "max_age" AuditLogChangeKeyTempoary AuditLogChangeKey = "temporary" AuditLogChangeKeyDeaf AuditLogChangeKey = "deaf" AuditLogChangeKeyMute AuditLogChangeKey = "mute" AuditLogChangeKeyNick AuditLogChangeKey = "nick" AuditLogChangeKeyAvatarHash AuditLogChangeKey = "avatar_hash" AuditLogChangeKeyID AuditLogChangeKey = "id" AuditLogChangeKeyType AuditLogChangeKey = "type" AuditLogChangeKeyEnableEmoticons AuditLogChangeKey = "enable_emoticons" AuditLogChangeKeyExpireBehavior AuditLogChangeKey = "expire_behavior" AuditLogChangeKeyExpireGracePeriod AuditLogChangeKey = "expire_grace_period" )
Block of valid AuditLogChangeKey
type AuditLogEntry ¶ added in v0.23.3
type AuditLogEntry struct { TargetID string `json:"target_id"` Changes []*AuditLogChange `json:"changes"` UserID string `json:"user_id"` ID string `json:"id"` ActionType *AuditLogAction `json:"action_type"` Options *AuditLogOptions `json:"options"` Reason string `json:"reason"` }
AuditLogEntry for a GuildAuditLog https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
type AuditLogOptions ¶ added in v0.23.3
type AuditLogOptions struct { DeleteMemberDays string `json:"delete_member_days"` MembersRemoved string `json:"members_removed"` ChannelID string `json:"channel_id"` MessageID string `json:"message_id"` Count string `json:"count"` ID string `json:"id"` Type *AuditLogOptionsType `json:"type"` RoleName string `json:"role_name"` }
AuditLogOptions optional data for the AuditLog https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
type AuditLogOptionsType ¶ added in v0.23.3
type AuditLogOptionsType string
AuditLogOptionsType of the AuditLogOption https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
const ( AuditLogOptionsTypeMember AuditLogOptionsType = "member" AuditLogOptionsTypeRole AuditLogOptionsType = "role" )
Valid Types for AuditLogOptionsType
type Bucket ¶ added in v0.15.0
type Bucket struct { sync.Mutex Key string Remaining int Userdata interface{} // contains filtered or unexported fields }
Bucket represents a ratelimit bucket, each bucket gets ratelimited individually (-global ratelimits)
type Button ¶ added in v0.23.3
type Button struct { Label string `json:"label"` Style ButtonStyle `json:"style"` Disabled bool `json:"disabled"` Emoji ComponentEmoji `json:"emoji"` // NOTE: Only button with LinkButton style can have link. Also, URL is mutually exclusive with CustomID. URL string `json:"url,omitempty"` CustomID string `json:"custom_id,omitempty"` }
Button represents button component.
func (Button) MarshalJSON ¶ added in v0.23.3
MarshalJSON is a method for marshaling Button to a JSON object.
func (Button) Type ¶ added in v0.23.3
func (Button) Type() ComponentType
Type is a method to get the type of a component.
type ButtonStyle ¶ added in v0.23.3
type ButtonStyle uint
ButtonStyle is style of button.
const ( // PrimaryButton is a button with blurple color. PrimaryButton ButtonStyle = 1 // SecondaryButton is a button with grey color. SecondaryButton ButtonStyle = 2 // SuccessButton is a button with green color. SuccessButton ButtonStyle = 3 // DangerButton is a button with red color. DangerButton ButtonStyle = 4 // LinkButton is a special type of button which navigates to a URL. Has grey color. LinkButton ButtonStyle = 5 )
Button styles.
type Channel ¶
type Channel struct { // The ID of the channel. ID string `json:"id"` // The ID of the guild to which the channel belongs, if it is in a guild. // Else, this ID is empty (e.g. DM channels). GuildID string `json:"guild_id"` // The name of the channel. Name string `json:"name"` // The topic of the channel. Topic string `json:"topic"` // The type of the channel. Type ChannelType `json:"type"` // The ID of the last message sent in the channel. This is not // guaranteed to be an ID of a valid message. LastMessageID string `json:"last_message_id"` // The timestamp of the last pinned message in the channel. // nil if the channel has no pinned messages. LastPinTimestamp *time.Time `json:"last_pin_timestamp"` // Whether the channel is marked as NSFW. NSFW bool `json:"nsfw"` // Icon of the group DM channel. Icon string `json:"icon"` // The position of the channel, used for sorting in client. Position int `json:"position"` // The bitrate of the channel, if it is a voice channel. Bitrate int `json:"bitrate"` // The recipients of the channel. This is only populated in DM channels. Recipients []*User `json:"recipients"` // The messages in the channel. This is only present in state-cached channels, // and State.MaxMessageCount must be non-zero. Messages []*Message `json:"-"` // A list of permission overwrites present for the channel. PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites"` // The user limit of the voice channel. UserLimit int `json:"user_limit"` // The ID of the parent channel, if the channel is under a category ParentID string `json:"parent_id"` // Amount of seconds a user has to wait before sending another message (0-21600) // bots, as well as users with the permission manage_messages or manage_channel, are unaffected RateLimitPerUser int `json:"rate_limit_per_user"` // ID of the DM creator Zeroed if guild channel OwnerID string `json:"owner_id"` // ApplicationID of the DM creator Zeroed if guild channel or not a bot user ApplicationID string `json:"application_id"` }
A Channel holds all data related to an individual Discord channel.
type ChannelCreate ¶ added in v0.11.0
type ChannelCreate struct {
*Channel
}
ChannelCreate is the data for a ChannelCreate event.
type ChannelDelete ¶ added in v0.11.0
type ChannelDelete struct {
*Channel
}
ChannelDelete is the data for a ChannelDelete event.
type ChannelEdit ¶ added in v0.18.0
type ChannelEdit struct { Name string `json:"name,omitempty"` Topic string `json:"topic,omitempty"` NSFW bool `json:"nsfw,omitempty"` Position int `json:"position"` Bitrate int `json:"bitrate,omitempty"` UserLimit int `json:"user_limit,omitempty"` PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"` ParentID string `json:"parent_id,omitempty"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` }
A ChannelEdit holds Channel Field data for a channel edit.
type ChannelFollow ¶ added in v0.23.3
type ChannelFollow struct { ChannelID string `json:"channel_id"` WebhookID string `json:"webhook_id"` }
A ChannelFollow holds data returned after following a news channel
type ChannelPinsUpdate ¶ added in v0.15.0
type ChannelPinsUpdate struct { LastPinTimestamp string `json:"last_pin_timestamp"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` }
ChannelPinsUpdate stores data for a ChannelPinsUpdate event.
type ChannelType ¶ added in v0.17.0
type ChannelType int
ChannelType is the type of a Channel
const ( ChannelTypeGuildText ChannelType = 0 ChannelTypeDM ChannelType = 1 ChannelTypeGuildVoice ChannelType = 2 ChannelTypeGroupDM ChannelType = 3 ChannelTypeGuildCategory ChannelType = 4 ChannelTypeGuildNews ChannelType = 5 ChannelTypeGuildStore ChannelType = 6 )
Block contains known ChannelType values
type ChannelUpdate ¶ added in v0.11.0
type ChannelUpdate struct {
*Channel
}
ChannelUpdate is the data for a ChannelUpdate event.
type ComponentEmoji ¶ added in v0.23.3
type ComponentEmoji struct { Name string `json:"name,omitempty"` ID string `json:"id,omitempty"` Animated bool `json:"animated,omitempty"` }
ComponentEmoji represents button emoji, if it does have one.
type ComponentType ¶ added in v0.23.3
type ComponentType uint
ComponentType is type of component.
const ( ActionsRowComponent ComponentType = 1 ButtonComponent ComponentType = 2 SelectMenuComponent ComponentType = 3 )
MessageComponent types.
type Connect ¶ added in v0.11.0
type Connect struct{}
Connect is the data for a Connect event. This is a synthetic event and is not dispatched by Discord.
type Disconnect ¶ added in v0.11.0
type Disconnect struct{}
Disconnect is the data for a Disconnect event. This is a synthetic event and is not dispatched by Discord.
type EmbedType ¶ added in v0.23.3
type EmbedType string
EmbedType is the type of embed https://discord.com/developers/docs/resources/channel#embed-object-embed-types
type Emoji ¶ added in v0.8.0
type Emoji struct { ID string `json:"id"` Name string `json:"name"` Roles []string `json:"roles"` User *User `json:"user"` RequireColons bool `json:"require_colons"` Managed bool `json:"managed"` Animated bool `json:"animated"` Available bool `json:"available"` }
Emoji struct holds data related to Emoji's
func (*Emoji) APIName ¶ added in v0.15.0
APIName returns an correctly formatted API name for use in the MessageReactions endpoints.
func (*Emoji) MessageFormat ¶ added in v0.23.3
MessageFormat returns a correctly formatted Emoji for use in Message content and embeds
type Event ¶
type Event struct { Operation int `json:"op"` Sequence int64 `json:"s"` Type string `json:"t"` RawData json.RawMessage `json:"d"` // Struct contains one of the other types in this file. Struct interface{} `json:"-"` }
Event provides a basic initial struct for all websocket events.
type EventHandler ¶ added in v0.15.0
type EventHandler interface { // Type returns the type of event this handler belongs to. Type() string // Handle is called whenever an event of Type() happens. // It is the receivers responsibility to type assert that the interface // is the expected struct. Handle(*Session, interface{}) }
EventHandler is an interface for Discord events.
type EventInterfaceProvider ¶ added in v0.15.0
type EventInterfaceProvider interface { // Type is the type of event this handler belongs to. Type() string // New returns a new instance of the struct this event handler handles. // This is called once per event. // The struct is provided to all handlers of the same Type(). New() interface{} }
EventInterfaceProvider is an interface for providing empty interfaces for Discord events.
type ExpireBehavior ¶ added in v0.23.3
type ExpireBehavior int
ExpireBehavior of Integration https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
const ( ExpireBehaviorRemoveRole ExpireBehavior = 0 ExpireBehaviorKick ExpireBehavior = 1 )
Block of valid ExpireBehaviors
type ExplicitContentFilterLevel ¶ added in v0.23.3
type ExplicitContentFilterLevel int
ExplicitContentFilterLevel type definition
const ( ExplicitContentFilterDisabled ExplicitContentFilterLevel = 0 ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterLevel = 1 ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2 )
Constants for ExplicitContentFilterLevel levels from 0 to 2 inclusive
type FriendSourceFlags ¶ added in v0.13.0
type FriendSourceFlags struct { All bool `json:"all"` MutualGuilds bool `json:"mutual_guilds"` MutualFriends bool `json:"mutual_friends"` }
FriendSourceFlags stores ... TODO :)
type GatewayBotResponse ¶ added in v0.17.0
type GatewayBotResponse struct { URL string `json:"url"` Shards int `json:"shards"` SessionStartLimit SessionInformation `json:"session_start_limit"` }
GatewayBotResponse stores the data for the gateway/bot response
type GatewayStatusUpdate ¶ added in v0.23.3
type GatewayStatusUpdate struct { Since int `json:"since"` Game Activity `json:"game"` Status string `json:"status"` AFK bool `json:"afk"` }
GatewayStatusUpdate is sent by the client to indicate a presence or status update https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
type Guild ¶
type Guild struct { // The ID of the guild. ID string `json:"id"` // The name of the guild. (2–100 characters) Name string `json:"name"` // The hash of the guild's icon. Use Session.GuildIcon // to retrieve the icon itself. Icon string `json:"icon"` // The voice region of the guild. Region string `json:"region"` // The ID of the AFK voice channel. AfkChannelID string `json:"afk_channel_id"` // The user ID of the owner of the guild. OwnerID string `json:"owner_id"` // If we are the owner of the guild Owner bool `json:"owner"` // The time at which the current user joined the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. JoinedAt time.Time `json:"joined_at"` // The hash of the guild's discovery splash. DiscoverySplash string `json:"discovery_splash"` // The hash of the guild's splash. Splash string `json:"splash"` // The timeout, in seconds, before a user is considered AFK in voice. AfkTimeout int `json:"afk_timeout"` // The number of members in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. MemberCount int `json:"member_count"` // The verification level required for the guild. VerificationLevel VerificationLevel `json:"verification_level"` // Whether the guild is considered large. This is // determined by a member threshold in the identify packet, // and is currently hard-coded at 250 members in the library. Large bool `json:"large"` // The default message notification setting for the guild. DefaultMessageNotifications MessageNotifications `json:"default_message_notifications"` // A list of roles in the guild. Roles []*Role `json:"roles"` // A list of the custom emojis present in the guild. Emojis []*Emoji `json:"emojis"` // A list of the members in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. Members []*Member `json:"members"` // A list of partial presence objects for members in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. Presences []*Presence `json:"presences"` // The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned) MaxPresences int `json:"max_presences"` // The maximum number of members for the guild MaxMembers int `json:"max_members"` // A list of channels in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. Channels []*Channel `json:"channels"` // A list of voice states for the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. VoiceStates []*VoiceState `json:"voice_states"` // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. Unavailable bool `json:"unavailable"` // The explicit content filter level ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"` // The list of enabled guild features Features []string `json:"features"` // Required MFA level for the guild MfaLevel MfaLevel `json:"mfa_level"` // The application id of the guild if bot created. ApplicationID string `json:"application_id"` // Whether or not the Server Widget is enabled WidgetEnabled bool `json:"widget_enabled"` // The Channel ID for the Server Widget WidgetChannelID string `json:"widget_channel_id"` // The Channel ID to which system messages are sent (eg join and leave messages) SystemChannelID string `json:"system_channel_id"` // The System channel flags SystemChannelFlags SystemChannelFlag `json:"system_channel_flags"` // The ID of the rules channel ID, used for rules. RulesChannelID string `json:"rules_channel_id"` // the vanity url code for the guild VanityURLCode string `json:"vanity_url_code"` // the description for the guild Description string `json:"description"` // The hash of the guild's banner Banner string `json:"banner"` // The premium tier of the guild PremiumTier PremiumTier `json:"premium_tier"` // The total number of users currently boosting this server PremiumSubscriptionCount int `json:"premium_subscription_count"` // The preferred locale of a guild with the "PUBLIC" feature; used in server discovery and notices from Discord; defaults to "en-US" PreferredLocale string `json:"preferred_locale"` // The id of the channel where admins and moderators of guilds with the "PUBLIC" feature receive notices from Discord PublicUpdatesChannelID string `json:"public_updates_channel_id"` // The maximum amount of users in a video channel MaxVideoChannelUsers int `json:"max_video_channel_users"` // Approximate number of members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true ApproximateMemberCount int `json:"approximate_member_count"` // Approximate number of non-offline members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true ApproximatePresenceCount int `json:"approximate_presence_count"` // Permissions of our user Permissions int64 `json:"permissions,string"` }
A Guild holds all data related to a specific Discord Guild. Guilds are also sometimes referred to as Servers in the Discord client.
type GuildAuditLog ¶ added in v0.23.3
type GuildAuditLog struct { Webhooks []*Webhook `json:"webhooks,omitempty"` Users []*User `json:"users,omitempty"` AuditLogEntries []*AuditLogEntry `json:"audit_log_entries"` Integrations []*Integration `json:"integrations"` }
A GuildAuditLog stores data for a guild audit log. https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
type GuildBanAdd ¶ added in v0.11.0
GuildBanAdd is the data for a GuildBanAdd event.
type GuildBanRemove ¶ added in v0.11.0
GuildBanRemove is the data for a GuildBanRemove event.
type GuildChannelCreateData ¶ added in v0.23.3
type GuildChannelCreateData struct { Name string `json:"name"` Type ChannelType `json:"type"` Topic string `json:"topic,omitempty"` Bitrate int `json:"bitrate,omitempty"` UserLimit int `json:"user_limit,omitempty"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` Position int `json:"position,omitempty"` PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"` ParentID string `json:"parent_id,omitempty"` NSFW bool `json:"nsfw,omitempty"` }
GuildChannelCreateData is provided to GuildChannelCreateComplex
type GuildCreate ¶ added in v0.11.0
type GuildCreate struct {
*Guild
}
GuildCreate is the data for a GuildCreate event.
type GuildDelete ¶ added in v0.11.0
GuildDelete is the data for a GuildDelete event.
type GuildEmbed ¶ added in v0.13.0
A GuildEmbed stores data for a guild embed.
type GuildEmojisUpdate ¶ added in v0.8.0
A GuildEmojisUpdate is the data for a guild emoji update event.
type GuildIntegrationsUpdate ¶
type GuildIntegrationsUpdate struct {
GuildID string `json:"guild_id"`
}
GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
type GuildMemberAdd ¶ added in v0.11.0
type GuildMemberAdd struct {
*Member
}
GuildMemberAdd is the data for a GuildMemberAdd event.
type GuildMemberRemove ¶ added in v0.11.0
type GuildMemberRemove struct {
*Member
}
GuildMemberRemove is the data for a GuildMemberRemove event.
type GuildMemberUpdate ¶ added in v0.11.0
type GuildMemberUpdate struct {
*Member
}
GuildMemberUpdate is the data for a GuildMemberUpdate event.
type GuildMembersChunk ¶ added in v0.15.0
type GuildMembersChunk struct { GuildID string `json:"guild_id"` Members []*Member `json:"members"` ChunkIndex int `json:"chunk_index"` ChunkCount int `json:"chunk_count"` Presences []*Presence `json:"presences,omitempty"` }
A GuildMembersChunk is the data for a GuildMembersChunk event.
type GuildParams ¶ added in v0.12.0
type GuildParams struct { Name string `json:"name,omitempty"` Region string `json:"region,omitempty"` VerificationLevel *VerificationLevel `json:"verification_level,omitempty"` DefaultMessageNotifications int `json:"default_message_notifications,omitempty"` // TODO: Separate type? AfkChannelID string `json:"afk_channel_id,omitempty"` AfkTimeout int `json:"afk_timeout,omitempty"` Icon string `json:"icon,omitempty"` OwnerID string `json:"owner_id,omitempty"` Splash string `json:"splash,omitempty"` Banner string `json:"banner,omitempty"` }
A GuildParams stores all the data needed to update discord guild settings
type GuildPreview ¶ added in v0.23.3
type GuildPreview struct { // The ID of the guild. ID string `json:"id"` // The name of the guild. (2–100 characters) Name string `json:"name"` // The hash of the guild's icon. Use Session.GuildIcon // to retrieve the icon itself. Icon string `json:"icon"` // The hash of the guild's splash. Splash string `json:"splash"` // The hash of the guild's discovery splash. DiscoverySplash string `json:"discovery_splash"` // A list of the custom emojis present in the guild. Emojis []*Emoji `json:"emojis"` // The list of enabled guild features Features []string `json:"features"` // Approximate number of members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true ApproximateMemberCount int `json:"approximate_member_count"` // Approximate number of non-offline members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true ApproximatePresenceCount int `json:"approximate_presence_count"` // the description for the guild Description string `json:"description"` }
A GuildPreview holds data related to a specific public Discord Guild, even if the user is not in the guild.
type GuildRoleCreate ¶ added in v0.11.0
type GuildRoleCreate struct {
*GuildRole
}
GuildRoleCreate is the data for a GuildRoleCreate event.
type GuildRoleDelete ¶
A GuildRoleDelete is the data for a GuildRoleDelete event.
type GuildRoleUpdate ¶ added in v0.11.0
type GuildRoleUpdate struct {
*GuildRole
}
GuildRoleUpdate is the data for a GuildRoleUpdate event.
type GuildUpdate ¶ added in v0.11.0
type GuildUpdate struct {
*Guild
}
GuildUpdate is the data for a GuildUpdate event.
type ICEServer ¶
type ICEServer struct { URL string `json:"url"` Username string `json:"username"` Credential string `json:"credential"` }
A ICEServer stores data for a specific voice ICE server.
type Identify ¶ added in v0.23.3
type Identify struct { Token string `json:"token"` Properties IdentifyProperties `json:"properties"` Compress bool `json:"compress"` LargeThreshold int `json:"large_threshold"` Shard *[2]int `json:"shard,omitempty"` Presence GatewayStatusUpdate `json:"presence,omitempty"` GuildSubscriptions bool `json:"guild_subscriptions"` Intents Intent `json:"intents"` }
Identify is sent during initial handshake with the discord gateway. https://discord.com/developers/docs/topics/gateway#identify
type IdentifyProperties ¶ added in v0.23.3
type IdentifyProperties struct { OS string `json:"$os"` Browser string `json:"$browser"` Device string `json:"$device"` Referer string `json:"$referer"` ReferringDomain string `json:"$referring_domain"` }
IdentifyProperties contains the "properties" portion of an Identify packet https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties
type Integration ¶ added in v0.23.3
type Integration struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` Enabled bool `json:"enabled"` Syncing bool `json:"syncing"` RoleID string `json:"role_id"` EnableEmoticons bool `json:"enable_emoticons"` ExpireBehavior ExpireBehavior `json:"expire_behavior"` ExpireGracePeriod int `json:"expire_grace_period"` User *User `json:"user"` Account IntegrationAccount `json:"account"` SyncedAt time.Time `json:"synced_at"` }
Integration stores integration information
type IntegrationAccount ¶ added in v0.23.3
IntegrationAccount is integration account information sent by the UserConnections endpoint
type Intent ¶ added in v0.23.3
type Intent int
Intent is the type of a Gateway Intent https://discord.com/developers/docs/topics/gateway#gateway-intents
const ( IntentsGuilds Intent = 1 << 0 IntentsGuildMembers Intent = 1 << 1 IntentsGuildBans Intent = 1 << 2 IntentsGuildEmojis Intent = 1 << 3 IntentsGuildIntegrations Intent = 1 << 4 IntentsGuildWebhooks Intent = 1 << 5 IntentsGuildInvites Intent = 1 << 6 IntentsGuildVoiceStates Intent = 1 << 7 IntentsGuildPresences Intent = 1 << 8 IntentsGuildMessages Intent = 1 << 9 IntentsGuildMessageReactions Intent = 1 << 10 IntentsGuildMessageTyping Intent = 1 << 11 IntentsDirectMessages Intent = 1 << 12 IntentsDirectMessageReactions Intent = 1 << 13 IntentsDirectMessageTyping Intent = 1 << 14 IntentsAllWithoutPrivileged = IntentsGuilds | IntentsGuildBans | IntentsGuildEmojis | IntentsGuildIntegrations | IntentsGuildWebhooks | IntentsGuildInvites | IntentsGuildVoiceStates | IntentsGuildMessages | IntentsGuildMessageReactions | IntentsGuildMessageTyping | IntentsDirectMessages | IntentsDirectMessageReactions | IntentsDirectMessageTyping IntentsAll = IntentsAllWithoutPrivileged | IntentsGuildMembers | IntentsGuildPresences IntentsNone Intent = 0 )
Constants for the different bit offsets of intents
func MakeIntent ¶ added in v0.23.3
MakeIntent used to help convert a gateway intent value for use in the Identify structure; this was useful to help support the use of a pointer type when intents were optional. This is now a no-op, and is not necessary to use.
type Interaction ¶ added in v0.23.3
type Interaction struct { ID string `json:"id"` Type InteractionType `json:"type"` Data InteractionData `json:"data"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` // The message on which interaction was used. // NOTE: this field is only filled when a button click triggered the interaction. Otherwise it will be nil. Message *Message `json:"message"` // The member who invoked this interaction. // NOTE: this field is only filled when the slash command was invoked in a guild; // if it was invoked in a DM, the `User` field will be filled instead. // Make sure to check for `nil` before using this field. Member *Member `json:"member"` // The user who invoked this interaction. // NOTE: this field is only filled when the slash command was invoked in a DM; // if it was invoked in a guild, the `Member` field will be filled instead. // Make sure to check for `nil` before using this field. User *User `json:"user"` Token string `json:"token"` Version int `json:"version"` }
Interaction represents data of an interaction.
func (Interaction) ApplicationCommandData ¶ added in v0.23.3
func (i Interaction) ApplicationCommandData() (data ApplicationCommandInteractionData)
ApplicationCommandData is helper function to assert the inner InteractionData to ApplicationCommandInteractionData. Make sure to check that the Type of the interaction is InteractionApplicationCommand before calling.
func (Interaction) MessageComponentData ¶ added in v0.23.3
func (i Interaction) MessageComponentData() (data MessageComponentInteractionData)
MessageComponentData is helper function to assert the inner InteractionData to MessageComponentInteractionData. Make sure to check that the Type of the interaction is InteractionMessageComponent before calling.
func (*Interaction) UnmarshalJSON ¶ added in v0.23.3
func (i *Interaction) UnmarshalJSON(raw []byte) error
UnmarshalJSON is a method for unmarshalling JSON object to Interaction.
type InteractionCreate ¶ added in v0.23.3
type InteractionCreate struct {
*Interaction
}
InteractionCreate is the data for a InteractionCreate event
func (*InteractionCreate) UnmarshalJSON ¶ added in v0.23.3
func (i *InteractionCreate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal Interaction object.
type InteractionData ¶ added in v0.23.3
type InteractionData interface {
Type() InteractionType
}
InteractionData is a common interface for all types of interaction data.
type InteractionResponse ¶ added in v0.23.3
type InteractionResponse struct { Type InteractionResponseType `json:"type,omitempty"` Data *InteractionResponseData `json:"data,omitempty"` }
InteractionResponse represents a response for an interaction event.
type InteractionResponseData ¶ added in v0.23.3
type InteractionResponseData struct { TTS bool `json:"tts"` Content string `json:"content"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` Flags uint64 `json:"flags,omitempty"` Files []*File `json:"-"` // NOTE: autocomplete interaction only. Choices []*ApplicationCommandOptionChoice `json:"choices,omitempty"` }
InteractionResponseData is response data for an interaction.
type InteractionResponseType ¶ added in v0.23.3
type InteractionResponseType uint8
InteractionResponseType is type of interaction response.
const ( // InteractionResponsePong is for ACK ping event. InteractionResponsePong InteractionResponseType = 1 // InteractionResponseChannelMessageWithSource is for responding with a message, showing the user's input. InteractionResponseChannelMessageWithSource InteractionResponseType = 4 // InteractionResponseDeferredChannelMessageWithSource acknowledges that the event was received, and that a follow-up will come later. InteractionResponseDeferredChannelMessageWithSource InteractionResponseType = 5 // InteractionResponseDeferredMessageUpdate acknowledges that the message component interaction event was received, and message will be updated later. InteractionResponseDeferredMessageUpdate InteractionResponseType = 6 // InteractionResponseUpdateMessage is for updating the message to which message component was attached. InteractionResponseUpdateMessage InteractionResponseType = 7 // InteractionApplicationCommandAutocompleteResult shows autocompletion results. Autocomplete interaction only. InteractionApplicationCommandAutocompleteResult InteractionResponseType = 8 )
Interaction response types.
type InteractionType ¶ added in v0.23.3
type InteractionType uint8
InteractionType indicates the type of an interaction event.
const ( InteractionPing InteractionType = 1 InteractionApplicationCommand InteractionType = 2 InteractionMessageComponent InteractionType = 3 InteractionApplicationCommandAutocomplete InteractionType = 4 )
Interaction types
func (InteractionType) String ¶ added in v0.23.3
func (t InteractionType) String() string
type Invite ¶
type Invite struct { Guild *Guild `json:"guild"` Channel *Channel `json:"channel"` Inviter *User `json:"inviter"` Code string `json:"code"` CreatedAt time.Time `json:"created_at"` MaxAge int `json:"max_age"` Uses int `json:"uses"` MaxUses int `json:"max_uses"` Revoked bool `json:"revoked"` Temporary bool `json:"temporary"` Unique bool `json:"unique"` TargetUser *User `json:"target_user"` TargetUserType TargetUserType `json:"target_user_type"` // will only be filled when using InviteWithCounts ApproximatePresenceCount int `json:"approximate_presence_count"` ApproximateMemberCount int `json:"approximate_member_count"` }
A Invite stores all data related to a specific Discord Guild or Channel invite.
type Member ¶
type Member struct { // The guild ID on which the member exists. GuildID string `json:"guild_id"` // The time at which the member joined the guild. JoinedAt time.Time `json:"joined_at"` // The nickname of the member, if they have one. Nick string `json:"nick"` // Whether the member is deafened at a guild level. Deaf bool `json:"deaf"` // Whether the member is muted at a guild level. Mute bool `json:"mute"` // The underlying user on which the member is based. User *User `json:"user"` // A list of IDs of the roles which are possessed by the member. Roles []string `json:"roles"` // When the user used their Nitro boost on the server PremiumSince *time.Time `json:"premium_since"` // Is true while the member hasn't accepted the membership screen. Pending bool `json:"pending"` // Total permissions of the member in the channel, including overrides, returned when in the interaction object. Permissions int64 `json:"permissions,string"` // The time at which the member's timeout will expire. // Time in the past or nil if the user is not timed out. CommunicationDisabledUntil *time.Time `json:"communication_disabled_until"` }
A Member stores user information for Guild members. A guild member represents a certain user's presence in a guild.
type MembershipState ¶ added in v0.23.3
type MembershipState int
The MembershipState represents whether the user is in the team or has been invited into it
const ( MembershipStateInvited MembershipState = 1 MembershipStateAccepted MembershipState = 2 )
Constants for the different stages of the MembershipState
type Message ¶
type Message struct { // The ID of the message. ID string `json:"id"` // The ID of the channel in which the message was sent. ChannelID string `json:"channel_id"` // The ID of the guild in which the message was sent. GuildID string `json:"guild_id,omitempty"` // The content of the message. Content string `json:"content"` // The time at which the messsage was sent. // CAUTION: this field may be removed in a // future API version; it is safer to calculate // the creation time via the ID. Timestamp time.Time `json:"timestamp"` // The time at which the last edit of the message // occurred, if it has been edited. EditedTimestamp *time.Time `json:"edited_timestamp"` // The roles mentioned in the message. MentionRoles []string `json:"mention_roles"` // Whether the message is text-to-speech. TTS bool `json:"tts"` // Whether the message mentions everyone. MentionEveryone bool `json:"mention_everyone"` // The author of the message. This is not guaranteed to be a // valid user (webhook-sent messages do not possess a full author). Author *User `json:"author"` // A list of attachments present in the message. Attachments []*MessageAttachment `json:"attachments"` // A list of components attached to the message. Components []MessageComponent `json:"-"` // A list of embeds present in the message. Embeds []*MessageEmbed `json:"embeds"` // A list of users mentioned in the message. Mentions []*User `json:"mentions"` // A list of reactions to the message. Reactions []*MessageReactions `json:"reactions"` // Whether the message is pinned or not. Pinned bool `json:"pinned"` // The type of the message. Type MessageType `json:"type"` // The webhook ID of the message, if it was generated by a webhook WebhookID string `json:"webhook_id"` // Member properties for this message's author, // contains only partial information Member *Member `json:"member"` // Channels specifically mentioned in this message // Not all channel mentions in a message will appear in mention_channels. // Only textual channels that are visible to everyone in a lurkable guild will ever be included. // Only crossposted messages (via Channel Following) currently include mention_channels at all. // If no mentions in the message meet these requirements, this field will not be sent. MentionChannels []*Channel `json:"mention_channels"` // Is sent with Rich Presence-related chat embeds Activity *MessageActivity `json:"activity"` // Is sent with Rich Presence-related chat embeds Application *MessageApplication `json:"application"` // MessageReference contains reference data sent with crossposted or reply messages. // This does not contain the reference *to* this message; this is for when *this* message references another. // To generate a reference to this message, use (*Message).Reference(). MessageReference *MessageReference `json:"message_reference"` // The flags of the message, which describe extra features of a message. // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the flag. Flags MessageFlags `json:"flags"` }
A Message stores all data related to a specific Discord message.
func (*Message) ContentWithMentionsReplaced ¶ added in v0.8.0
ContentWithMentionsReplaced will replace all @<id> mentions with the username of the mention.
func (*Message) ContentWithMoreMentionsReplaced ¶ added in v0.17.0
ContentWithMoreMentionsReplaced will replace all @<id> mentions with the username of the mention, but also role IDs and more.
func (*Message) GetCustomEmojis ¶ added in v0.23.3
GetCustomEmojis pulls out all the custom (Non-unicode) emojis from a message and returns a Slice of the Emoji struct.
func (*Message) Reference ¶ added in v0.23.3
func (m *Message) Reference() *MessageReference
Reference returns MessageReference of given message
func (*Message) UnmarshalJSON ¶ added in v0.23.3
UnmarshalJSON is a helper function to unmarshal the Message.
type MessageAck ¶
type MessageAck struct { MessageID string `json:"message_id"` ChannelID string `json:"channel_id"` }
MessageAck is the data for a MessageAck event.
type MessageActivity ¶ added in v0.23.3
type MessageActivity struct { Type MessageActivityType `json:"type"` PartyID string `json:"party_id"` }
MessageActivity is sent with Rich Presence-related chat embeds
type MessageActivityType ¶ added in v0.23.3
type MessageActivityType int
MessageActivityType is the type of message activity
const ( MessageActivityTypeJoin MessageActivityType = 1 MessageActivityTypeSpectate MessageActivityType = 2 MessageActivityTypeListen MessageActivityType = 3 MessageActivityTypeJoinRequest MessageActivityType = 5 )
Constants for the different types of Message Activity
type MessageAllowedMentions ¶ added in v0.23.3
type MessageAllowedMentions struct { // The mention types that are allowed to be parsed in this message. // Please note that this is purposely **not** marked as omitempty, // so if a zero-value MessageAllowedMentions object is provided no // mentions will be allowed. Parse []AllowedMentionType `json:"parse"` // A list of role IDs to allow. This cannot be used when specifying // AllowedMentionTypeRoles in the Parse slice. Roles []string `json:"roles,omitempty"` // A list of user IDs to allow. This cannot be used when specifying // AllowedMentionTypeUsers in the Parse slice. Users []string `json:"users,omitempty"` }
MessageAllowedMentions allows the user to specify which mentions Discord is allowed to parse in this message. This is useful when sending user input as a message, as it prevents unwanted mentions. If this type is used, all mentions must be explicitly whitelisted, either by putting an AllowedMentionType in the Parse slice (allowing all mentions of that type) or, in the case of roles and users, explicitly allowing those mentions on an ID-by-ID basis. For more information on this functionality, see: https://discordapp.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-reference
type MessageApplication ¶ added in v0.23.3
type MessageApplication struct { ID string `json:"id"` CoverImage string `json:"cover_image"` Description string `json:"description"` Icon string `json:"icon"` Name string `json:"name"` }
MessageApplication is sent with Rich Presence-related chat embeds
type MessageAttachment ¶ added in v0.13.0
type MessageAttachment struct { ID string `json:"id"` URL string `json:"url"` ProxyURL string `json:"proxy_url"` Filename string `json:"filename"` Width int `json:"width"` Height int `json:"height"` Size int `json:"size"` Ephemeral bool `json:"ephemeral"` }
A MessageAttachment stores data for message attachments.
type MessageComponent ¶ added in v0.23.3
type MessageComponent interface { json.Marshaler Type() ComponentType }
MessageComponent is a base interface for all message components.
func MessageComponentFromJSON ¶ added in v0.23.3
func MessageComponentFromJSON(b []byte) (MessageComponent, error)
type MessageComponentInteractionData ¶ added in v0.23.3
type MessageComponentInteractionData struct { CustomID string `json:"custom_id"` ComponentType ComponentType `json:"component_type"` // NOTE: Only filled when ComponentType is SelectMenuComponent (3). Otherwise is nil. Values []string `json:"values"` }
MessageComponentInteractionData contains the data of message component interaction.
func (MessageComponentInteractionData) Type ¶ added in v0.23.3
func (MessageComponentInteractionData) Type() InteractionType
Type returns the type of interaction data.
type MessageCreate ¶ added in v0.11.0
type MessageCreate struct {
*Message
}
MessageCreate is the data for a MessageCreate event.
func (*MessageCreate) UnmarshalJSON ¶ added in v0.23.3
func (m *MessageCreate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageCreate object.
type MessageDelete ¶
MessageDelete is the data for a MessageDelete event.
func (*MessageDelete) UnmarshalJSON ¶ added in v0.23.3
func (m *MessageDelete) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageDelete object.
type MessageDeleteBulk ¶ added in v0.16.0
type MessageDeleteBulk struct { Messages []string `json:"ids"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` }
MessageDeleteBulk is the data for a MessageDeleteBulk event
type MessageEdit ¶ added in v0.16.0
type MessageEdit struct { Content *string `json:"content,omitempty"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` ID string Channel string // TODO: Remove this when compatibility is not required. Embed *MessageEmbed `json:"-"` }
MessageEdit is used to chain parameters via ChannelMessageEditComplex, which is also where you should get the instance from.
func NewMessageEdit ¶ added in v0.16.0
func NewMessageEdit(channelID string, messageID string) *MessageEdit
NewMessageEdit returns a MessageEdit struct, initialized with the Channel and ID.
func (*MessageEdit) SetContent ¶ added in v0.16.0
func (m *MessageEdit) SetContent(str string) *MessageEdit
SetContent is the same as setting the variable Content, except it doesn't take a pointer.
func (*MessageEdit) SetEmbed ¶ added in v0.16.0
func (m *MessageEdit) SetEmbed(embed *MessageEmbed) *MessageEdit
SetEmbed is a convenience function for setting the embed, so you can chain commands.
func (*MessageEdit) SetEmbeds ¶ added in v0.23.3
func (m *MessageEdit) SetEmbeds(embeds []*MessageEmbed) *MessageEdit
SetEmbeds is a convenience function for setting the embeds, so you can chain commands.
type MessageEmbed ¶ added in v0.13.0
type MessageEmbed struct { URL string `json:"url,omitempty"` Type EmbedType `json:"type,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Timestamp string `json:"timestamp,omitempty"` Color int `json:"color,omitempty"` Image *MessageEmbedImage `json:"image,omitempty"` Thumbnail *MessageEmbedThumbnail `json:"thumbnail,omitempty"` Video *MessageEmbedVideo `json:"video,omitempty"` Provider *MessageEmbedProvider `json:"provider,omitempty"` Author *MessageEmbedAuthor `json:"author,omitempty"` Fields []*MessageEmbedField `json:"fields,omitempty"` }
An MessageEmbed stores data for message embeds.
type MessageEmbedAuthor ¶ added in v0.15.0
type MessageEmbedAuthor struct { URL string `json:"url,omitempty"` Name string `json:"name,omitempty"` IconURL string `json:"icon_url,omitempty"` ProxyIconURL string `json:"proxy_icon_url,omitempty"` }
MessageEmbedAuthor is a part of a MessageEmbed struct.
type MessageEmbedField ¶ added in v0.15.0
type MessageEmbedField struct { Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` Inline bool `json:"inline,omitempty"` }
MessageEmbedField is a part of a MessageEmbed struct.
type MessageEmbedFooter ¶ added in v0.15.0
type MessageEmbedFooter struct {}
MessageEmbedFooter is a part of a MessageEmbed struct.
type MessageEmbedImage ¶ added in v0.15.0
type MessageEmbedImage struct { URL string `json:"url,omitempty"` ProxyURL string `json:"proxy_url,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` }
MessageEmbedImage is a part of a MessageEmbed struct.
type MessageEmbedProvider ¶ added in v0.15.0
type MessageEmbedProvider struct { URL string `json:"url,omitempty"` Name string `json:"name,omitempty"` }
MessageEmbedProvider is a part of a MessageEmbed struct.
type MessageEmbedThumbnail ¶ added in v0.15.0
type MessageEmbedThumbnail struct { URL string `json:"url,omitempty"` ProxyURL string `json:"proxy_url,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` }
MessageEmbedThumbnail is a part of a MessageEmbed struct.
type MessageEmbedVideo ¶ added in v0.15.0
type MessageEmbedVideo struct { URL string `json:"url,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` }
MessageEmbedVideo is a part of a MessageEmbed struct.
type MessageFlags ¶ added in v0.23.3
type MessageFlags int
MessageFlags is the flags of "message" (see MessageFlags* consts) https://discord.com/developers/docs/resources/channel#message-object-message-flags
const ( MessageFlagsCrossPosted MessageFlags = 1 << 0 MessageFlagsIsCrossPosted MessageFlags = 1 << 1 MessageFlagsSupressEmbeds MessageFlags = 1 << 2 MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3 MessageFlagsUrgent MessageFlags = 1 << 4 )
Valid MessageFlags values
type MessageNotifications ¶ added in v0.23.3
type MessageNotifications int
MessageNotifications is the notification level for a guild https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
const ( MessageNotificationsAllMessages MessageNotifications = 0 MessageNotificationsOnlyMentions MessageNotifications = 1 )
Block containing known MessageNotifications values
type MessageReaction ¶ added in v0.15.0
type MessageReaction struct { UserID string `json:"user_id"` MessageID string `json:"message_id"` Emoji Emoji `json:"emoji"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` }
MessageReaction stores the data for a message reaction.
type MessageReactionAdd ¶ added in v0.15.0
type MessageReactionAdd struct { *MessageReaction Member *Member `json:"member,omitempty"` }
MessageReactionAdd is the data for a MessageReactionAdd event.
type MessageReactionRemove ¶ added in v0.15.0
type MessageReactionRemove struct {
*MessageReaction
}
MessageReactionRemove is the data for a MessageReactionRemove event.
type MessageReactionRemoveAll ¶ added in v0.16.0
type MessageReactionRemoveAll struct {
*MessageReaction
}
MessageReactionRemoveAll is the data for a MessageReactionRemoveAll event.
type MessageReactions ¶ added in v0.15.0
type MessageReactions struct { Count int `json:"count"` Me bool `json:"me"` Emoji *Emoji `json:"emoji"` }
MessageReactions holds a reactions object for a message.
type MessageReference ¶ added in v0.23.3
type MessageReference struct { MessageID string `json:"message_id"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` }
MessageReference contains reference data sent with crossposted messages
type MessageSend ¶ added in v0.16.0
type MessageSend struct { Content string `json:"content,omitempty"` Embeds []*MessageEmbed `json:"embeds,omitempty"` TTS bool `json:"tts"` Components []MessageComponent `json:"components"` Files []*File `json:"-"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` Reference *MessageReference `json:"message_reference,omitempty"` // TODO: Remove this when compatibility is not required. File *File `json:"-"` // TODO: Remove this when compatibility is not required. Embed *MessageEmbed `json:"-"` }
MessageSend stores all parameters you can send with ChannelMessageSendComplex.
type MessageType ¶ added in v0.17.0
type MessageType int
MessageType is the type of Message https://discord.com/developers/docs/resources/channel#message-object-message-types
const ( MessageTypeDefault MessageType = 0 MessageTypeRecipientAdd MessageType = 1 MessageTypeRecipientRemove MessageType = 2 MessageTypeCall MessageType = 3 MessageTypeChannelNameChange MessageType = 4 MessageTypeChannelIconChange MessageType = 5 MessageTypeChannelPinnedMessage MessageType = 6 MessageTypeGuildMemberJoin MessageType = 7 MessageTypeUserPremiumGuildSubscription MessageType = 8 MessageTypeUserPremiumGuildSubscriptionTierOne MessageType = 9 MessageTypeUserPremiumGuildSubscriptionTierTwo MessageType = 10 MessageTypeUserPremiumGuildSubscriptionTierThree MessageType = 11 MessageTypeChannelFollowAdd MessageType = 12 MessageTypeGuildDiscoveryDisqualified MessageType = 14 MessageTypeGuildDiscoveryRequalified MessageType = 15 MessageTypeReply MessageType = 19 MessageTypeChatInputCommand MessageType = 20 MessageTypeContextMenuCommand MessageType = 23 )
Block contains the valid known MessageType values
type MessageUpdate ¶ added in v0.11.0
type MessageUpdate struct { *Message // BeforeUpdate will be nil if the Message was not previously cached in the state cache. BeforeUpdate *Message `json:"-"` }
MessageUpdate is the data for a MessageUpdate event.
func (*MessageUpdate) UnmarshalJSON ¶ added in v0.23.3
func (m *MessageUpdate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageUpdate object.
type Packet ¶ added in v0.11.0
type Packet struct { SSRC uint32 Sequence uint16 Timestamp uint32 Type []byte Opus []byte PCM []int16 }
A Packet contains the headers and content of a received voice packet.
type Party ¶ added in v0.23.3
Party defines the Party field in the Activity struct https://discord.com/developers/docs/topics/gateway#activity-object
type PermissionOverwrite ¶
type PermissionOverwrite struct { ID string `json:"id"` Type PermissionOverwriteType `json:"type"` Deny int64 `json:"deny,string"` Allow int64 `json:"allow,string"` }
A PermissionOverwrite holds permission overwrite data for a Channel
type PermissionOverwriteType ¶ added in v0.23.3
type PermissionOverwriteType int
PermissionOverwriteType represents the type of resource on which a permission overwrite acts.
const ( PermissionOverwriteTypeRole PermissionOverwriteType = 0 PermissionOverwriteTypeMember PermissionOverwriteType = 1 )
The possible permission overwrite types.
type PremiumTier ¶ added in v0.23.3
type PremiumTier int
PremiumTier type definition
const ( PremiumTierNone PremiumTier = 0 PremiumTier1 PremiumTier = 1 PremiumTier2 PremiumTier = 2 PremiumTier3 PremiumTier = 3 )
Constants for PremiumTier levels from 0 to 3 inclusive
type Presence ¶
type Presence struct { User *User `json:"user"` Status Status `json:"status"` Activities []*Activity `json:"activities"` Since *int `json:"since"` }
A Presence stores the online, offline, or idle and game status of Guild members.
type PresenceUpdate ¶
PresenceUpdate is the data for a PresenceUpdate event.
type PresencesReplace ¶ added in v0.12.0
type PresencesReplace []*Presence
PresencesReplace is the data for a PresencesReplace event.
type RESTError ¶ added in v0.15.0
type RESTError struct { Request *http.Request Response *http.Response ResponseBody []byte Message *APIErrorMessage // Message may be nil. }
RESTError stores error information about a request with a bad response code. Message is not always present, there are cases where api calls can fail without returning a json message.
type RateLimit ¶ added in v0.9.0
type RateLimit struct { *TooManyRequests URL string }
RateLimit is the data for a RateLimit event. This is a synthetic event and is not dispatched by Discord.
type RateLimiter ¶ added in v0.15.0
RateLimiter holds all ratelimit buckets
func NewRatelimiter ¶ added in v0.15.0
func NewRatelimiter() *RateLimiter
NewRatelimiter returns a new RateLimiter
func (*RateLimiter) GetBucket ¶ added in v0.18.0
func (r *RateLimiter) GetBucket(key string) *Bucket
GetBucket retrieves or creates a bucket
func (*RateLimiter) GetWaitTime ¶ added in v0.18.0
func (r *RateLimiter) GetWaitTime(b *Bucket, minRemaining int) time.Duration
GetWaitTime returns the duration you should wait for a Bucket
func (*RateLimiter) LockBucket ¶ added in v0.15.0
func (r *RateLimiter) LockBucket(bucketID string) *Bucket
LockBucket Locks until a request can be made
func (*RateLimiter) LockBucketObject ¶ added in v0.18.0
func (r *RateLimiter) LockBucketObject(b *Bucket) *Bucket
LockBucketObject Locks an already resolved bucket until a request can be made
type ReadState ¶
type ReadState struct { MentionCount int `json:"mention_count"` LastMessageID string `json:"last_message_id"` ID string `json:"id"` }
A ReadState stores data on the read state of channels.
type Ready ¶
type Ready struct { Version int `json:"v"` SessionID string `json:"session_id"` User *User `json:"user"` ReadState []*ReadState `json:"read_state"` PrivateChannels []*Channel `json:"private_channels"` Guilds []*Guild `json:"guilds"` // Undocumented fields Settings *Settings `json:"user_settings"` UserGuildSettings []*UserGuildSettings `json:"user_guild_settings"` Relationships []*Relationship `json:"relationships"` Presences []*Presence `json:"presences"` Notes map[string]string `json:"notes"` }
A Ready stores all data for the websocket READY event.
type Relationship ¶ added in v0.13.0
type Relationship struct { User *User `json:"user"` Type int `json:"type"` // 1 = friend, 2 = blocked, 3 = incoming friend req, 4 = sent friend req ID string `json:"id"` }
A Relationship between the logged in user and Relationship.User
type RelationshipAdd ¶ added in v0.15.0
type RelationshipAdd struct {
*Relationship
}
RelationshipAdd is the data for a RelationshipAdd event.
type RelationshipRemove ¶ added in v0.15.0
type RelationshipRemove struct {
*Relationship
}
RelationshipRemove is the data for a RelationshipRemove event.
type Resumed ¶ added in v0.13.0
type Resumed struct {
Trace []string `json:"_trace"`
}
Resumed is the data for a Resumed event.
type Role ¶
type Role struct { // The ID of the role. ID string `json:"id"` // The name of the role. Name string `json:"name"` // Whether this role is managed by an integration, and // thus cannot be manually added to, or taken from, members. Managed bool `json:"managed"` // Whether this role is mentionable. Mentionable bool `json:"mentionable"` // Whether this role is hoisted (shows up separately in member list). Hoist bool `json:"hoist"` // The hex color of this role. Color int `json:"color"` // The position of this role in the guild's role hierarchy. Position int `json:"position"` // The permissions of the role on the guild (doesn't include channel overrides). // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the permission. Permissions int64 `json:"permissions,string"` }
A Role stores information about Discord guild member roles.
type Secrets ¶ added in v0.23.3
type Secrets struct { Join string `json:"join,omitempty"` Spectate string `json:"spectate,omitempty"` Match string `json:"match,omitempty"` }
Secrets defines the Secrets field for the Activity struct https://discord.com/developers/docs/topics/gateway#activity-object
type SelectMenu ¶ added in v0.23.3
type SelectMenu struct { CustomID string `json:"custom_id,omitempty"` // The text which will be shown in the menu if there's no default options or all options was deselected and component was closed. Placeholder string `json:"placeholder"` // This value determines the minimal amount of selected items in the menu. MinValues int `json:"min_values,omitempty"` // This value determines the maximal amount of selected items in the menu. // If MaxValues or MinValues are greater than one then the user can select multiple items in the component. MaxValues int `json:"max_values,omitempty"` Options []SelectMenuOption `json:"options"` }
SelectMenu represents select menu component.
func (SelectMenu) MarshalJSON ¶ added in v0.23.3
func (m SelectMenu) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling SelectMenu to a JSON object.
func (SelectMenu) Type ¶ added in v0.23.3
func (SelectMenu) Type() ComponentType
Type is a method to get the type of a component.
type SelectMenuOption ¶ added in v0.23.3
type SelectMenuOption struct { Label string `json:"label,omitempty"` Value string `json:"value"` Description string `json:"description"` Emoji ComponentEmoji `json:"emoji"` // Determines whenever option is selected by default or not. Default bool `json:"default"` }
SelectMenuOption represents an option for a select menu.
type Session ¶
type Session struct { sync.RWMutex // Authentication token for this session // TODO: Remove Below, Deprecated, Use Identify struct Token string MFA bool // Debug for printing JSON request/responses Debug bool // Deprecated, will be removed. LogLevel int // Should the session reconnect the websocket on errors. ShouldReconnectOnError bool // Identify is sent during initial handshake with the discord gateway. // https://discord.com/developers/docs/topics/gateway#identify Identify Identify // TODO: Remove Below, Deprecated, Use Identify struct // Should the session request compressed websocket data. Compress bool // Sharding ShardID int ShardCount int // Should state tracking be enabled. // State tracking is the best way for getting the the users // active guilds and the members of the guilds. StateEnabled bool // Whether or not to call event handlers synchronously. // e.g false = launch event handlers in their own goroutines. SyncEvents bool // Whether the Data Websocket is ready DataReady bool // NOTE: Maye be deprecated soon // Max number of REST API retries MaxRestRetries int // Whether the Voice Websocket is ready VoiceReady bool // NOTE: Deprecated. // Whether the UDP Connection is ready UDPReady bool // NOTE: Deprecated // Stores a mapping of guild id's to VoiceConnections VoiceConnections map[string]*VoiceConnection // Managed state object, updated internally with events when // StateEnabled is true. State *State // The http client used for REST requests Client *http.Client // The user agent used for REST APIs UserAgent string // Stores the last HeartbeatAck that was received (in UTC) LastHeartbeatAck time.Time // Stores the last Heartbeat sent (in UTC) LastHeartbeatSent time.Time // used to deal with rate limits Ratelimiter *RateLimiter // contains filtered or unexported fields }
A Session represents a connection to the Discord API.
func New ¶
New creates a new Discord session and will automate some startup tasks if given enough information to do so. Currently you can pass zero arguments and it will return an empty Discord session. There are 3 ways to call New:
With a single auth token - All requests will use the token blindly (just tossing it into the HTTP Authorization header); no verification of the token will be done and requests may fail. IF THE TOKEN IS FOR A BOT, IT MUST BE PREFIXED WITH `BOT ` eg: `"Bot <token>"` IF IT IS AN OAUTH2 ACCESS TOKEN, IT MUST BE PREFIXED WITH `Bearer ` eg: `"Bearer <token>"` With an email and password - Discord will sign in with the provided credentials. With an email, password and auth token - Discord will verify the auth token, if it is invalid it will sign in with the provided credentials. This is the Discord recommended way to sign in.
NOTE: While email/pass authentication is supported by DiscordGo it is HIGHLY DISCOURAGED by Discord. Please only use email/pass to obtain a token and then use that authentication token for all future connections. Also, doing any form of automation with a user (non Bot) account may result in that account being permanently banned from Discord.
func (*Session) AddHandler ¶ added in v0.11.0
func (s *Session) AddHandler(handler interface{}) func()
AddHandler allows you to add an event handler that will be fired anytime the Discord WSAPI event that matches the function fires. The first parameter is a *Session, and the second parameter is a pointer to a struct corresponding to the event for which you want to listen.
eg:
Session.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) { })
or:
Session.AddHandler(func(s *discordgo.Session, m *discordgo.PresenceUpdate) { })
List of events can be found at this page, with corresponding names in the library for each event: https://discord.com/developers/docs/topics/gateway#event-names There are also synthetic events fired by the library internally which are available for handling, like Connect, Disconnect, and RateLimit. events.go contains all of the Discord WSAPI and synthetic events that can be handled.
The return value of this method is a function, that when called will remove the event handler.
func (*Session) AddHandlerOnce ¶ added in v0.15.0
func (s *Session) AddHandlerOnce(handler interface{}) func()
AddHandlerOnce allows you to add an event handler that will be fired the next time the Discord WSAPI event that matches the function fires. See AddHandler for more details.
func (*Session) Application ¶ added in v0.12.0
func (s *Session) Application(appID string) (st *Application, err error)
Application returns an Application structure of a specific Application
appID : The ID of an Application
func (*Session) ApplicationAssets ¶ added in v0.23.3
ApplicationAssets returns an application's assets
func (*Session) ApplicationBotCreate ¶ added in v0.12.0
ApplicationBotCreate creates an Application Bot Account
appID : The ID of an Application
NOTE: func name may change, if I can think up something better.
func (*Session) ApplicationCommand ¶ added in v0.23.3
func (s *Session) ApplicationCommand(appID, guildID, cmdID string) (cmd *ApplicationCommand, err error)
ApplicationCommand retrieves an application command by given ID. appID : The application ID. cmdID : Application command ID. guildID : Guild ID to retrieve guild-specific application command. If empty - retrieves global application command.
func (*Session) ApplicationCommandBulkOverwrite ¶ added in v0.23.3
func (s *Session) ApplicationCommandBulkOverwrite(appID string, guildID string, commands []*ApplicationCommand) (createdCommands []*ApplicationCommand, err error)
ApplicationCommandBulkOverwrite Creates commands overwriting existing commands. Returns a list of commands. appID : The application ID. commands : The commands to create.
func (*Session) ApplicationCommandCreate ¶ added in v0.23.3
func (s *Session) ApplicationCommandCreate(appID string, guildID string, cmd *ApplicationCommand) (ccmd *ApplicationCommand, err error)
ApplicationCommandCreate creates a global application command and returns it. appID : The application ID. guildID : Guild ID to create guild-specific application command. If empty - creates global application command. cmd : New application command data.
func (*Session) ApplicationCommandDelete ¶ added in v0.23.3
ApplicationCommandDelete deletes application command by ID. appID : The application ID. cmdID : Application command ID to delete. guildID : Guild ID to delete guild-specific application command. If empty - deletes global application command.
func (*Session) ApplicationCommandEdit ¶ added in v0.23.3
func (s *Session) ApplicationCommandEdit(appID, guildID, cmdID string, cmd *ApplicationCommand) (updated *ApplicationCommand, err error)
ApplicationCommandEdit edits application command and returns new command data. appID : The application ID. cmdID : Application command ID to edit. guildID : Guild ID to edit guild-specific application command. If empty - edits global application command. cmd : Updated application command data.
func (*Session) ApplicationCommands ¶ added in v0.23.3
func (s *Session) ApplicationCommands(appID, guildID string) (cmd []*ApplicationCommand, err error)
ApplicationCommands retrieves all commands in application. appID : The application ID. guildID : Guild ID to retrieve all guild-specific application commands. If empty - retrieves global application commands.
func (*Session) ApplicationCreate ¶ added in v0.12.0
func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error)
ApplicationCreate creates a new Application
name : Name of Application / Bot uris : Redirect URIs (Not required)
func (*Session) ApplicationDelete ¶ added in v0.12.0
ApplicationDelete deletes an existing Application
appID : The ID of an Application
func (*Session) ApplicationUpdate ¶ added in v0.12.0
func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Application, err error)
ApplicationUpdate updates an existing Application
var : desc
func (*Session) Applications ¶ added in v0.12.0
func (s *Session) Applications() (st []*Application, err error)
Applications returns all applications for the authenticated user
func (*Session) Channel ¶
Channel returns a Channel structure of a specific Channel. channelID : The ID of the Channel you want returned.
func (*Session) ChannelDelete ¶
ChannelDelete deletes the given channel channelID : The ID of a Channel
func (*Session) ChannelEdit ¶
ChannelEdit edits the given channel channelID : The ID of a Channel name : The new name to assign the channel.
func (*Session) ChannelEditComplex ¶ added in v0.18.0
func (s *Session) ChannelEditComplex(channelID string, data *ChannelEdit) (st *Channel, err error)
ChannelEditComplex edits an existing channel, replacing the parameters entirely with ChannelEdit struct channelID : The ID of a Channel data : The channel struct to send
func (*Session) ChannelFileSend ¶ added in v0.11.0
ChannelFileSend sends a file to the given channel. channelID : The ID of a Channel. name: The name of the file. io.Reader : A reader for the file contents.
func (*Session) ChannelFileSendWithMessage ¶ added in v0.15.0
func (s *Session) ChannelFileSendWithMessage(channelID, content string, name string, r io.Reader) (*Message, error)
ChannelFileSendWithMessage sends a file to the given channel with an message. DEPRECATED. Use ChannelMessageSendComplex instead. channelID : The ID of a Channel. content: Optional Message content. name: The name of the file. io.Reader : A reader for the file contents.
func (*Session) ChannelInviteCreate ¶
ChannelInviteCreate creates a new invite for the given channel. channelID : The ID of a Channel i : An Invite struct with the values MaxAge, MaxUses and Temporary defined.
func (*Session) ChannelInvites ¶
ChannelInvites returns an array of Invite structures for the given channel channelID : The ID of a Channel
func (*Session) ChannelMessage ¶ added in v0.13.0
ChannelMessage gets a single message by ID from a given channel. channeld : The ID of a Channel messageID : the ID of a Message
func (*Session) ChannelMessageAck ¶
ChannelMessageAck acknowledges and marks the given message as read channeld : The ID of a Channel messageID : the ID of a Message lastToken : token returned by last ack
func (*Session) ChannelMessageCrosspost ¶ added in v0.23.3
ChannelMessageCrosspost cross posts a message in a news channel to followers of the channel channelID : The ID of a Channel messageID : The ID of a Message
func (*Session) ChannelMessageDelete ¶
ChannelMessageDelete deletes a message from the Channel.
func (*Session) ChannelMessageEdit ¶
ChannelMessageEdit edits an existing message, replacing it entirely with the given content. channelID : The ID of a Channel messageID : The ID of a Message content : The contents of the message
func (*Session) ChannelMessageEditComplex ¶ added in v0.16.0
func (s *Session) ChannelMessageEditComplex(m *MessageEdit) (st *Message, err error)
ChannelMessageEditComplex edits an existing message, replacing it entirely with the given MessageEdit struct
func (*Session) ChannelMessageEditEmbed ¶ added in v0.15.0
func (s *Session) ChannelMessageEditEmbed(channelID, messageID string, embed *MessageEmbed) (*Message, error)
ChannelMessageEditEmbed edits an existing message with embedded data. channelID : The ID of a Channel messageID : The ID of a Message embed : The embed data to send
func (*Session) ChannelMessageEditEmbeds ¶ added in v0.23.3
func (s *Session) ChannelMessageEditEmbeds(channelID, messageID string, embeds []*MessageEmbed) (*Message, error)
ChannelMessageEditEmbeds edits an existing message with multiple embedded data. channelID : The ID of a Channel messageID : The ID of a Message embeds : The embeds data to send
func (*Session) ChannelMessagePin ¶ added in v0.13.0
ChannelMessagePin pins a message within a given channel. channelID: The ID of a channel. messageID: The ID of a message.
func (*Session) ChannelMessageSend ¶
ChannelMessageSend sends a message to the given channel. channelID : The ID of a Channel. content : The message to send.
func (*Session) ChannelMessageSendComplex ¶ added in v0.16.0
func (s *Session) ChannelMessageSendComplex(channelID string, data *MessageSend) (st *Message, err error)
ChannelMessageSendComplex sends a message to the given channel. channelID : The ID of a Channel. data : The message struct to send.
func (*Session) ChannelMessageSendEmbed ¶ added in v0.15.0
func (s *Session) ChannelMessageSendEmbed(channelID string, embed *MessageEmbed) (*Message, error)
ChannelMessageSendEmbed sends a message to the given channel with embedded data. channelID : The ID of a Channel. embed : The embed data to send.
func (*Session) ChannelMessageSendEmbeds ¶ added in v0.23.3
func (s *Session) ChannelMessageSendEmbeds(channelID string, embeds []*MessageEmbed) (*Message, error)
ChannelMessageSendEmbeds sends a message to the given channel with multiple embedded data. channelID : The ID of a Channel. embeds : The embeds data to send.
func (*Session) ChannelMessageSendReply ¶ added in v0.23.3
func (s *Session) ChannelMessageSendReply(channelID string, content string, reference *MessageReference) (*Message, error)
ChannelMessageSendReply sends a message to the given channel with reference data. channelID : The ID of a Channel. content : The message to send. reference : The message reference to send.
func (*Session) ChannelMessageSendTTS ¶ added in v0.11.0
ChannelMessageSendTTS sends a message to the given channel with Text to Speech. channelID : The ID of a Channel. content : The message to send.
func (*Session) ChannelMessageUnpin ¶ added in v0.13.0
ChannelMessageUnpin unpins a message within a given channel. channelID: The ID of a channel. messageID: The ID of a message.
func (*Session) ChannelMessages ¶
func (s *Session) ChannelMessages(channelID string, limit int, beforeID, afterID, aroundID string) (st []*Message, err error)
ChannelMessages returns an array of Message structures for messages within a given channel. channelID : The ID of a Channel. limit : The number messages that can be returned. (max 100) beforeID : If provided all messages returned will be before given ID. afterID : If provided all messages returned will be after given ID. aroundID : If provided all messages returned will be around given ID.
func (*Session) ChannelMessagesBulkDelete ¶ added in v0.13.0
ChannelMessagesBulkDelete bulk deletes the messages from the channel for the provided messageIDs. If only one messageID is in the slice call channelMessageDelete function. If the slice is empty do nothing. channelID : The ID of the channel for the messages to delete. messages : The IDs of the messages to be deleted. A slice of string IDs. A maximum of 100 messages.
func (*Session) ChannelMessagesPinned ¶ added in v0.13.0
ChannelMessagesPinned returns an array of Message structures for pinned messages within a given channel channelID : The ID of a Channel.
func (*Session) ChannelNewsFollow ¶ added in v0.23.3
func (s *Session) ChannelNewsFollow(channelID, targetID string) (st *ChannelFollow, err error)
ChannelNewsFollow follows a news channel in the targetID channelID : The ID of a News Channel targetID : The ID of a Channel where the News Channel should post to
func (*Session) ChannelPermissionDelete ¶ added in v0.7.0
ChannelPermissionDelete deletes a specific permission override for the given channel. NOTE: Name of this func may change.
func (*Session) ChannelPermissionSet ¶ added in v0.7.0
func (s *Session) ChannelPermissionSet(channelID, targetID string, targetType PermissionOverwriteType, allow, deny int64) (err error)
ChannelPermissionSet creates a Permission Override for the given channel. NOTE: This func name may changed. Using Set instead of Create because you can both create a new override or update an override with this function.
func (*Session) ChannelTyping ¶
ChannelTyping broadcasts to all members that authenticated user is typing in the given channel. channelID : The ID of a Channel
func (*Session) ChannelVoiceJoin ¶ added in v0.9.0
func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *VoiceConnection, err error)
ChannelVoiceJoin joins the session user to a voice channel.
gID : Guild ID of the channel to join. cID : Channel ID of the channel to join. mute : If true, you will be set to muted upon joining. deaf : If true, you will be set to deafened upon joining.
func (*Session) ChannelVoiceJoinManual ¶ added in v0.23.3
ChannelVoiceJoinManual initiates a voice session to a voice channel, but does not complete it.
This should only be used when the VoiceServerUpdate will be intercepted and used elsewhere.
gID : Guild ID of the channel to join. cID : Channel ID of the channel to join, leave empty to disconnect. mute : If true, you will be set to muted upon joining. deaf : If true, you will be set to deafened upon joining.
func (*Session) ChannelWebhooks ¶ added in v0.15.0
ChannelWebhooks returns all webhooks for a given channel. channelID: The ID of a channel.
func (*Session) Close ¶
Close closes a websocket and stops all listening/heartbeat goroutines. TODO: Add support for Voice WS/UDP
func (*Session) CloseWithCode ¶ added in v0.23.3
CloseWithCode closes a websocket using the provided closeCode and stops all listening/heartbeat goroutines. TODO: Add support for Voice WS/UDP connections
func (*Session) FollowupMessageCreate ¶ added in v0.23.3
func (s *Session) FollowupMessageCreate(appID string, interaction *Interaction, wait bool, data *WebhookParams) (*Message, error)
FollowupMessageCreate creates the followup message for an interaction. appID : The application ID. interaction : Interaction instance. wait : Waits for server confirmation of message send and ensures that the return struct is populated (it is nil otherwise) data : Data of the message to send.
func (*Session) FollowupMessageDelete ¶ added in v0.23.3
func (s *Session) FollowupMessageDelete(appID string, interaction *Interaction, messageID string) error
FollowupMessageDelete deletes a followup message of an interaction. appID : The application ID. interaction : Interaction instance. messageID : The followup message ID.
func (*Session) FollowupMessageEdit ¶ added in v0.23.3
func (s *Session) FollowupMessageEdit(appID string, interaction *Interaction, messageID string, data *WebhookEdit) (*Message, error)
FollowupMessageEdit edits a followup message of an interaction. appID : The application ID. interaction : Interaction instance. messageID : The followup message ID. data : Data to update the message
func (*Session) GatewayBot ¶ added in v0.17.0
func (s *Session) GatewayBot() (st *GatewayBotResponse, err error)
GatewayBot returns the websocket Gateway address and the recommended number of shards
func (*Session) Guild ¶
Guild returns a Guild structure of a specific Guild. guildID : The ID of a Guild
func (*Session) GuildAuditLog ¶ added in v0.23.3
func (s *Session) GuildAuditLog(guildID, userID, beforeID string, actionType, limit int) (st *GuildAuditLog, err error)
GuildAuditLog returns the audit log for a Guild. guildID : The ID of a Guild. userID : If provided the log will be filtered for the given ID. beforeID : If provided all log entries returned will be before the given ID. actionType : If provided the log will be filtered for the given Action Type. limit : The number messages that can be returned. (default 50, min 1, max 100)
func (*Session) GuildBan ¶ added in v0.23.3
GuildBan finds ban by given guild and user id and returns GuildBan structure
func (*Session) GuildBanCreate ¶ added in v0.7.0
GuildBanCreate bans the given user from the given guild. guildID : The ID of a Guild. userID : The ID of a User days : The number of days of previous comments to delete.
func (*Session) GuildBanCreateWithReason ¶ added in v0.16.0
GuildBanCreateWithReason bans the given user from the given guild also providing a reaso. guildID : The ID of a Guild. userID : The ID of a User reason : The reason for this ban days : The number of days of previous comments to delete.
func (*Session) GuildBanDelete ¶
GuildBanDelete removes the given user from the guild bans guildID : The ID of a Guild. userID : The ID of a User
func (*Session) GuildBans ¶
GuildBans returns an array of GuildBan structures for all bans of a given guild. guildID : The ID of a Guild.
func (*Session) GuildChannelCreate ¶
func (s *Session) GuildChannelCreate(guildID, name string, ctype ChannelType) (st *Channel, err error)
GuildChannelCreate creates a new channel in the given guild guildID : The ID of a Guild. name : Name of the channel (2-100 chars length) ctype : Type of the channel
func (*Session) GuildChannelCreateComplex ¶ added in v0.23.3
func (s *Session) GuildChannelCreateComplex(guildID string, data GuildChannelCreateData) (st *Channel, err error)
GuildChannelCreateComplex creates a new channel in the given guild guildID : The ID of a Guild data : A data struct describing the new Channel, Name and Type are mandatory, other fields depending on the type
func (*Session) GuildChannels ¶
GuildChannels returns an array of Channel structures for all channels of a given guild. guildID : The ID of a Guild.
func (*Session) GuildChannelsReorder ¶ added in v0.13.0
GuildChannelsReorder updates the order of channels in a guild guildID : The ID of a Guild. channels : Updated channels.
func (*Session) GuildCreate ¶
GuildCreate creates a new Guild name : A name for the Guild (2-100 characters)
func (*Session) GuildDelete ¶
GuildDelete deletes a Guild. guildID : The ID of a Guild
func (*Session) GuildEdit ¶
func (s *Session) GuildEdit(guildID string, g GuildParams) (st *Guild, err error)
GuildEdit edits a new Guild guildID : The ID of a Guild g : A GuildParams struct with the values Name, Region and VerificationLevel defined.
func (*Session) GuildEmbed ¶ added in v0.13.0
func (s *Session) GuildEmbed(guildID string) (st *GuildEmbed, err error)
GuildEmbed returns the embed for a Guild. guildID : The ID of a Guild.
func (*Session) GuildEmbedEdit ¶ added in v0.13.0
GuildEmbedEdit returns the embed for a Guild. guildID : The ID of a Guild.
func (*Session) GuildEmojiCreate ¶ added in v0.23.3
func (s *Session) GuildEmojiCreate(guildID, name, image string, roles []string) (emoji *Emoji, err error)
GuildEmojiCreate creates a new emoji guildID : The ID of a Guild. name : The Name of the Emoji. image : The base64 encoded emoji image, has to be smaller than 256KB. roles : The roles for which this emoji will be whitelisted, can be nil.
func (*Session) GuildEmojiDelete ¶ added in v0.23.3
GuildEmojiDelete deletes an Emoji. guildID : The ID of a Guild. emojiID : The ID of an Emoji.
func (*Session) GuildEmojiEdit ¶ added in v0.23.3
func (s *Session) GuildEmojiEdit(guildID, emojiID, name string, roles []string) (emoji *Emoji, err error)
GuildEmojiEdit modifies an emoji guildID : The ID of a Guild. emojiID : The ID of an Emoji. name : The Name of the Emoji. roles : The roles for which this emoji will be whitelisted, can be nil.
func (*Session) GuildEmojis ¶ added in v0.23.3
GuildEmojis returns all emoji guildID : The ID of a Guild.
func (*Session) GuildIcon ¶ added in v0.10.0
GuildIcon returns an image.Image of a guild icon. guildID : The ID of a Guild.
func (*Session) GuildIntegrationCreate ¶ added in v0.13.0
func (s *Session) GuildIntegrationCreate(guildID, integrationType, integrationID string) (err error)
GuildIntegrationCreate creates a Guild Integration. guildID : The ID of a Guild. integrationType : The Integration type. integrationID : The ID of an integration.
func (*Session) GuildIntegrationDelete ¶ added in v0.13.0
GuildIntegrationDelete removes the given integration from the Guild. guildID : The ID of a Guild. integrationID : The ID of an integration.
func (*Session) GuildIntegrationEdit ¶ added in v0.13.0
func (s *Session) GuildIntegrationEdit(guildID, integrationID string, expireBehavior, expireGracePeriod int, enableEmoticons bool) (err error)
GuildIntegrationEdit edits a Guild Integration. guildID : The ID of a Guild. integrationType : The Integration type. integrationID : The ID of an integration. expireBehavior : The behavior when an integration subscription lapses (see the integration object documentation). expireGracePeriod : Period (in seconds) where the integration will ignore lapsed subscriptions. enableEmoticons : Whether emoticons should be synced for this integration (twitch only currently).
func (*Session) GuildIntegrationSync ¶ added in v0.13.0
GuildIntegrationSync syncs an integration. guildID : The ID of a Guild. integrationID : The ID of an integration.
func (*Session) GuildIntegrations ¶ added in v0.13.0
func (s *Session) GuildIntegrations(guildID string) (st []*Integration, err error)
GuildIntegrations returns an array of Integrations for a guild. guildID : The ID of a Guild.
func (*Session) GuildInvites ¶
GuildInvites returns an array of Invite structures for the given guild guildID : The ID of a Guild.
func (*Session) GuildLeave ¶ added in v0.11.0
GuildLeave leaves a Guild. guildID : The ID of a Guild
func (*Session) GuildMember ¶ added in v0.11.0
GuildMember returns a member of a guild.
guildID : The ID of a Guild. userID : The ID of a User
func (*Session) GuildMemberAdd ¶ added in v0.23.3
func (s *Session) GuildMemberAdd(accessToken, guildID, userID, nick string, roles []string, mute, deaf bool) (err error)
GuildMemberAdd force joins a user to the guild.
accessToken : Valid access_token for the user. guildID : The ID of a Guild. userID : The ID of a User. nick : Value to set users nickname to roles : A list of role ID's to set on the member. mute : If the user is muted. deaf : If the user is deafened.
func (*Session) GuildMemberDeafen ¶ added in v0.23.3
GuildMemberDeafen server deafens a guild member
guildID : The ID of a Guild. userID : The ID of a User. deaf : boolean value for if the user should be deafened
func (*Session) GuildMemberDelete ¶
GuildMemberDelete removes the given user from the given guild. guildID : The ID of a Guild. userID : The ID of a User
func (*Session) GuildMemberDeleteWithReason ¶ added in v0.17.0
GuildMemberDeleteWithReason removes the given user from the given guild. guildID : The ID of a Guild. userID : The ID of a User reason : The reason for the kick
func (*Session) GuildMemberEdit ¶ added in v0.11.0
GuildMemberEdit edits the roles of a member. guildID : The ID of a Guild. userID : The ID of a User. roles : A list of role ID's to set on the member.
func (*Session) GuildMemberMove ¶ added in v0.11.0
GuildMemberMove moves a guild member from one voice channel to another/none
guildID : The ID of a Guild. userID : The ID of a User. channelID : The ID of a channel to move user to or nil to remove from voice channel
NOTE : I am not entirely set on the name of this function and it may change prior to the final 1.0.0 release of Discordgo
func (*Session) GuildMemberMute ¶ added in v0.23.3
GuildMemberMute server mutes a guild member
guildID : The ID of a Guild. userID : The ID of a User. mute : boolean value for if the user should be muted
func (*Session) GuildMemberNickname ¶ added in v0.13.0
GuildMemberNickname updates the nickname of a guild member guildID : The ID of a guild userID : The ID of a user userID : The ID of a user or "@me" which is a shortcut of the current user ID nickname : The nickname of the member, "" will reset their nickname
func (*Session) GuildMemberRoleAdd ¶ added in v0.15.0
GuildMemberRoleAdd adds the specified role to a given member
guildID : The ID of a Guild. userID : The ID of a User. roleID : The ID of a Role to be assigned to the user.
func (*Session) GuildMemberRoleRemove ¶ added in v0.15.0
GuildMemberRoleRemove removes the specified role to a given member
guildID : The ID of a Guild. userID : The ID of a User. roleID : The ID of a Role to be removed from the user.
func (*Session) GuildMemberTimeout ¶ added in v0.23.3
GuildMemberTimeout times out a guild member
guildID : The ID of a Guild. userID : The ID of a User. until : The timestamp for how long a member should be timed out. Set to nil to remove timeout.
func (*Session) GuildMembers ¶
GuildMembers returns a list of members for a guild.
guildID : The ID of a Guild. after : The id of the member to return members after limit : max number of members to return (max 1000)
func (*Session) GuildPreview ¶ added in v0.23.3
func (s *Session) GuildPreview(guildID string) (st *GuildPreview, err error)
GuildPreview returns a GuildPreview structure of a specific public Guild. guildID : The ID of a Guild
func (*Session) GuildPrune ¶ added in v0.15.0
GuildPrune Begin as prune operation. Requires the 'KICK_MEMBERS' permission. Returns an object with one 'pruned' key indicating the number of members that were removed in the prune operation. guildID : The ID of a Guild. days : The number of days to count prune for (1 or more).
func (*Session) GuildPruneCount ¶ added in v0.15.0
GuildPruneCount Returns the number of members that would be removed in a prune operation. Requires 'KICK_MEMBER' permission. guildID : The ID of a Guild. days : The number of days to count prune for (1 or more).
func (*Session) GuildRoleCreate ¶ added in v0.7.0
GuildRoleCreate returns a new Guild Role. guildID: The ID of a Guild.
func (*Session) GuildRoleDelete ¶ added in v0.7.0
GuildRoleDelete deletes an existing role. guildID : The ID of a Guild. roleID : The ID of a Role.
func (*Session) GuildRoleEdit ¶ added in v0.7.0
func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int64, mention bool) (st *Role, err error)
GuildRoleEdit updates an existing Guild Role with new values guildID : The ID of a Guild. roleID : The ID of a Role. name : The name of the Role. color : The color of the role (decimal, not hex). hoist : Whether to display the role's users separately. perm : The permissions for the role. mention : Whether this role is mentionable
func (*Session) GuildRoleReorder ¶ added in v0.7.0
GuildRoleReorder reoders guild roles guildID : The ID of a Guild. roles : A list of ordered roles.
func (*Session) GuildRoles ¶ added in v0.7.0
GuildRoles returns all roles for a given guild. guildID : The ID of a Guild.
func (*Session) GuildSplash ¶ added in v0.10.0
GuildSplash returns an image.Image of a guild splash image. guildID : The ID of a Guild.
func (*Session) GuildWebhooks ¶ added in v0.15.0
GuildWebhooks returns all webhooks for a given guild. guildID: The ID of a Guild.
func (*Session) HeartbeatLatency ¶ added in v0.23.3
HeartbeatLatency returns the latency between heartbeat acknowledgement and heartbeat send.
func (*Session) InteractionRespond ¶ added in v0.23.3
func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse) (err error)
InteractionRespond creates the response to an interaction. appID : The application ID. interaction : Interaction instance. resp : Response message data.
func (*Session) InteractionResponse ¶ added in v0.23.3
func (s *Session) InteractionResponse(appID string, interaction *Interaction) (*Message, error)
InteractionResponse gets the response to an interaction. appID : The application ID. interaction : Interaction instance.
func (*Session) InteractionResponseDelete ¶ added in v0.23.3
func (s *Session) InteractionResponseDelete(appID string, interaction *Interaction) error
InteractionResponseDelete deletes the response to an interaction. appID : The application ID. interaction : Interaction instance.
func (*Session) InteractionResponseEdit ¶ added in v0.23.3
func (s *Session) InteractionResponseEdit(appID string, interaction *Interaction, newresp *WebhookEdit) (*Message, error)
InteractionResponseEdit edits the response to an interaction. appID : The application ID. interaction : Interaction instance. newresp : Updated response message data.
func (*Session) Invite ¶
Invite returns an Invite structure of the given invite inviteID : The invite code
func (*Session) InviteAccept ¶
InviteAccept accepts an Invite to a Guild or Channel inviteID : The invite code
func (*Session) InviteDelete ¶
InviteDelete deletes an existing invite inviteID : the code of an invite
func (*Session) InviteWithCounts ¶ added in v0.23.3
InviteWithCounts returns an Invite structure of the given invite including approximate member counts inviteID : The invite code
func (*Session) Login ¶
Login asks the Discord server for an authentication token.
NOTE: While email/pass authentication is supported by DiscordGo it is HIGHLY DISCOURAGED by Discord. Please only use email/pass to obtain a token and then use that authentication token for all future connections. Also, doing any form of automation with a user (non Bot) account may result in that account being permanently banned from Discord.
func (*Session) Logout ¶
Logout sends a logout request to Discord. This does not seem to actually invalidate the token. So you can still make API calls even after a Logout. So, it seems almost pointless to even use.
func (*Session) MessageReactionAdd ¶ added in v0.15.0
MessageReactionAdd creates an emoji reaction to a message. channelID : The channel ID. messageID : The message ID. emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier.
func (*Session) MessageReactionRemove ¶ added in v0.15.0
MessageReactionRemove deletes an emoji reaction to a message. channelID : The channel ID. messageID : The message ID. emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier. userID : @me or ID of the user to delete the reaction for.
func (*Session) MessageReactions ¶ added in v0.15.0
func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit int, beforeID, afterID string) (st []*User, err error)
MessageReactions gets all the users reactions for a specific emoji. channelID : The channel ID. messageID : The message ID. emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier. limit : max number of users to return (max 100) beforeID : If provided all reactions returned will be before given ID. afterID : If provided all reactions returned will be after given ID.
func (*Session) MessageReactionsRemoveAll ¶ added in v0.17.0
MessageReactionsRemoveAll deletes all reactions from a message channelID : The channel ID messageID : The message ID.
func (*Session) MessageReactionsRemoveEmoji ¶ added in v0.23.3
MessageReactionsRemoveEmoji deletes all reactions of a certain emoji from a message channelID : The channel ID messageID : The message ID emojiID : The emoji ID
func (*Session) Open ¶
Open creates a websocket connection to Discord. See: https://discord.com/developers/docs/topics/gateway#connecting
func (*Session) Register ¶ added in v0.9.0
Register sends a Register request to Discord, and returns the authentication token Note that this account is temporary and should be verified for future use. Another option is to save the authentication token external, but this isn't recommended.
func (*Session) RelationshipDelete ¶ added in v0.15.0
RelationshipDelete removes the relationship with a user. userID: ID of the user.
func (*Session) RelationshipFriendRequestAccept ¶ added in v0.15.0
RelationshipFriendRequestAccept accepts a friend request from a user. userID: ID of the user.
func (*Session) RelationshipFriendRequestSend ¶ added in v0.15.0
RelationshipFriendRequestSend sends a friend request to a user. userID: ID of the user.
func (*Session) RelationshipUserBlock ¶ added in v0.15.0
RelationshipUserBlock blocks a user. userID: ID of the user.
func (*Session) RelationshipsGet ¶ added in v0.15.0
func (s *Session) RelationshipsGet() (r []*Relationship, err error)
RelationshipsGet returns an array of all the relationships of the user.
func (*Session) RelationshipsMutualGet ¶ added in v0.15.0
RelationshipsMutualGet returns an array of all the users both @me and the given user is friends with. userID: ID of the user.
func (*Session) Request ¶
Request is the same as RequestWithBucketID but the bucket id is the same as the urlStr
func (*Session) RequestGuildMembers ¶ added in v0.15.0
func (s *Session) RequestGuildMembers(guildID string, query string, limit int, presences bool) (err error)
RequestGuildMembers requests guild members from the gateway The gateway responds with GuildMembersChunk events guildID : Single Guild ID to request members of query : String that username starts with, leave empty to return all members limit : Max number of items to return, or 0 to request all members matched presences : Whether to request presences of guild members
func (*Session) RequestGuildMembersBatch ¶ added in v0.23.3
func (s *Session) RequestGuildMembersBatch(guildIDs []string, query string, limit int, presences bool) (err error)
RequestGuildMembersBatch requests guild members from the gateway The gateway responds with GuildMembersChunk events guildID : Slice of guild IDs to request members of query : String that username starts with, leave empty to return all members limit : Max number of items to return, or 0 to request all members matched presences : Whether to request presences of guild members
func (*Session) RequestWithBucketID ¶ added in v0.15.0
func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, bucketID string) (response []byte, err error)
RequestWithBucketID makes a (GET/POST/...) Requests to Discord REST API with JSON data.
func (*Session) RequestWithLockedBucket ¶ added in v0.18.0
func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b []byte, bucket *Bucket, sequence int) (response []byte, err error)
RequestWithLockedBucket makes a request using a bucket that's already been locked
func (*Session) UpdateGameStatus ¶ added in v0.23.3
UpdateGameStatus is used to update the user's status. If idle>0 then set status to idle. If name!="" then set game. if otherwise, set status to active, and no activity.
func (*Session) UpdateListeningStatus ¶ added in v0.23.3
UpdateListeningStatus is used to set the user to "Listening to..." If name!="" then set to what user is listening to Else, set user to active and no activity.
func (*Session) UpdateStatusComplex ¶ added in v0.18.0
func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error)
UpdateStatusComplex allows for sending the raw status update data untouched by discordgo.
func (*Session) UpdateStreamingStatus ¶ added in v0.13.0
UpdateStreamingStatus is used to update the user's streaming status. If idle>0 then set status to idle. If name!="" then set game. If name!="" and url!="" then set the status type to streaming with the URL set. if otherwise, set status to active, and no game.
func (*Session) User ¶
User returns the user details of the given userID userID : A user ID or "@me" which is a shortcut of current user ID
func (*Session) UserAvatar ¶
UserAvatar is deprecated. Please use UserAvatarDecode userID : A user ID or "@me" which is a shortcut of current user ID
func (*Session) UserAvatarDecode ¶ added in v0.16.0
UserAvatarDecode returns an image.Image of a user's Avatar user : The user which avatar should be retrieved
func (*Session) UserChannelCreate ¶
UserChannelCreate creates a new User (Private) Channel with another User recipientID : A user ID for the user to which this channel is opened with.
func (*Session) UserChannelPermissions ¶ added in v0.12.0
UserChannelPermissions returns the permission of a user in a channel. userID : The ID of the user to calculate permissions for. channelID : The ID of the channel to calculate permission for.
NOTE: This function is now deprecated and will be removed in the future. Please see the same function inside state.go
func (*Session) UserChannels ¶
UserChannels returns an array of Channel structures for all private channels.
func (*Session) UserConnections ¶ added in v0.23.3
func (s *Session) UserConnections() (conn []*UserConnection, err error)
UserConnections returns the user's connections
func (*Session) UserGuildSettingsEdit ¶ added in v0.13.0
func (s *Session) UserGuildSettingsEdit(guildID string, settings *UserGuildSettingsEdit) (st *UserGuildSettings, err error)
UserGuildSettingsEdit Edits the users notification settings for a guild guildID : The ID of the guild to edit the settings on settings : The settings to update
func (*Session) UserGuilds ¶
UserGuilds returns an array of UserGuild structures for all guilds. limit : The number guilds that can be returned. (max 100) beforeID : If provided all guilds returned will be before given ID. afterID : If provided all guilds returned will be after given ID.
func (*Session) UserNoteSet ¶ added in v0.16.0
UserNoteSet sets the note for a specific user.
func (*Session) UserSettings ¶
UserSettings returns the settings for a given user
func (*Session) UserUpdate ¶ added in v0.6.0
func (s *Session) UserUpdate(email, password, username, avatar, newPassword string) (st *User, err error)
UserUpdate updates a users settings.
func (*Session) UserUpdateStatus ¶ added in v0.15.0
UserUpdateStatus update the user status status : The new status (Actual valid status are 'online','idle','dnd','invisible')
func (*Session) VoiceRegions ¶
func (s *Session) VoiceRegions() (st []*VoiceRegion, err error)
VoiceRegions returns the voice server regions
func (*Session) Webhook ¶ added in v0.15.0
Webhook returns a webhook for a given ID webhookID: The ID of a webhook.
func (*Session) WebhookCreate ¶ added in v0.15.0
WebhookCreate returns a new Webhook. channelID: The ID of a Channel. name : The name of the webhook. avatar : The avatar of the webhook.
func (*Session) WebhookDelete ¶ added in v0.15.0
WebhookDelete deletes a webhook for a given ID webhookID: The ID of a webhook.
func (*Session) WebhookDeleteWithToken ¶ added in v0.15.0
WebhookDeleteWithToken deletes a webhook for a given ID with an auth token. webhookID: The ID of a webhook. token : The auth token for the webhook.
func (*Session) WebhookEdit ¶ added in v0.15.0
WebhookEdit updates an existing Webhook. webhookID: The ID of a webhook. name : The name of the webhook. avatar : The avatar of the webhook.
func (*Session) WebhookEditWithToken ¶ added in v0.15.0
WebhookEditWithToken updates an existing Webhook with an auth token. webhookID: The ID of a webhook. token : The auth token for the webhook. name : The name of the webhook. avatar : The avatar of the webhook.
func (*Session) WebhookExecute ¶ added in v0.15.0
func (s *Session) WebhookExecute(webhookID, token string, wait bool, data *WebhookParams) (st *Message, err error)
WebhookExecute executes a webhook. webhookID: The ID of a webhook. token : The auth token for the webhook wait : Waits for server confirmation of message send and ensures that the return struct is populated (it is nil otherwise)
func (*Session) WebhookMessage ¶ added in v0.23.3
WebhookMessage gets a webhook message. webhookID : The ID of a webhook token : The auth token for the webhook messageID : The ID of message to get
func (*Session) WebhookMessageDelete ¶ added in v0.23.3
WebhookMessageDelete deletes a webhook message. webhookID : The ID of a webhook token : The auth token for the webhook messageID : The ID of a message to edit
func (*Session) WebhookMessageEdit ¶ added in v0.23.3
func (s *Session) WebhookMessageEdit(webhookID, token, messageID string, data *WebhookEdit) (st *Message, err error)
WebhookMessageEdit edits a webhook message and returns a new one. webhookID : The ID of a webhook token : The auth token for the webhook messageID : The ID of message to edit
type SessionInformation ¶ added in v0.23.3
type SessionInformation struct { Total int `json:"total,omitempty"` Remaining int `json:"remaining,omitempty"` ResetAfter int `json:"reset_after,omitempty"` MaxConcurrency int `json:"max_concurrency,omitempty"` }
SessionInformation provides the information for max concurrency sharding
type Settings ¶
type Settings struct { RenderEmbeds bool `json:"render_embeds"` InlineEmbedMedia bool `json:"inline_embed_media"` InlineAttachmentMedia bool `json:"inline_attachment_media"` EnableTTSCommand bool `json:"enable_tts_command"` MessageDisplayCompact bool `json:"message_display_compact"` ShowCurrentGame bool `json:"show_current_game"` ConvertEmoticons bool `json:"convert_emoticons"` Locale string `json:"locale"` Theme string `json:"theme"` GuildPositions []string `json:"guild_positions"` RestrictedGuilds []string `json:"restricted_guilds"` FriendSourceFlags *FriendSourceFlags `json:"friend_source_flags"` Status Status `json:"status"` DetectPlatformAccounts bool `json:"detect_platform_accounts"` DeveloperMode bool `json:"developer_mode"` }
A Settings stores data for a specific users Discord client settings.
type State ¶ added in v0.8.0
type State struct { sync.RWMutex Ready // MaxMessageCount represents how many messages per channel the state will store. MaxMessageCount int TrackChannels bool TrackEmojis bool TrackMembers bool TrackRoles bool TrackVoice bool TrackPresences bool // contains filtered or unexported fields }
A State contains the current known state. As discord sends this in a READY blob, it seems reasonable to simply use that struct as the data store.
func (*State) Channel ¶ added in v0.8.0
Channel gets a channel by ID, it will look in all guilds and private channels.
func (*State) ChannelAdd ¶ added in v0.8.0
ChannelAdd adds a channel to the current world state, or updates it if it already exists. Channels may exist either as PrivateChannels or inside a guild.
func (*State) ChannelRemove ¶ added in v0.8.0
ChannelRemove removes a channel from current world state.
func (*State) Guild ¶ added in v0.8.0
Guild gets a guild by ID. Useful for querying if @me is in a guild:
_, err := discordgo.Session.State.Guild(guildID) isInGuild := err == nil
func (*State) GuildAdd ¶ added in v0.8.0
GuildAdd adds a guild to the current world state, or updates it if it already exists.
func (*State) GuildChannel ¶ added in v0.8.0
GuildChannel gets a channel by ID from a guild. This method is Deprecated, use Channel(channelID)
func (*State) GuildRemove ¶ added in v0.8.0
GuildRemove removes a guild from current world state.
func (*State) MemberAdd ¶ added in v0.8.0
MemberAdd adds a member to the current world state, or updates it if it already exists.
func (*State) MemberRemove ¶ added in v0.8.0
MemberRemove removes a member from current world state.
func (*State) MessageAdd ¶ added in v0.10.0
MessageAdd adds a message to the current world state, or updates it if it exists. If the channel cannot be found, the message is discarded. Messages are kept in state up to s.MaxMessageCount per channel.
func (*State) MessageColor ¶ added in v0.23.3
MessageColor returns the color of the author's name as displayed in the client associated with this message.
func (*State) MessagePermissions ¶ added in v0.23.3
MessagePermissions returns the permissions of the author of the message in the channel in which it was sent.
func (*State) MessageRemove ¶ added in v0.10.0
MessageRemove removes a message from the world state.
func (*State) OnInterface ¶ added in v0.17.0
OnInterface handles all events related to states.
func (*State) PresenceAdd ¶ added in v0.16.0
PresenceAdd adds a presence to the current world state, or updates it if it already exists.
func (*State) PresenceRemove ¶ added in v0.16.0
PresenceRemove removes a presence from the current world state.
func (*State) PrivateChannel ¶ added in v0.8.0
PrivateChannel gets a private channel by ID. This method is Deprecated, use Channel(channelID)
func (*State) RoleAdd ¶ added in v0.13.0
RoleAdd adds a role to the current world state, or updates it if it already exists.
func (*State) RoleRemove ¶ added in v0.13.0
RoleRemove removes a role from current world state by ID.
func (*State) UserChannelPermissions ¶ added in v0.13.0
UserChannelPermissions returns the permission of a user in a channel. userID : The ID of the user to calculate permissions for. channelID : The ID of the channel to calculate permission for.
func (*State) UserColor ¶ added in v0.16.0
UserColor returns the color of a user in a channel. While colors are defined at a Guild level, determining for a channel is more useful in message handlers. 0 is returned in cases of error, which is the color of @everyone. userID : The ID of the user to calculate the color for. channelID : The ID of the channel to calculate the color for.
func (*State) VoiceState ¶ added in v0.23.3
func (s *State) VoiceState(guildID, userID string) (*VoiceState, error)
VoiceState gets a VoiceState by guild and user ID.
type SystemChannelFlag ¶ added in v0.23.3
type SystemChannelFlag int
SystemChannelFlag is the type of flags in the system channel (see SystemChannelFlag* consts) https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
const ( SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << 0 SystemChannelFlagsSuppressPremium SystemChannelFlag = 1 << 1 )
Block containing known SystemChannelFlag values
type TargetUserType ¶ added in v0.23.3
type TargetUserType int
TargetUserType is the type of the target user https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
const (
TargetUserTypeStream TargetUserType = 1
)
Block contains known TargetUserType values
type Team ¶ added in v0.23.3
type Team struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Icon string `json:"icon"` OwnerID string `json:"owner_user_id"` Members []*TeamMember `json:"members"` }
A Team struct stores the members of a Discord Developer Team as well as some metadata about it
type TeamMember ¶ added in v0.23.3
type TeamMember struct { User *User `json:"user"` TeamID string `json:"team_id"` MembershipState MembershipState `json:"membership_state"` Permissions []string `json:"permissions"` }
A TeamMember struct stores values for a single Team Member, extending the normal User data - note that the user field is partial
type TimeStamps ¶ added in v0.18.0
type TimeStamps struct { EndTimestamp int64 `json:"end,omitempty"` StartTimestamp int64 `json:"start,omitempty"` }
A TimeStamps struct contains start and end times used in the rich presence "playing .." Game
func (*TimeStamps) UnmarshalJSON ¶ added in v0.18.0
func (t *TimeStamps) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSON into TimeStamps struct
type TooManyRequests ¶ added in v0.13.0
type TooManyRequests struct { Bucket string `json:"bucket"` Message string `json:"message"` RetryAfter time.Duration `json:"retry_after"` }
A TooManyRequests struct holds information received from Discord when receiving a HTTP 429 response.
func (*TooManyRequests) UnmarshalJSON ¶ added in v0.23.3
func (t *TooManyRequests) UnmarshalJSON(b []byte) error
UnmarshalJSON helps support translation of a milliseconds-based float into a time.Duration on TooManyRequests.
type TypingStart ¶
type TypingStart struct { UserID string `json:"user_id"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` Timestamp int `json:"timestamp"` }
TypingStart is the data for a TypingStart event.
type UpdateStatusData ¶ added in v0.18.0
type UpdateStatusData struct { IdleSince *int `json:"since"` Activities []*Activity `json:"activities"` AFK bool `json:"afk"` Status string `json:"status"` }
UpdateStatusData ia provided to UpdateStatusComplex()
type User ¶
type User struct { // The ID of the user. ID string `json:"id"` // The email of the user. This is only present when // the application possesses the email scope for the user. Email string `json:"email"` // The user's username. Username string `json:"username"` // The hash of the user's avatar. Use Session.UserAvatar // to retrieve the avatar itself. Avatar string `json:"avatar"` // The user's chosen language option. Locale string `json:"locale"` // The discriminator of the user (4 numbers after name). Discriminator string `json:"discriminator"` // The token of the user. This is only present for // the user represented by the current session. Token string `json:"token"` // Whether the user's email is verified. Verified bool `json:"verified"` // Whether the user has multi-factor authentication enabled. MFAEnabled bool `json:"mfa_enabled"` // Whether the user is a bot. Bot bool `json:"bot"` // The public flags on a user's account. // This is a combination of bit masks; the presence of a certain flag can // be checked by performing a bitwise AND between this int and the flag. PublicFlags UserFlags `json:"public_flags"` // The type of Nitro subscription on a user's account. // Only available when the request is authorized via a Bearer token. PremiumType int `json:"premium_type"` // Whether the user is an Official Discord System user (part of the urgent message system). System bool `json:"system"` // The flags on a user's account. // Only available when the request is authorized via a Bearer token. Flags int `json:"flags"` }
A User stores all data for an individual Discord user.
func (*User) AvatarURL ¶ added in v0.17.0
AvatarURL returns a URL to the user's avatar.
size: The size of the user's avatar as a power of two if size is an empty string, no size parameter will be added to the URL.
type UserConnection ¶ added in v0.23.3
type UserConnection struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` Revoked bool `json:"revoked"` Integrations []*Integration `json:"integrations"` }
UserConnection is a Connection returned from the UserConnections endpoint
type UserFlags ¶ added in v0.23.3
type UserFlags int
UserFlags is the flags of "user" (see UserFlags* consts) https://discord.com/developers/docs/resources/user#user-object-user-flags
const ( UserFlagDiscordEmployee UserFlags = 1 << 0 UserFlagDiscordPartner UserFlags = 1 << 1 UserFlagHypeSquadEvents UserFlags = 1 << 2 UserFlagBugHunterLevel1 UserFlags = 1 << 3 UserFlagHouseBravery UserFlags = 1 << 6 UserFlagHouseBrilliance UserFlags = 1 << 7 UserFlagHouseBalance UserFlags = 1 << 8 UserFlagEarlySupporter UserFlags = 1 << 9 UserFlagTeamUser UserFlags = 1 << 10 UserFlagSystem UserFlags = 1 << 12 UserFlagBugHunterLevel2 UserFlags = 1 << 14 UserFlagVerifiedBot UserFlags = 1 << 16 UserFlagVerifiedBotDeveloper UserFlags = 1 << 17 UserFlagDiscordCertifiedModerator UserFlags = 1 << 18 )
Valid UserFlags values
type UserGuild ¶ added in v0.15.0
type UserGuild struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon"` Owner bool `json:"owner"` Permissions int64 `json:"permissions,string"` }
A UserGuild holds a brief version of a Guild
type UserGuildSettings ¶ added in v0.12.0
type UserGuildSettings struct { SupressEveryone bool `json:"suppress_everyone"` Muted bool `json:"muted"` MobilePush bool `json:"mobile_push"` MessageNotifications int `json:"message_notifications"` GuildID string `json:"guild_id"` ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"` }
A UserGuildSettings stores data for a users guild settings.
type UserGuildSettingsChannelOverride ¶ added in v0.12.0
type UserGuildSettingsChannelOverride struct { Muted bool `json:"muted"` MessageNotifications int `json:"message_notifications"` ChannelID string `json:"channel_id"` }
A UserGuildSettingsChannelOverride stores data for a channel override for a users guild settings.
type UserGuildSettingsEdit ¶ added in v0.13.0
type UserGuildSettingsEdit struct { SupressEveryone bool `json:"suppress_everyone"` Muted bool `json:"muted"` MobilePush bool `json:"mobile_push"` MessageNotifications int `json:"message_notifications"` ChannelOverrides map[string]*UserGuildSettingsChannelOverride `json:"channel_overrides"` }
A UserGuildSettingsEdit stores data for editing UserGuildSettings
type UserGuildSettingsUpdate ¶ added in v0.12.0
type UserGuildSettingsUpdate struct {
*UserGuildSettings
}
UserGuildSettingsUpdate is the data for a UserGuildSettingsUpdate event.
type UserNoteUpdate ¶ added in v0.16.0
UserNoteUpdate is the data for a UserNoteUpdate event.
type UserSettingsUpdate ¶ added in v0.11.0
type UserSettingsUpdate map[string]interface{}
UserSettingsUpdate is the data for a UserSettingsUpdate event.
type UserUpdate ¶ added in v0.11.0
type UserUpdate struct {
*User
}
UserUpdate is the data for a UserUpdate event.
type VerificationLevel ¶ added in v0.12.0
type VerificationLevel int
VerificationLevel type definition
const ( VerificationLevelNone VerificationLevel = 0 VerificationLevelLow VerificationLevel = 1 VerificationLevelMedium VerificationLevel = 2 VerificationLevelHigh VerificationLevel = 3 VerificationLevelVeryHigh VerificationLevel = 4 )
Constants for VerificationLevel levels from 0 to 4 inclusive
type VoiceConnection ¶ added in v0.12.0
type VoiceConnection struct { sync.RWMutex Debug bool // If true, print extra logging -- DEPRECATED LogLevel int Ready bool // If true, voice is ready to send/receive audio UserID string GuildID string ChannelID string OpusSend chan []byte // Chan for sending opus audio OpusRecv chan *Packet // Chan for receiving opus audio // contains filtered or unexported fields }
A VoiceConnection struct holds all the data and functions related to a Discord Voice Connection.
func (*VoiceConnection) AddHandler ¶ added in v0.12.0
func (v *VoiceConnection) AddHandler(h VoiceSpeakingUpdateHandler)
AddHandler adds a Handler for VoiceSpeakingUpdate events.
func (*VoiceConnection) ChangeChannel ¶ added in v0.12.0
func (v *VoiceConnection) ChangeChannel(channelID string, mute, deaf bool) (err error)
ChangeChannel sends Discord a request to change channels within a Guild !!! NOTE !!! This function may be removed in favour of just using ChannelVoiceJoin
func (*VoiceConnection) Close ¶ added in v0.12.0
func (v *VoiceConnection) Close()
Close closes the voice ws and udp connections
func (*VoiceConnection) Disconnect ¶ added in v0.12.0
func (v *VoiceConnection) Disconnect() (err error)
Disconnect disconnects from this voice channel and closes the websocket and udp connections to Discord.
func (*VoiceConnection) Speaking ¶ added in v0.12.0
func (v *VoiceConnection) Speaking(b bool) (err error)
Speaking sends a speaking notification to Discord over the voice websocket. This must be sent as true prior to sending audio and should be set to false once finished sending audio.
b : Send true if speaking, false if not.
type VoiceRegion ¶
type VoiceRegion struct { ID string `json:"id"` Name string `json:"name"` Hostname string `json:"sample_hostname"` Port int `json:"sample_port"` }
A VoiceRegion stores data for a specific voice region server.
type VoiceServerUpdate ¶
type VoiceServerUpdate struct { Token string `json:"token"` GuildID string `json:"guild_id"` Endpoint string `json:"endpoint"` }
VoiceServerUpdate is the data for a VoiceServerUpdate event.
type VoiceSpeakingUpdate ¶ added in v0.12.0
type VoiceSpeakingUpdate struct { UserID string `json:"user_id"` SSRC int `json:"ssrc"` Speaking bool `json:"speaking"` }
VoiceSpeakingUpdate is a struct for a VoiceSpeakingUpdate event.
type VoiceSpeakingUpdateHandler ¶ added in v0.12.0
type VoiceSpeakingUpdateHandler func(vc *VoiceConnection, vs *VoiceSpeakingUpdate)
VoiceSpeakingUpdateHandler type provides a function definition for the VoiceSpeakingUpdate event
type VoiceState ¶
type VoiceState struct { UserID string `json:"user_id"` SessionID string `json:"session_id"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` Suppress bool `json:"suppress"` SelfMute bool `json:"self_mute"` SelfDeaf bool `json:"self_deaf"` Mute bool `json:"mute"` Deaf bool `json:"deaf"` }
A VoiceState stores the voice states of Guilds
type VoiceStateUpdate ¶ added in v0.11.0
type VoiceStateUpdate struct { *VoiceState // BeforeUpdate will be nil if the VoiceState was not previously cached in the state cache. BeforeUpdate *VoiceState `json:"-"` }
VoiceStateUpdate is the data for a VoiceStateUpdate event.
type Webhook ¶ added in v0.15.0
type Webhook struct { ID string `json:"id"` Type WebhookType `json:"type"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` User *User `json:"user"` Name string `json:"name"` Avatar string `json:"avatar"` Token string `json:"token"` // ApplicationID is the bot/OAuth2 application that created this webhook ApplicationID string `json:"application_id,omitempty"` }
Webhook stores the data for a webhook.
type WebhookEdit ¶ added in v0.23.3
type WebhookEdit struct { Content string `json:"content,omitempty"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` Files []*File `json:"-"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` }
WebhookEdit stores data for editing of a webhook message.
type WebhookParams ¶ added in v0.15.0
type WebhookParams struct { Content string `json:"content,omitempty"` Username string `json:"username,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` TTS bool `json:"tts,omitempty"` Files []*File `json:"-"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` // NOTE: Works only for followup messages. Flags uint64 `json:"flags,omitempty"` }
WebhookParams is a struct for webhook params, used in the WebhookExecute command.
type WebhookType ¶ added in v0.23.3
type WebhookType int
WebhookType is the type of Webhook (see WebhookType* consts) in the Webhook struct https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types
const ( WebhookTypeIncoming WebhookType = 1 WebhookTypeChannelFollower WebhookType = 2 )
Valid WebhookType values
type WebhooksUpdate ¶ added in v0.23.3
type WebhooksUpdate struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` }
WebhooksUpdate is the data for a WebhooksUpdate event