Documentation ¶
Overview ¶
Package discordgo provides Discord binding for Go
Code generated by tools/cmd/permnames; DO NOT EDIT.
Index ¶
- Constants
- Variables
- func CheckRetry(_ context.Context, resp *http.Response, err error) (bool, error)
- func CreateEndpoints(base string)
- func DecodeSnowflake(dst *int64, dec *gojay.Decoder) error
- func GetEventInterface(evtType string) interface{}
- func IsEmbedEmpty(embed *MessageEmbed) bool
- func MemberPermissions(guild *Guild, channel *Channel, member *Member) (apermissions int64)
- func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType string, requestBody []byte, err error)
- func ParseID(s string) (int64, error)
- func PermissionName(p int64) string
- func StrID(id int64) string
- func VerifyInteraction(r *http.Request, key ed25519.PublicKey) bool
- type APIErrorMessage
- type Ack
- type ActionsRow
- type Activities
- type Activity
- type ActivityType
- type AddedThreadMember
- type AllowedMentionType
- type AllowedMentions
- type Application
- type ApplicationCommand
- type ApplicationCommandCreate
- type ApplicationCommandDelete
- 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 int64) *Role
- func (o ApplicationCommandInteractionDataOption) StringValue() string
- func (o ApplicationCommandInteractionDataOption) UintValue() uint64
- func (a *ApplicationCommandInteractionDataOption) UnmarshalJSON(b []byte) error
- func (o ApplicationCommandInteractionDataOption) UserValue(s *Session) *User
- type ApplicationCommandInteractionDataResolved
- type ApplicationCommandOption
- type ApplicationCommandOptionChoice
- type ApplicationCommandOptionType
- type ApplicationCommandPermissionType
- type ApplicationCommandPermissions
- type ApplicationCommandPermissionsList
- type ApplicationCommandPermissionsUpdate
- type ApplicationCommandType
- type ApplicationCommandUpdate
- type Assets
- type AuditLogAction
- type AuditLogChange
- type AuditLogChangeKey
- type AuditLogEntry
- type AuditLogOptions
- type AuditLogOptionsType
- type AutoArchiveDuration
- type AutoModerationAction
- type AutoModerationActionExecution
- type AutoModerationActionMetadata
- type AutoModerationActionType
- type AutoModerationKeywordPreset
- type AutoModerationRule
- type AutoModerationRuleCreate
- type AutoModerationRuleDelete
- type AutoModerationRuleEventType
- type AutoModerationRuleTriggerType
- type AutoModerationRuleUpdate
- type AutoModerationTriggerMetadata
- type Bucket
- type Button
- type ButtonStyle
- type Channel
- type ChannelCreate
- type ChannelDelete
- type ChannelEdit
- type ChannelEvent
- type ChannelFlags
- type ChannelPinsUpdate
- type ChannelTopicUpdate
- type ChannelType
- type ChannelUpdate
- type ComponentEmoji
- type ComponentType
- type Connect
- type CreateApplicationCommandRequest
- type CtxKey
- type Disconnect
- type DiscordFloat
- type DiscordInt64
- type EditApplicationCommandRequest
- type Emoji
- type EmojiName
- type Entitlement
- type EntitlementCreate
- type EntitlementDelete
- type EntitlementFilterOptions
- type EntitlementOwnerType
- type EntitlementTest
- type EntitlementType
- type EntitlementUpdate
- type Event
- type EventHandler
- type EventInterfaceProvider
- type ExplicitContentFilterLevel
- type File
- type ForumDefaultReaction
- type ForumLayout
- type ForumSortOrderType
- type ForumTag
- type FriendSourceFlags
- type GatewayBotResponse
- type GatewayConnection
- func (g *GatewayConnection) Close() error
- func (g *GatewayConnection) Reconnect(forceReIdentify bool) error
- func (g *GatewayConnection) ReconnectUnlessClosed(forceReIdentify bool) error
- func (g *GatewayConnection) RequestGuildMembers(d *RequestGuildMembersData)
- func (g *GatewayConnection) Status() (st GatewayStatus)
- func (g *GatewayConnection) UpdateStatusComplex(usd UpdateStatusData)
- type GatewayConnectionManager
- func (g *GatewayConnectionManager) ChannelVoiceJoin(gID, cID int64, mute, deaf bool) (voice *VoiceConnection, err error)
- func (g *GatewayConnectionManager) ChannelVoiceLeave(gID int64)
- func (g *GatewayConnectionManager) Close() (err error)
- func (g *GatewayConnectionManager) GetCurrentConnection() *GatewayConnection
- func (s *GatewayConnectionManager) GetSessionInfo() (sessionID string, sequence int64, resumeGatewayUrl string)
- func (g *GatewayConnectionManager) HeartBeatStats() (lastSend time.Time, lastAck time.Time)
- func (g *GatewayConnectionManager) Open() error
- func (g *GatewayConnectionManager) Reconnect(forceIdentify bool) error
- func (g *GatewayConnectionManager) RequestGuildMemberByID(guildID int64, query int64, limit int)
- func (g *GatewayConnectionManager) RequestGuildMembers(guildID int64, query string, limit int)
- func (g *GatewayConnectionManager) RequestGuildMembersComplex(d *RequestGuildMembersData)
- func (s *GatewayConnectionManager) SetSessionInfo(sessionID string, sequence int64, resumeGatewayUrl string)
- func (g *GatewayConnectionManager) Status() GatewayStatus
- type GatewayIdentifyRatelimiter
- type GatewayIntent
- type GatewayOP
- type GatewayStatus
- type Guild
- type GuildApplicationCommandPermissions
- type GuildAuditLog
- type GuildAuditLogEntryCreate
- type GuildBan
- type GuildBanAdd
- type GuildBanRemove
- type GuildCreate
- type GuildDelete
- type GuildEmbed
- type GuildEmojisUpdate
- type GuildEvent
- type GuildIntegrationsUpdate
- type GuildJoinRequestDelete
- type GuildJoinRequestUpdate
- type GuildMemberAdd
- type GuildMemberRemove
- type GuildMemberUpdate
- type GuildMembersChunk
- type GuildParams
- type GuildRole
- type GuildRoleCreate
- type GuildRoleDelete
- type GuildRoleUpdate
- type GuildStickersUpdate
- type GuildUpdate
- type ICEServer
- type IDSlice
- type Integration
- type IntegrationAccount
- type Interaction
- type InteractionApplicationCommandCallbackData
- type InteractionCreate
- type InteractionData
- type InteractionResponse
- type InteractionResponseData
- type InteractionResponseType
- type InteractionType
- type Invite
- type InviteCreate
- type InviteDelete
- type InviteUser
- type Locale
- type Member
- type MemberFlags
- type Message
- func (m *Message) ContentWithMentionsReplaced() (content string)
- func (m *Message) ContentWithMoreMentionsReplaced(s *Session) (content string, err error)
- func (m *Message) GetChannelID() int64
- func (m *Message) GetGuildID() int64
- func (m *Message) GetMessageContents() []string
- func (m *Message) Link() string
- func (m *Message) Reference() *MessageReference
- func (m *Message) UnmarshalJSON(data []byte) error
- type MessageAck
- type MessageActivity
- 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 MessageInteraction
- type MessageReaction
- type MessageReactionAdd
- type MessageReactionRemove
- type MessageReactionRemoveAll
- type MessageReactionRemoveEmoji
- type MessageReactions
- type MessageReactionsCountDetails
- type MessageReference
- type MessageReferenceType
- type MessageSend
- type MessageSnapshot
- type MessageType
- type MessageUpdate
- type MfaLevel
- type ModalSubmitInteractionData
- type NullableID
- type Packet
- type PermissionOverwrite
- type PermissionOverwriteType
- type Presence
- type PresenceUpdate
- type PresencesReplace
- type RESTError
- type RateLimit
- type RateLimiter
- func (r *RateLimiter) CurrentConcurrentLocks() int
- func (r *RateLimiter) GetBucket(key string) *Bucket
- func (r *RateLimiter) GetWaitTime(b *Bucket, minRemaining int) time.Duration
- func (r *RateLimiter) LockBucket(bucketID string) (b *Bucket, lockID int64)
- func (r *RateLimiter) LockBucketObject(b *Bucket) (lockID int64)
- func (r *RateLimiter) SetGlobalTriggered(to time.Time)
- type ReadState
- type ReaderWithMockClose
- type Ready
- type Relationship
- type RelationshipAdd
- type RelationshipRemove
- type RequestGuildMembersData
- type Resumed
- type Role
- type RoleCreate
- type Roles
- type SKU
- type SKUFlags
- type SKUType
- type SelectMenu
- type SelectMenuDefaultValue
- type SelectMenuDefaultValueType
- type SelectMenuOption
- type SelectMenuType
- type SelfUser
- type Session
- func (s *Session) AddHandler(handler interface{}) func()
- func (s *Session) AddHandlerOnce(handler interface{}) func()
- func (s *Session) Application(appID int64) (st *Application, err error)
- func (s *Session) ApplicationBotCreate(appID int64) (st *User, err error)
- func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error)
- func (s *Session) ApplicationDelete(appID int64) (err error)
- func (s *Session) ApplicationMe() (st *Application, err error)
- func (s *Session) ApplicationUpdate(appID int64, ap *Application) (st *Application, err error)
- func (s *Session) Applications() (st []*Application, err error)
- func (s *Session) BatchEditGuildApplicationCommandsPermissions(applicationID int64, guildID int64, data []*GuildApplicationCommandPermissions) (st []*GuildApplicationCommandPermissions, err error)
- func (s *Session) BulkOverwriteGlobalApplicationCommands(applicationID int64, data []*CreateApplicationCommandRequest) (st []*ApplicationCommand, err error)
- func (s *Session) BulkOverwriteGuildApplicationCommands(applicationID int64, guildID int64, data []*CreateApplicationCommandRequest) (st []*ApplicationCommand, err error)
- func (s *Session) Channel(channelID int64) (st *Channel, err error)
- func (s *Session) ChannelDelete(channelID int64) (st *Channel, err error)
- func (s *Session) ChannelEdit(channelID int64, name string) (*Channel, error)
- func (s *Session) ChannelEditComplex(channelID int64, data *ChannelEdit) (st *Channel, err error)
- func (s *Session) ChannelFileSend(channelID int64, name string, r io.Reader) (*Message, error)
- func (s *Session) ChannelFileSendWithMessage(channelID int64, content string, name string, r io.Reader) (*Message, error)
- func (s *Session) ChannelInviteCreate(channelID int64, i Invite) (st *Invite, err error)
- func (s *Session) ChannelInvites(channelID int64) (st []*Invite, err error)
- func (s *Session) ChannelMessage(channelID, messageID int64) (st *Message, err error)
- func (s *Session) ChannelMessageAck(channelID, messageID int64, lastToken string) (st *Ack, err error)
- func (s *Session) ChannelMessageCrosspost(channelID, messageID int64) (st *Message, err error)
- func (s *Session) ChannelMessageDelete(channelID, messageID int64) (err error)
- func (s *Session) ChannelMessageEdit(channelID, messageID int64, content string) (*Message, error)
- func (s *Session) ChannelMessageEditComplex(msg *MessageEdit) (st *Message, err error)
- func (s *Session) ChannelMessageEditEmbed(channelID, messageID int64, embed *MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageEditEmbedList(channelID, messageID int64, embeds []*MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessagePin(channelID, messageID int64) (err error)
- func (s *Session) ChannelMessageSend(channelID int64, content string) (*Message, error)
- func (s *Session) ChannelMessageSendComplex(channelID int64, msg *MessageSend) (st *Message, err error)
- func (s *Session) ChannelMessageSendEmbed(channelID int64, embed *MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageSendEmbedList(channelID int64, embeds []*MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageSendEmbeds(channelID int64, embeds []*MessageEmbed) (*Message, error)
- func (s *Session) ChannelMessageSendReply(channelID int64, content string, reference *MessageReference) (*Message, error)
- func (s *Session) ChannelMessageSendTTS(channelID int64, content string) (*Message, error)
- func (s *Session) ChannelMessageUnpin(channelID, messageID int64) (err error)
- func (s *Session) ChannelMessages(channelID int64, limit int, beforeID, afterID, aroundID int64) (st []*Message, err error)
- func (s *Session) ChannelMessagesBulkDelete(channelID int64, messages []int64) (err error)
- func (s *Session) ChannelMessagesPinned(channelID int64) (st []*Message, err error)
- func (s *Session) ChannelPermissionDelete(channelID, targetID int64) (err error)
- func (s *Session) ChannelPermissionSet(channelID, targetID int64, targetType PermissionOverwriteType, ...) (err error)
- func (s *Session) ChannelTyping(channelID int64) (err error)
- func (s *Session) ChannelWebhooks(channelID int64) (st []*Webhook, err error)
- func (s *Session) Close() error
- func (s *Session) CreateFollowupMessage(applicationID int64, token string, data *WebhookParams) (st *Message, err error)
- func (s *Session) CreateGlobalApplicationCommand(applicationID int64, command *CreateApplicationCommandRequest) (st *ApplicationCommand, err error)
- func (s *Session) CreateGuildApplicationCommands(applicationID int64, guildID int64, data *CreateApplicationCommandRequest) (st *ApplicationCommand, err error)
- func (s *Session) CreateInteractionResponse(interactionID int64, token string, data *InteractionResponse) (err error)
- func (s *Session) DeleteFollowupMessage(applicationID int64, token string, messageID int64) (err error)
- func (s *Session) DeleteGlobalApplicationCommand(applicationID int64, cmdID int64) (err error)
- func (s *Session) DeleteGuildApplicationCommand(applicationID int64, guildID int64, cmdID int64) (err error)
- func (s *Session) DeleteInteractionResponse(applicationID int64, token string) (err error)
- func (s *Session) EditFollowupMessage(applicationID int64, token string, messageID int64, data *WebhookParams) (st *Message, err error)
- func (s *Session) EditGlobalApplicationCommand(applicationID int64, cmdID int64, data *EditApplicationCommandRequest) (st *ApplicationCommand, err error)
- func (s *Session) EditGuildApplicationCommand(applicationID int64, guildID int64, cmdID int64, ...) (st *ApplicationCommand, err error)
- func (s *Session) EditGuildApplicationCommandPermissions(applicationID int64, guildID int64, cmdID int64, ...) (err error)
- func (s *Session) EditOriginalInteractionResponse(applicationID int64, token string, data *WebhookParams) (st *Message, err error)
- func (s *Session) EntitlementConsume(appID, entitlementID int64) (err error)
- func (s *Session) EntitlementTestCreate(appID int64, data *EntitlementTest) (err error)
- func (s *Session) EntitlementTestDelete(appID, entitlementID int64) (err error)
- func (s *Session) Entitlements(applicationID int64, filterOptions *EntitlementFilterOptions) (entitlements []*Entitlement, err error)
- func (s *Session) ForumThreadStart(channelID int64, name string, archiveDuration AutoArchiveDuration, ...) (th *Channel, err error)
- func (s *Session) ForumThreadStartComplex(channelID int64, threadData *ThreadStart, messageData *MessageSend) (th *Channel, err error)
- func (s *Session) ForumThreadStartEmbed(channelID int64, name string, archiveDuration AutoArchiveDuration, ...) (th *Channel, err error)
- func (s *Session) ForumThreadStartEmbeds(channelID int64, name string, archiveDuration AutoArchiveDuration, ...) (th *Channel, err error)
- func (s *Session) Gateway() (gateway string, err error)
- func (s *Session) GatewayBot() (st *GatewayBotResponse, err error)
- func (s *Session) GetGlobalApplicationCommand(applicationID int64, cmdID int64) (st *ApplicationCommand, err error)
- func (s *Session) GetGlobalApplicationCommands(applicationID int64) (st []*ApplicationCommand, err error)
- func (s *Session) GetGuildApplicationCommand(applicationID int64, guildID int64, cmdID int64) (st *ApplicationCommand, err error)
- func (s *Session) GetGuildApplicationCommandPermissions(applicationID int64, guildID int64, cmdID int64) (st *GuildApplicationCommandPermissions, err error)
- func (s *Session) GetGuildApplicationCommands(applicationID int64, guildID int64) (st []*ApplicationCommand, err error)
- func (s *Session) GetGuildApplicationCommandsPermissions(applicationID int64, guildID int64) (st []*GuildApplicationCommandPermissions, err error)
- func (s *Session) GetOriginalInteractionResponse(applicationID int64, token string) (st *Message, err error)
- func (s *Session) GetSKUSubscription(skuID, subscriptionID int64) (subscription *Subscription, err error)
- func (s *Session) GetSKUSubscriptions(skuID int64, filterOptions *SubscriptionFilterOptions) (subscriptions []*Subscription, err error)
- func (s *Session) Guild(guildID int64) (st *Guild, err error)
- func (s *Session) GuildAuditLog(guildID, userID, beforeID int64, actionType AuditLogAction, limit int) (st *GuildAuditLog, err error)
- func (s *Session) GuildBan(guildID, userID int64) (st *GuildBan, err error)
- func (s *Session) GuildBanCreate(guildID, userID int64, days int) (err error)
- func (s *Session) GuildBanCreateWithReason(guildID, userID int64, reason string, days int) (err error)
- func (s *Session) GuildBanDelete(guildID, userID int64) (err error)
- func (s *Session) GuildBanDeleteWithReason(guildID, userID int64, reason string) (err error)
- func (s *Session) GuildBans(guildID int64) (st []*GuildBan, err error)
- func (s *Session) GuildChannelCreate(guildID int64, name string, ctype ChannelType) (st *Channel, err error)
- func (s *Session) GuildChannelCreateWithOverwrites(guildID int64, name string, ctype ChannelType, parentID int64, ...) (st *Channel, err error)
- func (s *Session) GuildChannels(guildID int64) (st []*Channel, err error)
- func (s *Session) GuildChannelsReorder(guildID int64, channels []*Channel) (err error)
- func (s *Session) GuildCreate(name string) (st *Guild, err error)
- func (s *Session) GuildDelete(guildID int64) (st *Guild, err error)
- func (s *Session) GuildEdit(guildID int64, g GuildParams) (st *Guild, err error)
- func (s *Session) GuildEmbed(guildID int64) (st *GuildEmbed, err error)
- func (s *Session) GuildEmbedEdit(guildID int64, enabled bool, channelID int64) (err error)
- func (s *Session) GuildEmojiCreate(guildID int64, name, image string, roles []int64) (emoji *Emoji, err error)
- func (s *Session) GuildEmojiDelete(guildID, emojiID int64) (err error)
- func (s *Session) GuildEmojiEdit(guildID, emojiID int64, name string, roles []int64) (emoji *Emoji, err error)
- func (s *Session) GuildIcon(guildID int64) (img image.Image, err error)
- func (s *Session) GuildIntegrationCreate(guildID int64, integrationType string, integrationID int64) (err error)
- func (s *Session) GuildIntegrationDelete(guildID, integrationID int64) (err error)
- func (s *Session) GuildIntegrationEdit(guildID, integrationID int64, expireBehavior, expireGracePeriod int, ...) (err error)
- func (s *Session) GuildIntegrationSync(guildID, integrationID int64) (err error)
- func (s *Session) GuildIntegrations(guildID int64) (st []*Integration, err error)
- func (s *Session) GuildInvites(guildID int64) (st []*Invite, err error)
- func (s *Session) GuildLeave(guildID int64) (err error)
- func (s *Session) GuildMember(guildID, userID int64) (st *Member, err error)
- func (s *Session) GuildMemberAdd(accessToken string, guildID, userID int64, nick string, roles []int64, ...) (err error)
- func (s *Session) GuildMemberDelete(guildID, userID int64) (err error)
- func (s *Session) GuildMemberDeleteWithReason(guildID, userID int64, reason string) (err error)
- func (s *Session) GuildMemberEdit(guildID, userID int64, roles []string) (err error)
- func (s *Session) GuildMemberMove(guildID, userID, channelID int64) (err error)
- func (s *Session) GuildMemberNickname(guildID, userID int64, nickname string) (err error)
- func (s *Session) GuildMemberNicknameMe(guildID int64, nickname string) (err error)
- func (s *Session) GuildMemberRoleAdd(guildID, userID, roleID int64) (err error)
- func (s *Session) GuildMemberRoleRemove(guildID, userID, roleID int64) (err error)
- func (s *Session) GuildMemberTimeout(guildID int64, userID int64, until *time.Time, reason string) (err error)
- func (s *Session) GuildMemberTimeoutWithReason(guildID int64, userID int64, until *time.Time, reason string) (err error)
- func (s *Session) GuildMemberVoiceState(guildID, userID int64) (voiceState *VoiceState, err error)
- func (s *Session) GuildMembers(guildID int64, after int64, limit int) (st []*Member, err error)
- func (s *Session) GuildPrune(guildID int64, days uint32) (count uint32, err error)
- func (s *Session) GuildPruneCount(guildID int64, days uint32) (count uint32, err error)
- func (s *Session) GuildRoleCreate(guildID int64) (st *Role, err error)
- func (s *Session) GuildRoleCreateComplex(guildID int64, roleCreate RoleCreate) (st *Role, err error)
- func (s *Session) GuildRoleDelete(guildID, roleID int64) (err error)
- func (s *Session) GuildRoleEdit(guildID, roleID int64, name string, color int, hoist bool, perm int64, ...) (st *Role, err error)
- func (s *Session) GuildRoleReorder(guildID int64, roles []*Role) (st []*Role, err error)
- func (s *Session) GuildRoles(guildID int64) (st []*Role, err error)
- func (s *Session) GuildSplash(guildID int64) (img image.Image, err error)
- func (s *Session) GuildThreadsActive(guildID int64) (threads *ThreadsList, err error)
- func (s *Session) GuildWebhooks(guildID int64) (st []*Webhook, err error)
- func (s *Session) GuildWithCounts(guildID int64) (st *Guild, err error)
- func (s *Session) HandleEvent(t string, i interface{})
- 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) MessageReactionAdd(channelID, messageID int64, emoji string) error
- func (s *Session) MessageReactionRemove(channelID, messageID int64, emoji string, userID int64) error
- func (s *Session) MessageReactionRemoveEmoji(channelID, messageID int64, emoji string) error
- func (s *Session) MessageReactionRemoveMe(channelID, messageID int64, emoji string) error
- func (s *Session) MessageReactions(channelID, messageID int64, emoji string, limit int, before, after int64) (st []*User, err error)
- func (s *Session) MessageReactionsRemoveAll(channelID, messageID int64) error
- func (s *Session) MessageThreadStart(channelID, messageID int64, name string, archiveDuration AutoArchiveDuration) (ch *Channel, err error)
- func (s *Session) MessageThreadStartComplex(channelID, messageID int64, data *ThreadStart) (ch *Channel, err error)
- func (s *Session) Open() error
- func (s *Session) RelationshipDelete(userID int64) (err error)
- func (s *Session) RelationshipFriendRequestAccept(userID int64) (err error)
- func (s *Session) RelationshipFriendRequestSend(userID int64) (err error)
- func (s *Session) RelationshipUserBlock(userID int64) (err error)
- func (s *Session) RelationshipsGet() (r []*Relationship, err error)
- func (s *Session) RelationshipsMutualGet(userID int64) (mf []*User, err error)
- func (s *Session) Request(method, urlStr string, data interface{}, headers map[string]string) (response []byte, err error)
- func (s *Session) RequestWithBucket(method, urlStr, contentType string, b []byte, headers map[string]string, ...) (response []byte, err error)
- func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, headers map[string]string, ...) (response []byte, err error)
- func (s *Session) SKUs(applicationID int64) (skus []*SKU, err error)
- func (s *Session) ThreadJoin(id int64) error
- func (s *Session) ThreadLeave(id int64) error
- func (s *Session) ThreadMember(threadID int64, memberID string, withMember bool) (member *ThreadMember, err error)
- func (s *Session) ThreadMemberAdd(threadID int64, memberID string) error
- func (s *Session) ThreadMemberRemove(threadID int64, memberID string) error
- func (s *Session) ThreadMembers(threadID int64, limit int, withMember bool, afterID string) (members []*ThreadMember, err error)
- func (s *Session) ThreadStart(channelID int64, name string, typ ChannelType, ...) (ch *Channel, err error)
- func (s *Session) ThreadStartComplex(channelID int64, data *ThreadStart) (ch *Channel, err error)
- func (s *Session) ThreadsActive(channelID int64) (threads *ThreadsList, err error)
- func (s *Session) ThreadsArchived(channelID int64, before *time.Time, limit int) (threads *ThreadsList, err error)
- func (s *Session) ThreadsPrivateArchived(channelID int64, before *time.Time, limit int) (threads *ThreadsList, err error)
- func (s *Session) ThreadsPrivateJoinedArchived(channelID int64, before *time.Time, limit int) (threads *ThreadsList, err error)
- func (s *Session) UpdateCompetingStatus(statusText string, statusType Status) (err error)
- func (s *Session) UpdateCustomStatus(statusText string, statusType Status) (err error)
- func (s *Session) UpdateListeningStatus(statusText string, statusType Status) (err error)
- func (s *Session) UpdatePlayingStatus(statusText string, statusType Status) (err error)
- func (s *Session) UpdateStatus(activityType ActivityType, statusType Status, statusText, streamingUrl string) (err error)
- func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error)
- func (s *Session) UpdateStreamingStatus(statusText string, statusType Status, url string) (err error)
- func (s *Session) UpdateWatchingStatus(statusText string, statusType Status) (err error)
- func (s *Session) User(userID int64) (st *User, err error)
- func (s *Session) UserAvatar(userID int64) (img image.Image, err error)
- func (s *Session) UserAvatarDecode(u *User) (img image.Image, err error)
- func (s *Session) UserChannelCreate(recipientID int64) (st *Channel, err error)
- func (s *Session) UserChannelPermissions(userID, channelID int64) (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 int64, settings *UserGuildSettingsEdit) (st *UserGuildSettings, err error)
- func (s *Session) UserGuilds(limit int, beforeID, afterID int64) (st []*UserGuild, err error)
- func (s *Session) UserMe() (st *User, err error)
- func (s *Session) UserNoteSet(userID int64, 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 int64) (st *Webhook, err error)
- func (s *Session) WebhookCreate(channelID int64, name, avatar string) (st *Webhook, err error)
- func (s *Session) WebhookDelete(webhookID int64) (err error)
- func (s *Session) WebhookDeleteWithToken(webhookID int64, token string) (st *Webhook, err error)
- func (s *Session) WebhookEdit(webhookID int64, name, avatar string, channelID int64) (st *Role, err error)
- func (s *Session) WebhookEditWithToken(webhookID int64, token, name, avatar string) (st *Role, err error)
- func (s *Session) WebhookExecute(webhookID int64, token string, wait bool, data *WebhookParams) (err error)
- func (s *Session) WebhookExecuteComplex(webhookID int64, token string, wait bool, data *WebhookParams) (m *Message, err error)
- func (s *Session) WebhookMessage(webhookID int64, token string, messageID int64) (message *Message, err error)
- func (s *Session) WebhookWithToken(webhookID int64, token string) (st *Webhook, err error)
- type SessionStartLimit
- type Settings
- type StageInstanceCreate
- type StageInstanceDelete
- type StageInstanceUpdate
- type State
- func (s *State) Channel(channelID int64) (*Channel, error)
- func (s *State) ChannelAdd(channel *Channel) error
- func (s *State) ChannelRemove(channel *Channel) error
- func (s *State) Emoji(guildID, emojiID int64) (*Emoji, error)
- func (s *State) EmojiAdd(guildID int64, emoji *Emoji) error
- func (s *State) EmojisAdd(guildID int64, emojis []*Emoji) error
- func (s *State) Guild(guildID int64) (*Guild, error)
- func (s *State) GuildAdd(guild *Guild) error
- func (s *State) GuildChannel(guildID, channelID int64) (*Channel, error)
- func (s *State) GuildRemove(guild *Guild) error
- func (s *State) Member(guildID, userID int64) (*Member, error)
- func (s *State) MemberAdd(member *Member) error
- func (s *State) MemberRemove(member *Member) error
- func (s *State) Message(channelID, messageID int64) (*Message, error)
- func (s *State) MessageAdd(message *Message) error
- func (s *State) MessageRemove(message *Message) error
- func (s *State) OnInterface(se *Session, i interface{}) (err error)
- func (s *State) Presence(guildID, userID int64) (*Presence, error)
- func (s *State) PresenceAdd(guildID int64, presence *Presence) error
- func (s *State) PresenceRemove(guildID int64, presence *Presence) error
- func (s *State) PrivateChannel(channelID int64) (*Channel, error)
- func (s *State) Role(guildID, roleID int64) (*Role, error)
- func (s *State) RoleAdd(guildID int64, role *Role) error
- func (s *State) RoleRemove(guildID, roleID int64) error
- func (s *State) UserChannelPermissions(userID, channelID int64) (apermissions int64, err error)
- func (s *State) UserColor(userID, channelID int64) int
- type Status
- type StdGatewayIdentifyRatleimiter
- type Sticker
- type StickerFormat
- type StickerItem
- type StickerPack
- type StickerType
- type Subscription
- type SubscriptionCreate
- type SubscriptionDelete
- type SubscriptionFilterOptions
- type SubscriptionStatus
- type SubscriptionUpdate
- type TextInput
- type TextInputStyle
- type ThreadCreate
- type ThreadDelete
- type ThreadListSync
- type ThreadMember
- type ThreadMemberUpdate
- type ThreadMembersUpdate
- type ThreadMetadata
- type ThreadStart
- type ThreadUpdate
- type ThreadsList
- type TimeStamps
- type Timestamp
- type TooManyRequests
- type TypingStart
- type UpdateStatusData
- type User
- type UserConnection
- type UserGuild
- type UserGuildSettings
- type UserGuildSettingsChannelOverride
- type UserGuildSettingsEdit
- type UserGuildSettingsUpdate
- type UserNoteUpdate
- type UserSettingsUpdate
- type UserUpdate
- type VerificationLevel
- type VoiceChannelStatusUpdate
- type VoiceConnection
- type VoiceICE
- type VoiceRegion
- type VoiceServerUpdate
- type VoiceSpeakingUpdate
- type VoiceSpeakingUpdateHandler
- type VoiceState
- type VoiceStateUpdate
- type Webhook
- type WebhookParams
- type WebhooksUpdate
Examples ¶
Constants ¶
const ( StringSelectMenu = SelectMenuType(SelectMenuComponent) UserSelectMenu = SelectMenuType(UserSelectMenuComponent) RoleSelectMenu = SelectMenuType(RoleSelectMenuComponent) MentionableSelectMenu = SelectMenuType(MentionableSelectMenuComponent) ChannelSelectMenu = SelectMenuType(ChannelSelectMenuComponent) )
SelectMenu types.
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 ( PermissionCreateInstantInvite int64 = 1 << 0 // Allows creation of instant invites T, V, S PermissionKickMembers int64 = 1 << 1 // Allows kicking members PermissionBanMembers int64 = 1 << 2 // Allows banning members PermissionAdministrator int64 = 1 << 3 // Allows all permissions and bypasses channel permission overwrites PermissionManageChannels int64 = 1 << 4 // Allows management and editing of channels T, V, S PermissionManageGuild int64 = 1 << 5 // Allows management and editing of the guild PermissionAddReactions int64 = 1 << 6 // Allows for the addition of reactions to messages T PermissionViewAuditLog int64 = 1 << 7 // Allows for viewing of audit logs PermissionPrioritySpeaker int64 = 1 << 8 // Allows for using priority speaker in a voice channel V PermissionStream int64 = 1 << 9 // Allows the user to go live V PermissionViewChannel int64 = 1 << 10 // Allows guild members to view a channel, which includes reading messages in text channels T, V, S PermissionSendMessages int64 = 1 << 11 // Allows for sending messages in a channel T PermissionSendTTSMessages int64 = 1 << 12 // Allows for sending of /tts messages T PermissionManageMessages int64 = 1 << 13 // Allows for deletion of other users messages T PermissionEmbedLinks int64 = 1 << 14 // Links sent by users with this permission will be auto-embedded T PermissionAttachFiles int64 = 1 << 15 // Allows for uploading images and files T PermissionReadMessageHistory int64 = 1 << 16 // Allows for reading of message history T PermissionMentionEveryone int64 = 1 << 17 // Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel T PermissionUseExternalEmojis int64 = 1 << 18 // Allows the usage of custom emojis from other servers T PermissionViewGuildInsights int64 = 1 << 19 // Allows for viewing guild insights PermissionVoiceConnect int64 = 1 << 20 // Allows for joining of a voice channel V, S PermissionVoiceSpeak int64 = 1 << 21 // Allows for speaking in a voice channel V PermissionVoiceMuteMembers int64 = 1 << 22 // Allows for muting members in a voice channel V, S PermissionVoiceDeafenMembers int64 = 1 << 23 // Allows for deafening of members in a voice channel V, S PermissionVoiceMoveMembers int64 = 1 << 24 // Allows for moving of members between voice channels V, S PermissionVoiceUseVAD int64 = 1 << 25 // Allows for using voice-activity-detection in a voice channel V PermissionChangeNickname int64 = 1 << 26 // Allows for modification of own nickname PermissionManageNicknames int64 = 1 << 27 // Allows for modification of other users nicknames PermissionManageRoles int64 = 1 << 28 // Allows management and editing of roles T, V, S PermissionManageWebhooks int64 = 1 << 29 // Allows management and editing of webhooks T PermissionManageGuildExpressions int64 = 1 << 30 // Allows management and editing of emojis and stickers PermissionUseApplicationCommands int64 = 1 << 31 // Allows members to use slash commands in text channels T PermissionRequestToSpeak int64 = 1 << 32 // Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.) S PermissionManageEvents int64 = 1 << 33 // Allows for creating, editing, and deleting scheduled events V, S PermissionManageThreads int64 = 1 << 34 // Allows for deleting and archiving threads, and viewing all private threads T PermissionUsePublicThreads int64 = 1 << 35 // Allows for creating and participating in threads T PermissionUsePrivateThreads int64 = 1 << 36 // Allows for creating and participating in private threads T PermissionUseExternalStickers int64 = 1 << 37 // Allows the usage of custom stickers from other servers T PermissionSendMessagesInThreads int64 = 1 << 38 // Allows for sending messages in threads T PermissionUseEmbeddedActivities int64 = 1 << 39 // Allows for using Activities (applications with the EMBEDDED flag) in a voice channel V PermissionModerateMembers int64 = 1 << 40 // Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels PermissionViewCreatorMonetizationAnalytics int64 = 1 << 41 // Allows for viewing role subscription insights PermissionUseSoundboard int64 = 1 << 42 // Allows for using soundboard in a voice channel V PermissionCreateGuildExpressions int64 = 1 << 43 // Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user PermissionCreateEvents int64 = 1 << 44 // Allows for creating scheduled events, and editing and deleting those created by the current user PermissionUseExternalSounds int64 = 1 << 45 // Allows the usage of custom soundboard sounds from other servers V PermissionSendVoiceMessages int64 = 1 << 46 // Allows sending voice messages T, V, S PermissionSendPolls int64 = 1 << 49 // Allows sending polls T, V, S )
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 ErrCodeBotsCannotUseEndpoint = 20001 ErrCodeOnlyBotsCanUseEndpoint = 20002 ErrCodeMaximumGuildsReached = 30001 ErrCodeMaximumFriendsReached = 30002 ErrCodeMaximumPinsReached = 30003 ErrCodeMaximumGuildRolesReached = 30005 ErrCodeTooManyReactions = 30010 ErrCodeMessageAlreadyCrossposted = 40033 ErrCodeMissingAccess = 50001 ErrCodeInvalidAccountType = 50002 ErrCodeCannotExecuteActionOnDMChannel = 50003 ErrCodeEmbedCisabled = 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 ( EntitlementTypePurchase = 1 EntitlementTypePremiumSubscription = 2 EntitlementTypeDeveloperGift = 3 EntitlementTypeTestModePurchase = 4 EntitlementTypeFreePurchase = 5 EntitlementTypeUserGift = 6 EntitlementTypePremiumPurchase = 7 EntitlementTypeApplicationSubscription = 8 )
Valid EntitlementType values
const InteractionDeadline = time.Second * 3
InteractionDeadline is the time allowed to respond to an interaction.
const MaxIntermediaryBuffersSize = 10000
max size of buffers before they're discarded (e.g after a big incmoing event)
const PermissionAll int64 = int64(^uint64(0) >> 1)
all bits set except the leftmost to avoid using negative numbers in case discord doesn't handle it
const VERSION = "unknown-jonas"
VERSION of DiscordGo, follows Semantic Versioning. (http://semver.org/)
Variables ¶
var ( EndpointStatus string EndpointSm string EndpointSmActive string EndpointSmUpcoming string EndpointDiscord string EndpointAPI string EndpointGuilds string EndpointChannels string EndpointUsers string EndpointGateway string EndpointGatewayBot string EndpointWebhooks string EndpointStickers string EndpointCDN string EndpointCDNAttachments string EndpointCDNAvatars string EndpointCDNGuilds string EndpointCDNIcons string EndpointCDNSplashes string EndpointCDNChannelIcons string EndpointCDNBanners string EndpointAuth string EndpointLogin string EndpointLogout string EndpointVerify string EndpointVerifyResend string EndpointForgotPassword string EndpointResetPassword string EndpointRegister string EndpointVoice string EndpointVoiceRegions string EndpointVoiceIce string EndpointTutorial string EndpointTutorialIndicators string EndpointTrack string EndpointSso string EndpointReport string EndpointIntegrations string EndpointUser = func(uID string) string { return "" } EndpointUserAvatar = func(uID int64, aID string) string { return "" } EndpointUserAvatarAnimated = func(uID int64, aID string) string { return "" } EndpointUserSettings = func(uID string) string { return "" } EndpointUserGuilds = func(uID string) string { return "" } EndpointUserGuild = func(uID string, gID int64) string { return "" } EndpointUserGuildSettings = func(uID string, gID int64) string { return "" } EndpointUserChannels = func(uID string) string { return "" } EndpointUserDevices = func(uID string) string { return "" } EndpointUserConnections = func(uID string) string { return "" } EndpointUserNotes = func(uID int64) string { return "" } EndpointGuild = func(gID int64) string { return "" } EndpointGuildChannels = func(gID int64) string { return "" } EndpointGuildMembers = func(gID int64) string { return "" } EndpointGuildMember = func(gID int64, uID int64) string { return "" } EndpointGuildMemberAvatar = func(gID, uID int64, aID string) string { return "" } EndpointGuildMemberAvatarAnimated = func(gID, uID int64, aID string) string { return "" } EndpointGuildMemberMe = func(gID int64) string { return "" } EndpointGuildMemberVoiceState = func(gID, uID int64) string { return "" } EndpointGuildMemberRole = func(gID, uID, rID int64) string { return "" } EndpointGuildBans = func(gID int64) string { return "" } EndpointGuildBan = func(gID, uID int64) string { return "" } EndpointGuildIntegrations = func(gID int64) string { return "" } EndpointGuildIntegration = func(gID, iID int64) string { return "" } EndpointGuildIntegrationSync = func(gID, iID int64) string { return "" } EndpointGuildRoles = func(gID int64) string { return "" } EndpointGuildRole = func(gID, rID int64) string { return "" } EndpointGuildInvites = func(gID int64) string { return "" } EndpointGuildEmbed = func(gID int64) string { return "" } EndpointGuildPrune = func(gID int64) string { return "" } EndpointGuildIcon = func(gID int64, hash string) string { return "" } EndpointGuildIconAnimated = func(gID int64, hash string) string { return "" } EndpointGuildSplash = func(gID int64, hash string) string { return "" } EndpointGuildWebhooks = func(gID int64) string { return "" } EndpointGuildAuditLogs = func(gID int64) string { return "" } EndpointGuildEmojis = func(gID int64) string { return "" } EndpointGuildEmoji = func(gID, eID int64) string { return "" } EndpointGuildBanner = func(gID int64, hash string) string { return "" } EndpointGuildBannerAnimated = func(gID int64, hash string) string { return "" } EndpointGuildThreads = func(gID int64) string { return "" } EndpointGuildActiveThreads = func(gID int64) string { return "" } EndpointGuildStickers = func(gID int64) string { return "" } EndpointGuildSticker = func(gID, sID int64) string { return "" } EndpointChannel = func(cID int64) string { return "" } EndpointChannelThreads = func(cID int64) string { return "" } EndpointChannelActiveThreads = func(cID int64) string { return "" } EndpointChannelPublicArchivedThreads = func(cID int64) string { return "" } EndpointChannelPrivateArchivedThreads = func(cID int64) string { return "" } EndpointChannelJoinedPrivateArchivedThreads = func(cID int64) string { return "" } EndpointChannelPermissions = func(cID int64) string { return "" } EndpointChannelPermission = func(cID, tID int64) string { return "" } EndpointChannelInvites = func(cID int64) string { return "" } EndpointChannelTyping = func(cID int64) string { return "" } EndpointChannelMessages = func(cID int64) string { return "" } EndpointChannelMessage = func(cID, mID int64) string { return "" } EndpointChannelMessageAck = func(cID, mID int64) string { return "" } EndpointChannelMessagesBulkDelete = func(cID int64) string { return "" } EndpointChannelMessagesPins = func(cID int64) string { return "" } EndpointChannelMessagePin = func(cID, mID int64) string { return "" } EndpointChannelMessageCrosspost = func(cID, mID int64) string { return "" } EndpointChannelMessageThread = func(cID, mID int64) string { return "" } EndpointThreadMembers = func(tID int64) string { return "" } EndpointThreadMember = func(tID int64, mID string) string { return "" } EndpointGroupIcon = func(cID int64, hash string) string { return "" } EndpointSticker = func(sID int64) string { return "" } EndpointNitroStickersPacks string EndpointChannelWebhooks = func(cID int64) string { return "" } EndpointWebhook = func(wID int64) string { return "" } EndpointWebhookToken = func(wID int64, token string) string { return "" } EndpointWebhookMessage = func(wID int64, token, mID string) string { return "" } EndpointDefaultUserAvatar = func(index int) string { return "" } EndpointMessageReactionsAll = func(cID, mID int64) string { return "" } EndpointMessageReactions = func(cID, mID int64, emoji EmojiName) string { return "" } EndpointMessageReaction = func(cID, mID int64, emoji EmojiName, uID string) string { return "" } EndpointRelationships = func() string { return "" } EndpointRelationship = func(uID int64) string { return "" } EndpointRelationshipsMutual = func(uID int64) string { return "" } EndpointGuildCreate = "" EndpointInvite = func(iID string) string { return "" } EndpointIntegrationsJoin = func(iID string) string { return "" } EndpointEmoji = func(eID int64) string { return "" } EndpointEmojiAnimated = func(eID int64) string { return "" } EndpointOauth2 = "" EndpointApplications = "" EndpointApplication = func(aID int64) string { return "" } EndpointApplicationMe = "" EndpointApplicationsBot = func(aID int64) string { return "" } EndpointApplicationNonOauth2 = func(aID int64) string { return "" } EndpointApplicationCommands = func(aID int64) string { return "" } EndpointApplicationCommand = func(aID int64, cmdID int64) string { return "" } EndpointApplicationGuildCommands = func(aID int64, gID int64) string { return "" } EndpointApplicationGuildCommand = func(aID int64, gID int64, cmdID int64) string { return "" } EndpointApplicationGuildCommandsPermissions = func(aID int64, gID int64) string { return "" } EndpointApplicationGuildCommandPermissions = func(aID int64, gID int64, cmdID int64) string { return "" } EndpointInteractions = "" EndpointInteractionCallback = func(interactionID int64, token string) string { return "" } EndpointWebhookInteraction = func(applicationID int64, token string) string { return "" } EndpointInteractionOriginalMessage = func(applicationID int64, token string) string { return "" } EndpointInteractionFollowupMessage = func(applicationID int64, token string, messageID int64) string { return "" } EndpointSKUs = func(applicationID int64) string { return "" } EndpointEntitlements = func(applicationID int64) string { return "" } EndpointEntitlement = func(applicationID, entitlementID int64) string { return "" } EndpointEntitlementConsume = func(applicationID, entitlementID int64) string { return "" } EndpointSKUSubscriptions = func(skuID int64) string { return "" } EndpointSKUSubscription = func(skuID, subscriptionID int64) string { return "" } )
Known Discord API Endpoints.
var ( ErrBadAuth = errors.New("authentication failed") ErrInvalidIntent = errors.New("one of the gateway intents passed was invalid") ErrDisabledIntent = errors.New("an intent you specified has not been enabled or not been whitelisted for") ErrInvalidShard = errors.New("you specified a invalid sharding setup") )
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") ErrTokenInvalid = errors.New("Invalid token provided, it has been marked as invalid") )
All error constants
var APIVersion = "10"
APIVersion is the Discord API version used for the REST and Websocket API.
var AllPermissions = []int64{ PermissionAdministrator, PermissionManageGuild, PermissionViewGuildInsights, PermissionViewCreatorMonetizationAnalytics, PermissionViewChannel, PermissionSendMessages, PermissionSendTTSMessages, PermissionManageMessages, PermissionEmbedLinks, PermissionAttachFiles, PermissionReadMessageHistory, PermissionMentionEveryone, PermissionUseExternalEmojis, PermissionUseExternalStickers, PermissionUseApplicationCommands, PermissionUseEmbeddedActivities, PermissionUseSoundboard, PermissionUseExternalSounds, PermissionSendVoiceMessages, PermissionSendPolls, PermissionVoiceConnect, PermissionVoiceSpeak, PermissionVoiceMuteMembers, PermissionVoiceDeafenMembers, PermissionVoiceMoveMembers, PermissionVoiceUseVAD, PermissionPrioritySpeaker, PermissionRequestToSpeak, PermissionStream, PermissionChangeNickname, PermissionManageNicknames, PermissionManageRoles, PermissionManageWebhooks, PermissionManageGuildExpressions, PermissionCreateInstantInvite, PermissionModerateMembers, PermissionKickMembers, PermissionBanMembers, PermissionManageChannels, PermissionManageEvents, PermissionCreateGuildExpressions, PermissionCreateEvents, PermissionManageThreads, PermissionUsePublicThreads, PermissionUsePrivateThreads, PermissionSendMessagesInThreads, PermissionAddReactions, PermissionViewAuditLog, }
var (
ErrAlreadyOpen = errors.New("connection already open")
)
var ErrMFA = errors.New("account has 2FA enabled")
ErrMFA will be risen by New when the user has 2FA.
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 ErrTimeoutWaitingForVoice = errors.New("timeout waiting for voice")
var GatewayLogger func(shardID int, connID int, msgL int, format string, a ...interface{})
var Locales = map[Locale]string{ EnglishUS: "English (United States)", EnglishGB: "English (Great Britain)", Bulgarian: "Bulgarian", ChineseCN: "Chinese (China)", ChineseTW: "Chinese (Taiwan)", Croatian: "Croatian", Czech: "Czech", Danish: "Danish", Dutch: "Dutch", Finnish: "Finnish", French: "French", German: "German", Greek: "Greek", Hindi: "Hindi", Hungarian: "Hungarian", Italian: "Italian", Japanese: "Japanese", Korean: "Korean", Lithuanian: "Lithuanian", Norwegian: "Norwegian", Polish: "Polish", PortugueseBR: "Portuguese (Brazil)", Romanian: "Romanian", Russian: "Russian", SpanishES: "Spanish (Spain)", Swedish: "Swedish", Thai: "Thai", Turkish: "Turkish", Ukrainian: "Ukrainian", Vietnamese: "Vietnamese", Unknown: "unknown", }
Locales is a map of all the languages codes to their names.
var Logger func(msgL, caller int, format string, a ...interface{})
Logger can be used to replace the standard logging for discordgo
Functions ¶
func CreateEndpoints ¶
func CreateEndpoints(base string)
func GetEventInterface ¶
func GetEventInterface(evtType string) interface{}
func IsEmbedEmpty ¶ added in v2.3.1
func IsEmbedEmpty(embed *MessageEmbed) bool
func MemberPermissions ¶
Calculates the permissions for a member. https://support.discordapp.com/hc/en-us/articles/206141927-How-is-the-permission-hierarchy-structured-
func MultipartBodyWithJSON ¶ added in v2.3.0
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 PermissionName ¶ added in v2.39.0
func VerifyInteraction ¶ added in v2.3.0
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 ¶
An APIErrorMessage is an api error message returned from discord
type ActionsRow ¶ added in v2.3.0
type ActionsRow struct {
Components []MessageComponent `json:"components"`
}
ActionsRow is a container for components within one row.
func (ActionsRow) MarshalJSON ¶ added in v2.3.0
func (r ActionsRow) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling ActionsRow to a JSON object.
func (ActionsRow) Type ¶ added in v2.3.0
func (r ActionsRow) Type() ComponentType
Type is a method to get the type of a component.
func (*ActionsRow) UnmarshalJSON ¶ added in v2.3.0
func (r *ActionsRow) UnmarshalJSON(data []byte) error
UnmarshalJSON is a helper function to unmarshal Actions Row.
type Activities ¶
type Activities []*Activity
func (*Activities) UnmarshalJSONArray ¶
func (a *Activities) UnmarshalJSONArray(dec *gojay.Decoder) error
type Activity ¶ added in v2.31.0
type Activity struct { Name string `json:"name"` Type ActivityType `json:"type"` URL string `json:"url,omitempty"` Details string `json:"details,omitempty"` State string `json:"state,omitempty"` TimeStamps TimeStamps `json:"timestamps,omitempty"` Assets Assets `json:"assets,omitempty"` Instance int8 `json:"instance,omitempty"` }
An Activity struct holds data about a user's activity.
type ActivityType ¶ added in v2.31.0
type ActivityType int
ActivityType is the type of presence (see ActivityType* consts) in the Activity struct
const ( ActivityTypePlaying ActivityType = iota ActivityTypeStreaming ActivityTypeListening ActivityTypeWatching ActivityTypeCustom ActivityTypeCompeting )
Valid ActivityType values
type AddedThreadMember ¶ added in v2.34.0
type AddedThreadMember struct { *ThreadMember Member *Member `json:"member"` Presence *Presence `json:"presence"` }
AddedThreadMember holds information about the user who was added to the thread
type AllowedMentionType ¶
type AllowedMentionType string
const ( AllowedMentionTypeRoles AllowedMentionType = "roles" AllowedMentionTypeUsers AllowedMentionType = "users" AllowedMentionTypeEveryone AllowedMentionType = "everyone" )
type AllowedMentions ¶
type AllowedMentions struct { // Allowed mention types to parse from message content Parse []AllowedMentionType `json:"parse"` // Slice of role ids to mention Roles IDSlice `json:"roles"` // Slice of users to mention Users IDSlice `json:"users"` RepliedUser bool `json:"replied_user"` }
type Application ¶
type Application struct { ID int64 `json:"id,string,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"` }
An Application struct stores values for a Discord OAuth2 Application
Example ¶
package main import ( "log" "os" "github.com/botlabs-gg/yagpdb/v2/lib/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) }
Output:
type ApplicationCommand ¶
type ApplicationCommand struct { ID int64 `json:"id,string,omitempty"` ApplicationID int64 `json:"application_id,string,omitempty"` Version string `json:"version,omitempty"` Type ApplicationCommandType `json:"type,omitempty"` Name string `json:"name"` NameLocalizations *map[Locale]string `json:"name_localizations,omitempty"` DefaultPermission *bool `json:"default_permission,omitempty"` Description string `json:"description,omitempty"` DescriptionLocalizations *map[Locale]string `json:"description_localizations,omitempty"` Options []*ApplicationCommandOption `json:"options"` NSFW bool `json:"nsfw,omitempty"` }
ApplicationCommand represents an application's slash command.
type ApplicationCommandCreate ¶
type ApplicationCommandCreate struct { GuildID int64 `json:"guild_id,string"` ApplicationCommand }
new Slash Command was created
type ApplicationCommandDelete ¶
type ApplicationCommandDelete struct { GuildID int64 `json:"guild_id,string"` ApplicationCommand }
Slash Command was deleted
type ApplicationCommandInteractionData ¶
type ApplicationCommandInteractionData struct { ID int64 `json:"id,string"` 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 int64 `json:"target_id,string"` }
ApplicationCommandInteractionData contains the data of application command interaction.
func (ApplicationCommandInteractionData) Type ¶ added in v2.3.0
func (ApplicationCommandInteractionData) Type() InteractionType
Type returns the type of interaction data.
type ApplicationCommandInteractionDataOption ¶
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 v2.3.0
func (o ApplicationCommandInteractionDataOption) BoolValue() bool
BoolValue is a utility function for casting option value to bool
func (ApplicationCommandInteractionDataOption) ChannelValue ¶ added in v2.3.0
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 v2.3.0
func (o ApplicationCommandInteractionDataOption) FloatValue() float64
FloatValue is a utility function for casting option value to float
func (ApplicationCommandInteractionDataOption) IntValue ¶ added in v2.3.0
func (o ApplicationCommandInteractionDataOption) IntValue() int64
IntValue is a utility function for casting option value to integer
func (ApplicationCommandInteractionDataOption) RoleValue ¶ added in v2.3.0
func (o ApplicationCommandInteractionDataOption) RoleValue(s *Session, gID int64) *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 v2.3.0
func (o ApplicationCommandInteractionDataOption) StringValue() string
StringValue is a utility function for casting option value to string
func (ApplicationCommandInteractionDataOption) UintValue ¶ added in v2.3.0
func (o ApplicationCommandInteractionDataOption) UintValue() uint64
UintValue is a utility function for casting option value to unsigned integer
func (*ApplicationCommandInteractionDataOption) UnmarshalJSON ¶
func (a *ApplicationCommandInteractionDataOption) UnmarshalJSON(b []byte) error
func (ApplicationCommandInteractionDataOption) UserValue ¶ added in v2.3.0
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 ¶
type ApplicationCommandInteractionDataResolved struct { Users map[int64]*User `json:"users"` Members map[int64]*Member `json:"members"` Roles map[int64]*Role `json:"roles"` Channels map[int64]*Channel `json:"channels"` Messages map[int64]*Message `json:"messages"` Attachments map[int64]*MessageAttachment `json:"attachments"` }
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.
func (*ApplicationCommandInteractionDataResolved) UnmarshalJSON ¶
func (a *ApplicationCommandInteractionDataResolved) UnmarshalJSON(b []byte) error
type ApplicationCommandOption ¶
type ApplicationCommandOption struct { Type ApplicationCommandOptionType `json:"type"` Name string `json:"name"` NameLocalizations map[Locale]string `json:"name_localizations,omitempty"` Description string `json:"description,omitempty"` DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"` 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"` // Minimal value of number/integer option. MinValue *float64 `json:"min_value,omitempty"` // Maximum value of number/integer option. MaxValue float64 `json:"max_value,omitempty"` }
ApplicationCommandOption represents an option/subcommand/subcommands group.
type ApplicationCommandOptionChoice ¶
type ApplicationCommandOptionChoice struct { Name string `json:"name"` NameLocalizations map[Locale]string `json:"name_localizations,omitempty"` Value interface{} `json:"value"` }
ApplicationCommandOptionChoice represents a slash command option choice.
type ApplicationCommandOptionType ¶
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 ApplicationCommandOptionNumber ApplicationCommandOptionType = 10 ApplicationCommandOptionAttachment ApplicationCommandOptionType = 11 )
Application command option types.
func (ApplicationCommandOptionType) String ¶ added in v2.3.0
func (t ApplicationCommandOptionType) String() string
type ApplicationCommandPermissionType ¶
type ApplicationCommandPermissionType uint8
ApplicationCommandPermissionType indicates whether a permission is user or role based.
const ( ApplicationCommandPermissionTypeRole ApplicationCommandPermissionType = 1 ApplicationCommandPermissionTypeUser ApplicationCommandPermissionType = 2 )
Application command permission types.
type ApplicationCommandPermissions ¶
type ApplicationCommandPermissions struct { ID int64 `json:"id,string"` Type ApplicationCommandPermissionType `json:"type"` Permission bool `json:"permission"` }
ApplicationCommandPermissions represents a single user or role permission for a command.
type ApplicationCommandPermissionsList ¶ added in v2.3.0
type ApplicationCommandPermissionsList struct {
Permissions []*ApplicationCommandPermissions `json:"permissions"`
}
ApplicationCommandPermissionsList represents a list of ApplicationCommandPermissions, needed for serializing to JSON.
type ApplicationCommandPermissionsUpdate ¶ added in v2.17.0
type ApplicationCommandPermissionsUpdate struct {
*GuildApplicationCommandPermissions
}
ApplicationCommandPermissionsUpdate is the data for an ApplicationCommandPermissionsUpdate event
type ApplicationCommandType ¶ added in v2.3.0
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 ApplicationCommandUpdate ¶
type ApplicationCommandUpdate struct { GuildID int64 `json:"guild_id,string"` ApplicationCommand }
Slash Command was updated
type Assets ¶
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 v2.17.0
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 AuditLogActionMemberMove AuditLogAction = 26 AuditLogActionMemberDisconnect AuditLogAction = 27 AuditLogActionBotAdd AuditLogAction = 28 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 AuditLogActionStageInstanceCreate AuditLogAction = 83 AuditLogActionStageInstanceUpdate AuditLogAction = 84 AuditLogActionStageInstanceDelete AuditLogAction = 85 AuditLogActionStickerCreate AuditLogAction = 90 AuditLogActionStickerUpdate AuditLogAction = 91 AuditLogActionStickerDelete AuditLogAction = 92 AuditLogGuildScheduledEventCreate AuditLogAction = 100 AuditLogGuildScheduledEventUpdare AuditLogAction = 101 AuditLogGuildScheduledEventDelete AuditLogAction = 102 AuditLogActionThreadCreate AuditLogAction = 110 AuditLogActionThreadUpdate AuditLogAction = 111 AuditLogActionThreadDelete AuditLogAction = 112 AuditLogActionApplicationCommandPermissionUpdate AuditLogAction = 121 AuditLogActionAutoModerationRuleCreate AuditLogAction = 140 AuditLogActionAutoModerationRuleUpdate AuditLogAction = 141 AuditLogActionAutoModerationRuleDelete AuditLogAction = 142 AuditLogActionAutoModerationBlockMessage AuditLogAction = 143 AuditLogActionAutoModerationFlagToChannel AuditLogAction = 144 AuditLogActionAutoModerationUserCommunicationDisabled AuditLogAction = 145 )
Block contains Discord Audit Log Action Types
type AuditLogChange ¶ added in v2.17.0
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 v2.17.0
type AuditLogChangeKey string
AuditLogChangeKey value for AuditLogChange https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key
const ( // AuditLogChangeKeyAfkChannelID is sent when afk channel changed (snowflake) - guild AuditLogChangeKeyAfkChannelID AuditLogChangeKey = "afk_channel_id" // AuditLogChangeKeyAfkTimeout is sent when afk timeout duration changed (int) - guild AuditLogChangeKeyAfkTimeout AuditLogChangeKey = "afk_timeout" // AuditLogChangeKeyAllow is sent when a permission on a text or voice channel was allowed for a role (string) - role AuditLogChangeKeyAllow AuditLogChangeKey = "allow" // AudirChangeKeyApplicationID is sent when application id of the added or removed webhook or bot (snowflake) - channel AuditLogChangeKeyApplicationID AuditLogChangeKey = "application_id" // AuditLogChangeKeyArchived is sent when thread was archived/unarchived (bool) - thread AuditLogChangeKeyArchived AuditLogChangeKey = "archived" // AuditLogChangeKeyAsset is sent when asset is changed (string) - sticker AuditLogChangeKeyAsset AuditLogChangeKey = "asset" // AuditLogChangeKeyAutoArchiveDuration is sent when auto archive duration changed (int) - thread AuditLogChangeKeyAutoArchiveDuration AuditLogChangeKey = "auto_archive_duration" // AuditLogChangeKeyAvailable is sent when availability of sticker changed (bool) - sticker AuditLogChangeKeyAvailable AuditLogChangeKey = "available" // AuditLogChangeKeyAvatarHash is sent when user avatar changed (string) - user AuditLogChangeKeyAvatarHash AuditLogChangeKey = "avatar_hash" // AuditLogChangeKeyBannerHash is sent when guild banner changed (string) - guild AuditLogChangeKeyBannerHash AuditLogChangeKey = "banner_hash" // AuditLogChangeKeyBitrate is sent when voice channel bitrate changed (int) - channel AuditLogChangeKeyBitrate AuditLogChangeKey = "bitrate" // AuditLogChangeKeyChannelID is sent when channel for invite code or guild scheduled event changed (snowflake) - invite or guild scheduled event AuditLogChangeKeyChannelID AuditLogChangeKey = "channel_id" // AuditLogChangeKeyCode is sent when invite code changed (string) - invite AuditLogChangeKeyCode AuditLogChangeKey = "code" // AuditLogChangeKeyColor is sent when role color changed (int) - role AuditLogChangeKeyColor AuditLogChangeKey = "color" // AuditLogChangeKeyCommunicationDisabledUntil is sent when member timeout state changed (ISO8601 timestamp) - member AuditLogChangeKeyCommunicationDisabledUntil AuditLogChangeKey = "communication_disabled_until" // AuditLogChangeKeyDeaf is sent when user server deafened/undeafened (bool) - member AuditLogChangeKeyDeaf AuditLogChangeKey = "deaf" // AuditLogChangeKeyDefaultAutoArchiveDuration is sent when default auto archive duration for newly created threads changed (int) - channel AuditLogChangeKeyDefaultAutoArchiveDuration AuditLogChangeKey = "default_auto_archive_duration" // AuditLogChangeKeyDefaultMessageNotification is sent when default message notification level changed (int) - guild AuditLogChangeKeyDefaultMessageNotification AuditLogChangeKey = "default_message_notifications" // AuditLogChangeKeyDeny is sent when a permission on a text or voice channel was denied for a role (string) - role AuditLogChangeKeyDeny AuditLogChangeKey = "deny" // AuditLogChangeKeyDescription is sent when description changed (string) - guild, sticker, or guild scheduled event AuditLogChangeKeyDescription AuditLogChangeKey = "description" // AuditLogChangeKeyDiscoverySplashHash is sent when discovery splash changed (string) - guild AuditLogChangeKeyDiscoverySplashHash AuditLogChangeKey = "discovery_splash_hash" // AuditLogChangeKeyEnableEmoticons is sent when integration emoticons enabled/disabled (bool) - integration AuditLogChangeKeyEnableEmoticons AuditLogChangeKey = "enable_emoticons" // AuditLogChangeKeyEntityType is sent when entity type of guild scheduled event was changed (int) - guild scheduled event AuditLogChangeKeyEntityType AuditLogChangeKey = "entity_type" // AuditLogChangeKeyExpireBehavior is sent when integration expiring subscriber behavior changed (int) - integration AuditLogChangeKeyExpireBehavior AuditLogChangeKey = "expire_behavior" // AuditLogChangeKeyExpireGracePeriod is sent when integration expire grace period changed (int) - integration AuditLogChangeKeyExpireGracePeriod AuditLogChangeKey = "expire_grace_period" // AuditLogChangeKeyExplicitContentFilter is sent when change in whose messages are scanned and deleted for explicit content in the server is made (int) - guild AuditLogChangeKeyExplicitContentFilter AuditLogChangeKey = "explicit_content_filter" // AuditLogChangeKeyFormatType is sent when format type of sticker changed (int - sticker format type) - sticker AuditLogChangeKeyFormatType AuditLogChangeKey = "format_type" // AuditLogChangeKeyGuildID is sent when guild sticker is in changed (snowflake) - sticker AuditLogChangeKeyGuildID AuditLogChangeKey = "guild_id" // AuditLogChangeKeyHoist is sent when role is now displayed/no longer displayed separate from online users (bool) - role AuditLogChangeKeyHoist AuditLogChangeKey = "hoist" // AuditLogChangeKeyIconHash is sent when icon changed (string) - guild or role AuditLogChangeKeyIconHash AuditLogChangeKey = "icon_hash" // AuditLogChangeKeyID is sent when the id of the changed entity - sometimes used in conjunction with other keys (snowflake) - any AuditLogChangeKeyID AuditLogChangeKey = "id" // AuditLogChangeKeyInvitable is sent when private thread is now invitable/uninvitable (bool) - thread AuditLogChangeKeyInvitable AuditLogChangeKey = "invitable" // AuditLogChangeKeyInviterID is sent when person who created invite code changed (snowflake) - invite AuditLogChangeKeyInviterID AuditLogChangeKey = "inviter_id" // AuditLogChangeKeyLocation is sent when channel id for guild scheduled event changed (string) - guild scheduled event AuditLogChangeKeyLocation AuditLogChangeKey = "location" // AuditLogChangeKeyLocked is sent when thread was locked/unlocked (bool) - thread AuditLogChangeKeyLocked AuditLogChangeKey = "locked" // AuditLogChangeKeyMaxAge is sent when invite code expiration time changed (int) - invite AuditLogChangeKeyMaxAge AuditLogChangeKey = "max_age" // AuditLogChangeKeyMaxUses is sent when max number of times invite code can be used changed (int) - invite AuditLogChangeKeyMaxUses AuditLogChangeKey = "max_uses" // AuditLogChangeKeyMentionable is sent when role is now mentionable/unmentionable (bool) - role AuditLogChangeKeyMentionable AuditLogChangeKey = "mentionable" // AuditLogChangeKeyMfaLevel is sent when two-factor auth requirement changed (int - mfa level) - guild AuditLogChangeKeyMfaLevel AuditLogChangeKey = "mfa_level" // AuditLogChangeKeyMute is sent when user server muted/unmuted (bool) - member AuditLogChangeKeyMute AuditLogChangeKey = "mute" // AuditLogChangeKeyName is sent when name changed (string) - any AuditLogChangeKeyName AuditLogChangeKey = "name" // AuditLogChangeKeyNick is sent when user nickname changed (string) - member AuditLogChangeKeyNick AuditLogChangeKey = "nick" // AuditLogChangeKeyNSFW is sent when channel nsfw restriction changed (bool) - channel AuditLogChangeKeyNSFW AuditLogChangeKey = "nsfw" // AuditLogChangeKeyOwnerID is sent when owner changed (snowflake) - guild AuditLogChangeKeyOwnerID AuditLogChangeKey = "owner_id" // AuditLogChangeKeyPermissionOverwrite is sent when permissions on a channel changed (array of channel overwrite objects) - channel AuditLogChangeKeyPermissionOverwrite AuditLogChangeKey = "permission_overwrites" // AuditLogChangeKeyPermissions is sent when permissions for a role changed (string) - role AuditLogChangeKeyPermissions AuditLogChangeKey = "permissions" // AuditLogChangeKeyPosition is sent when text or voice channel position changed (int) - channel AuditLogChangeKeyPosition AuditLogChangeKey = "position" // AuditLogChangeKeyPreferredLocale is sent when preferred locale changed (string) - guild AuditLogChangeKeyPreferredLocale AuditLogChangeKey = "preferred_locale" // AuditLogChangeKeyPrivacylevel is sent when privacy level of the stage instance changed (integer - privacy level) - stage instance or guild scheduled event AuditLogChangeKeyPrivacylevel AuditLogChangeKey = "privacy_level" // AuditLogChangeKeyPruneDeleteDays is sent when number of days after which inactive and role-unassigned members are kicked changed (int) - guild AuditLogChangeKeyPruneDeleteDays AuditLogChangeKey = "prune_delete_days" // AuditLogChangeKeyPulibUpdatesChannelID is sent when id of the public updates channel changed (snowflake) - guild AuditLogChangeKeyPulibUpdatesChannelID AuditLogChangeKey = "public_updates_channel_id" // AuditLogChangeKeyRateLimitPerUser is sent when amount of seconds a user has to wait before sending another message changed (int) - channel AuditLogChangeKeyRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user" // AuditLogChangeKeyRegion is sent when region changed (string) - guild AuditLogChangeKeyRegion AuditLogChangeKey = "region" // AuditLogChangeKeyRulesChannelID is sent when id of the rules channel changed (snowflake) - guild AuditLogChangeKeyRulesChannelID AuditLogChangeKey = "rules_channel_id" // AuditLogChangeKeySplashHash is sent when invite splash page artwork changed (string) - guild AuditLogChangeKeySplashHash AuditLogChangeKey = "splash_hash" // AuditLogChangeKeyStatus is sent when status of guild scheduled event was changed (int - guild scheduled event status) - guild scheduled event AuditLogChangeKeyStatus AuditLogChangeKey = "status" // AuditLogChangeKeySystemChannelID is sent when id of the system channel changed (snowflake) - guild AuditLogChangeKeySystemChannelID AuditLogChangeKey = "system_channel_id" // AuditLogChangeKeyTags is sent when related emoji of sticker changed (string) - sticker AuditLogChangeKeyTags AuditLogChangeKey = "tags" // AuditLogChangeKeyTemporary is sent when invite code is now temporary or never expires (bool) - invite AuditLogChangeKeyTemporary AuditLogChangeKey = "temporary" // TODO: remove when compatibility is not required AuditLogChangeKeyTempoary = AuditLogChangeKeyTemporary // AuditLogChangeKeyTopic is sent when text channel topic or stage instance topic changed (string) - channel or stage instance AuditLogChangeKeyTopic AuditLogChangeKey = "topic" // AuditLogChangeKeyType is sent when type of entity created (int or string) - any AuditLogChangeKeyType AuditLogChangeKey = "type" // AuditLogChangeKeyUnicodeEmoji is sent when role unicode emoji changed (string) - role AuditLogChangeKeyUnicodeEmoji AuditLogChangeKey = "unicode_emoji" // AuditLogChangeKeyUserLimit is sent when new user limit in a voice channel set (int) - voice channel AuditLogChangeKeyUserLimit AuditLogChangeKey = "user_limit" // AuditLogChangeKeyUses is sent when number of times invite code used changed (int) - invite AuditLogChangeKeyUses AuditLogChangeKey = "uses" // AuditLogChangeKeyVanityURLCode is sent when guild invite vanity url changed (string) - guild AuditLogChangeKeyVanityURLCode AuditLogChangeKey = "vanity_url_code" // AuditLogChangeKeyVerificationLevel is sent when required verification level changed (int - verification level) - guild AuditLogChangeKeyVerificationLevel AuditLogChangeKey = "verification_level" // AuditLogChangeKeyWidgetChannelID is sent when channel id of the server widget changed (snowflake) - guild AuditLogChangeKeyWidgetChannelID AuditLogChangeKey = "widget_channel_id" // AuditLogChangeKeyWidgetEnabled is sent when server widget enabled/disabled (bool) - guild AuditLogChangeKeyWidgetEnabled AuditLogChangeKey = "widget_enabled" // AuditLogChangeKeyRoleAdd is sent when new role added (array of partial role objects) - guild AuditLogChangeKeyRoleAdd AuditLogChangeKey = "$add" // AuditLogChangeKeyRoleRemove is sent when role removed (array of partial role objects) - guild AuditLogChangeKeyRoleRemove AuditLogChangeKey = "$remove" )
Block of valid AuditLogChangeKey
type AuditLogEntry ¶
type AuditLogEntry struct { TargetID int64 `json:"target_id,string"` Changes []*AuditLogChange `json:"changes"` UserID int64 `json:"user_id,string"` ID int64 `json:"id,string"` 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 v2.17.0
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 v2.17.0
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 AutoArchiveDuration ¶ added in v2.40.0
type AutoArchiveDuration int
the thread will stop showing in the channel list after auto_archive_duration minutes of inactivity, can be set to: 60, 1440, 4320, 10080
const ( AutoArchiveDurationOneHour AutoArchiveDuration = 60 AutoArchiveDurationOneDay AutoArchiveDuration = 1440 AutoArchiveDurationThreeDays AutoArchiveDuration = 4320 AutoArchiveDurationOneWeek AutoArchiveDuration = 10080 )
type AutoModerationAction ¶ added in v2.17.0
type AutoModerationAction struct { Type AutoModerationActionType `json:"type"` Metadata *AutoModerationActionMetadata `json:"metadata,omitempty"` }
AutoModerationAction stores data for an auto moderation action.
type AutoModerationActionExecution ¶ added in v2.17.0
type AutoModerationActionExecution struct { GuildID int64 `json:"guild_id,string"` Action AutoModerationAction `json:"action"` RuleID int64 `json:"rule_id,string"` RuleTriggerType AutoModerationRuleTriggerType `json:"rule_trigger_type"` UserID int64 `json:"user_id,string"` ChannelID int64 `json:"channel_id,string"` MessageID int64 `json:"message_id,string"` AlertSystemMessageID int64 `json:"alert_system_message_id,string"` Content string `json:"content"` MatchedKeyword string `json:"matched_keyword"` MatchedContent string `json:"matched_content"` }
AutoModerationActionExecution is the data for an AutoModerationActionExecution event.
func (*AutoModerationActionExecution) GetGuildID ¶ added in v2.25.0
func (e *AutoModerationActionExecution) GetGuildID() int64
type AutoModerationActionMetadata ¶ added in v2.17.0
type AutoModerationActionMetadata struct { // Channel to which user content should be logged. // NOTE: should be only used with send alert message action type. ChannelID int64 `json:"channel_id,string,omitempty"` // Timeout duration in seconds (maximum of 2419200 - 4 weeks). // NOTE: should be only used with timeout action type. Duration int `json:"duration_seconds,omitempty"` }
AutoModerationActionMetadata represents additional metadata needed during execution for a specific action type.
type AutoModerationActionType ¶ added in v2.17.0
type AutoModerationActionType int
AutoModerationActionType represents an action which will execute whenever a rule is triggered.
const ( AutoModerationRuleActionBlockMessage AutoModerationActionType = 1 AutoModerationRuleActionSendAlertMessage AutoModerationActionType = 2 AutoModerationRuleActionTimeout AutoModerationActionType = 3 )
Auto moderation actions types.
type AutoModerationKeywordPreset ¶ added in v2.17.0
type AutoModerationKeywordPreset uint
AutoModerationKeywordPreset represents an internally pre-defined wordset.
const ( AutoModerationKeywordPresetProfanity AutoModerationKeywordPreset = 1 AutoModerationKeywordPresetSexualContent AutoModerationKeywordPreset = 2 AutoModerationKeywordPresetSlurs AutoModerationKeywordPreset = 3 )
Auto moderation keyword presets.
type AutoModerationRule ¶ added in v2.17.0
type AutoModerationRule struct { ID int64 `json:"id,string,omitempty"` GuildID int64 `json:"guild_id,string,omitempty"` Name string `json:"name,omitempty"` CreatorID int64 `json:"creator_id,string,omitempty"` EventType AutoModerationRuleEventType `json:"event_type,omitempty"` TriggerType AutoModerationRuleTriggerType `json:"trigger_type,omitempty"` TriggerMetadata *AutoModerationTriggerMetadata `json:"trigger_metadata,omitempty"` Actions []AutoModerationAction `json:"actions,omitempty"` Enabled *bool `json:"enabled,omitempty"` ExemptRoles IDSlice `json:"exempt_roles,omitempty"` ExemptChannels IDSlice `json:"exempt_channels,omitempty"` }
AutoModerationRule stores data for an auto moderation rule.
type AutoModerationRuleCreate ¶ added in v2.17.0
type AutoModerationRuleCreate struct {
*AutoModerationRule
}
AutoModerationRuleCreate is the data for an AutoModerationRuleCreate event.
type AutoModerationRuleDelete ¶ added in v2.17.0
type AutoModerationRuleDelete struct {
*AutoModerationRule
}
AutoModerationRuleDelete is the data for an AutoModerationRuleDelete event.
type AutoModerationRuleEventType ¶ added in v2.17.0
type AutoModerationRuleEventType int
AutoModerationRuleEventType indicates in what event context a rule should be checked.
const ( // AutoModerationEventMessageSend is checked when a member sends or edits a message in the guild AutoModerationEventMessageSend AutoModerationRuleEventType = 1 )
Auto moderation rule event types.
type AutoModerationRuleTriggerType ¶ added in v2.17.0
type AutoModerationRuleTriggerType int
AutoModerationRuleTriggerType represents the type of content which can trigger the rule.
const ( AutoModerationEventTriggerKeyword AutoModerationRuleTriggerType = 1 AutoModerationEventTriggerHarmfulLink AutoModerationRuleTriggerType = 2 AutoModerationEventTriggerSpam AutoModerationRuleTriggerType = 3 AutoModerationEventTriggerKeywordPreset AutoModerationRuleTriggerType = 4 )
Auto moderation rule trigger types.
type AutoModerationRuleUpdate ¶ added in v2.17.0
type AutoModerationRuleUpdate struct {
*AutoModerationRule
}
AutoModerationRuleUpdate is the data for an AutoModerationRuleUpdate event.
type AutoModerationTriggerMetadata ¶ added in v2.17.0
type AutoModerationTriggerMetadata struct { // Substrings which will be searched for in content. // NOTE: should be only used with keyword trigger type. KeywordFilter []string `json:"keyword_filter,omitempty"` // Regular expression patterns which will be matched against content (maximum of 10). // NOTE: should be only used with keyword trigger type. RegexPatterns []string `json:"regex_patterns,omitempty"` // Internally pre-defined wordsets which will be searched for in content. // NOTE: should be only used with keyword preset trigger type. Presets []AutoModerationKeywordPreset `json:"presets,omitempty"` // Substrings which should not trigger the rule. // NOTE: should be only used with keyword or keyword preset trigger type. AllowList *[]string `json:"allow_list,omitempty"` // Total number of unique role and user mentions allowed per message. // NOTE: should be only used with mention spam trigger type. MentionTotalLimit int `json:"mention_total_limit,omitempty"` }
AutoModerationTriggerMetadata represents additional metadata used to determine whether rule should be triggered.
type Bucket ¶
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 v2.3.0
type Button struct { Label string `json:"label"` Style ButtonStyle `json:"style"` Disabled bool `json:"disabled"` Emoji *ComponentEmoji `json:"emoji,omitempty"` // 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 v2.3.0
MarshalJSON is a method for marshaling Button to a JSON object.
func (Button) Type ¶ added in v2.3.0
func (Button) Type() ComponentType
Type is a method to get the type of a component.
type ButtonStyle ¶ added in v2.3.0
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 int64 `json:"id,string"` // 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 int64 `json:"guild_id,string"` // 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 int64 `json:"last_message_id,string"` // 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 int64 `json:"parent_id,string"` // Period of time in which the user is unable to send another message or create a new thread for. // Excludes "manage_messages" and "manage_channel" permissions RateLimitPerUser int `json:"rate_limit_per_user"` // The user ID of the owner of the thread. Nil on normal channels OwnerID int64 `json:"owner_id,string"` // Thread specific fields ThreadMetadata *ThreadMetadata `json:"thread_metadata"` // ChannelFlags combined as a bitfield. Flags ChannelFlags `json:"flags"` // The set of tags that can be used in a forum channel. AvailableTags []ForumTag `json:"available_tags"` // The IDs of the set of tags that have been applied to a thread in a forum channel. AppliedTags IDSlice `json:"applied_tags"` // Emoji to use as the default reaction to a forum post. DefaultReactionEmoji ForumDefaultReaction `json:"default_reaction_emoji"` // The initial RateLimitPerUser to set on newly created threads in a channel. // This field is copied to the thread at creation time and does not live update. DefaultThreadRateLimitPerUser int `json:"default_thread_rate_limit_per_user"` // The default sort order type used to order posts in forum channels. // Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin. DefaultSortOrder *ForumSortOrderType `json:"default_sort_order"` // The default forum layout view used to display posts in forum channels. // Defaults to ForumLayoutNotSet, which indicates a layout view has not been set by a channel admin. DefaultForumLayout ForumLayout `json:"default_forum_layout"` }
A Channel holds all data related to an individual Discord channel.
func (*Channel) GetChannelID ¶
func (*Channel) GetGuildID ¶
type ChannelCreate ¶
type ChannelCreate struct {
*Channel
}
ChannelCreate is the data for a ChannelCreate event.
type ChannelDelete ¶
type ChannelDelete struct {
*Channel
}
ChannelDelete is the data for a ChannelDelete event.
type ChannelEdit ¶
type ChannelEdit struct { Name string `json:"name,omitempty"` Topic string `json:"topic,omitempty"` NSFW bool `json:"nsfw,omitempty"` Position *int `json:"position,omitempty"` Bitrate int `json:"bitrate,omitempty"` UserLimit int `json:"user_limit,omitempty"` PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"` ParentID *null.String `json:"parent_id,omitempty"` Flags *ChannelFlags `json:"flags,omitempty"` RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"` // Threads only Archived *bool `json:"archived,omitempty"` AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration,omitempty"` Locked *bool `json:"locked,omitempty"` Invitable *bool `json:"invitable,omitempty"` // NOTE: forum threads only - these are IDs AppliedTags IDSlice `json:"applied_tags,string,omitempty"` }
A ChannelEdit holds Channel Field data for a channel edit.
type ChannelEvent ¶
type ChannelEvent interface {
GetChannelID() int64
}
type ChannelFlags ¶ added in v2.39.0
type ChannelFlags int
ChannelFlags is the flags of "channel" (see ChannelFlags* consts) https://discord.com/developers/docs/resources/channel#message-object-message-flags
const ( // ChannelFlagsPinned this thread is pinned to the top of its parent GUILD_FORUM or GUILD_MEDIA channel. ChannelFlagsPinned ChannelFlags = 1 << 1 // ChannelFlagsRequireTag whether a tag is required to be specified when creating a thread in a GUILD_FORUM or a GUILD_MEDIA channel. Tags are specified in the applied_tags field. ChannelFlagsRequireTag ChannelFlags = 1 << 4 // ChannelFlagsHideMediaDownloadOptions when set hides the embedded media download options. Available only for media channels. ChannelFlagsHideMediaDownloadOptions ChannelFlags = 1 << 15 )
Valid ChannelFlags values
type ChannelPinsUpdate ¶
type ChannelPinsUpdate struct { LastPinTimestamp string `json:"last_pin_timestamp"` ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string,omitempty"` }
ChannelPinsUpdate stores data for a ChannelPinsUpdate event.
func (*ChannelPinsUpdate) GetChannelID ¶
func (cp *ChannelPinsUpdate) GetChannelID() int64
func (*ChannelPinsUpdate) GetGuildID ¶
func (cp *ChannelPinsUpdate) GetGuildID() int64
type ChannelTopicUpdate ¶ added in v2.27.0
type ChannelTopicUpdate struct{}
type ChannelType ¶
type ChannelType int
ChannelType is the type of a Channel
const ( ChannelTypeGuildText ChannelType = 0 // a text channel within a server ChannelTypeDM ChannelType = 1 // a direct message between users ChannelTypeGuildVoice ChannelType = 2 // a voice channel within a server ChannelTypeGroupDM ChannelType = 3 // a direct message between multiple users ChannelTypeGuildCategory ChannelType = 4 // an organizational category that contains up to 50 channels ChannelTypeGuildNews ChannelType = 5 // a channel that users can follow and crosspost into their own server ChannelTypeGuildStore ChannelType = 6 // a channel in which game developers can sell their game on Discord ChannelTypeGuildNewsThread ChannelType = 10 // a temporary sub-channel within a GUILD_NEWS channel ChannelTypeGuildPublicThread ChannelType = 11 // a temporary sub-channel within a GUILD_TEXT channel ChannelTypeGuildPrivateThread ChannelType = 12 // a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission ChannelTypeGuildStageVoice ChannelType = 13 // a voice channel for hosting events with an audience ChannelTypeGuildForum ChannelType = 15 // a channel that can only contain threads )
Block contains known ChannelType values
func (ChannelType) IsThread ¶
func (t ChannelType) IsThread() bool
type ChannelUpdate ¶
type ChannelUpdate struct {
*Channel
}
ChannelUpdate is the data for a ChannelUpdate event.
type ComponentEmoji ¶ added in v2.3.0
type ComponentEmoji struct { Name string `json:"name,omitempty"` ID int64 `json:"id,string,omitempty"` Animated bool `json:"animated,omitempty"` }
ComponentEmoji represents button emoji, if it does have one.
type ComponentType ¶ added in v2.3.0
type ComponentType uint
ComponentType is type of component.
const ( ActionsRowComponent ComponentType = 1 ButtonComponent ComponentType = 2 SelectMenuComponent ComponentType = 3 TextInputComponent ComponentType = 4 UserSelectMenuComponent ComponentType = 5 RoleSelectMenuComponent ComponentType = 6 MentionableSelectMenuComponent ComponentType = 7 ChannelSelectMenuComponent ComponentType = 8 )
MessageComponent types.
type Connect ¶
type Connect struct{}
Connect is the data for a Connect event. This is a sythetic event and is not dispatched by Discord.
type CreateApplicationCommandRequest ¶
type CreateApplicationCommandRequest struct { Name string `json:"name"` // 1-32 character name matching ^[\w-]{1,32}$ Description string `json:"description"` // 1-100 character description Options []*ApplicationCommandOption `json:"options"` // the parameters for the command DefaultPermission *bool `json:"default_permission,omitempty"` // (default true) whether the command is enabled by default when the app is added to a guild NSFW bool `json:"nsfw,omitempty"` // marks a command as age-restricted }
type Disconnect ¶
type Disconnect struct{}
Disconnect is the data for a Disconnect event. This is a sythetic event and is not dispatched by Discord.
type DiscordFloat ¶
type DiscordFloat float64
Discord is super inconsistent with with types in some places (especially presence updates, might aswell change them to map[string]interface{} soon because there is 0 validation)
func (*DiscordFloat) UnmarshalJSON ¶
func (df *DiscordFloat) UnmarshalJSON(data []byte) error
type DiscordInt64 ¶
type DiscordInt64 int64
func (*DiscordInt64) UnmarshalJSON ¶
func (di *DiscordInt64) UnmarshalJSON(data []byte) error
type EditApplicationCommandRequest ¶
type EditApplicationCommandRequest struct { Name *string `json:"name,omitempty"` // 1-32 character name matching ^[\w-]{1,32}$ Description *string `json:"description,omitempty"` // 1-100 character description Options *[]*ApplicationCommandOption `json:"options,omitempty"` // the parameters for the command DefaultPermission *bool `json:"default_permission,omitempty"` // (default true) whether the command is enabled by default when the app is added to a guild }
type Emoji ¶
type Emoji struct { ID int64 `json:"id,string"` Name string `json:"name"` Roles IDSlice `json:"roles,string"` Managed bool `json:"managed"` RequireColons bool `json:"require_colons"` Animated bool `json:"animated"` }
Emoji struct holds data related to Emoji's
func (*Emoji) APIName ¶
APIName returns an correctly formatted API name for use in the MessageReactions endpoints.
func (*Emoji) MessageFormat ¶
MessageFormat returns a correctly formatted Emoji for use in Message content and embeds
type Entitlement ¶ added in v2.45.0
type Entitlement struct { // The ID of the entitlement ID int64 `json:"id,string"` // The ID of the SKU SKUID int64 `json:"sku_id,string"` // The ID of the parent application ApplicationID int64 `json:"application_id,string"` // The ID of the user that is granted access to the entitlement's sku // Only available for user subscriptions. UserID int64 `json:"user_id,string,omitempty"` // The type of the entitlement Type EntitlementType `json:"type"` // The entitlement was deleted Deleted bool `json:"deleted"` // The start date at which the entitlement is valid. // Not present when using test entitlements. StartsAt *time.Time `json:"starts_at,omitempty"` // The date at which the entitlement is no longer valid. // Not present when using test entitlements. EndsAt *time.Time `json:"ends_at,omitempty"` // The ID of the guild that is granted access to the entitlement's sku. // Only available for guild subscriptions. GuildID int64 `json:"guild_id,string,omitempty"` // Whether or not the entitlement has been consumed. // Only available for consumable items. Consumed bool `json:"consumed,omitempty"` }
Entitlement represents that a user or guild has access to a premium offering in your application.
type EntitlementCreate ¶ added in v2.45.0
type EntitlementCreate struct {
*Entitlement
}
Monetization events
type EntitlementDelete ¶ added in v2.45.0
type EntitlementDelete struct {
*Entitlement
}
EntitlementDelete is the data for an EntitlementDelete event. NOTE: Entitlements are not deleted when they expire.
type EntitlementFilterOptions ¶ added in v2.45.0
type EntitlementFilterOptions struct { // Optional user ID to look up for. UserID int64 // Optional array of SKU IDs to check for. SkuIDs []int64 // Optional timestamp (snowflake) to retrieve Entitlements before this time. BeforeID int64 // Optional timestamp (snowflake) to retrieve Entitlements after this time. AfterID int64 // Optional maximum number of entitlements to return (1-100, default 100). Limit int // Optional guild ID to look up for. GuildID int64 // Optional whether or not ended entitlements should be omitted. ExcludeEnded bool }
EntitlementFilterOptions are the options for filtering Entitlements
type EntitlementOwnerType ¶ added in v2.45.0
type EntitlementOwnerType int
EntitlementOwnerType is the type of entitlement (see EntitlementOwnerType* consts)
const ( EntitlementOwnerTypeGuildSubscription EntitlementOwnerType = 1 EntitlementOwnerTypeUserSubscription EntitlementOwnerType = 2 )
Valid EntitlementOwnerType values
type EntitlementTest ¶ added in v2.45.0
type EntitlementTest struct { // The ID of the SKU to grant the entitlement to SKUID int64 `json:"sku_id,string"` // The ID of the guild or user to grant the entitlement to OwnerID int64 `json:"owner_id,string"` // OwnerType is the type of which the entitlement should be created OwnerType EntitlementOwnerType `json:"owner_type"` }
EntitlementTest is used to test granting an entitlement to a user or guild
type EntitlementType ¶ added in v2.45.0
type EntitlementType int
EntitlementType is the type of entitlement https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-types
type EntitlementUpdate ¶ added in v2.45.0
type EntitlementUpdate struct {
*Entitlement
}
type Event ¶
type Event struct { Operation GatewayOP `json:"op"` Sequence int64 `json:"s"` Type string `json:"t"` RawData gojay.EmbeddedJSON `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 ¶
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 ¶
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 ExplicitContentFilterLevel ¶
type ExplicitContentFilterLevel int
ExplicitContentFilterLevel type definition
const ( ExplicitContentFilterDisabled ExplicitContentFilterLevel = iota ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterAllMembers )
Constants for ExplicitContentFilterLevel levels from 0 to 2 inclusive
type ForumDefaultReaction ¶ added in v2.34.0
type ForumDefaultReaction struct { // The id of a guild's custom emoji. EmojiID int64 `json:"emoji_id,string,omitempty"` // The unicode character of the emoji. EmojiName string `json:"emoji_name,omitempty"` }
ForumDefaultReaction specifies emoji to use as the default reaction to a forum post. NOTE: Exactly one of EmojiID and EmojiName must be set.
type ForumLayout ¶ added in v2.34.0
type ForumLayout int
ForumLayout represents layout of a forum channel.
const ( // ForumLayoutNotSet represents no default layout. ForumLayoutNotSet ForumLayout = 0 // ForumLayoutListView displays forum posts as a list. ForumLayoutListView ForumLayout = 1 // ForumLayoutGalleryView displays forum posts as a collection of tiles. ForumLayoutGalleryView ForumLayout = 2 )
type ForumSortOrderType ¶ added in v2.34.0
type ForumSortOrderType int
ForumSortOrderType represents sort order of a forum channel.
const ( // ForumSortOrderLatestActivity sorts posts by activity. ForumSortOrderLatestActivity ForumSortOrderType = 0 // ForumSortOrderCreationDate sorts posts by creation time (from most recent to oldest). ForumSortOrderCreationDate ForumSortOrderType = 1 )
type ForumTag ¶ added in v2.34.0
type ForumTag struct { ID int64 `json:"id,string,omitempty"` Name string `json:"name"` Moderated bool `json:"moderated"` EmojiID int64 `json:"emoji_id,string,omitempty"` EmojiName string `json:"emoji_name,omitempty"` }
ForumTag represents a tag that is able to be applied to a thread in a forum channel.
type FriendSourceFlags ¶
type FriendSourceFlags struct { All bool `json:"all"` MutualGuilds bool `json:"mutual_guilds"` MutualFriends bool `json:"mutual_friends"` }
FriendSourceFlags stores ... TODO :)
type GatewayBotResponse ¶
type GatewayBotResponse struct { URL string `json:"url"` Shards int `json:"shards"` SessionStartLimit SessionStartLimit `json:"session_start_limit"` }
GatewayBotResponse stores the data for the gateway/bot response
type GatewayConnection ¶
type GatewayConnection struct {
// contains filtered or unexported fields
}
func NewGatewayConnection ¶
func NewGatewayConnection(parent *GatewayConnectionManager, id int, intents []GatewayIntent) *GatewayConnection
func (*GatewayConnection) Close ¶
func (g *GatewayConnection) Close() error
Close closes the gateway connection
func (*GatewayConnection) Reconnect ¶
func (g *GatewayConnection) Reconnect(forceReIdentify bool) error
Reconnect is a helper for Close() and Connect() and will attempt to resume if possible
func (*GatewayConnection) ReconnectUnlessClosed ¶
func (g *GatewayConnection) ReconnectUnlessClosed(forceReIdentify bool) error
ReconnectUnlessStopped will not reconnect if close was called earlier
func (*GatewayConnection) RequestGuildMembers ¶
func (g *GatewayConnection) RequestGuildMembers(d *RequestGuildMembersData)
func (*GatewayConnection) Status ¶
func (g *GatewayConnection) Status() (st GatewayStatus)
Status returns the current status of the connection
func (*GatewayConnection) UpdateStatusComplex ¶
func (g *GatewayConnection) UpdateStatusComplex(usd UpdateStatusData)
UpdateStatusComplex allows for sending the raw status update data untouched by discordgo.
type GatewayConnectionManager ¶
type GatewayConnectionManager struct {
// contains filtered or unexported fields
}
GatewayConnectionManager is responsible for managing the gateway connections for a single shard We create a new GatewayConnection every time we reconnect to avoid a lot of synchronization needs and also to avoid having to manually reset the connection state, all the workers related to the old connection should eventually stop, and if they're late they will be working on a closed connection anyways so it dosen't matter
func (*GatewayConnectionManager) ChannelVoiceJoin ¶
func (g *GatewayConnectionManager) ChannelVoiceJoin(gID, cID int64, 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 (*GatewayConnectionManager) ChannelVoiceLeave ¶
func (g *GatewayConnectionManager) ChannelVoiceLeave(gID int64)
func (*GatewayConnectionManager) Close ¶
func (g *GatewayConnectionManager) Close() (err error)
func (*GatewayConnectionManager) GetCurrentConnection ¶
func (g *GatewayConnectionManager) GetCurrentConnection() *GatewayConnection
func (*GatewayConnectionManager) GetSessionInfo ¶
func (s *GatewayConnectionManager) GetSessionInfo() (sessionID string, sequence int64, resumeGatewayUrl string)
func (*GatewayConnectionManager) HeartBeatStats ¶
func (g *GatewayConnectionManager) HeartBeatStats() (lastSend time.Time, lastAck time.Time)
func (*GatewayConnectionManager) Open ¶
func (g *GatewayConnectionManager) Open() error
func (*GatewayConnectionManager) Reconnect ¶
func (g *GatewayConnectionManager) Reconnect(forceIdentify bool) error
func (*GatewayConnectionManager) RequestGuildMemberByID ¶
func (g *GatewayConnectionManager) RequestGuildMemberByID(guildID int64, query int64, limit int)
func (*GatewayConnectionManager) RequestGuildMembers ¶
func (g *GatewayConnectionManager) RequestGuildMembers(guildID int64, query string, limit int)
func (*GatewayConnectionManager) RequestGuildMembersComplex ¶
func (g *GatewayConnectionManager) RequestGuildMembersComplex(d *RequestGuildMembersData)
func (*GatewayConnectionManager) SetSessionInfo ¶
func (s *GatewayConnectionManager) SetSessionInfo(sessionID string, sequence int64, resumeGatewayUrl string)
func (*GatewayConnectionManager) Status ¶
func (g *GatewayConnectionManager) Status() GatewayStatus
Status returns the status of the current active connection
type GatewayIdentifyRatelimiter ¶
type GatewayIdentifyRatelimiter interface {
RatelimitIdentify(shardID int) // Called whenever an attempted identify is made, can be called from multiple goroutines at the same time
}
GatewayIdentifyRatelimiter is if you need some custom identify ratelimit logic (if you're running shards across processes for example)
var IdentifyRatelimiter GatewayIdentifyRatelimiter = &StdGatewayIdentifyRatleimiter{}
This is used at the package level because it can be used by multiple sessions !! Changing this after starting 1 or more gateway sessions will lead to undefined behaviour
type GatewayIntent ¶
type GatewayIntent int
const ( GatewayIntentGuilds GatewayIntent = 1 << 0 GatewayIntentGuildMembers GatewayIntent = 1 << 1 GatewayIntentGuildBans GatewayIntent = 1 << 2 GatewayIntentGuildEmojis GatewayIntent = 1 << 3 GatewayIntentGuildIntegrations GatewayIntent = 1 << 4 GatewayIntentGuildWebhooks GatewayIntent = 1 << 5 GatewayIntentGuildInvites GatewayIntent = 1 << 6 GatewayIntentGuildVoiceStates GatewayIntent = 1 << 7 GatewayIntentGuildPresences GatewayIntent = 1 << 8 GatewayIntentGuildMessages GatewayIntent = 1 << 9 GatewayIntentGuildMessageReactions GatewayIntent = 1 << 10 GatewayIntentGuildMessageTyping GatewayIntent = 1 << 11 GatewayIntentDirectMessages GatewayIntent = 1 << 12 GatewayIntentDirectMessageReactions GatewayIntent = 1 << 13 GatewayIntentDirectMessageTyping GatewayIntent = 1 << 14 // - TYPING_START GatewayIntentMessageContent GatewayIntent = 1 << 15 GatewayIntentGuildScheduledEvents GatewayIntent = 1 << 16 GatewayIntentAutomoderationExecution GatewayIntent = 1 << 21 GatewayIntentAutomoderationConfiguration GatewayIntent = 1 << 20 )
type GatewayOP ¶
type GatewayOP int
GatewayOP represents a gateway operation see https://discordapp.com/developers/docs/topics/gateway#gateway-opcodespayloads-gateway-opcodes
const ( GatewayOPDispatch GatewayOP = 0 // (Receive) GatewayOPHeartbeat GatewayOP = 1 // (Send/Receive) GatewayOPIdentify GatewayOP = 2 // (Send) GatewayOPStatusUpdate GatewayOP = 3 // (Send) GatewayOPVoiceStateUpdate GatewayOP = 4 // (Send) GatewayOPVoiceServerPing GatewayOP = 5 // (Send) GatewayOPResume GatewayOP = 6 // (Send) GatewayOPReconnect GatewayOP = 7 // (Receive) GatewayOPRequestGuildMembers GatewayOP = 8 // (Send) GatewayOPInvalidSession GatewayOP = 9 // (Receive) GatewayOPHello GatewayOP = 10 // (Receive) GatewayOPHeartbeatACK GatewayOP = 11 // (Receive) )
type GatewayStatus ¶
type GatewayStatus int
const ( GatewayStatusDisconnected GatewayStatus = iota GatewayStatusConnecting GatewayStatusIdentifying GatewayStatusResuming GatewayStatusReady )
func (GatewayStatus) String ¶
func (gs GatewayStatus) String() string
type Guild ¶
type Guild struct { // The ID of the guild. ID int64 `json:"id,string"` // The name of the guild. (2–100 characters) Name string `json:"name"` Description string `json:"description"` Banner string `json:"banner"` PreferredLocale string `json:"preferred_locale"` // 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 int64 `json:"afk_channel_id,string"` // The user ID of the owner of the guild. OwnerID int64 `json:"owner_id,string"` // 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 Timestamp `json:"joined_at"` // 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. // 0 == all messages, 1 == mentions only. DefaultMessageNotifications int `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 custom stickers present in the guild. Stickers []*Sticker `json:"stickers"` // 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"` // A list of channels in the guild. // This field is only present in GUILD_CREATE events Channels []*Channel `json:"channels"` // All active threads in the guild that current user has permission to view // This field is only present in GUILD_CREATE events Threads []*Channel `json:"threads"` // 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"` MaxPresences int `json:"max_presences"` MaxMembers int `json:"max_members"` // 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"` // 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"` ApproximateMemberCount int `json:"approximate_member_count"` ApproximatePresenceCount int `json:"approximate_presence_count"` VanityURLCode string `json:"vanity_url_code"` }
A Guild holds all data related to a specific Discord Guild. Guilds are also sometimes referred to as Servers in the Discord client.
func (*Guild) GetGuildID ¶
type GuildApplicationCommandPermissions ¶
type GuildApplicationCommandPermissions struct { ID int64 `json:"id,string"` ApplicationID int64 `json:"application_id,string"` GuildID int64 `json:"guild_id,string"` Permissions []*ApplicationCommandPermissions `json:"permissions"` }
GuildApplicationCommandPermissions represents all permissions for a single guild command.
type GuildAuditLog ¶
type GuildAuditLog struct { Webhooks []struct { ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string"` ID string `json:"id"` Avatar string `json:"avatar"` Name string `json:"name"` } `json:"webhooks,omitempty"` Users []*User `json:"users,omitempty"` AuditLogEntries []*AuditLogEntry `json:"audit_log_entries"` }
A GuildAuditLog stores data for a guild audit log.
type GuildAuditLogEntryCreate ¶ added in v2.17.0
type GuildAuditLogEntryCreate struct {
*AuditLogEntry
}
type GuildBanAdd ¶
GuildBanAdd is the data for a GuildBanAdd event.
func (*GuildBanAdd) GetGuildID ¶
func (gba *GuildBanAdd) GetGuildID() int64
type GuildBanRemove ¶
GuildBanRemove is the data for a GuildBanRemove event.
func (*GuildBanRemove) GetGuildID ¶
func (e *GuildBanRemove) GetGuildID() int64
type GuildCreate ¶
type GuildCreate struct {
*Guild
}
GuildCreate is the data for a GuildCreate event.
type GuildDelete ¶
type GuildDelete struct {
*Guild
}
GuildDelete is the data for a GuildDelete event.
type GuildEmbed ¶
A GuildEmbed stores data for a guild embed.
type GuildEmojisUpdate ¶
type GuildEmojisUpdate struct { GuildID int64 `json:"guild_id,string"` Emojis []*Emoji `json:"emojis"` }
A GuildEmojisUpdate is the data for a guild emoji update event.
func (*GuildEmojisUpdate) GetGuildID ¶
func (e *GuildEmojisUpdate) GetGuildID() int64
type GuildEvent ¶
type GuildEvent interface {
GetGuildID() int64
}
type GuildIntegrationsUpdate ¶
type GuildIntegrationsUpdate struct {
GuildID int64 `json:"guild_id,string"`
}
GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
func (*GuildIntegrationsUpdate) GetGuildID ¶
func (e *GuildIntegrationsUpdate) GetGuildID() int64
type GuildJoinRequestDelete ¶ added in v2.17.1
type GuildJoinRequestDelete struct{}
type GuildJoinRequestUpdate ¶ added in v2.17.1
type GuildJoinRequestUpdate struct{}
type GuildMemberAdd ¶
type GuildMemberAdd struct {
*Member
}
GuildMemberAdd is the data for a GuildMemberAdd event.
func (*GuildMemberAdd) GetGuildID ¶
func (e *GuildMemberAdd) GetGuildID() int64
type GuildMemberRemove ¶
type GuildMemberRemove struct {
*Member
}
GuildMemberRemove is the data for a GuildMemberRemove event.
type GuildMemberUpdate ¶
type GuildMemberUpdate struct {
*Member
}
GuildMemberUpdate is the data for a GuildMemberUpdate event.
type GuildMembersChunk ¶
type GuildMembersChunk struct { GuildID int64 `json:"guild_id,string"` Members []*Member `json:"members"` ChunkIndex int `json:"chunk_index"` ChunkCount int `json:"chunk_count"` Nonce string `json:"nonce"` }
A GuildMembersChunk is the data for a GuildMembersChunk event.
func (*GuildMembersChunk) GetGuildID ¶
func (e *GuildMembersChunk) GetGuildID() int64
type GuildParams ¶
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 int64 `json:"afk_channel_id,omitempty,string"` AfkTimeout int `json:"afk_timeout,omitempty"` Icon string `json:"icon,omitempty"` OwnerID int64 `json:"owner_id,omitempty,string"` Splash string `json:"splash,omitempty"` }
A GuildParams stores all the data needed to update discord guild settings
type GuildRoleCreate ¶
type GuildRoleCreate struct {
*GuildRole
}
GuildRoleCreate is the data for a GuildRoleCreate event.
type GuildRoleDelete ¶
type GuildRoleDelete struct { RoleID int64 `json:"role_id,string"` GuildID int64 `json:"guild_id,string"` }
A GuildRoleDelete is the data for a GuildRoleDelete event.
func (*GuildRoleDelete) GetGuildID ¶
func (e *GuildRoleDelete) GetGuildID() int64
type GuildRoleUpdate ¶
type GuildRoleUpdate struct {
*GuildRole
}
GuildRoleUpdate is the data for a GuildRoleUpdate event.
type GuildStickersUpdate ¶
type GuildStickersUpdate struct { GuildID int64 `json:"guild_id,string"` Stickers []*Sticker `json:"stickers"` }
guild stickers were updated
func (*GuildStickersUpdate) GetGuildID ¶ added in v2.47.0
func (e *GuildStickersUpdate) GetGuildID() int64
type GuildUpdate ¶
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 IDSlice ¶
type IDSlice []int64
IDSlice Is a slice of snowflake id's that properly marshals and unmarshals the way discord expects them to They unmarshal from string arrays and marshals back to string arrays
func (IDSlice) MarshalJSON ¶
func (*IDSlice) UnmarshalJSON ¶
type Integration ¶
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"` ExpireBehavior int `json:"expire_behavior"` ExpireGracePeriod int `json:"expire_grace_period"` User *User `json:"user"` Account IntegrationAccount `json:"account"` SyncedAt Timestamp `json:"synced_at"` }
Integration stores integration information
type IntegrationAccount ¶
IntegrationAccount is integration account information sent by the UserConnections endpoint
type Interaction ¶
type Interaction struct { ID int64 `json:"id,string"` ApplicationID int64 `json:"application_id,string"` Type InteractionType `json:"type"` Data InteractionData `json:"data"` GuildID int64 `json:"guild_id,string"` ChannelID int64 `json:"channel_id,string"` // 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"` // The user's discord client locale. Locale Locale `json:"locale"` // The guild's locale. This defaults to EnglishUS // NOTE: this field is only filled when the interaction was invoked in a guild. GuildLocale *Locale `json:"guild_locale"` Token string `json:"token"` Version int `json:"version"` DataCommand *ApplicationCommandInteractionData Entitlements []*Entitlement `json:"entitlements"` }
Interaction represents data of an interaction.
func (Interaction) ApplicationCommandData ¶ added in v2.3.0
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 v2.3.0
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) ModalSubmitData ¶ added in v2.3.0
func (i Interaction) ModalSubmitData() (data ModalSubmitInteractionData)
ModalSubmitData is helper function to assert the inner InteractionData to ModalSubmitInteractionData. Make sure to check that the Type of the interaction is InteractionModalSubmit before calling.
func (*Interaction) UnmarshalJSON ¶
func (i *Interaction) UnmarshalJSON(raw []byte) error
UnmarshalJSON is a method for unmarshalling JSON object to Interaction.
type InteractionApplicationCommandCallbackData ¶
type InteractionApplicationCommandCallbackData struct { TTS bool `json:"tts,omitempty"` // is the response TTS Content *string `json:"content,omitempty"` // message content Embeds []MessageEmbed `json:"embeds,omitempty"` // supports up to 10 embeds AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` // allowed mentions object Flags int `json:"flags,omitempty"` // set to 64 to make your response ephemeral }
type InteractionCreate ¶
type InteractionCreate struct {
Interaction
}
type InteractionData ¶ added in v2.3.0
type InteractionData interface {
Type() InteractionType
}
InteractionData is a common interface for all types of interaction data.
type InteractionResponse ¶
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 v2.3.0
type InteractionResponseData struct { TTS bool `json:"tts"` Content string `json:"content"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds"` AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` Flags MessageFlags `json:"flags,omitempty"` Files []*File `json:"-"` // NOTE: autocomplete interaction only. Choices []*ApplicationCommandOptionChoice `json:"choices,omitempty"` CustomID string `json:"custom_id,omitempty"` Title string `json:"title,omitempty"` }
InteractionResponseData is response data for an interaction.
type InteractionResponseType ¶
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 // InteractionResponseModal is for responding to an interaction with a modal window. InteractionResponseModal InteractionResponseType = 9 )
Interaction response types.
type InteractionType ¶
type InteractionType uint8
InteractionType indicates the type of an interaction event.
const ( InteractionPing InteractionType = 1 InteractionApplicationCommand InteractionType = 2 InteractionMessageComponent InteractionType = 3 InteractionApplicationCommandAutocomplete InteractionType = 4 InteractionModalSubmit InteractionType = 5 )
Interaction types
func (InteractionType) String ¶ added in v2.3.0
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 Timestamp `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"` // 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 InviteCreate ¶
type InviteCreate struct { GuildID int64 `json:"guild_id,string"` ChannelID int64 `json:"channel_id,string"` Code string `json:"code"` CreatedAt Timestamp `json:"created_at"` MaxAge int `json:"max_age"` MaxUses int `json:"max_uses"` Temporary bool `json:"temporary"` Uses int `json:"uses"` Inviter *InviteUser `json:"inviter"` }
InviteCreate is the data for the InviteCreate event
type InviteDelete ¶
type InviteDelete struct { GuildID int64 `json:"guild_id,string"` ChannelID int64 `json:"channel_id,string"` Code string `json:"code"` }
InviteDelete is the data for the InviteDelete event
type InviteUser ¶
type InviteUser struct { ID int64 `json:"id,string"` Avatar string `json:"avatar"` Discriminator string `json:"discriminator"` Username string `json:"username"` }
InviteUser is a partial user obejct from the invite event(s)
type Locale ¶ added in v2.3.0
type Locale string
Locale represents the accepted languages for Discord. https://discord.com/developers/docs/reference#locales
const ( EnglishUS Locale = "en-US" EnglishGB Locale = "en-GB" Bulgarian Locale = "bg" ChineseCN Locale = "zh-CN" ChineseTW Locale = "zh-TW" Croatian Locale = "hr" Czech Locale = "cs" Danish Locale = "da" Dutch Locale = "nl" Finnish Locale = "fi" French Locale = "fr" German Locale = "de" Greek Locale = "el" Hindi Locale = "hi" Hungarian Locale = "hu" Italian Locale = "it" Japanese Locale = "ja" Korean Locale = "ko" Lithuanian Locale = "lt" Norwegian Locale = "no" Polish Locale = "pl" PortugueseBR Locale = "pt-BR" Romanian Locale = "ro" Russian Locale = "ru" SpanishES Locale = "es-ES" Swedish Locale = "sv-SE" Thai Locale = "th" Turkish Locale = "tr" Ukrainian Locale = "uk" Vietnamese Locale = "vi" Unknown Locale = "" )
All defined locales in Discord
type Member ¶
type Member struct { // The guild ID on which the member exists. GuildID int64 `json:"guild_id,string"` // The time at which the member joined the guild, in ISO8601. JoinedAt Timestamp `json:"joined_at"` // The nickname of the member, if they have one. Nick string `json:"nick"` // The guild avatar hash of the member, if they have one. Avatar string `json:"avatar"` // 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 IDSlice `json:"roles,string"` // When the user used their Nitro boost on the server PremiumSince *time.Time `json:"premium_since"` // The flags of this member. 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. Flags MemberFlags `json:"flags"` // Whether the user has not yet passed the guild's Membership Screening requirements Pending bool `json:"pending"` // 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.
func (*Member) GetGuildID ¶
type MemberFlags ¶ added in v2.36.0
type MemberFlags int
MemberFlags represent flags of a guild member. https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-flags
const ( // MemberFlagDidRejoin indicates whether the Member has left and rejoined the guild. MemberFlagDidRejoin MemberFlags = 1 << 0 // MemberFlagCompletedOnboarding indicates whether the Member has completed onboarding. MemberFlagCompletedOnboarding MemberFlags = 1 << 1 // MemberFlagBypassesVerification indicates whether the Member is exempt from guild verification requirements. MemberFlagBypassesVerification MemberFlags = 1 << 2 // MemberFlagStartedOnboarding indicates whether the Member has started onboarding. MemberFlagStartedOnboarding MemberFlags = 1 << 3 )
Block containing known MemberFlags values.
type Message ¶
type Message struct { // The ID of the message. ID int64 `json:"id,string"` // The ID of the channel in which the message was sent. ChannelID int64 `json:"channel_id,string"` // The ID of the guild in which the message was sent. GuildID int64 `json:"guild_id,string,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 Timestamp `json:"timestamp"` // The time at which the last edit of the message // occurred, if it has been edited. EditedTimestamp Timestamp `json:"edited_timestamp"` // The roles mentioned in the message. MentionRoles IDSlice `json:"mention_roles,string"` // 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. Multiple // embeds can currently only be sent by webhooks. Embeds []*MessageEmbed `json:"embeds"` // A list of users mentioned in the message. Mentions []*User `json:"mentions"` // Whether the message is pinned or not. Pinned bool `json:"pinned"` // A list of reactions to the message. Reactions []*MessageReactions `json:"reactions"` // The type of the message. Type MessageType `json:"type"` WebhookID int64 `json:"webhook_id,string"` Member *Member `json:"member"` // 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. MessageReference *MessageReference `json:"message_reference"` // The message associated with the message_reference when message_reference type is DEFAULT // NOTE: This field is only returned for messages with a type of 19 (REPLY) or 21 (THREAD_STARTER_MESSAGE). // If the message is a reply but the referenced_message field is not present, // the backend did not attempt to fetch the message that was being replied to, so its state is unknown. // If the field exists but is null, the referenced message was deleted. ReferencedMessage *Message `json:"referenced_message"` // The messages associated with the message_reference when message_reference type is FORWARD MessageSnapshots []*MessageSnapshot `json:"message_snapshots"` // Is sent when the message is a response to an Interaction, without an existing message. // This means responses to message component interactions do not include this property, // instead including a MessageReference, as components exist on preexisting messages. Interaction *MessageInteraction `json:"interaction"` // 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 mesage activity object, sent with Rich Presence-related chat embeds. Activity *MessageActivity `json:"activity"` // An array of StickerItem objects, is the message contains any. StickerItems []*StickerItem `json:"sticker_items"` ApplicationID int64 `json:"application_id,string"` }
A Message stores all data related to a specific Discord message.
func (*Message) ContentWithMentionsReplaced ¶
ContentWithMentionsReplaced will replace all @<id> mentions with the username of the mention.
func (*Message) ContentWithMoreMentionsReplaced ¶
ContentWithMoreMentionsReplaced will replace all @<id> mentions with the username of the mention, but also role IDs and more.
func (*Message) GetChannelID ¶
func (*Message) GetGuildID ¶
func (*Message) GetMessageContents ¶ added in v2.45.0
func (*Message) Reference ¶ added in v2.3.0
func (m *Message) Reference() *MessageReference
Reference returns MessageReference of given message
func (*Message) UnmarshalJSON ¶ added in v2.39.0
UnmarshalJSON is a helper function to unmarshal the Message.
type MessageAck ¶
type MessageAck struct { MessageID int64 `json:"message_id,string"` ChannelID int64 `json:"channel_id,string"` }
MessageAck is the data for a MessageAck event.
type MessageActivity ¶ added in v2.27.0
A MessageActivity represents the activity sent with a message, such as a game invite.
type MessageAttachment ¶
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"` }
A MessageAttachment stores data for message attachments.
type MessageComponent ¶ added in v2.3.0
type MessageComponent interface { json.Marshaler Type() ComponentType }
MessageComponent is a base interface for all message components.
func MessageComponentFromJSON ¶ added in v2.3.0
func MessageComponentFromJSON(b []byte) (MessageComponent, error)
MessageComponentFromJSON is a helper function for unmarshaling message components
type MessageComponentInteractionData ¶ added in v2.3.0
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 v2.3.0
func (MessageComponentInteractionData) Type() InteractionType
Type returns the type of interaction data.
type MessageCreate ¶
type MessageCreate struct {
*Message
}
MessageCreate is the data for a MessageCreate event.
func (*MessageCreate) UnmarshalJSON ¶ added in v2.39.0
func (m *MessageCreate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageCreate object.
type MessageDelete ¶
type MessageDelete struct {
*Message
}
MessageDelete is the data for a MessageDelete event.
func (*MessageDelete) UnmarshalJSON ¶ added in v2.39.0
func (m *MessageDelete) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageDelete object.
type MessageDeleteBulk ¶
type MessageDeleteBulk struct { Messages IDSlice `json:"ids"` ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string"` }
MessageDeleteBulk is the data for a MessageDeleteBulk event
func (*MessageDeleteBulk) GetChannelID ¶
func (e *MessageDeleteBulk) GetChannelID() int64
func (*MessageDeleteBulk) GetGuildID ¶
func (e *MessageDeleteBulk) GetGuildID() int64
type MessageEdit ¶
type MessageEdit struct { Content *string `json:"content,omitempty"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` AllowedMentions AllowedMentions `json:"allowed_mentions,omitempty"` Flags MessageFlags `json:"flags,omitempty"` ID int64 Channel int64 }
MessageEdit is used to chain parameters via ChannelMessageEditComplex, which is also where you should get the instance from.
func NewMessageEdit ¶
func NewMessageEdit(channelID int64, messageID int64) *MessageEdit
NewMessageEdit returns a MessageEdit struct, initialized with the Channel and ID.
func (*MessageEdit) SetContent ¶
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) SetEmbeds ¶ added in v2.3.0
func (m *MessageEdit) SetEmbeds(embeds []*MessageEmbed) *MessageEdit
SetEmbeds is a convenience function for setting the embeds, so you can chain commands.
type MessageEmbed ¶
type MessageEmbed struct { URL string `json:"url,omitempty"` Type string `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"` // contains filtered or unexported fields }
An MessageEmbed stores data for message embeds.
func ValidateComplexMessageEmbeds ¶ added in v2.3.1
func ValidateComplexMessageEmbeds(embeds []*MessageEmbed) []*MessageEmbed
func (*MessageEmbed) GetMarshalNil ¶
func (e *MessageEmbed) GetMarshalNil() bool
func (*MessageEmbed) MarshalJSON ¶
func (e *MessageEmbed) MarshalJSON() ([]byte, error)
func (*MessageEmbed) MarshalNil ¶
func (e *MessageEmbed) MarshalNil(flag bool) *MessageEmbed
type MessageEmbedAuthor ¶
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 ¶
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 ¶
type MessageEmbedFooter struct {}
MessageEmbedFooter is a part of a MessageEmbed struct.
type MessageEmbedImage ¶
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 ¶
type MessageEmbedProvider struct { URL string `json:"url,omitempty"` Name string `json:"name,omitempty"` }
MessageEmbedProvider is a part of a MessageEmbed struct.
type MessageEmbedThumbnail ¶
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 ¶
type MessageEmbedVideo struct { URL string `json:"url,omitempty"` ProxyURL string `json:"proxy_url,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` }
MessageEmbedVideo is a part of a MessageEmbed struct.
type MessageFlags ¶ added in v2.3.0
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 This message has been published to subscribed channels (via Channel Following). MessageFlagsCrossPosted MessageFlags = 1 << 0 // MessageFlagsIsCrossPosted this message originated from a message in another channel (via Channel Following). MessageFlagsIsCrossPosted MessageFlags = 1 << 1 // MessageFlagsSuppressEmbeds do not include any embeds when serializing this message. MessageFlagsSuppressEmbeds MessageFlags = 1 << 2 // MessageFlagsSourceMessageDeleted the source message for this crosspost has been deleted (via Channel Following). MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3 // MessageFlagsUrgent this message came from the urgent message system. MessageFlagsUrgent MessageFlags = 1 << 4 // MessageFlagsHasThread this message has an associated thread, with the same id as the message. MessageFlagsHasThread MessageFlags = 1 << 5 // MessageFlagsEphemeral this message is only visible to the user who invoked the Interaction. MessageFlagsEphemeral MessageFlags = 1 << 6 // MessageFlagsLoading this message is an Interaction Response and the bot is "thinking". MessageFlagsLoading MessageFlags = 1 << 7 // MessageFlagsFailedToMentionSomeRolesInThread this message failed to mention some roles and add their members to the thread. MessageFlagsFailedToMentionSomeRolesInThread MessageFlags = 1 << 8 // MessageFlagsSuppressNotifications this message will not trigger push and desktop notifications MessageFlagsSuppressNotifications MessageFlags = 1 << 12 // MessageFlagsIsVoiceMessage this message is a voice message. MessageFlagsIsVoiceMessage MessageFlags = 1 << 13 )
Valid MessageFlags values
type MessageInteraction ¶
type MessageInteraction struct { ID int64 `json:"id,string"` Type InteractionType `json:"type"` Name string `json:"name"` User *User `json:"user"` // Member is only present when the interaction is from a guild. Member *Member `json:"member"` }
MessageInteraction contains information about the application command interaction which generated the message.
type MessageReaction ¶
type MessageReaction struct { UserID int64 `json:"user_id,string"` MessageID int64 `json:"message_id,string"` Emoji Emoji `json:"emoji"` ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string,omitempty"` }
MessageReaction stores the data for a message reaction.
func (*MessageReaction) GetChannelID ¶
func (mr *MessageReaction) GetChannelID() int64
func (*MessageReaction) GetGuildID ¶
func (mr *MessageReaction) GetGuildID() int64
type MessageReactionAdd ¶
type MessageReactionAdd struct {
*MessageReaction
}
MessageReactionAdd is the data for a MessageReactionAdd event.
type MessageReactionRemove ¶
type MessageReactionRemove struct {
*MessageReaction
}
MessageReactionRemove is the data for a MessageReactionRemove event.
type MessageReactionRemoveAll ¶
type MessageReactionRemoveAll struct {
*MessageReaction
}
MessageReactionRemoveAll is the data for a MessageReactionRemoveAll event.
type MessageReactionRemoveEmoji ¶
type MessageReactionRemoveEmoji struct { ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string"` MessageID int64 `json:"message_id,string"` Emoji Emoji `json:"emoji"` }
all reactions for a given emoji were explicitly removed from a message
type MessageReactions ¶
type MessageReactions struct { Count int `json:"count"` CountDetails MessageReactionsCountDetails `json:"count_details"` Me bool `json:"me"` MeBurst bool `json:"me_burst"` Emoji *Emoji `json:"emoji"` BurstColors []string `json:"burst_colors"` }
MessageReactions holds a reactions object for a message.
type MessageReactionsCountDetails ¶ added in v2.34.0
MessageReactionsCountDetails holds normal and super reaction counts for the associated emoji.
type MessageReference ¶ added in v2.3.0
type MessageReference struct { Type MessageReferenceType `json:"type"` MessageID int64 `json:"message_id,string"` ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string,omitempty"` }
MessageReference contains reference data sent with crossposted messages
type MessageReferenceType ¶ added in v2.45.0
type MessageReferenceType int
const ( MessageReferenceTypeDefault MessageReferenceType = iota MessageReferenceTypeForward )
type MessageSend ¶
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 AllowedMentions `json:"allowed_mentions,omitempty"` Reference *MessageReference `json:"message_reference,omitempty"` Flags MessageFlags `json:"flags,omitempty"` StickerIDs []int64 `json:"sticker_ids"` // 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 MessageSnapshot ¶ added in v2.45.0
type MessageSnapshot struct {
Message *Message `json:"message"`
}
type MessageType ¶
type MessageType int
MessageType is the type of Message
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 MessageTypeUserPremiumGuildSubscriptionTier1 MessageType = 9 MessageTypeUserPremiumGuildSubscriptionTier2 MessageType = 10 MessageTypeUserPremiumGuildSubscriptionTier3 MessageType = 11 MessageTypeChannelFollowAdd MessageType = 12 MessageTypeGuildDiscoveryDisqualified MessageType = 14 MessageTypeGuildDiscoveryRequalified MessageType = 15 MessageTypeGuildDiscoveryGracePeriodInitialWarning MessageType = 16 MessageTypeGuildDiscoveryGracePeriodFinalWarning MessageType = 17 MessageTypeThreadCreated MessageType = 18 MessageTypeReply MessageType = 19 MessageTypeApplicationCommand MessageType = 20 MessageTypeThreadStarterMessage MessageType = 21 MessageTypeGuildInviteReminder MessageType = 22 )
Block contains the valid known MessageType values
func (MessageType) IsSystem ¶
func (m MessageType) IsSystem() bool
IsSystem returns wether the message type is a system message type, a message created by discord
type MessageUpdate ¶
type MessageUpdate struct {
*Message
}
MessageUpdate is the data for a MessageUpdate event.
func (*MessageUpdate) UnmarshalJSON ¶ added in v2.39.0
func (m *MessageUpdate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageUpdate object.
type ModalSubmitInteractionData ¶ added in v2.3.0
type ModalSubmitInteractionData struct { CustomID string `json:"custom_id"` Components []MessageComponent `json:"components"` }
ModalSubmitInteractionData contains the data of modal submit interaction.
func (ModalSubmitInteractionData) Type ¶ added in v2.3.0
func (ModalSubmitInteractionData) Type() InteractionType
Type returns the type of interaction data.
func (*ModalSubmitInteractionData) UnmarshalJSON ¶ added in v2.3.0
func (d *ModalSubmitInteractionData) UnmarshalJSON(data []byte) error
UnmarshalJSON is a helper function to correctly unmarshal Components.
type NullableID ¶ added in v2.1.0
type NullableID int64
A NullableID is a nullable snowflake ID that represents null as the value 0. It marshals into "null" if its value is 0, and otherwise marshals into the string representation of its value. Unmarshaling behaves similarly, and accepts null, string, and integer values.
func (NullableID) MarshalJSON ¶ added in v2.1.0
func (i NullableID) MarshalJSON() ([]byte, error)
func (*NullableID) UnmarshalJSON ¶ added in v2.1.0
func (i *NullableID) UnmarshalJSON(data []byte) error
type Packet ¶
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 PermissionOverwrite ¶
type PermissionOverwrite struct { ID int64 `json:"id,string"` 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 ¶
type PermissionOverwriteType int
const ( PermissionOverwriteTypeRole PermissionOverwriteType = 0 PermissionOverwriteTypeMember PermissionOverwriteType = 1 )
type Presence ¶
type Presence struct { User *User `json:"user"` Status Status `json:"status"` Activities Activities `json:"activities"` }
A Presence stores the online, offline, or idle and game status of Guild members.
type PresenceUpdate ¶
PresenceUpdate is the data for a PresenceUpdate event.
func (*PresenceUpdate) GetGuildID ¶
func (e *PresenceUpdate) GetGuildID() int64
func (*PresenceUpdate) NKeys ¶
func (p *PresenceUpdate) NKeys() int
func (*PresenceUpdate) UnmarshalJSONObject ¶
func (p *PresenceUpdate) UnmarshalJSONObject(dec *gojay.Decoder, key string) error
implement gojay.UnmarshalerJSONObject
type PresencesReplace ¶
type PresencesReplace []*Presence
PresencesReplace is the data for a PresencesReplace event.
type RESTError ¶
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 ¶
type RateLimit struct { *TooManyRequests URL string }
RateLimit is the data for a RateLimit event. This is a sythetic event and is not dispatched by Discord.
type RateLimiter ¶
type RateLimiter struct { sync.Mutex MaxConcurrentRequests int // contains filtered or unexported fields }
RateLimiter holds all ratelimit buckets
func (*RateLimiter) CurrentConcurrentLocks ¶
func (r *RateLimiter) CurrentConcurrentLocks() int
func (*RateLimiter) GetBucket ¶
func (r *RateLimiter) GetBucket(key string) *Bucket
GetBucket retrieves or creates a bucket
func (*RateLimiter) GetWaitTime ¶
func (r *RateLimiter) GetWaitTime(b *Bucket, minRemaining int) time.Duration
GetWaitTime returns the duration you should wait for a Bucket
func (*RateLimiter) LockBucket ¶
func (r *RateLimiter) LockBucket(bucketID string) (b *Bucket, lockID int64)
LockBucket Locks until a request can be made
func (*RateLimiter) LockBucketObject ¶
func (r *RateLimiter) LockBucketObject(b *Bucket) (lockID int64)
LockBucketObject Locks an already resolved bucket until a request can be made
func (*RateLimiter) SetGlobalTriggered ¶
func (r *RateLimiter) SetGlobalTriggered(to time.Time)
type ReadState ¶
type ReadState struct { MentionCount int `json:"mention_count"` LastMessageID int64 `json:"last_message_id,string"` ID int64 `json:"id,string"` }
A ReadState stores data on the read state of channels.
type ReaderWithMockClose ¶
func (*ReaderWithMockClose) Close ¶
func (rwmc *ReaderWithMockClose) Close() error
type Ready ¶
type Ready struct { Version int `json:"v"` SessionID string `json:"session_id"` User *SelfUser `json:"user"` ReadState []*ReadState `json:"read_state"` PrivateChannels []*Channel `json:"private_channels"` Guilds []*Guild `json:"guilds"` ResumeGatewayUrl string `json:"resume_gateway_url"` // 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 ¶
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 ¶
type RelationshipAdd struct {
*Relationship
}
RelationshipAdd is the data for a RelationshipAdd event.
type RelationshipRemove ¶
type RelationshipRemove struct {
*Relationship
}
RelationshipRemove is the data for a RelationshipRemove event.
type RequestGuildMembersData ¶
type Resumed ¶
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 int64 `json:"id,string"` // 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 RoleCreate ¶
type SKU ¶ added in v2.45.0
type SKU struct { // The ID of the SKU ID int64 `json:"id,string"` // The Type of the SKU Type SKUType `json:"type"` // The ID of the parent application ApplicationID int64 `json:"application_id,string"` // Customer-facing name of the SKU. Name string `json:"name"` // System-generated URL slug based on the SKU's name. Slug string `json:"slug"` // SKUFlags combined as a bitfield. The presence of a certain flag can be checked // by performing a bitwise AND operation between this int and the flag. Flags SKUFlags `json:"flags"` }
SKU represents a purchasable item in the Discord store.
type SKUFlags ¶ added in v2.45.0
type SKUFlags int
const ( // SKUFlagAvailable indicates that the SKU is available for purchase. SKUFlagAvailable SKUFlags = 1 << 2 // SKUFlagGuildSubscription indicates that the SKU is a guild subscription. SKUFlagGuildSubscription SKUFlags = 1 << 7 // SKUFlagUserSubscription indicates that the SKU is a user subscription. SKUFlagUserSubscription SKUFlags = 1 << 8 )
type SelectMenu ¶ added in v2.3.0
type SelectMenu struct { // Type of the select menu. MenuType SelectMenuType `json:"type,omitempty"` // CustomID is a developer-defined identifier for the select menu. 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"` // List of default values for auto-populated select menus. // NOTE: Number of entries should be in the range defined by MinValues and MaxValues. DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"` Options []SelectMenuOption `json:"options,omitempty"` Disabled bool `json:"disabled"` // NOTE: Can only be used in SelectMenu with Channel menu type. ChannelTypes []ChannelType `json:"channel_types,omitempty"` }
SelectMenu represents select menu component.
func (SelectMenu) MarshalJSON ¶ added in v2.3.0
func (s SelectMenu) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling SelectMenu to a JSON object.
func (SelectMenu) Type ¶ added in v2.3.0
func (s SelectMenu) Type() ComponentType
Type is a method to get the type of a component.
type SelectMenuDefaultValue ¶ added in v2.39.0
type SelectMenuDefaultValue struct { // ID of the entity. ID string `json:"id"` // Type of the entity. Type SelectMenuDefaultValueType `json:"type"` }
SelectMenuDefaultValue represents an entity selected by default in auto-populated select menus.
type SelectMenuDefaultValueType ¶ added in v2.39.0
type SelectMenuDefaultValueType string
SelectMenuDefaultValueType represents the type of an entity selected by default in auto-populated select menus.
const ( SelectMenuDefaultValueUser SelectMenuDefaultValueType = "user" SelectMenuDefaultValueRole SelectMenuDefaultValueType = "role" SelectMenuDefaultValueChannel SelectMenuDefaultValueType = "channel" )
SelectMenuDefaultValue types.
type SelectMenuOption ¶ added in v2.3.0
type SelectMenuOption struct { Label string `json:"label,omitempty"` Value string `json:"value"` Description string `json:"description"` Emoji *ComponentEmoji `json:"emoji,omitempty"` // Determines whenever option is selected by default or not. Default bool `json:"default"` }
SelectMenuOption represents an option for a select menu.
type SelectMenuType ¶ added in v2.39.0
type SelectMenuType ComponentType
SelectMenuType represents select menu type.
type SelfUser ¶
A SelfUser stores user data about the token owner. Includes a few extra fields than a normal user struct.
type Session ¶
type Session struct { // Authentication token for this session Token string MFA bool Intents []GatewayIntent // Debug for printing JSON request/responses Debug bool // Deprecated, will be removed. LogLevel int // Should the session reconnect the websocket on errors. ShouldReconnectOnError bool // 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 // Max number of REST API retries MaxRestRetries int // Managed state object, updated internally with events when // StateEnabled is true. State *State // The http client used for REST requests Client *http.Client // Stores the last HeartbeatAck that was recieved (in UTC) LastHeartbeatAck time.Time // used to deal with rate limits Ratelimiter *RateLimiter // The gateway websocket connection GatewayManager *GatewayConnectionManager // 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, 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>"` 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 ¶
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://discordapp.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 ¶
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 ¶
func (s *Session) Application(appID int64) (st *Application, err error)
Application returns an Application structure of a specific Application
appID : The ID of an Application
func (*Session) ApplicationBotCreate ¶
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) ApplicationCreate ¶
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 ¶
ApplicationDelete deletes an existing Application
appID : The ID of an Application
func (*Session) ApplicationMe ¶
func (s *Session) ApplicationMe() (st *Application, err error)
Application returns an Application structure of the current bot
func (*Session) ApplicationUpdate ¶
func (s *Session) ApplicationUpdate(appID int64, ap *Application) (st *Application, err error)
ApplicationUpdate updates an existing Application
var : desc
func (*Session) Applications ¶
func (s *Session) Applications() (st []*Application, err error)
Applications returns all applications for the authenticated user
func (*Session) BatchEditGuildApplicationCommandsPermissions ¶
func (s *Session) BatchEditGuildApplicationCommandsPermissions(applicationID int64, guildID int64, data []*GuildApplicationCommandPermissions) (st []*GuildApplicationCommandPermissions, err error)
BatchEditGuildApplicationCommandsPermissions Fetches command permissions for a specific command for your application in a guild. PUT /applications/{application.id}/guilds/{guild.id}/commands/permissions
func (*Session) BulkOverwriteGlobalApplicationCommands ¶
func (s *Session) BulkOverwriteGlobalApplicationCommands(applicationID int64, data []*CreateApplicationCommandRequest) (st []*ApplicationCommand, err error)
BulkOverwriteGlobalApplicationCommands Takes a list of application commands, overwriting existing commands that are registered globally for this application. Updates will be available in all guilds after 1 hour. PUT /applications/{application.id}/commands
func (*Session) BulkOverwriteGuildApplicationCommands ¶
func (s *Session) BulkOverwriteGuildApplicationCommands(applicationID int64, guildID int64, data []*CreateApplicationCommandRequest) (st []*ApplicationCommand, err error)
BulkOverwriteGuildApplicationCommands Takes a list of application commands, overwriting existing commands for the guild. PUT /applications/{application.id}/guilds/{guild.id}/commands
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 ¶
func (s *Session) ChannelEditComplex(channelID int64, 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 ¶
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 ¶
func (s *Session) ChannelFileSendWithMessage(channelID int64, 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 ¶
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 ¶
func (s *Session) ChannelMessageAck(channelID, messageID int64, lastToken string) (st *Ack, err error)
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 v2.29.0
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 ¶
func (s *Session) ChannelMessageEditComplex(msg *MessageEdit) (st *Message, err error)
ChannelMessageEditComplex edits an existing message, replacing it entirely with the given MessageEdit struct
func (*Session) ChannelMessageEditEmbed ¶
func (s *Session) ChannelMessageEditEmbed(channelID, messageID int64, 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) ChannelMessageEditEmbedList ¶ added in v2.3.0
func (s *Session) ChannelMessageEditEmbedList(channelID, messageID int64, embeds []*MessageEmbed) (*Message, error)
ChannelMessageEditEmbeds edits an existing message with a list of embedded data. channelID : The ID of a Channel messageID : The ID of a Message embeds : The list of embed data to send
func (*Session) ChannelMessagePin ¶
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 ¶
func (s *Session) ChannelMessageSendComplex(channelID int64, msg *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 ¶
func (s *Session) ChannelMessageSendEmbed(channelID int64, 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) ChannelMessageSendEmbedList ¶ added in v2.3.0
func (s *Session) ChannelMessageSendEmbedList(channelID int64, embeds []*MessageEmbed) (*Message, error)
ChannelMessageSendEmbeds sends a message to the given channel with list of embedded data. channelID : The ID of a Channel. embed : The list embed data to send.
func (*Session) ChannelMessageSendEmbeds ¶ added in v2.3.0
func (s *Session) ChannelMessageSendEmbeds(channelID int64, 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 v2.3.0
func (s *Session) ChannelMessageSendReply(channelID int64, 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 ¶
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 ¶
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 int64, limit int, beforeID, afterID, aroundID int64) (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 ¶
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 message IDs. A maximum of 100 messages.
func (*Session) ChannelMessagesPinned ¶
ChannelMessagesPinned returns an array of Message structures for pinned messages within a given channel channelID : The ID of a Channel.
func (*Session) ChannelPermissionDelete ¶
ChannelPermissionDelete deletes a specific permission override for the given channel. NOTE: Name of this func may change.
func (*Session) ChannelPermissionSet ¶
func (s *Session) ChannelPermissionSet(channelID, targetID int64, 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) ChannelWebhooks ¶
ChannelWebhooks returns all webhooks for a given channel. channelID: The ID of a channel.
func (*Session) Close ¶
Close maintains backwards compatibility with old discordgo versions It's the same as s.GatewayManager.Close()
func (*Session) CreateFollowupMessage ¶
func (s *Session) CreateFollowupMessage(applicationID int64, token string, data *WebhookParams) (st *Message, err error)
CreateFollowupMessage Creates a followup message for an Interaction. Functions the same as Execute Webhook, but wait is always true, and flags can be set to 64 in the body to send an ephemeral message. POST /webhooks/{application.id}/{interaction.token}
func (*Session) CreateGlobalApplicationCommand ¶
func (s *Session) CreateGlobalApplicationCommand(applicationID int64, command *CreateApplicationCommandRequest) (st *ApplicationCommand, err error)
CreateGlobalApplicationCommand creates a new global command. New global commands will be available in all guilds after 1 hour. POST /applications/{application.id}/commands
func (*Session) CreateGuildApplicationCommands ¶
func (s *Session) CreateGuildApplicationCommands(applicationID int64, guildID int64, data *CreateApplicationCommandRequest) (st *ApplicationCommand, err error)
CreateGuildApplicationCommands Create a new guild command. New guild commands will be available in the guild immediately. Returns 201 and an ApplicationCommand object. If the command did not already exist, it will count toward daily application command create limits. POST /applications/{application.id}/guilds/{guild.id}/commands
func (*Session) CreateInteractionResponse ¶
func (s *Session) CreateInteractionResponse(interactionID int64, token string, data *InteractionResponse) (err error)
CreateInteractionResponse Create a response to an Interaction from the gateway. Takes an Interaction response. POST /interactions/{interaction.id}/{interaction.token}/callback
func (*Session) DeleteFollowupMessage ¶
func (s *Session) DeleteFollowupMessage(applicationID int64, token string, messageID int64) (err error)
DeleteFollowupMessage Deletes a followup message for an Interaction. DELETE /webhooks/{application.id}/{interaction.token}/messages/{message.id}
func (*Session) DeleteGlobalApplicationCommand ¶
DeleteGlobalApplicationCommand deletes a global command. DELETE /applications/{application.id}/commands/{command.id}
func (*Session) DeleteGuildApplicationCommand ¶
func (s *Session) DeleteGuildApplicationCommand(applicationID int64, guildID int64, cmdID int64) (err error)
DeleteGuildApplicationCommand Delete a guild command. DELETE /applications/{application.id}/guilds/{guild.id}/commands/{command.id}
func (*Session) DeleteInteractionResponse ¶
DeleteInteractionResponse Deletes the initial Interaction response. DELETE /webhooks/{application.id}/{interaction.token}/messages/@original
func (*Session) EditFollowupMessage ¶
func (s *Session) EditFollowupMessage(applicationID int64, token string, messageID int64, data *WebhookParams) (st *Message, err error)
EditFollowupMessage Edits a followup message for an Interaction. Functions the same as Edit Webhook Message. PATCH /webhooks/{application.id}/{interaction.token}/messages/{message.id}
func (*Session) EditGlobalApplicationCommand ¶
func (s *Session) EditGlobalApplicationCommand(applicationID int64, cmdID int64, data *EditApplicationCommandRequest) (st *ApplicationCommand, err error)
EditGlobalApplicationCommand edits a global command. Updates will be available in all guilds after 1 hour. PATCH /applications/{application.id}/commands/{command.id}
func (*Session) EditGuildApplicationCommand ¶
func (s *Session) EditGuildApplicationCommand(applicationID int64, guildID int64, cmdID int64, data *EditApplicationCommandRequest) (st *ApplicationCommand, err error)
EditGuildApplicationCommand Edit a guild command. Updates for guild commands will be available immediately. PATCH /applications/{application.id}/guilds/{guild.id}/commands/{command.id}
func (*Session) EditGuildApplicationCommandPermissions ¶
func (s *Session) EditGuildApplicationCommandPermissions(applicationID int64, guildID int64, cmdID int64, permissions []*ApplicationCommandPermissions) (err error)
EditGuildApplicationCommandPermissions Edits command permissions for a specific command for your application in a guild. PUT /applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions TODO: what does this return? docs dosn't say
func (*Session) EditOriginalInteractionResponse ¶
func (s *Session) EditOriginalInteractionResponse(applicationID int64, token string, data *WebhookParams) (st *Message, err error)
Edits the initial Interaction response. Functions the same as Edit Webhook Message. PATCH /webhooks/{application.id}/{interaction.token}/messages/@original
func (*Session) EntitlementConsume ¶ added in v2.45.0
EntitlementConsume marks a given One-Time Purchase for the user as consumed.
func (*Session) EntitlementTestCreate ¶ added in v2.45.0
func (s *Session) EntitlementTestCreate(appID int64, data *EntitlementTest) (err error)
EntitlementTestCreate creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering.
func (*Session) EntitlementTestDelete ¶ added in v2.45.0
EntitlementTestDelete deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.
func (*Session) Entitlements ¶ added in v2.45.0
func (s *Session) Entitlements(applicationID int64, filterOptions *EntitlementFilterOptions) (entitlements []*Entitlement, err error)
Entitlements returns all antitlements for a given app, active and expired. appID : The ID of the application. filterOptions : Optional filter options; otherwise set it to nil.
func (*Session) ForumThreadStart ¶ added in v2.34.0
func (s *Session) ForumThreadStart(channelID int64, name string, archiveDuration AutoArchiveDuration, content string) (th *Channel, err error)
ForumThreadStart starts a new thread (post) in a forum channel. channelID : Channel to create thread in. name : Name of the thread. archiveDuration : Auto archive duration. content : Content of the starting message.
func (*Session) ForumThreadStartComplex ¶ added in v2.34.0
func (s *Session) ForumThreadStartComplex(channelID int64, threadData *ThreadStart, messageData *MessageSend) (th *Channel, err error)
ForumThreadStartComplex starts a new thread (creates a post) in a forum channel. channelID : Channel to create thread in. threadData : Parameters of the thread. messageData : Parameters of the starting message.
func (*Session) ForumThreadStartEmbed ¶ added in v2.34.0
func (s *Session) ForumThreadStartEmbed(channelID int64, name string, archiveDuration AutoArchiveDuration, embed *MessageEmbed) (th *Channel, err error)
ForumThreadStartEmbed starts a new thread (post) in a forum channel. channelID : Channel to create thread in. name : Name of the thread. archiveDuration : Auto archive duration. embed : Embed data of the starting message.
func (*Session) ForumThreadStartEmbeds ¶ added in v2.34.0
func (s *Session) ForumThreadStartEmbeds(channelID int64, name string, archiveDuration AutoArchiveDuration, embeds []*MessageEmbed) (th *Channel, err error)
ForumThreadStartEmbeds starts a new thread (post) in a forum channel. channelID : Channel to create thread in. name : Name of the thread. archiveDuration : Auto archive duration. embeds : Embeds data of the starting message.
func (*Session) GatewayBot ¶
func (s *Session) GatewayBot() (st *GatewayBotResponse, err error)
GatewayBot returns the websocket Gateway address and the recommended number of shards
func (*Session) GetGlobalApplicationCommand ¶
func (s *Session) GetGlobalApplicationCommand(applicationID int64, cmdID int64) (st *ApplicationCommand, err error)
GetGlobalApplicationCommand fetches a global command for your application. Returns an ApplicationCommand object. GET /applications/{application.id}/commands/{command.id}
func (*Session) GetGlobalApplicationCommands ¶
func (s *Session) GetGlobalApplicationCommands(applicationID int64) (st []*ApplicationCommand, err error)
GetGlobalApplicationCommands fetches all of the global commands for your application. Returns an array of ApplicationCommand objects. GET /applications/{application.id}/commands
func (*Session) GetGuildApplicationCommand ¶
func (s *Session) GetGuildApplicationCommand(applicationID int64, guildID int64, cmdID int64) (st *ApplicationCommand, err error)
GetGuildApplicationCommand Fetch a guild command for your application. GET /applications/{application.id}/guilds/{guild.id}/commands/{command.id}
func (*Session) GetGuildApplicationCommandPermissions ¶
func (s *Session) GetGuildApplicationCommandPermissions(applicationID int64, guildID int64, cmdID int64) (st *GuildApplicationCommandPermissions, err error)
GetGuildApplicationCommandPermissions Fetches command permissions for a specific command for your application in a guild. GET /applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions
func (*Session) GetGuildApplicationCommands ¶
func (s *Session) GetGuildApplicationCommands(applicationID int64, guildID int64) (st []*ApplicationCommand, err error)
GetGuildApplicationCommands fetches all of the guild commands for your application for a specific guild. GET /applications/{application.id}/guilds/{guild.id}/commands
func (*Session) GetGuildApplicationCommandsPermissions ¶
func (s *Session) GetGuildApplicationCommandsPermissions(applicationID int64, guildID int64) (st []*GuildApplicationCommandPermissions, err error)
GetGuildApplicationCommandPermissions Fetches command permissions for all commands for your application in a guild. GET /applications/{application.id}/guilds/{guild.id}/commands/permissions
func (*Session) GetOriginalInteractionResponse ¶
func (s *Session) GetOriginalInteractionResponse(applicationID int64, token string) (st *Message, err error)
GetOriginalInteractionResponse Returns the initial Interaction response. Functions the same as Get Webhook Message. GET /webhooks/{application.id}/{interaction.token}/messages/@original
func (*Session) GetSKUSubscription ¶ added in v2.45.0
func (s *Session) GetSKUSubscription(skuID, subscriptionID int64) (subscription *Subscription, err error)
func (*Session) GetSKUSubscriptions ¶ added in v2.45.0
func (s *Session) GetSKUSubscriptions(skuID int64, filterOptions *SubscriptionFilterOptions) (subscriptions []*Subscription, err error)
func (*Session) Guild ¶
Guild returns a Guild structure of a specific Guild. guildID : The ID of a Guild
func (*Session) GuildAuditLog ¶
func (s *Session) GuildAuditLog(guildID, userID, beforeID int64, actionType AuditLogAction, 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 ¶
GuildBan returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission. guildID : The ID of a Guild.
func (*Session) GuildBanCreate ¶
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 ¶
func (s *Session) GuildBanCreateWithReason(guildID, userID int64, reason string, days int) (err error)
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) GuildBanDeleteWithReason ¶ added in v2.36.0
GuildBanDeleteWithReason removes the given user from the guild bans, including sending an audit log reason. guildID : The ID of a Guild userID : The ID of a User reason : The reason for removing the ban
func (*Session) GuildBans ¶
GuildBans returns an array of User structures for all bans of a given guild. guildID : The ID of a Guild.
func (*Session) GuildChannelCreate ¶
func (s *Session) GuildChannelCreate(guildID int64, 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) GuildChannelCreateWithOverwrites ¶
func (s *Session) GuildChannelCreateWithOverwrites(guildID int64, name string, ctype ChannelType, parentID int64, overwrites []*PermissionOverwrite) (st *Channel, err error)
GuildChannelCreateWithOverwrites 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 overwrites : slice of permission overwrites
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 ¶
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 int64, 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 ¶
func (s *Session) GuildEmbed(guildID int64) (st *GuildEmbed, err error)
GuildEmbed returns the embed for a Guild. guildID : The ID of a Guild.
func (*Session) GuildEmbedEdit ¶
GuildEmbedEdit returns the embed for a Guild. guildID : The ID of a Guild.
func (*Session) GuildEmojiCreate ¶
func (s *Session) GuildEmojiCreate(guildID int64, name, image string, roles []int64) (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 ¶
GuildEmojiDelete deletes an Emoji. guildID : The ID of a Guild. emojiID : The ID of an Emoji.
func (*Session) GuildEmojiEdit ¶
func (s *Session) GuildEmojiEdit(guildID, emojiID int64, name string, roles []int64) (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) GuildIcon ¶
GuildIcon returns an image.Image of a guild icon. guildID : The ID of a Guild.
func (*Session) GuildIntegrationCreate ¶
func (s *Session) GuildIntegrationCreate(guildID int64, integrationType string, integrationID int64) (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 ¶
GuildIntegrationDelete removes the given integration from the Guild. guildID : The ID of a Guild. integrationID : The ID of an integration.
func (*Session) GuildIntegrationEdit ¶
func (s *Session) GuildIntegrationEdit(guildID, integrationID int64, 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 ¶
GuildIntegrationSync syncs an integration. guildID : The ID of a Guild. integrationID : The ID of an integration.
func (*Session) GuildIntegrations ¶
func (s *Session) GuildIntegrations(guildID int64) (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 ¶
GuildLeave leaves a Guild. guildID : The ID of a Guild
func (*Session) GuildMember ¶
GuildMember returns a member of a guild.
guildID : The ID of a Guild. userID : The ID of a User
func (*Session) GuildMemberAdd ¶
func (s *Session) GuildMemberAdd(accessToken string, guildID, userID int64, nick string, roles []int64, 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) 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 ¶
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 ¶
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 ¶
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. Use 0 to disconnect the member.
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) GuildMemberNickname ¶
GuildMemberNickname updates the nickname of a guild member guildID : The ID of a guild userID : The ID of a user or "@me" which is a shortcut of the current user ID nickname : The new nickname
func (*Session) GuildMemberNicknameMe ¶
GuildMemberNicknameMe updates the nickname the current user guildID : The ID of a guild nickname : The new nickname
func (*Session) GuildMemberRoleAdd ¶
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 ¶
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 v2.3.0
func (s *Session) GuildMemberTimeout(guildID int64, userID int64, until *time.Time, reason string) (err error)
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) GuildMemberTimeoutWithReason ¶ added in v2.3.0
func (s *Session) GuildMemberTimeoutWithReason(guildID int64, userID int64, until *time.Time, reason string) (err error)
GuildMemberTimeoutWithReason times out a guild member with a mandatory reason
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.
reason : The reason for the timeout
func (*Session) GuildMemberVoiceState ¶ added in v2.43.0
func (s *Session) GuildMemberVoiceState(guildID, userID int64) (voiceState *VoiceState, err error)
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) GuildPrune ¶
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 ¶
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 ¶
GuildRoleCreate returns a new Guild Role. guildID: The ID of a Guild.
func (*Session) GuildRoleCreateComplex ¶
func (s *Session) GuildRoleCreateComplex(guildID int64, roleCreate RoleCreate) (st *Role, err error)
GuildRoleCreateComplex returns a new Guild Role. guildID: The ID of a Guild.
func (*Session) GuildRoleDelete ¶
GuildRoleDelete deletes an existing role. guildID : The ID of a Guild. roleID : The ID of a Role.
func (*Session) GuildRoleEdit ¶
func (s *Session) GuildRoleEdit(guildID, roleID int64, 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 ¶
GuildRoleReorder reoders guild roles guildID : The ID of a Guild. roles : A list of ordered roles.
func (*Session) GuildRoles ¶
GuildRoles returns all roles for a given guild. guildID : The ID of a Guild.
func (*Session) GuildSplash ¶
GuildSplash returns an image.Image of a guild splash image. guildID : The ID of a Guild.
func (*Session) GuildThreadsActive ¶ added in v2.34.0
func (s *Session) GuildThreadsActive(guildID int64) (threads *ThreadsList, err error)
GuildThreadsActive returns all active threads for specified guild.
func (*Session) GuildWebhooks ¶
GuildWebhooks returns all webhooks for a given guild. guildID: The ID of a Guild.
func (*Session) GuildWithCounts ¶
Guild returns a Guild structure of a specific Guild. guildID : The ID of a Guild
func (*Session) HandleEvent ¶
Handles an event type by calling internal methods, firing handlers and firing the interface{} event.
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 ¶
InviteWithCounts returns an Invite structure of the given invite including approximate member counts inviteID : The invite code
func (*Session) MessageReactionAdd ¶
MessageReactionAdd creates an emoji reaction to a message. channelID : The channel ID. messageID : The message ID. emoji : Either the unicode emoji for the reaction, or a guild emoji identifier.
func (*Session) MessageReactionRemove ¶
func (s *Session) MessageReactionRemove(channelID, messageID int64, emoji string, userID int64) error
MessageReactionRemove deletes an emoji reaction to a message. channelID : The channel ID. messageID : The message ID. emoji : Either the unicode emoji for the reaction, or a guild emoji identifier. userID : The ID of the user to delete the reaction for.
func (*Session) MessageReactionRemoveEmoji ¶
MessageReactionRemoveEmoji deletes all emoji reactions in a message. channelID : The channel ID. messageID : The message ID. emoji : Either the unicode emoji for the reaction, or a guild emoji identifier.
func (*Session) MessageReactionRemoveMe ¶
MessageReactionRemoveMe deletes an emoji reaction to a message the current user made. channelID : The channel ID. messageID : The message ID. emoji : Either the unicode emoji for the reaction, or a guild emoji identifier.
func (*Session) MessageReactions ¶
func (s *Session) MessageReactions(channelID, messageID int64, emoji string, limit int, before, after int64) (st []*User, err error)
MessageReactions gets all the users reactions for a specific emoji. channelID : The channel ID. messageID : The message ID. emoji : Either the unicode emoji for the reaction, or a guild emoji identifier. limit : max number of users to return (max 100)
func (*Session) MessageReactionsRemoveAll ¶
MessageReactionsRemoveAll deletes all reactions from a message channelID : The channel ID messageID : The message ID.
func (*Session) MessageThreadStart ¶ added in v2.34.0
func (s *Session) MessageThreadStart(channelID, messageID int64, name string, archiveDuration AutoArchiveDuration) (ch *Channel, err error)
MessageThreadStart creates a new thread from an existing message. channelID : Channel to create thread in messageID : Message to start thread from name : Name of the thread archiveDuration : Auto archive duration (in minutes)
func (*Session) MessageThreadStartComplex ¶ added in v2.34.0
func (s *Session) MessageThreadStartComplex(channelID, messageID int64, data *ThreadStart) (ch *Channel, err error)
MessageThreadStartComplex creates a new thread from an existing message. channelID : Channel to create thread in messageID : Message to start thread from data : Parameters of the thread
func (*Session) RelationshipDelete ¶
RelationshipDelete removes the relationship with a user. userID: ID of the user.
func (*Session) RelationshipFriendRequestAccept ¶
RelationshipFriendRequestAccept accepts a friend request from a user. userID: ID of the user.
func (*Session) RelationshipFriendRequestSend ¶
RelationshipFriendRequestSend sends a friend request to a user. userID: ID of the user.
func (*Session) RelationshipUserBlock ¶
RelationshipUserBlock blocks a user. userID: ID of the user.
func (*Session) RelationshipsGet ¶
func (s *Session) RelationshipsGet() (r []*Relationship, err error)
RelationshipsGet returns an array of all the relationships of the user.
func (*Session) RelationshipsMutualGet ¶
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 ¶
func (s *Session) Request(method, urlStr string, data interface{}, headers map[string]string) (response []byte, err error)
Request is the same as RequestWithBucketID but the bucket id is the same as the urlStr
func (*Session) RequestWithBucket ¶
func (s *Session) RequestWithBucket(method, urlStr, contentType string, b []byte, headers map[string]string, bucket *Bucket) (response []byte, err error)
RequestWithLockedBucket makes a request using a bucket that's already been locked
func (*Session) RequestWithBucketID ¶
func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, headers map[string]string, bucketID string) (response []byte, err error)
RequestWithBucketID makes a (GET/POST/...) Requests to Discord REST API with JSON data.
func (*Session) SKUs ¶ added in v2.45.0
SKUs returns all SKUs for a given application. appID : The ID of the application.
func (*Session) ThreadJoin ¶ added in v2.34.0
ThreadJoin adds current user to a thread
func (*Session) ThreadLeave ¶ added in v2.34.0
ThreadLeave removes current user to a thread
func (*Session) ThreadMember ¶ added in v2.34.0
func (s *Session) ThreadMember(threadID int64, memberID string, withMember bool) (member *ThreadMember, err error)
ThreadMember returns thread member object for the specified member of a thread. withMember : Whether to include a guild member object.
func (*Session) ThreadMemberAdd ¶ added in v2.34.0
ThreadMemberAdd adds another member to a thread
func (*Session) ThreadMemberRemove ¶ added in v2.34.0
ThreadMemberRemove removes another member from a thread
func (*Session) ThreadMembers ¶ added in v2.34.0
func (s *Session) ThreadMembers(threadID int64, limit int, withMember bool, afterID string) (members []*ThreadMember, err error)
ThreadMembers returns all members of specified thread. limit : Max number of thread members to return (1-100). Defaults to 100. afterID : Get thread members after this user ID. withMember : Whether to include a guild member object for each thread member.
func (*Session) ThreadStart ¶ added in v2.34.0
func (s *Session) ThreadStart(channelID int64, name string, typ ChannelType, archiveDuration AutoArchiveDuration) (ch *Channel, err error)
ThreadStart creates a new thread. channelID : Channel to create thread in name : Name of the thread archiveDuration : Auto archive duration (in minutes)
func (*Session) ThreadStartComplex ¶ added in v2.34.0
func (s *Session) ThreadStartComplex(channelID int64, data *ThreadStart) (ch *Channel, err error)
ThreadStartComplex creates a new thread. channelID : Channel to create thread in data : Parameters of the thread
func (*Session) ThreadsActive ¶ added in v2.34.0
func (s *Session) ThreadsActive(channelID int64) (threads *ThreadsList, err error)
ThreadsActive returns all active threads for specified channel.
func (*Session) ThreadsArchived ¶ added in v2.34.0
func (s *Session) ThreadsArchived(channelID int64, before *time.Time, limit int) (threads *ThreadsList, err error)
ThreadsArchived returns archived threads for specified channel. before : If specified returns only threads before the timestamp limit : Optional maximum amount of threads to return.
func (*Session) ThreadsPrivateArchived ¶ added in v2.34.0
func (s *Session) ThreadsPrivateArchived(channelID int64, before *time.Time, limit int) (threads *ThreadsList, err error)
ThreadsPrivateArchived returns archived private threads for specified channel. before : If specified returns only threads before the timestamp limit : Optional maximum amount of threads to return.
func (*Session) ThreadsPrivateJoinedArchived ¶ added in v2.34.0
func (s *Session) ThreadsPrivateJoinedArchived(channelID int64, before *time.Time, limit int) (threads *ThreadsList, err error)
ThreadsPrivateJoinedArchived returns archived joined private threads for specified channel. before : If specified returns only threads before the timestamp limit : Optional maximum amount of threads to return.
func (*Session) UpdateCompetingStatus ¶ added in v2.31.0
UpdateCompetingStatus is used to update the user's competing status Set what the user is competing in to status. Set the online status to statusType.
func (*Session) UpdateCustomStatus ¶ added in v2.31.0
UpdateCustomStatus is used to update the user's custom status Set the user's custom text to status. Set the online status to statusType.
func (*Session) UpdateListeningStatus ¶
UpdateListeningStatus is used to update the user's listening status Set what the user is listening to to status. Set the online status to statusType.
func (*Session) UpdatePlayingStatus ¶ added in v2.31.0
UpdatePlayingStatus is used to update the user's playing status. Set the game being played to status. Set the online status to statusType.
func (*Session) UpdateStatus ¶
func (s *Session) UpdateStatus(activityType ActivityType, statusType Status, statusText, streamingUrl string) (err error)
UpdateStatus is used to update the user's status. Set the custom status to statusText. Set the online status to statusType.
func (*Session) UpdateStatusComplex ¶
func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error)
func (*Session) UpdateStreamingStatus ¶
func (s *Session) UpdateStreamingStatus(statusText string, statusType Status, url string) (err error)
UpdateStreamingStatus is used to update the user's streaming status. Set the name of the stream to status. Set the online status to statusType. Set the stream URL to url.
func (*Session) UpdateWatchingStatus ¶ added in v2.31.0
UpdateWatchingStatus is used to update the user's watching status Set what the user is watching to status. Set the online status to statusType.
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 ¶
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 ¶
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 ¶
func (s *Session) UserConnections() (conn []*UserConnection, err error)
UserConnections returns the user's connections
func (*Session) UserGuildSettingsEdit ¶
func (s *Session) UserGuildSettingsEdit(guildID int64, 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 ¶
UserNoteSet sets the note for a specific user.
func (*Session) UserSettings ¶
UserSettings returns the settings for a given user
func (*Session) UserUpdate ¶
func (s *Session) UserUpdate(email, password, username, avatar, newPassword string) (st *User, err error)
UserUpdate updates a users settings.
func (*Session) UserUpdateStatus ¶
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) WebhookCreate ¶
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 ¶
WebhookDelete deletes a webhook for a given ID webhookID: The ID of a webhook.
func (*Session) WebhookDeleteWithToken ¶
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 ¶
func (s *Session) WebhookEdit(webhookID int64, name, avatar string, channelID int64) (st *Role, err error)
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 ¶
func (s *Session) WebhookEditWithToken(webhookID int64, token, name, avatar string) (st *Role, err error)
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 ¶
func (s *Session) WebhookExecute(webhookID int64, token string, wait bool, data *WebhookParams) (err error)
WebhookExecute executes a webhook. webhookID: The ID of a webhook. token : The auth token for the webhook
func (*Session) WebhookExecuteComplex ¶
func (s *Session) WebhookExecuteComplex(webhookID int64, token string, wait bool, data *WebhookParams) (m *Message, err error)
WebhookExecuteComplex executes a webhook. webhookID: The ID of a webhook. token : The auth token for the webhook
func (*Session) WebhookMessage ¶ added in v2.39.0
func (s *Session) WebhookMessage(webhookID int64, token string, messageID int64) (message *Message, err error)
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
type SessionStartLimit ¶
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 IDSlice `json:"guild_positions,string"` RestrictedGuilds IDSlice `json:"restricted_guilds,string"` 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 ¶
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 ¶
Channel gets a channel by ID, it will look in all guilds and private channels.
func (*State) ChannelAdd ¶
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 ¶
ChannelRemove removes a channel from current world state.
func (*State) Guild ¶
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 ¶
GuildAdd adds a guild to the current world state, or updates it if it already exists.
func (*State) GuildChannel ¶
GuildChannel gets a channel by ID from a guild. This method is Deprecated, use Channel(channelID)
func (*State) GuildRemove ¶
GuildRemove removes a guild from current world state.
func (*State) MemberAdd ¶
MemberAdd adds a member to the current world state, or updates it if it already exists.
func (*State) MemberRemove ¶
MemberRemove removes a member from current world state.
func (*State) MessageAdd ¶
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) MessageRemove ¶
MessageRemove removes a message from the world state.
func (*State) OnInterface ¶
OnInterface handles all events related to states.
func (*State) PresenceAdd ¶
PresenceAdd adds a presence to the current world state, or updates it if it already exists.
func (*State) PresenceRemove ¶
PresenceRemove removes a presence from the current world state.
func (*State) PrivateChannel ¶
PrivateChannel gets a private channel by ID. This method is Deprecated, use Channel(channelID)
func (*State) RoleAdd ¶
RoleAdd adds a role to the current world state, or updates it if it already exists.
func (*State) RoleRemove ¶
RoleRemove removes a role from current world state by ID.
func (*State) UserChannelPermissions ¶
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 ¶
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.
type StdGatewayIdentifyRatleimiter ¶
type StdGatewayIdentifyRatleimiter struct {
// contains filtered or unexported fields
}
Standard implementation of the GatewayIdentifyRatelimiter
func (*StdGatewayIdentifyRatleimiter) RatelimitIdentify ¶
func (rl *StdGatewayIdentifyRatleimiter) RatelimitIdentify(shardID int)
type Sticker ¶ added in v2.47.0
type Sticker struct { ID int64 `json:"id,string"` PackID int64 `json:"pack_id,string"` Name string `json:"name"` Description string `json:"description"` Tags string `json:"tags"` Type StickerType `json:"type"` FormatType StickerFormat `json:"format_type"` Available bool `json:"available"` GuildID int64 `json:"guild_id,string"` User *User `json:"user"` SortValue int `json:"sort_value"` }
Sticker represents a Sticker object that can be sent in a Message.
type StickerFormat ¶ added in v2.47.0
type StickerFormat int
StickerFormat is the file format of the Sticker.
const ( StickerFormatTypePNG StickerFormat = 1 StickerFormatTypeAPNG StickerFormat = 2 StickerFormatTypeLottie StickerFormat = 3 StickerFormatTypeGIF StickerFormat = 4 )
Defines all known Sticker types.
type StickerItem ¶ added in v2.47.0
type StickerItem struct { ID int64 `json:"id,string"` Name string `json:"name"` FormatType StickerFormat `json:"format_type"` }
StickerItem represents the smallest amount of data required to render a sticker. A partial sticker object.
type StickerPack ¶ added in v2.47.0
type StickerPack struct { ID int64 `json:"id,string"` Stickers []Sticker `json:"stickers"` Name string `json:"name"` SKUID int64 `json:"sku_id,string"` CoverStickerID int64 `json:"cover_sticker_id,string"` Description string `json:"description"` BannerAssetID int64 `json:"banner_asset_id,string"` }
StickerPack represents a pack of standard stickers.
type StickerType ¶ added in v2.47.0
type StickerType int
StickerType is the type of Sticker.
const ( StickerTypeStandard StickerType = 1 StickerTypeGuild StickerType = 2 )
Defines Sticker types.
type Subscription ¶ added in v2.45.0
type Subscription struct { ID int64 `json:"id,string"` UserID int64 `json:"user_id,string"` //list of SKUs the user has subscribed to SKUIDS []int64 `json:"sku_ids"` //list of entitlements granted EntitlementIDs []int64 `json:"entitlement_ids"` //start of the current subscription period, this is updated when the subscription is renewed, not to be confused with the start of a subscription CurrentPeriodStart time.Time `json:"current_period_start"` //end of the current subscription period CurrentPeriodEnd time.Time `json:"current_period_end"` Status SubscriptionStatus `json:"status"` // Only present if the subscription status is Ending or Inactive, represents the time when the subscription was cancelled CancelledAt time.Time `json:"cancelled_at,omitempty"` }
type SubscriptionCreate ¶ added in v2.45.0
type SubscriptionCreate struct {
*Subscription
}
type SubscriptionDelete ¶ added in v2.45.0
type SubscriptionDelete struct {
*Subscription
}
type SubscriptionFilterOptions ¶ added in v2.45.0
SubscriptionFilterOptions are the options for filtering Subscriptions for list subscriptions API
type SubscriptionStatus ¶ added in v2.45.0
type SubscriptionStatus int
Tells the status of a subscription
const ( //Subscription is Active and scheduled to renew SubscriptionStatusActive SubscriptionStatus = 1 //Subscription is Active but scheduled to end and not be renewed SubscriptionStatusEnding SubscriptionStatus = 2 //Subscription is Inactive and not being charged SubscriptionStatusInactive SubscriptionStatus = 3 )
type SubscriptionUpdate ¶ added in v2.45.0
type SubscriptionUpdate struct {
*Subscription
}
type TextInput ¶ added in v2.3.0
type TextInput struct { CustomID string `json:"custom_id"` Label string `json:"label"` Style TextInputStyle `json:"style"` Placeholder string `json:"placeholder,omitempty"` Value string `json:"value,omitempty"` Required bool `json:"required"` MinLength int `json:"min_length,omitempty"` MaxLength int `json:"max_length,omitempty"` }
TextInput represents text input component.
func (TextInput) MarshalJSON ¶ added in v2.3.0
MarshalJSON is a method for marshaling TextInput to a JSON object.
func (TextInput) Type ¶ added in v2.3.0
func (TextInput) Type() ComponentType
Type is a method to get the type of a component.
type TextInputStyle ¶ added in v2.3.0
type TextInputStyle uint
TextInputStyle is style of text in TextInput component.
const ( TextInputShort TextInputStyle = 1 TextInputParagraph TextInputStyle = 2 )
Text styles
type ThreadCreate ¶
type ThreadCreate struct {
Channel
}
thread created, also sent when being added to a private thread
type ThreadDelete ¶
type ThreadDelete struct { ID int64 `json:"id,string"` GuildID int64 `json:"guild_id,string"` ParentID int64 `json:"parent_id,string"` Type ChannelType }
thread was deleted
type ThreadListSync ¶
type ThreadListSync struct { GuildID int64 `json:"guild_id,string"` // snowflake the id of the guild Channels IDSlice `json:"channel_ids"` // array of snowflakes the parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data. Threads []*Channel `json:"threads"` // array of channel objects all active threads in the given channels that the current user can access Members []*ThreadMember `json:"members"` // array of thread member objects all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to }
sent when gaining access to a channel, contains all active threads in that channel
type ThreadMember ¶
type ThreadMember struct { ID int64 `json:"id,string"` // the id of the thread (NOT INCLUDED IN GUILDCREATE) UserID int64 `json:"user_id,string"` // the id of the user (NOT INCLUDED IN GUILDCREATE) JoinTimestamp Timestamp `json:"join_timestamp"` // the time the current user last joined the thread Flags int `json:"flags"` // any user-thread settings, currently only used for notifications Member *Member `json:"member,omitempty"` // Additional information about the user. NOTE: only present if the withMember parameter is set to true when calling Session.ThreadMembers or Session.ThreadMember. }
A thread member is used to indicate whether a user has joined a thread or not.
type ThreadMemberUpdate ¶
type ThreadMemberUpdate struct { *ThreadMember GuildID int64 `json:"guild_id,string"` // snowflake the id of the guild }
thread member for the current user was updated
type ThreadMembersUpdate ¶
type ThreadMembersUpdate struct { ID int64 `json:"id,string"` // snowflake the id of the thread GuildID int64 `json:"guild_id,string"` // snowflake the id of the guild MemberCount int `json:"member_count"` // integer the approximate number of members in the thread, capped at 50 AddedMembers []*ThreadMember `json:"added_members"` // array of thread member objects the users who were added to the thread RemovedMembers IDSlice `json:"removed_member_ids"` // array of snowflakes the id of the users who were removed from the thread }
some user(s) were added to or removed from a thread
type ThreadMetadata ¶
type ThreadMetadata struct { Archived bool `json:"archived"` // whether the thread is archived AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration"` // duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 ArchiveTimestamp string `json:"archive_timestamp"` // timestamp when the thread's archive status was last changed, used for calculating recent activity Locked bool `json:"locked"` // whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it Invitable bool `json:"invitable"` // Whether non-moderators can add other non-moderators to a thread; only available on private threads }
type ThreadStart ¶ added in v2.34.0
type ThreadStart struct { Name string `json:"name"` AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration,omitempty"` Type ChannelType `json:"type,omitempty"` Invitable bool `json:"invitable"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` // NOTE: forum threads only - these are IDs AppliedTags IDSlice `json:"applied_tags,string,omitempty"` }
ThreadStart stores all parameters you can use with MessageThreadStartComplex or ThreadStartComplex
type ThreadsList ¶ added in v2.34.0
type ThreadsList struct { Threads []*Channel `json:"threads"` Members []*ThreadMember `json:"members"` HasMore bool `json:"has_more"` }
ThreadsList represents a list of threads alongisde with thread member objects for the current user.
type TimeStamps ¶
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) NKeys ¶
func (t *TimeStamps) NKeys() int
func (*TimeStamps) UnmarshalJSON ¶
func (t *TimeStamps) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSON into TimeStamps struct
func (*TimeStamps) UnmarshalJSONObject ¶
func (t *TimeStamps) UnmarshalJSONObject(dec *gojay.Decoder, key string) error
type TooManyRequests ¶
type TooManyRequests struct { Bucket string `json:"bucket"` Message string `json:"message"` RetryAfter float64 `json:"retry_after"` Global bool `json:"global"` }
A TooManyRequests struct holds information received from Discord when receiving a HTTP 429 response.
func (*TooManyRequests) RetryAfterDur ¶
func (t *TooManyRequests) RetryAfterDur() time.Duration
type TypingStart ¶
type TypingStart struct { UserID int64 `json:"user_id,string"` ChannelID int64 `json:"channel_id,string"` Timestamp int `json:"timestamp"` GuildID int64 `json:"guild_id,string,omitempty"` }
TypingStart is the data for a TypingStart event.
func (*TypingStart) GetChannelID ¶
func (e *TypingStart) GetChannelID() int64
func (*TypingStart) GetGuildID ¶
func (e *TypingStart) GetGuildID() int64
func (*TypingStart) NKeys ¶
func (ts *TypingStart) NKeys() int
func (*TypingStart) UnmarshalJSONObject ¶
func (ts *TypingStart) UnmarshalJSONObject(dec *gojay.Decoder, key string) error
implement gojay.UnmarshalerJSONObject
type UpdateStatusData ¶
type User ¶
type User struct { // The ID of the user. ID int64 `json:"id,string"` // The user's username. Username string `json:"username"` // The user's display name on discord Globalname string `json:"global_name"` // 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"` // Whether the user is a bot. Bot bool `json:"bot"` }
A User stores all data for an individual Discord user.
func (*User) AvatarURL ¶
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 ¶
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 UserGuild ¶
type UserGuild struct { ID int64 `json:"id,string"` 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 ¶
type UserGuildSettings struct { SupressEveryone bool `json:"suppress_everyone"` Muted bool `json:"muted"` MobilePush bool `json:"mobile_push"` MessageNotifications int `json:"message_notifications"` GuildID int64 `json:"guild_id,string"` ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"` }
A UserGuildSettings stores data for a users guild settings.
type UserGuildSettingsChannelOverride ¶
type UserGuildSettingsChannelOverride struct { Muted bool `json:"muted"` MessageNotifications int `json:"message_notifications"` ChannelID int64 `json:"channel_id,string"` }
A UserGuildSettingsChannelOverride stores data for a channel override for a users guild settings.
type UserGuildSettingsEdit ¶
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 ¶
type UserGuildSettingsUpdate struct {
*UserGuildSettings
}
UserGuildSettingsUpdate is the data for a UserGuildSettingsUpdate event.
type UserNoteUpdate ¶
UserNoteUpdate is the data for a UserNoteUpdate event.
type UserSettingsUpdate ¶
type UserSettingsUpdate map[string]interface{}
UserSettingsUpdate is the data for a UserSettingsUpdate event.
type UserUpdate ¶
type UserUpdate struct {
*User
}
UserUpdate is the data for a UserUpdate event.
func (*UserUpdate) NKeys ¶
func (u *UserUpdate) NKeys() int
func (*UserUpdate) UnmarshalJSONObject ¶
func (u *UserUpdate) UnmarshalJSONObject(dec *gojay.Decoder, key string) error
implement gojay.UnmarshalerJSONObject
type VerificationLevel ¶
type VerificationLevel int
VerificationLevel type definition
const ( VerificationLevelNone VerificationLevel = iota VerificationLevelLow VerificationLevelMedium VerificationLevelHigh )
Constants for VerificationLevel levels from 0 to 3 inclusive
type VoiceChannelStatusUpdate ¶ added in v2.27.0
type VoiceChannelStatusUpdate struct{}
type VoiceConnection ¶
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 int64 GuildID int64 ChannelID int64 OpusSend chan []byte // Chan for sending opus audio OpusRecv chan *Packet // Chan for receiving opus audio // Used to allow blocking until connected Connected chan bool // contains filtered or unexported fields }
A VoiceConnection struct holds all the data and functions related to a Discord Voice Connection.
func (*VoiceConnection) AddHandler ¶
func (v *VoiceConnection) AddHandler(h VoiceSpeakingUpdateHandler)
AddHandler adds a Handler for VoiceSpeakingUpdate events.
func (*VoiceConnection) ChangeChannel ¶
func (v *VoiceConnection) ChangeChannel(channelID int64, 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 ¶
func (v *VoiceConnection) Close()
Close closes the voice ws and udp connections
func (*VoiceConnection) Disconnect ¶
func (v *VoiceConnection) Disconnect() (err error)
Disconnect disconnects from this voice channel and closes the websocket and udp connections to Discord. !!! NOTE !!! this function may be removed in favour of ChannelVoiceLeave
func (*VoiceConnection) Speaking ¶
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 int64 `json:"guild_id,string"` Endpoint string `json:"endpoint"` }
VoiceServerUpdate is the data for a VoiceServerUpdate event.
func (*VoiceServerUpdate) GetGuildID ¶
func (e *VoiceServerUpdate) GetGuildID() int64
type VoiceSpeakingUpdate ¶
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 ¶
type VoiceSpeakingUpdateHandler func(vc *VoiceConnection, vs *VoiceSpeakingUpdate)
VoiceSpeakingUpdateHandler type provides a function definition for the VoiceSpeakingUpdate event
type VoiceState ¶
type VoiceState struct { UserID int64 `json:"user_id,string"` SessionID string `json:"session_id"` ChannelID int64 `json:"channel_id,string"` GuildID int64 `json:"guild_id,string"` Suppress bool `json:"suppress"` SelfMute bool `json:"self_mute"` SelfDeaf bool `json:"self_deaf"` Mute bool `json:"mute"` Deaf bool `json:"deaf"` SelfStream bool `json:"self_stream"` SelfVideo bool `json:"self_video"` }
A VoiceState stores the voice states of Guilds
type VoiceStateUpdate ¶
type VoiceStateUpdate struct {
*VoiceState
}
VoiceStateUpdate is the data for a VoiceStateUpdate event.
type Webhook ¶
type Webhook struct { ID int64 `json:"id,string"` GuildID int64 `json:"guild_id,string"` ChannelID int64 `json:"channel_id,string"` User *User `json:"user"` Name string `json:"name"` Avatar string `json:"avatar"` Token string `json:"token"` }
Webhook stores the data for a webhook.
type WebhookParams ¶
type WebhookParams struct { Content string `json:"content,omitempty"` Username string `json:"username,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` TTS bool `json:"tts,omitempty"` File *File `json:"-,omitempty"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` Flags int64 `json:"flags,omitempty"` AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"` }
WebhookParams is a struct for webhook params, used in the WebhookExecute command.
type WebhooksUpdate ¶
type WebhooksUpdate struct { GuildID int64 `json:"guild_id,string"` ChannelID int64 `json:"channel_id,string"` }
WebhooksUpdate is the data for a WebhooksUpdate event
func (*WebhooksUpdate) GetChannelID ¶
func (e *WebhooksUpdate) GetChannelID() int64
func (*WebhooksUpdate) GetGuildID ¶
func (e *WebhooksUpdate) GetGuildID() int64