Documentation ¶
Overview ¶
Package discordgo provides Discord binding for Go
Index ¶
- Constants
- Variables
- func GuildAllChannelsID(guild string) (id string, err error)
- func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType string, requestBody []byte, err error)
- func SnowflakeTimestamp(ID string) (t time.Time, err error)
- func VerifyInteraction(r *http.Request, key ed25519.PublicKey) bool
- type APIErrorMessage
- type ActionsRow
- type Activity
- type ActivityType
- type AddedThreadMember
- type AllowedMentionType
- type Application
- type ApplicationCommand
- type ApplicationCommandInteractionData
- type ApplicationCommandInteractionDataOption
- func (o ApplicationCommandInteractionDataOption) BoolValue() bool
- func (o ApplicationCommandInteractionDataOption) ChannelValue(s *Session) *Channel
- func (o ApplicationCommandInteractionDataOption) FloatValue() float64
- func (o ApplicationCommandInteractionDataOption) IntValue() int64
- func (o ApplicationCommandInteractionDataOption) RoleValue(s *Session, gID string) *Role
- func (o ApplicationCommandInteractionDataOption) StringValue() string
- func (o ApplicationCommandInteractionDataOption) UintValue() uint64
- func (o ApplicationCommandInteractionDataOption) UserValue(s *Session) *User
- type ApplicationCommandInteractionDataResolved
- type ApplicationCommandOption
- type ApplicationCommandOptionChoice
- type ApplicationCommandOptionType
- type ApplicationCommandPermissionType
- type ApplicationCommandPermissions
- type ApplicationCommandPermissionsList
- type ApplicationCommandPermissionsUpdate
- type ApplicationCommandType
- type ApplicationRoleConnection
- type ApplicationRoleConnectionMetadata
- type ApplicationRoleConnectionMetadataType
- type Asset
- type Assets
- type AuditLogAction
- type AuditLogChange
- type AuditLogChangeKey
- type AuditLogEntry
- type AuditLogOptions
- type AuditLogOptionsType
- 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 ChannelFlags
- type ChannelFollow
- type ChannelPinsUpdate
- type ChannelType
- type ChannelUpdate
- type ClientStatus
- type ComponentEmoji
- type ComponentType
- type Connect
- type Disconnect
- type EmbedType
- type Emoji
- type EmojiParams
- type Event
- type EventHandler
- type EventInterfaceProvider
- type ExpireBehavior
- type ExplicitContentFilterLevel
- type File
- type ForumDefaultReaction
- type ForumLayout
- type ForumSortOrderType
- type ForumTag
- type GatewayBotResponse
- type GatewayStatusUpdate
- type Guild
- type GuildApplicationCommandPermissions
- type GuildAuditLog
- type GuildAuditLogEntryCreate
- type GuildBan
- type GuildBanAdd
- type GuildBanRemove
- type GuildChannelCreateData
- type GuildCreate
- type GuildDelete
- type GuildEmbed
- type GuildEmojisUpdate
- type GuildFeature
- type GuildIntegrationsUpdate
- type GuildMemberAdd
- type GuildMemberAddParams
- type GuildMemberParams
- type GuildMemberRemove
- type GuildMemberUpdate
- type GuildMembersChunk
- type GuildNSFWLevel
- type GuildOnboarding
- type GuildOnboardingMode
- type GuildOnboardingPrompt
- type GuildOnboardingPromptOption
- type GuildOnboardingPromptType
- type GuildParams
- type GuildPreview
- type GuildRole
- type GuildRoleCreate
- type GuildRoleDelete
- type GuildRoleUpdate
- type GuildScheduledEvent
- type GuildScheduledEventCreate
- type GuildScheduledEventDelete
- type GuildScheduledEventEntityMetadata
- type GuildScheduledEventEntityType
- type GuildScheduledEventParams
- type GuildScheduledEventPrivacyLevel
- type GuildScheduledEventStatus
- type GuildScheduledEventUpdate
- type GuildScheduledEventUser
- type GuildScheduledEventUserAdd
- type GuildScheduledEventUserRemove
- type GuildTemplate
- type GuildTemplateParams
- type GuildUpdate
- type Identify
- type IdentifyProperties
- type Integration
- type IntegrationAccount
- type Intent
- type Interaction
- type InteractionCreate
- type InteractionData
- type InteractionResponse
- type InteractionResponseData
- type InteractionResponseType
- type InteractionType
- type Invite
- type InviteCreate
- type InviteDelete
- type InviteTargetType
- type Locale
- type Member
- type MemberFlags
- type MembershipState
- type Message
- func (m *Message) ContentWithMentionsReplaced() (content string)
- func (m *Message) ContentWithMoreMentionsReplaced(s *Session) (content string, err error)
- func (m *Message) GetCustomEmojis() []*Emoji
- func (m *Message) Reference() *MessageReference
- func (m *Message) SoftReference() *MessageReference
- func (m *Message) UnmarshalJSON(data []byte) error
- type MessageActivity
- type MessageActivityType
- type MessageAllowedMentions
- type MessageApplication
- type MessageAttachment
- type MessageComponent
- type MessageComponentInteractionData
- type MessageComponentInteractionDataResolved
- 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 MessageNotifications
- type MessageReaction
- type MessageReactionAdd
- type MessageReactionRemove
- type MessageReactionRemoveAll
- type MessageReactions
- type MessageReference
- type MessageSend
- type MessageType
- type MessageUpdate
- type MfaLevel
- type ModalSubmitInteractionData
- type Packet
- type Party
- type PermissionOverwrite
- type PermissionOverwriteType
- type PremiumTier
- type Presence
- type PresenceUpdate
- type PresencesReplace
- type RESTError
- type RateLimit
- type RateLimitError
- type RateLimiter
- type ReadState
- type Ready
- type RequestConfig
- type RequestOption
- func WithAuditLogReason(reason string) RequestOption
- func WithClient(client *http.Client) RequestOption
- func WithContext(ctx context.Context) RequestOption
- func WithHeader(key, value string) RequestOption
- func WithLocale(locale Locale) RequestOption
- func WithRestRetries(max int) RequestOption
- func WithRetryOnRatelimit(retry bool) RequestOption
- type Resumed
- type Role
- type RoleParams
- type Roles
- type Secrets
- type SelectMenu
- type SelectMenuDefaultValue
- type SelectMenuDefaultValueType
- type SelectMenuOption
- type SelectMenuType
- type Session
- func (s *Session) AddHandler(handler interface{}) func()
- func (s *Session) AddHandlerOnce(handler interface{}) func()
- func (s *Session) Application(appID string) (st *Application, err error)
- func (s *Session) ApplicationAssets(appID string) (ass []*Asset, err error)
- func (s *Session) ApplicationBotCreate(appID string) (st *User, err error)
- func (s *Session) ApplicationCommand(appID, guildID, cmdID string, options ...RequestOption) (cmd *ApplicationCommand, err error)
- func (s *Session) ApplicationCommandBulkOverwrite(appID string, guildID string, commands []*ApplicationCommand, ...) (createdCommands []*ApplicationCommand, err error)
- func (s *Session) ApplicationCommandCreate(appID string, guildID string, cmd *ApplicationCommand, ...) (ccmd *ApplicationCommand, err error)
- func (s *Session) ApplicationCommandDelete(appID, guildID, cmdID string, options ...RequestOption) error
- func (s *Session) ApplicationCommandEdit(appID, guildID, cmdID string, cmd *ApplicationCommand, ...) (updated *ApplicationCommand, err error)
- func (s *Session) ApplicationCommandPermissions(appID, guildID, cmdID string, options ...RequestOption) (permissions *GuildApplicationCommandPermissions, err error)
- func (s *Session) ApplicationCommandPermissionsBatchEdit(appID, guildID string, permissions []*GuildApplicationCommandPermissions, ...) (err error)
- func (s *Session) ApplicationCommandPermissionsEdit(appID, guildID, cmdID string, permissions *ApplicationCommandPermissionsList, ...) (err error)
- func (s *Session) ApplicationCommands(appID, guildID string, options ...RequestOption) (cmd []*ApplicationCommand, err error)
- func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error)
- func (s *Session) ApplicationDelete(appID string) (err error)
- func (s *Session) ApplicationRoleConnectionMetadata(appID string) (st []*ApplicationRoleConnectionMetadata, err error)
- func (s *Session) ApplicationRoleConnectionMetadataUpdate(appID string, metadata []*ApplicationRoleConnectionMetadata) (st []*ApplicationRoleConnectionMetadata, err error)
- func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Application, err error)
- func (s *Session) Applications() (st []*Application, err error)
- func (s *Session) AutoModerationRule(guildID, ruleID string, options ...RequestOption) (st *AutoModerationRule, err error)
- func (s *Session) AutoModerationRuleCreate(guildID string, rule *AutoModerationRule, options ...RequestOption) (st *AutoModerationRule, err error)
- func (s *Session) AutoModerationRuleDelete(guildID, ruleID string, options ...RequestOption) (err error)
- func (s *Session) AutoModerationRuleEdit(guildID, ruleID string, rule *AutoModerationRule, options ...RequestOption) (st *AutoModerationRule, err error)
- func (s *Session) AutoModerationRules(guildID string, options ...RequestOption) (st []*AutoModerationRule, err error)
- func (s *Session) Channel(channelID string, options ...RequestOption) (st *Channel, err error)
- func (s *Session) ChannelDelete(channelID string, options ...RequestOption) (st *Channel, err error)
- func (s *Session) ChannelEdit(channelID string, data *ChannelEdit, options ...RequestOption) (st *Channel, err error)
- func (s *Session) ChannelEditComplex(channelID string, data *ChannelEdit, options ...RequestOption) (st *Channel, err error)
- func (s *Session) ChannelFileSend(channelID, name string, r io.Reader, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelFileSendWithMessage(channelID, content string, name string, r io.Reader, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelInviteCreate(channelID string, i Invite, options ...RequestOption) (st *Invite, err error)
- func (s *Session) ChannelInvites(channelID string, options ...RequestOption) (st []*Invite, err error)
- func (s *Session) ChannelMessage(channelID, messageID string, options ...RequestOption) (st *Message, err error)
- func (s *Session) ChannelMessageCrosspost(channelID, messageID string, options ...RequestOption) (st *Message, err error)
- func (s *Session) ChannelMessageDelete(channelID, messageID string, options ...RequestOption) (err error)
- func (s *Session) ChannelMessageEdit(channelID, messageID, content string, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessageEditComplex(m *MessageEdit, options ...RequestOption) (st *Message, err error)
- func (s *Session) ChannelMessageEditEmbed(channelID, messageID string, embed *MessageEmbed, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessageEditEmbeds(channelID, messageID string, embeds []*MessageEmbed, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessagePin(channelID, messageID string, options ...RequestOption) (err error)
- func (s *Session) ChannelMessageSend(channelID string, content string, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessageSendComplex(channelID string, data *MessageSend, options ...RequestOption) (st *Message, err error)
- func (s *Session) ChannelMessageSendEmbed(channelID string, embed *MessageEmbed, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessageSendEmbedReply(channelID string, embed *MessageEmbed, reference *MessageReference, ...) (*Message, error)
- func (s *Session) ChannelMessageSendEmbeds(channelID string, embeds []*MessageEmbed, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessageSendEmbedsReply(channelID string, embeds []*MessageEmbed, reference *MessageReference, ...) (*Message, error)
- func (s *Session) ChannelMessageSendReply(channelID string, content string, reference *MessageReference, ...) (*Message, error)
- func (s *Session) ChannelMessageSendTTS(channelID string, content string, options ...RequestOption) (*Message, error)
- func (s *Session) ChannelMessageUnpin(channelID, messageID string, options ...RequestOption) (err error)
- func (s *Session) ChannelMessages(channelID string, limit int, beforeID, afterID, aroundID string, ...) (st []*Message, err error)
- func (s *Session) ChannelMessagesBulkDelete(channelID string, messages []string, options ...RequestOption) (err error)
- func (s *Session) ChannelMessagesPinned(channelID string, options ...RequestOption) (st []*Message, err error)
- func (s *Session) ChannelNewsFollow(channelID, targetID string, options ...RequestOption) (st *ChannelFollow, err error)
- func (s *Session) ChannelPermissionDelete(channelID, targetID string, options ...RequestOption) (err error)
- func (s *Session) ChannelPermissionSet(channelID, targetID string, targetType PermissionOverwriteType, ...) (err error)
- func (s *Session) ChannelTyping(channelID string, options ...RequestOption) (err error)
- func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *VoiceConnection, err error)
- func (s *Session) ChannelVoiceJoinManual(gID, cID string, mute, deaf bool) (err error)
- func (s *Session) ChannelWebhooks(channelID string, options ...RequestOption) (st []*Webhook, err error)
- func (s *Session) Close() error
- func (s *Session) CloseWithCode(closeCode int) (err error)
- func (s *Session) FollowupMessageCreate(interaction *Interaction, wait bool, data *WebhookParams, ...) (*Message, error)
- func (s *Session) FollowupMessageDelete(interaction *Interaction, messageID string, options ...RequestOption) error
- func (s *Session) FollowupMessageEdit(interaction *Interaction, messageID string, data *WebhookEdit, ...) (*Message, error)
- func (s *Session) ForumThreadStart(channelID, name string, archiveDuration int, content string, ...) (th *Channel, err error)
- func (s *Session) ForumThreadStartComplex(channelID string, threadData *ThreadStart, messageData *MessageSend, ...) (th *Channel, err error)
- func (s *Session) ForumThreadStartEmbed(channelID, name string, archiveDuration int, embed *MessageEmbed, ...) (th *Channel, err error)
- func (s *Session) ForumThreadStartEmbeds(channelID, name string, archiveDuration int, embeds []*MessageEmbed, ...) (th *Channel, err error)
- func (s *Session) Gateway(options ...RequestOption) (gateway string, err error)
- func (s *Session) GatewayBot(options ...RequestOption) (st *GatewayBotResponse, err error)
- func (s *Session) Guild(guildID string, options ...RequestOption) (st *Guild, err error)
- func (s *Session) GuildApplicationCommandsPermissions(appID, guildID string, options ...RequestOption) (permissions []*GuildApplicationCommandPermissions, err error)
- func (s *Session) GuildAuditLog(guildID, userID, beforeID string, actionType, limit int, ...) (st *GuildAuditLog, err error)
- func (s *Session) GuildBan(guildID, userID string, options ...RequestOption) (st *GuildBan, err error)
- func (s *Session) GuildBanCreate(guildID, userID string, days int, options ...RequestOption) (err error)
- func (s *Session) GuildBanCreateWithReason(guildID, userID, reason string, days int, options ...RequestOption) (err error)
- func (s *Session) GuildBanDelete(guildID, userID string, options ...RequestOption) (err error)
- func (s *Session) GuildBans(guildID string, limit int, beforeID, afterID string, options ...RequestOption) (st []*GuildBan, err error)
- func (s *Session) GuildChannelCreate(guildID, name string, ctype ChannelType, options ...RequestOption) (st *Channel, err error)
- func (s *Session) GuildChannelCreateComplex(guildID string, data GuildChannelCreateData, options ...RequestOption) (st *Channel, err error)
- func (s *Session) GuildChannels(guildID string, options ...RequestOption) (st []*Channel, err error)
- func (s *Session) GuildChannelsReorder(guildID string, channels []*Channel, options ...RequestOption) (err error)
- func (s *Session) GuildCreate(name string, options ...RequestOption) (st *Guild, err error)
- func (s *Session) GuildCreateWithTemplate(templateCode, name, icon string, options ...RequestOption) (st *Guild, err error)
- func (s *Session) GuildDelete(guildID string, options ...RequestOption) (err error)
- func (s *Session) GuildEdit(guildID string, g *GuildParams, options ...RequestOption) (st *Guild, err error)
- func (s *Session) GuildEmbed(guildID string, options ...RequestOption) (st *GuildEmbed, err error)
- func (s *Session) GuildEmbedEdit(guildID string, data *GuildEmbed, options ...RequestOption) (err error)
- func (s *Session) GuildEmoji(guildID, emojiID string, options ...RequestOption) (emoji *Emoji, err error)
- func (s *Session) GuildEmojiCreate(guildID string, data *EmojiParams, options ...RequestOption) (emoji *Emoji, err error)
- func (s *Session) GuildEmojiDelete(guildID, emojiID string, options ...RequestOption) (err error)
- func (s *Session) GuildEmojiEdit(guildID, emojiID string, data *EmojiParams, options ...RequestOption) (emoji *Emoji, err error)
- func (s *Session) GuildEmojis(guildID string, options ...RequestOption) (emoji []*Emoji, err error)
- func (s *Session) GuildIcon(guildID string, options ...RequestOption) (img image.Image, err error)
- func (s *Session) GuildIntegrationCreate(guildID, integrationType, integrationID string, options ...RequestOption) (err error)
- func (s *Session) GuildIntegrationDelete(guildID, integrationID string, options ...RequestOption) (err error)
- func (s *Session) GuildIntegrationEdit(guildID, integrationID string, expireBehavior, expireGracePeriod int, ...) (err error)
- func (s *Session) GuildIntegrations(guildID string, options ...RequestOption) (st []*Integration, err error)
- func (s *Session) GuildInvites(guildID string, options ...RequestOption) (st []*Invite, err error)
- func (s *Session) GuildLeave(guildID string, options ...RequestOption) (err error)
- func (s *Session) GuildMember(guildID, userID string, options ...RequestOption) (st *Member, err error)
- func (s *Session) GuildMemberAdd(guildID, userID string, data *GuildMemberAddParams, options ...RequestOption) (err error)
- func (s *Session) GuildMemberDeafen(guildID string, userID string, deaf bool, options ...RequestOption) (err error)
- func (s *Session) GuildMemberDelete(guildID, userID string, options ...RequestOption) (err error)
- func (s *Session) GuildMemberDeleteWithReason(guildID, userID, reason string, options ...RequestOption) (err error)
- func (s *Session) GuildMemberEdit(guildID, userID string, data *GuildMemberParams, options ...RequestOption) (st *Member, err error)
- func (s *Session) GuildMemberEditComplex(guildID, userID string, data *GuildMemberParams, options ...RequestOption) (st *Member, err error)
- func (s *Session) GuildMemberMove(guildID string, userID string, channelID *string, options ...RequestOption) (err error)
- func (s *Session) GuildMemberMute(guildID string, userID string, mute bool, options ...RequestOption) (err error)
- func (s *Session) GuildMemberNickname(guildID, userID, nickname string, options ...RequestOption) (err error)
- func (s *Session) GuildMemberRoleAdd(guildID, userID, roleID string, options ...RequestOption) (err error)
- func (s *Session) GuildMemberRoleRemove(guildID, userID, roleID string, options ...RequestOption) (err error)
- func (s *Session) GuildMemberTimeout(guildID string, userID string, until *time.Time, options ...RequestOption) (err error)
- func (s *Session) GuildMembers(guildID string, after string, limit int, options ...RequestOption) (st []*Member, err error)
- func (s *Session) GuildMembersSearch(guildID, query string, limit int, options ...RequestOption) (st []*Member, err error)
- func (s *Session) GuildOnboarding(guildID string, options ...RequestOption) (onboarding *GuildOnboarding, err error)
- func (s *Session) GuildOnboardingEdit(guildID string, o *GuildOnboarding, options ...RequestOption) (onboarding *GuildOnboarding, err error)
- func (s *Session) GuildPreview(guildID string, options ...RequestOption) (st *GuildPreview, err error)
- func (s *Session) GuildPrune(guildID string, days uint32, options ...RequestOption) (count uint32, err error)
- func (s *Session) GuildPruneCount(guildID string, days uint32, options ...RequestOption) (count uint32, err error)
- func (s *Session) GuildRoleCreate(guildID string, data *RoleParams, options ...RequestOption) (st *Role, err error)
- func (s *Session) GuildRoleDelete(guildID, roleID string, options ...RequestOption) (err error)
- func (s *Session) GuildRoleEdit(guildID, roleID string, data *RoleParams, options ...RequestOption) (st *Role, err error)
- func (s *Session) GuildRoleReorder(guildID string, roles []*Role, options ...RequestOption) (st []*Role, err error)
- func (s *Session) GuildRoles(guildID string, options ...RequestOption) (st []*Role, err error)
- func (s *Session) GuildScheduledEvent(guildID, eventID string, userCount bool, options ...RequestOption) (st *GuildScheduledEvent, err error)
- func (s *Session) GuildScheduledEventCreate(guildID string, event *GuildScheduledEventParams, options ...RequestOption) (st *GuildScheduledEvent, err error)
- func (s *Session) GuildScheduledEventDelete(guildID, eventID string, options ...RequestOption) (err error)
- func (s *Session) GuildScheduledEventEdit(guildID, eventID string, event *GuildScheduledEventParams, ...) (st *GuildScheduledEvent, err error)
- func (s *Session) GuildScheduledEventUsers(guildID, eventID string, limit int, withMember bool, beforeID, afterID string, ...) (st []*GuildScheduledEventUser, err error)
- func (s *Session) GuildScheduledEvents(guildID string, userCount bool, options ...RequestOption) (st []*GuildScheduledEvent, err error)
- func (s *Session) GuildSplash(guildID string, options ...RequestOption) (img image.Image, err error)
- func (s *Session) GuildTemplate(templateCode string, options ...RequestOption) (st *GuildTemplate, err error)
- func (s *Session) GuildTemplateCreate(guildID string, data *GuildTemplateParams, options ...RequestOption) (st *GuildTemplate)
- func (s *Session) GuildTemplateDelete(guildID, templateCode string, options ...RequestOption) (err error)
- func (s *Session) GuildTemplateEdit(guildID, templateCode string, data *GuildTemplateParams, ...) (st *GuildTemplate, err error)
- func (s *Session) GuildTemplateSync(guildID, templateCode string, options ...RequestOption) (err error)
- func (s *Session) GuildTemplates(guildID string, options ...RequestOption) (st []*GuildTemplate, err error)
- func (s *Session) GuildThreadsActive(guildID string, options ...RequestOption) (threads *ThreadsList, err error)
- func (s *Session) GuildWebhooks(guildID string, options ...RequestOption) (st []*Webhook, err error)
- func (s *Session) GuildWithCounts(guildID string, options ...RequestOption) (st *Guild, err error)
- func (s *Session) HeartbeatLatency() time.Duration
- func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse, options ...RequestOption) error
- func (s *Session) InteractionResponse(interaction *Interaction, options ...RequestOption) (*Message, error)
- func (s *Session) InteractionResponseDelete(interaction *Interaction, options ...RequestOption) error
- func (s *Session) InteractionResponseEdit(interaction *Interaction, newresp *WebhookEdit, options ...RequestOption) (*Message, error)
- func (s *Session) Invite(inviteID string, options ...RequestOption) (st *Invite, err error)
- func (s *Session) InviteAccept(inviteID string, options ...RequestOption) (st *Invite, err error)
- func (s *Session) InviteComplex(inviteID, guildScheduledEventID string, withCounts, withExpiration bool, ...) (st *Invite, err error)
- func (s *Session) InviteDelete(inviteID string, options ...RequestOption) (st *Invite, err error)
- func (s *Session) InviteWithCounts(inviteID string, options ...RequestOption) (st *Invite, err error)
- func (s *Session) MessageReactionAdd(channelID, messageID, emojiID string, options ...RequestOption) error
- func (s *Session) MessageReactionRemove(channelID, messageID, emojiID, userID string, options ...RequestOption) error
- func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit int, beforeID, afterID string, ...) (st []*User, err error)
- func (s *Session) MessageReactionsRemoveAll(channelID, messageID string, options ...RequestOption) error
- func (s *Session) MessageReactionsRemoveEmoji(channelID, messageID, emojiID string, options ...RequestOption) error
- func (s *Session) MessageThreadStart(channelID, messageID string, name string, archiveDuration int, ...) (ch *Channel, err error)
- func (s *Session) MessageThreadStartComplex(channelID, messageID string, data *ThreadStart, options ...RequestOption) (ch *Channel, err error)
- func (s *Session) Open() error
- func (s *Session) Request(method, urlStr string, data interface{}, options ...RequestOption) (response []byte, err error)
- func (s *Session) RequestGuildMembers(guildID, query string, limit int, nonce string, presences bool) error
- func (s *Session) RequestGuildMembersBatch(guildIDs []string, query string, limit int, nonce string, presences bool) (err error)
- func (s *Session) RequestGuildMembersBatchList(guildIDs []string, userIDs []string, limit int, nonce string, presences bool) (err error)
- func (s *Session) RequestGuildMembersList(guildID string, userIDs []string, limit int, nonce string, presences bool) error
- func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, bucketID string, ...) (response []byte, err error)
- func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b []byte, bucket *Bucket, sequence int, ...) (response []byte, err error)
- func (s *Session) StageInstance(channelID string, options ...RequestOption) (si *StageInstance, err error)
- func (s *Session) StageInstanceCreate(data *StageInstanceParams, options ...RequestOption) (si *StageInstance, err error)
- func (s *Session) StageInstanceDelete(channelID string, options ...RequestOption) (err error)
- func (s *Session) StageInstanceEdit(channelID string, data *StageInstanceParams, options ...RequestOption) (si *StageInstance, err error)
- func (s *Session) ThreadJoin(id string, options ...RequestOption) error
- func (s *Session) ThreadLeave(id string, options ...RequestOption) error
- func (s *Session) ThreadMember(threadID, memberID string, withMember bool, options ...RequestOption) (member *ThreadMember, err error)
- func (s *Session) ThreadMemberAdd(threadID, memberID string, options ...RequestOption) error
- func (s *Session) ThreadMemberRemove(threadID, memberID string, options ...RequestOption) error
- func (s *Session) ThreadMembers(threadID string, limit int, withMember bool, afterID string, ...) (members []*ThreadMember, err error)
- func (s *Session) ThreadStart(channelID, name string, typ ChannelType, archiveDuration int, ...) (ch *Channel, err error)
- func (s *Session) ThreadStartComplex(channelID string, data *ThreadStart, options ...RequestOption) (ch *Channel, err error)
- func (s *Session) ThreadsActive(channelID string, options ...RequestOption) (threads *ThreadsList, err error)
- func (s *Session) ThreadsArchived(channelID string, before *time.Time, limit int, options ...RequestOption) (threads *ThreadsList, err error)
- func (s *Session) ThreadsPrivateArchived(channelID string, before *time.Time, limit int, options ...RequestOption) (threads *ThreadsList, err error)
- func (s *Session) ThreadsPrivateJoinedArchived(channelID string, before *time.Time, limit int, options ...RequestOption) (threads *ThreadsList, err error)
- func (s *Session) UpdateCustomStatus(state string) (err error)
- func (s *Session) UpdateGameStatus(idle int, name string) (err error)
- func (s *Session) UpdateListeningStatus(name string) (err error)
- func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error)
- func (s *Session) UpdateStreamingStatus(idle int, name string, url string) (err error)
- func (s *Session) UpdateWatchStatus(idle int, name string) (err error)
- func (s *Session) User(userID string, options ...RequestOption) (st *User, err error)
- func (s *Session) UserApplicationRoleConnection(appID string) (st *ApplicationRoleConnection, err error)
- func (s *Session) UserApplicationRoleConnectionUpdate(appID string, rconn *ApplicationRoleConnection) (st *ApplicationRoleConnection, err error)
- func (s *Session) UserAvatar(userID string, options ...RequestOption) (img image.Image, err error)
- func (s *Session) UserAvatarDecode(u *User, options ...RequestOption) (img image.Image, err error)
- func (s *Session) UserChannelCreate(recipientID string, options ...RequestOption) (st *Channel, err error)
- func (s *Session) UserChannelPermissions(userID, channelID string, fetchOptions ...RequestOption) (apermissions int64, err error)
- func (s *Session) UserConnections(options ...RequestOption) (conn []*UserConnection, err error)
- func (s *Session) UserGuildMember(guildID string, options ...RequestOption) (st *Member, err error)
- func (s *Session) UserGuilds(limit int, beforeID, afterID string, options ...RequestOption) (st []*UserGuild, err error)
- func (s *Session) UserUpdate(username, avatar string, options ...RequestOption) (st *User, err error)
- func (s *Session) VoiceRegions(options ...RequestOption) (st []*VoiceRegion, err error)
- func (s *Session) Webhook(webhookID string, options ...RequestOption) (st *Webhook, err error)
- func (s *Session) WebhookCreate(channelID, name, avatar string, options ...RequestOption) (st *Webhook, err error)
- func (s *Session) WebhookDelete(webhookID string, options ...RequestOption) (err error)
- func (s *Session) WebhookDeleteWithToken(webhookID, token string, options ...RequestOption) (st *Webhook, err error)
- func (s *Session) WebhookEdit(webhookID, name, avatar, channelID string, options ...RequestOption) (st *Webhook, err error)
- func (s *Session) WebhookEditWithToken(webhookID, token, name, avatar string, options ...RequestOption) (st *Webhook, err error)
- func (s *Session) WebhookExecute(webhookID, token string, wait bool, data *WebhookParams, ...) (st *Message, err error)
- func (s *Session) WebhookMessage(webhookID, token, messageID string, options ...RequestOption) (message *Message, err error)
- func (s *Session) WebhookMessageDelete(webhookID, token, messageID string, options ...RequestOption) (err error)
- func (s *Session) WebhookMessageEdit(webhookID, token, messageID string, data *WebhookEdit, ...) (st *Message, err error)
- func (s *Session) WebhookThreadExecute(webhookID, token string, wait bool, threadID string, data *WebhookParams, ...) (st *Message, err error)
- func (s *Session) WebhookWithToken(webhookID, token string, options ...RequestOption) (st *Webhook, err error)
- type SessionInformation
- type StageInstance
- type StageInstanceEventCreate
- type StageInstanceEventDelete
- type StageInstanceEventUpdate
- type StageInstanceParams
- type StageInstancePrivacyLevel
- type State
- func (s *State) Channel(channelID string) (*Channel, error)
- func (s *State) ChannelAdd(channel *Channel) error
- func (s *State) ChannelRemove(channel *Channel) error
- func (s *State) Emoji(guildID, emojiID string) (*Emoji, error)
- func (s *State) EmojiAdd(guildID string, emoji *Emoji) error
- func (s *State) EmojisAdd(guildID string, emojis []*Emoji) error
- func (s *State) Guild(guildID string) (*Guild, error)
- func (s *State) GuildAdd(guild *Guild) error
- func (s *State) GuildRemove(guild *Guild) error
- func (s *State) Member(guildID, userID string) (*Member, error)
- func (s *State) MemberAdd(member *Member) error
- func (s *State) MemberRemove(member *Member) error
- func (s *State) Message(channelID, messageID string) (*Message, error)
- func (s *State) MessageAdd(message *Message) error
- func (s *State) MessageColor(message *Message) int
- func (s *State) MessagePermissions(message *Message) (apermissions int64, err error)
- func (s *State) MessageRemove(message *Message) error
- func (s *State) OnInterface(se *Session, i interface{}) (err error)
- func (s *State) Presence(guildID, userID string) (*Presence, error)
- func (s *State) PresenceAdd(guildID string, presence *Presence) error
- func (s *State) PresenceRemove(guildID string, presence *Presence) error
- func (s *State) Role(guildID, roleID string) (*Role, error)
- func (s *State) RoleAdd(guildID string, role *Role) error
- func (s *State) RoleRemove(guildID, roleID string) error
- func (s *State) ThreadListSync(tls *ThreadListSync) error
- func (s *State) ThreadMemberUpdate(mu *ThreadMemberUpdate) error
- func (s *State) ThreadMembersUpdate(tmu *ThreadMembersUpdate) error
- func (s *State) UserChannelPermissions(userID, channelID string) (apermissions int64, err error)
- func (s *State) UserColor(userID, channelID string) int
- func (s *State) VoiceState(guildID, userID string) (*VoiceState, error)
- type Status
- type Sticker
- type StickerFormat
- type StickerItem
- type StickerPack
- type StickerType
- type SystemChannelFlag
- type Team
- type TeamMember
- 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 TooManyRequests
- type TypingStart
- type UpdateStatusData
- type User
- type UserConnection
- type UserFlags
- type UserGuild
- type UserPremiumType
- type UserUpdate
- type VerificationLevel
- type VoiceConnection
- type VoiceRegion
- type VoiceServerUpdate
- type VoiceSpeakingUpdate
- type VoiceSpeakingUpdateHandler
- type VoiceState
- type VoiceStateUpdate
- type Webhook
- type WebhookEdit
- type WebhookParams
- type WebhookType
- type WebhooksUpdate
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 ( // Deprecated: PermissionReadMessages has been replaced with PermissionViewChannel for text and voice channels PermissionReadMessages = 0x0000000000000400 PermissionSendMessages = 0x0000000000000800 PermissionSendTTSMessages = 0x0000000000001000 PermissionManageMessages = 0x0000000000002000 PermissionEmbedLinks = 0x0000000000004000 PermissionAttachFiles = 0x0000000000008000 PermissionReadMessageHistory = 0x0000000000010000 PermissionMentionEveryone = 0x0000000000020000 PermissionUseExternalEmojis = 0x0000000000040000 PermissionUseSlashCommands = 0x0000000080000000 PermissionManageThreads = 0x0000000400000000 PermissionCreatePublicThreads = 0x0000000800000000 PermissionCreatePrivateThreads = 0x0000001000000000 PermissionUseExternalStickers = 0x0000002000000000 PermissionSendMessagesInThreads = 0x0000004000000000 )
Constants for the different bit offsets of text channel permissions
const ( PermissionVoicePrioritySpeaker = 0x0000000000000100 PermissionVoiceStreamVideo = 0x0000000000000200 PermissionVoiceConnect = 0x0000000000100000 PermissionVoiceSpeak = 0x0000000000200000 PermissionVoiceMuteMembers = 0x0000000000400000 PermissionVoiceDeafenMembers = 0x0000000000800000 PermissionVoiceMoveMembers = 0x0000000001000000 PermissionVoiceUseVAD = 0x0000000002000000 PermissionVoiceRequestToSpeak = 0x0000000100000000 PermissionUseActivities = 0x0000008000000000 )
Constants for the different bit offsets of voice permissions
const ( PermissionChangeNickname = 0x0000000004000000 PermissionManageNicknames = 0x0000000008000000 PermissionManageRoles = 0x0000000010000000 PermissionManageWebhooks = 0x0000000020000000 PermissionManageEmojis = 0x0000000040000000 PermissionManageEvents = 0x0000000200000000 )
Constants for general management.
const ( PermissionCreateInstantInvite = 0x0000000000000001 PermissionKickMembers = 0x0000000000000002 PermissionBanMembers = 0x0000000000000004 PermissionAdministrator = 0x0000000000000008 PermissionManageChannels = 0x0000000000000010 PermissionManageServer = 0x0000000000000020 PermissionAddReactions = 0x0000000000000040 PermissionViewAuditLogs = 0x0000000000000080 PermissionViewChannel = 0x0000000000000400 PermissionViewGuildInsights = 0x0000000000080000 PermissionModerateMembers = 0x0000010000000000 PermissionAllText = PermissionViewChannel | PermissionSendMessages | PermissionSendTTSMessages | PermissionManageMessages | PermissionEmbedLinks | PermissionAttachFiles | PermissionReadMessageHistory | PermissionMentionEveryone PermissionAllVoice = PermissionViewChannel | PermissionVoiceConnect | PermissionVoiceSpeak | PermissionVoiceMuteMembers | PermissionVoiceDeafenMembers | PermissionVoiceMoveMembers | PermissionVoiceUseVAD | PermissionVoicePrioritySpeaker PermissionAllChannel = PermissionAllText | PermissionAllVoice | PermissionCreateInstantInvite | PermissionManageRoles | PermissionManageChannels | PermissionAddReactions | PermissionViewAuditLogs PermissionAll = PermissionAllChannel | PermissionKickMembers | PermissionBanMembers | PermissionManageServer | PermissionAdministrator | PermissionManageWebhooks | PermissionManageEmojis )
Constants for the different bit offsets of general permissions
const ( ErrCodeGeneralError = 0 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 ErrCodeUnknownWebhookService = 10016 ErrCodeUnknownSession = 10020 ErrCodeUnknownBan = 10026 ErrCodeUnknownSKU = 10027 ErrCodeUnknownStoreListing = 10028 ErrCodeUnknownEntitlement = 10029 ErrCodeUnknownBuild = 10030 ErrCodeUnknownLobby = 10031 ErrCodeUnknownBranch = 10032 ErrCodeUnknownStoreDirectoryLayout = 10033 ErrCodeUnknownRedistributable = 10036 ErrCodeUnknownGiftCode = 10038 ErrCodeUnknownStream = 10049 ErrCodeUnknownPremiumServerSubscribeCooldown = 10050 ErrCodeUnknownGuildTemplate = 10057 ErrCodeUnknownDiscoveryCategory = 10059 ErrCodeUnknownSticker = 10060 ErrCodeUnknownInteraction = 10062 ErrCodeUnknownApplicationCommand = 10063 ErrCodeUnknownApplicationCommandPermissions = 10066 ErrCodeUnknownStageInstance = 10067 ErrCodeUnknownGuildMemberVerificationForm = 10068 ErrCodeUnknownGuildWelcomeScreen = 10069 ErrCodeUnknownGuildScheduledEvent = 10070 ErrCodeUnknownGuildScheduledEventUser = 10071 ErrUnknownTag = 10087 ErrCodeBotsCannotUseEndpoint = 20001 ErrCodeOnlyBotsCanUseEndpoint = 20002 ErrCodeExplicitContentCannotBeSentToTheDesiredRecipients = 20009 ErrCodeYouAreNotAuthorizedToPerformThisActionOnThisApplication = 20012 ErrCodeThisActionCannotBePerformedDueToSlowmodeRateLimit = 20016 ErrCodeOnlyTheOwnerOfThisAccountCanPerformThisAction = 20018 ErrCodeMessageCannotBeEditedDueToAnnouncementRateLimits = 20022 ErrCodeChannelHasHitWriteRateLimit = 20028 ErrCodeTheWriteActionYouArePerformingOnTheServerHasHitTheWriteRateLimit = 20029 ErrCodeStageTopicContainsNotAllowedWordsForPublicStages = 20031 ErrCodeGuildPremiumSubscriptionLevelTooLow = 20035 ErrCodeMaximumGuildsReached = 30001 ErrCodeMaximumPinsReached = 30003 ErrCodeMaximumNumberOfRecipientsReached = 30004 ErrCodeMaximumGuildRolesReached = 30005 ErrCodeMaximumNumberOfWebhooksReached = 30007 ErrCodeMaximumNumberOfEmojisReached = 30008 ErrCodeTooManyReactions = 30010 ErrCodeMaximumNumberOfGuildChannelsReached = 30013 ErrCodeMaximumNumberOfAttachmentsInAMessageReached = 30015 ErrCodeMaximumNumberOfInvitesReached = 30016 ErrCodeMaximumNumberOfAnimatedEmojisReached = 30018 ErrCodeMaximumNumberOfServerMembersReached = 30019 ErrCodeMaximumNumberOfGuildDiscoverySubcategoriesReached = 30030 ErrCodeGuildAlreadyHasATemplate = 30031 ErrCodeMaximumNumberOfThreadParticipantsReached = 30033 ErrCodeMaximumNumberOfBansForNonGuildMembersHaveBeenExceeded = 30035 ErrCodeMaximumNumberOfBansFetchesHasBeenReached = 30037 ErrCodeMaximumNumberOfUncompletedGuildScheduledEventsReached = 30038 ErrCodeMaximumNumberOfStickersReached = 30039 ErrCodeMaximumNumberOfPruneRequestsHasBeenReached = 30040 ErrCodeMaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached = 30042 ErrCodeMaximumNumberOfEditsToMessagesOlderThanOneHourReached = 30046 ErrCodeMaximumNumberOfPinnedThreadsInForumChannelHasBeenReached = 30047 ErrCodeMaximumNumberOfTagsInForumChannelHasBeenReached = 30048 ErrCodeActionRequiredVerifiedAccount = 40002 ErrCodeOpeningDirectMessagesTooFast = 40003 ErrCodeSendMessagesHasBeenTemporarilyDisabled = 40004 ErrCodeRequestEntityTooLarge = 40005 ErrCodeFeatureTemporarilyDisabledServerSide = 40006 ErrCodeUserIsBannedFromThisGuild = 40007 ErrCodeTargetIsNotConnectedToVoice = 40032 ErrCodeMessageAlreadyCrossposted = 40033 ErrCodeAnApplicationWithThatNameAlreadyExists = 40041 ErrCodeInteractionHasAlreadyBeenAcknowledged = 40060 ErrCodeTagNamesMustBeUnique = 40061 ErrCodeMissingAccess = 50001 ErrCodeInvalidAccountType = 50002 ErrCodeCannotExecuteActionOnDMChannel = 50003 ErrCodeEmbedDisabled = 50004 ErrCodeGuildWidgetDisabled = 50004 ErrCodeCannotEditFromAnotherUser = 50005 ErrCodeCannotSendEmptyMessage = 50006 ErrCodeCannotSendMessagesToThisUser = 50007 ErrCodeCannotSendMessagesInVoiceChannel = 50008 ErrCodeChannelVerificationLevelTooHigh = 50009 ErrCodeOAuth2ApplicationDoesNotHaveBot = 50010 ErrCodeOAuth2ApplicationLimitReached = 50011 ErrCodeInvalidOAuthState = 50012 ErrCodeMissingPermissions = 50013 ErrCodeInvalidAuthenticationToken = 50014 ErrCodeTooFewOrTooManyMessagesToDelete = 50016 ErrCodeCanOnlyPinMessageToOriginatingChannel = 50019 ErrCodeInviteCodeWasEitherInvalidOrTaken = 50020 ErrCodeCannotExecuteActionOnSystemMessage = 50021 ErrCodeCannotExecuteActionOnThisChannelType = 50024 ErrCodeInvalidOAuth2AccessTokenProvided = 50025 ErrCodeMissingRequiredOAuth2Scope = 50026 ErrCodeInvalidWebhookTokenProvided = 50027 ErrCodeInvalidRole = 50028 ErrCodeInvalidRecipients = 50033 ErrCodeMessageProvidedTooOldForBulkDelete = 50034 ErrCodeInvalidFormBody = 50035 ErrCodeInviteAcceptedToGuildApplicationsBotNotIn = 50036 ErrCodeInvalidAPIVersionProvided = 50041 ErrCodeFileUploadedExceedsTheMaximumSize = 50045 ErrCodeInvalidFileUploaded = 50046 ErrCodeInvalidGuild = 50055 ErrCodeInvalidMessageType = 50068 ErrCodeCannotDeleteAChannelRequiredForCommunityGuilds = 50074 ErrCodeInvalidStickerSent = 50081 ErrCodePerformedOperationOnArchivedThread = 50083 ErrCodeBeforeValueIsEarlierThanThreadCreationDate = 50085 ErrCodeCommunityServerChannelsMustBeTextChannels = 50086 ErrCodeThisServerIsNotAvailableInYourLocation = 50095 ErrCodeThisServerNeedsMonetizationEnabledInOrderToPerformThisAction = 50097 ErrCodeThisServerNeedsMoreBoostsToPerformThisAction = 50101 ErrCodeTheRequestBodyContainsInvalidJSON = 50109 ErrCodeNoUsersWithDiscordTagExist = 80004 ErrCodeReactionBlocked = 90001 ErrCodeAPIResourceIsCurrentlyOverloaded = 130000 ErrCodeTheStageIsAlreadyOpen = 150006 ErrCodeCannotReplyWithoutPermissionToReadMessageHistory = 160002 ErrCodeThreadAlreadyCreatedForThisMessage = 160004 ErrCodeThreadIsLocked = 160005 ErrCodeMaximumNumberOfActiveThreadsReached = 160006 ErrCodeMaximumNumberOfActiveAnnouncementThreadsReached = 160007 ErrCodeInvalidJSONForUploadedLottieFile = 170001 ErrCodeUploadedLottiesCannotContainRasterizedImages = 170002 ErrCodeStickerMaximumFramerateExceeded = 170003 ErrCodeStickerFrameCountExceedsMaximumOfOneThousandFrames = 170004 ErrCodeLottieAnimationMaximumDimensionsExceeded = 170005 ErrCodeStickerFrameRateOutOfRange = 170006 ErrCodeStickerAnimationDurationExceedsMaximumOfFiveSeconds = 170007 ErrCodeCannotUpdateAFinishedEvent = 180000 ErrCodeFailedToCreateStageNeededForStageEvent = 180002 ErrCodeCannotEnableOnboardingRequirementsAreNotMet = 350000 ErrCodeCannotUpdateOnboardingWhileBelowRequirements = 350001 )
Block contains Discord JSON Error Response codes
const FailedHeartbeatAcks time.Duration = 5 * time.Millisecond
FailedHeartbeatAcks is the Number of heartbeat intervals to wait until forcing a connection restart.
const InteractionDeadline = time.Second * 3
InteractionDeadline is the time allowed to respond to an interaction.
const VERSION = "0.27.1"
VERSION of DiscordGo, follows Semantic Versioning. (http://semver.org/)
Variables ¶
var ( EndpointStatus = "https://status.discord.com/api/v2/" EndpointSm = EndpointStatus + "scheduled-maintenances/" EndpointSmActive = EndpointSm + "active.json" EndpointSmUpcoming = EndpointSm + "upcoming.json" EndpointDiscord = "https://discord.com/" EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/" EndpointGuilds = EndpointAPI + "guilds/" EndpointChannels = EndpointAPI + "channels/" EndpointUsers = EndpointAPI + "users/" EndpointGateway = EndpointAPI + "gateway" EndpointGatewayBot = EndpointGateway + "/bot" EndpointWebhooks = EndpointAPI + "webhooks/" EndpointStickers = EndpointAPI + "stickers/" EndpointStageInstances = EndpointAPI + "stage-instances" EndpointCDN = "https://cdn.discordapp.com/" EndpointCDNAttachments = EndpointCDN + "attachments/" EndpointCDNAvatars = EndpointCDN + "avatars/" EndpointCDNIcons = EndpointCDN + "icons/" EndpointCDNSplashes = EndpointCDN + "splashes/" EndpointCDNChannelIcons = EndpointCDN + "channel-icons/" EndpointCDNBanners = EndpointCDN + "banners/" EndpointCDNGuilds = EndpointCDN + "guilds/" EndpointCDNRoleIcons = EndpointCDN + "role-icons/" EndpointVoice = EndpointAPI + "/voice/" EndpointVoiceRegions = EndpointVoice + "regions" EndpointUser = func(uID string) string { return EndpointUsers + uID } EndpointUserAvatar = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".png" } EndpointUserAvatarAnimated = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".gif" } EndpointDefaultUserAvatar = func(idx int) string { return EndpointCDN + "embed/avatars/" + strconv.Itoa(idx) + ".png" } EndpointUserBanner = func(uID, cID string) string { return EndpointCDNBanners + uID + "/" + cID + ".png" } EndpointUserBannerAnimated = func(uID, cID string) string { return EndpointCDNBanners + uID + "/" + cID + ".gif" } EndpointUserGuilds = func(uID string) string { return EndpointUsers + uID + "/guilds" } EndpointUserGuild = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID } EndpointUserGuildMember = func(uID, gID string) string { return EndpointUserGuild(uID, gID) + "/member" } EndpointUserChannels = func(uID string) string { return EndpointUsers + uID + "/channels" } EndpointUserApplicationRoleConnection = func(aID string) string { return EndpointUsers + "@me/applications/" + aID + "/role-connection" } EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" } EndpointGuild = func(gID string) string { return EndpointGuilds + gID } EndpointGuildAutoModeration = func(gID string) string { return EndpointGuild(gID) + "/auto-moderation" } EndpointGuildAutoModerationRules = func(gID string) string { return EndpointGuildAutoModeration(gID) + "/rules" } EndpointGuildAutoModerationRule = func(gID, rID string) string { return EndpointGuildAutoModerationRules(gID) + "/" + rID } EndpointGuildThreads = func(gID string) string { return EndpointGuild(gID) + "/threads" } EndpointGuildActiveThreads = func(gID string) string { return EndpointGuildThreads(gID) + "/active" } EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" } EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" } EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" } EndpointGuildMembersSearch = func(gID string) string { return EndpointGuildMembers(gID) + "/search" } EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID } EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID } EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" } EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID } EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" } EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID } EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" } EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID } EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" } EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" } EndpointGuildEmbed = EndpointGuildWidget EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" } EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" } EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" } EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" } EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" } EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" } EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" } EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID } EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" } EndpointGuildBannerAnimated = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".gif" } EndpointGuildStickers = func(gID string) string { return EndpointGuilds + gID + "/stickers" } EndpointGuildSticker = func(gID, sID string) string { return EndpointGuilds + gID + "/stickers/" + sID } EndpointStageInstance = func(cID string) string { return EndpointStageInstances + "/" + cID } EndpointGuildScheduledEvents = func(gID string) string { return EndpointGuilds + gID + "/scheduled-events" } EndpointGuildScheduledEvent = func(gID, eID string) string { return EndpointGuilds + gID + "/scheduled-events/" + eID } EndpointGuildScheduledEventUsers = func(gID, eID string) string { return EndpointGuildScheduledEvent(gID, eID) + "/users" } EndpointGuildOnboarding = func(gID string) string { return EndpointGuilds + gID + "/onboarding" } EndpointGuildTemplate = func(tID string) string { return EndpointGuilds + "templates/" + tID } EndpointGuildTemplates = func(gID string) string { return EndpointGuilds + gID + "/templates" } EndpointGuildTemplateSync = func(gID, tID string) string { return EndpointGuilds + gID + "/templates/" + tID } EndpointGuildMemberAvatar = func(gId, uID, aID string) string { return EndpointCDNGuilds + gId + "/users/" + uID + "/avatars/" + aID + ".png" } EndpointGuildMemberAvatarAnimated = func(gId, uID, aID string) string { return EndpointCDNGuilds + gId + "/users/" + uID + "/avatars/" + aID + ".gif" } EndpointRoleIcon = func(rID, hash string) string { return EndpointCDNRoleIcons + rID + "/" + hash + ".png" } EndpointChannel = func(cID string) string { return EndpointChannels + cID } EndpointChannelThreads = func(cID string) string { return EndpointChannel(cID) + "/threads" } EndpointChannelActiveThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/active" } EndpointChannelPublicArchivedThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/archived/public" } EndpointChannelPrivateArchivedThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/archived/private" } EndpointChannelJoinedPrivateArchivedThreads = func(cID string) string { return EndpointChannel(cID) + "/users/@me/threads/archived/private" } EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" } EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID } EndpointChannelInvites = func(cID string) string { return EndpointChannels + cID + "/invites" } EndpointChannelTyping = func(cID string) string { return EndpointChannels + cID + "/typing" } EndpointChannelMessages = func(cID string) string { return EndpointChannels + cID + "/messages" } EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID } EndpointChannelMessageThread = func(cID, mID string) string { return EndpointChannelMessage(cID, mID) + "/threads" } EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" } EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" } EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID } EndpointChannelMessageCrosspost = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" } EndpointChannelFollow = func(cID string) string { return EndpointChannel(cID) + "/followers" } EndpointThreadMembers = func(tID string) string { return EndpointChannel(tID) + "/thread-members" } EndpointThreadMember = func(tID, mID string) string { return EndpointThreadMembers(tID) + "/" + mID } EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" } EndpointSticker = func(sID string) string { return EndpointStickers + sID } EndpointNitroStickersPacks = EndpointAPI + "/sticker-packs" EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" } EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID } EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token } EndpointWebhookMessage = func(wID, token, messageID string) string { return EndpointWebhookToken(wID, token) + "/messages/" + messageID } EndpointMessageReactionsAll = func(cID, mID string) string { return EndpointChannelMessage(cID, mID) + "/reactions" } EndpointMessageReactions = func(cID, mID, eID string) string { return EndpointChannelMessage(cID, mID) + "/reactions/" + eID } EndpointMessageReaction = func(cID, mID, eID, uID string) string { return EndpointMessageReactions(cID, mID, eID) + "/" + uID } EndpointApplicationGlobalCommands = func(aID string) string { return EndpointApplication(aID) + "/commands" } EndpointApplicationGlobalCommand = func(aID, cID string) string { return EndpointApplicationGlobalCommands(aID) + "/" + cID } EndpointApplicationGuildCommands = func(aID, gID string) string { return EndpointApplication(aID) + "/guilds/" + gID + "/commands" } EndpointApplicationGuildCommand = func(aID, gID, cID string) string { return EndpointApplicationGuildCommands(aID, gID) + "/" + cID } EndpointApplicationCommandPermissions = func(aID, gID, cID string) string { return EndpointApplicationGuildCommand(aID, gID, cID) + "/permissions" } EndpointApplicationCommandsGuildPermissions = func(aID, gID string) string { return EndpointApplicationGuildCommands(aID, gID) + "/permissions" } EndpointInteraction = func(aID, iToken string) string { return EndpointAPI + "interactions/" + aID + "/" + iToken } EndpointInteractionResponse = func(iID, iToken string) string { return EndpointInteraction(iID, iToken) + "/callback" } EndpointInteractionResponseActions = func(aID, iToken string) string { return EndpointWebhookMessage(aID, iToken, "@original") } EndpointFollowupMessage = func(aID, iToken string) string { return EndpointWebhookToken(aID, iToken) } EndpointFollowupMessageActions = func(aID, iToken, mID string) string { return EndpointWebhookMessage(aID, iToken, mID) } EndpointGuildCreate = EndpointAPI + "guilds" EndpointInvite = func(iID string) string { return EndpointAPI + "invites/" + iID } EndpointEmoji = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" } EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" } EndpointApplications = EndpointAPI + "applications" EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID } EndpointApplicationRoleConnectionMetadata = func(aID string) string { return EndpointApplication(aID) + "/role-connections/metadata" } EndpointOAuth2 = EndpointAPI + "oauth2/" EndpointOAuth2Applications = EndpointOAuth2 + "applications" EndpointOAuth2Application = func(aID string) string { return EndpointOAuth2Applications + "/" + aID } EndpointOAuth2ApplicationsBot = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/bot" } EndpointOAuth2ApplicationAssets = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/assets" } // TODO: Deprecated, remove in the next release EndpointOauth2 = EndpointOAuth2 EndpointOauth2Applications = EndpointOAuth2Applications EndpointOauth2Application = EndpointOAuth2Application EndpointOauth2ApplicationsBot = EndpointOAuth2ApplicationsBot EndpointOauth2ApplicationAssets = EndpointOAuth2ApplicationAssets )
Known Discord API Endpoints.
var ( ErrJSONUnmarshal = errors.New("json unmarshal") ErrStatusOffline = errors.New("You can't set your Status to offline") ErrVerificationLevelBounds = errors.New("VerificationLevel out of bounds, should be between 0 and 3") ErrPruneDaysBounds = errors.New("the number of days should be more than or equal to 1") ErrGuildNoIcon = errors.New("guild does not have an icon set") ErrGuildNoSplash = errors.New("guild does not have a splash set") )
All error constants
var ( // Marshal defines function used to encode JSON payloads Marshal func(v interface{}) ([]byte, error) = json.Marshal // Unmarshal defines function used to decode JSON payloads Unmarshal func(src []byte, v interface{}) error = json.Unmarshal )
var APIVersion = "9"
APIVersion is the Discord API version used for the REST and Websocket API.
var (
EmojiRegex = regexp.MustCompile(`<(a|):[A-z0-9_~]+:[0-9]{18,20}>`)
)
EmojiRegex is the regex used to find and identify emojis in messages
var ErrMessageIncompletePermissions = errors.New("message incomplete, unable to determine permissions")
ErrMessageIncompletePermissions is returned when the message requested for permissions does not contain enough data to generate the permissions.
var ErrNilState = errors.New("state not instantiated, please use discordgo.New() or assign Session.State")
ErrNilState is returned when the state is nil.
var ErrStateNotFound = errors.New("state cache not found")
ErrStateNotFound is returned when the state cache requested is not found
var ErrWSAlreadyOpen = errors.New("web socket already opened")
ErrWSAlreadyOpen is thrown when you attempt to open a websocket that already is open.
var ErrWSNotFound = errors.New("no websocket connection exists")
ErrWSNotFound is thrown when you attempt to use a websocket that doesn't exist
var ErrWSShardBounds = errors.New("ShardID must be less than ShardCount")
ErrWSShardBounds is thrown when you try to use a shard ID that is more than the total shard count
var 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)", SpanishLATAM: "Spanish (LATAM)", 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 GuildAllChannelsID ¶
GuildAllChannelsID is a helper function which returns guild_id-1. It is used in ApplicationCommandPermissions to target all the channels within a guild.
func MultipartBodyWithJSON ¶
func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType string, requestBody []byte, err error)
MultipartBodyWithJSON returns the contentType and body for a discord request data : The object to encode for payload_json in the multipart request files : Files to include in the request
func SnowflakeTimestamp ¶
SnowflakeTimestamp returns the creation time of a Snowflake ID relative to the creation of Discord.
func VerifyInteraction ¶
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 ¶
type ActionsRow struct {
Components []MessageComponent `json:"components"`
}
ActionsRow is a container for components within one row.
func (ActionsRow) MarshalJSON ¶
func (r ActionsRow) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling ActionsRow to a JSON object.
func (ActionsRow) Type ¶
func (r ActionsRow) Type() ComponentType
Type is a method to get the type of a component.
func (*ActionsRow) UnmarshalJSON ¶
func (r *ActionsRow) UnmarshalJSON(data []byte) error
UnmarshalJSON is a helper function to unmarshal Actions Row.
type Activity ¶
type Activity struct { Name string `json:"name"` Type ActivityType `json:"type"` URL string `json:"url,omitempty"` CreatedAt time.Time `json:"created_at"` ApplicationID string `json:"application_id,omitempty"` State string `json:"state,omitempty"` Details string `json:"details,omitempty"` Timestamps TimeStamps `json:"timestamps,omitempty"` Emoji Emoji `json:"emoji,omitempty"` Party Party `json:"party,omitempty"` Assets Assets `json:"assets,omitempty"` Secrets Secrets `json:"secrets,omitempty"` Instance bool `json:"instance,omitempty"` Flags int `json:"flags,omitempty"` }
Activity defines the Activity sent with GatewayStatusUpdate https://discord.com/developers/docs/topics/gateway#activity-object
func (*Activity) UnmarshalJSON ¶
UnmarshalJSON is a custom unmarshaljson to make CreatedAt a time.Time instead of an int
type ActivityType ¶
type ActivityType int
ActivityType is the type of Activity (see ActivityType* consts) in the Activity struct https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
const ( ActivityTypeGame ActivityType = 0 ActivityTypeStreaming ActivityType = 1 ActivityTypeListening ActivityType = 2 ActivityTypeWatching ActivityType = 3 ActivityTypeCustom ActivityType = 4 ActivityTypeCompeting ActivityType = 5 )
Valid ActivityType values
type AddedThreadMember ¶
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
AllowedMentionType describes the types of mentions used in the MessageAllowedMentions type.
const ( AllowedMentionTypeRoles AllowedMentionType = "roles" AllowedMentionTypeUsers AllowedMentionType = "users" AllowedMentionTypeEveryone AllowedMentionType = "everyone" )
The types of mentions used in MessageAllowedMentions.
type Application ¶
type Application struct { ID string `json:"id,omitempty"` Name string `json:"name"` Icon string `json:"icon,omitempty"` Description string `json:"description,omitempty"` RPCOrigins []string `json:"rpc_origins,omitempty"` BotPublic bool `json:"bot_public,omitempty"` BotRequireCodeGrant bool `json:"bot_require_code_grant,omitempty"` TermsOfServiceURL string `json:"terms_of_service_url"` PrivacyProxyURL string `json:"privacy_policy_url"` Owner *User `json:"owner"` Summary string `json:"summary"` VerifyKey string `json:"verify_key"` Team *Team `json:"team"` GuildID string `json:"guild_id"` PrimarySKUID string `json:"primary_sku_id"` Slug string `json:"slug"` CoverImage string `json:"cover_image"` Flags int `json:"flags,omitempty"` }
Application stores values for a Discord Application
type ApplicationCommand ¶
type ApplicationCommand struct { ID string `json:"id,omitempty"` ApplicationID string `json:"application_id,omitempty"` GuildID string `json:"guild_id,omitempty"` Version string `json:"version,omitempty"` Type ApplicationCommandType `json:"type,omitempty"` Name string `json:"name"` NameLocalizations *map[Locale]string `json:"name_localizations,omitempty"` // NOTE: DefaultPermission will be soon deprecated. Use DefaultMemberPermissions and DMPermission instead. DefaultPermission *bool `json:"default_permission,omitempty"` DefaultMemberPermissions *int64 `json:"default_member_permissions,string,omitempty"` DMPermission *bool `json:"dm_permission,omitempty"` NSFW *bool `json:"nsfw,omitempty"` Description string `json:"description,omitempty"` DescriptionLocalizations *map[Locale]string `json:"description_localizations,omitempty"` Options []*ApplicationCommandOption `json:"options"` }
ApplicationCommand represents an application's slash command.
type ApplicationCommandInteractionData ¶
type ApplicationCommandInteractionData struct { ID string `json:"id"` Name string `json:"name"` CommandType ApplicationCommandType `json:"type"` Resolved *ApplicationCommandInteractionDataResolved `json:"resolved"` // Slash command options Options []*ApplicationCommandInteractionDataOption `json:"options"` // Target (user/message) id on which context menu command was called. // The details are stored in Resolved according to command type. TargetID string `json:"target_id"` }
ApplicationCommandInteractionData contains the data of application command interaction.
func (ApplicationCommandInteractionData) Type ¶
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 ¶
func (o ApplicationCommandInteractionDataOption) BoolValue() bool
BoolValue is a utility function for casting option value to bool
func (ApplicationCommandInteractionDataOption) ChannelValue ¶
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 ¶
func (o ApplicationCommandInteractionDataOption) FloatValue() float64
FloatValue is a utility function for casting option value to float
func (ApplicationCommandInteractionDataOption) IntValue ¶
func (o ApplicationCommandInteractionDataOption) IntValue() int64
IntValue is a utility function for casting option value to integer
func (ApplicationCommandInteractionDataOption) RoleValue ¶
func (o ApplicationCommandInteractionDataOption) RoleValue(s *Session, gID string) *Role
RoleValue is a utility function for casting option value to role object. s : Session object, if not nil, function additionally fetches all role's data
func (ApplicationCommandInteractionDataOption) StringValue ¶
func (o ApplicationCommandInteractionDataOption) StringValue() string
StringValue is a utility function for casting option value to string
func (ApplicationCommandInteractionDataOption) UintValue ¶
func (o ApplicationCommandInteractionDataOption) UintValue() uint64
UintValue is a utility function for casting option value to unsigned integer
func (ApplicationCommandInteractionDataOption) UserValue ¶
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[string]*User `json:"users"` Members map[string]*Member `json:"members"` Roles map[string]*Role `json:"roles"` Channels map[string]*Channel `json:"channels"` Messages map[string]*Message `json:"messages"` Attachments map[string]*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.
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"` // Minimum length of string option. MinLength *int `json:"min_length,omitempty"` // Maximum length of string option. MaxLength int `json:"max_length,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 ¶
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 ApplicationCommandPermissionTypeChannel ApplicationCommandPermissionType = 3 )
Application command permission types.
type ApplicationCommandPermissions ¶
type ApplicationCommandPermissions struct { ID string `json:"id"` Type ApplicationCommandPermissionType `json:"type"` Permission bool `json:"permission"` }
ApplicationCommandPermissions represents a single user or role permission for a command.
type ApplicationCommandPermissionsList ¶
type ApplicationCommandPermissionsList struct {
Permissions []*ApplicationCommandPermissions `json:"permissions"`
}
ApplicationCommandPermissionsList represents a list of ApplicationCommandPermissions, needed for serializing to JSON.
type ApplicationCommandPermissionsUpdate ¶
type ApplicationCommandPermissionsUpdate struct {
*GuildApplicationCommandPermissions
}
ApplicationCommandPermissionsUpdate is the data for an ApplicationCommandPermissionsUpdate event
type ApplicationCommandType ¶
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 ApplicationRoleConnection ¶
type ApplicationRoleConnection struct { PlatformName string `json:"platform_name"` PlatformUsername string `json:"platform_username"` Metadata map[string]string `json:"metadata"` }
ApplicationRoleConnection represents the role connection that an application has attached to a user.
type ApplicationRoleConnectionMetadata ¶
type ApplicationRoleConnectionMetadata struct { Type ApplicationRoleConnectionMetadataType `json:"type"` Key string `json:"key"` Name string `json:"name"` NameLocalizations map[Locale]string `json:"name_localizations"` Description string `json:"description"` DescriptionLocalizations map[Locale]string `json:"description_localizations"` }
ApplicationRoleConnectionMetadata stores application role connection metadata.
type ApplicationRoleConnectionMetadataType ¶
type ApplicationRoleConnectionMetadataType int
ApplicationRoleConnectionMetadataType represents the type of application role connection metadata.
const ( ApplicationRoleConnectionMetadataIntegerLessThanOrEqual ApplicationRoleConnectionMetadataType = 1 ApplicationRoleConnectionMetadataIntegerGreaterThanOrEqual ApplicationRoleConnectionMetadataType = 2 ApplicationRoleConnectionMetadataIntegerEqual ApplicationRoleConnectionMetadataType = 3 ApplicationRoleConnectionMetadataIntegerNotEqual ApplicationRoleConnectionMetadataType = 4 ApplicationRoleConnectionMetadataDatetimeLessThanOrEqual ApplicationRoleConnectionMetadataType = 5 ApplicationRoleConnectionMetadataDatetimeGreaterThanOrEqual ApplicationRoleConnectionMetadataType = 6 ApplicationRoleConnectionMetadataBooleanEqual ApplicationRoleConnectionMetadataType = 7 ApplicationRoleConnectionMetadataBooleanNotEqual ApplicationRoleConnectionMetadataType = 8 )
Application role connection metadata types.
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 ¶
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 AuditLogGuildScheduledEventUpdate 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 AuditLogActionCreatorMonetizationRequestCreated AuditLogAction = 150 AuditLogActionCreatorMonetizationTermsAccepted AuditLogAction = 151 )
Block contains Discord Audit Log Action Types
type AuditLogChange ¶
type AuditLogChange struct { NewValue interface{} `json:"new_value"` OldValue interface{} `json:"old_value"` Key *AuditLogChangeKey `json:"key"` }
AuditLogChange for an AuditLogEntry
type AuditLogChangeKey ¶
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 string `json:"target_id"` Changes []*AuditLogChange `json:"changes"` UserID string `json:"user_id"` ID string `json:"id"` ActionType *AuditLogAction `json:"action_type"` Options *AuditLogOptions `json:"options"` Reason string `json:"reason"` }
AuditLogEntry for a GuildAuditLog https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
type AuditLogOptions ¶
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"` ApplicationID string `json:"application_id"` AutoModerationRuleName string `json:"auto_moderation_rule_name"` AutoModerationRuleTriggerType string `json:"auto_moderation_rule_trigger_type"` IntegrationType string `json:"integration_type"` }
AuditLogOptions optional data for the AuditLog https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
type AuditLogOptionsType ¶
type AuditLogOptionsType string
AuditLogOptionsType of the AuditLogOption https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
const ( AuditLogOptionsTypeRole AuditLogOptionsType = "0" AuditLogOptionsTypeMember AuditLogOptionsType = "1" )
Valid Types for AuditLogOptionsType
type AutoModerationAction ¶
type AutoModerationAction struct { Type AutoModerationActionType `json:"type"` Metadata *AutoModerationActionMetadata `json:"metadata,omitempty"` }
AutoModerationAction stores data for an auto moderation action.
type AutoModerationActionExecution ¶
type AutoModerationActionExecution struct { GuildID string `json:"guild_id"` Action AutoModerationAction `json:"action"` RuleID string `json:"rule_id"` RuleTriggerType AutoModerationRuleTriggerType `json:"rule_trigger_type"` UserID string `json:"user_id"` ChannelID string `json:"channel_id"` MessageID string `json:"message_id"` AlertSystemMessageID string `json:"alert_system_message_id"` Content string `json:"content"` MatchedKeyword string `json:"matched_keyword"` MatchedContent string `json:"matched_content"` }
AutoModerationActionExecution is the data for an AutoModerationActionExecution event.
type AutoModerationActionMetadata ¶
type AutoModerationActionMetadata struct { // Channel to which user content should be logged. // NOTE: should be only used with send alert message action type. ChannelID string `json:"channel_id,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 ¶
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 ¶
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 ¶
type AutoModerationRule struct { ID string `json:"id,omitempty"` GuildID string `json:"guild_id,omitempty"` Name string `json:"name,omitempty"` CreatorID string `json:"creator_id,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 *[]string `json:"exempt_roles,omitempty"` ExemptChannels *[]string `json:"exempt_channels,omitempty"` }
AutoModerationRule stores data for an auto moderation rule.
type AutoModerationRuleCreate ¶
type AutoModerationRuleCreate struct {
*AutoModerationRule
}
AutoModerationRuleCreate is the data for an AutoModerationRuleCreate event.
type AutoModerationRuleDelete ¶
type AutoModerationRuleDelete struct {
*AutoModerationRule
}
AutoModerationRuleDelete is the data for an AutoModerationRuleDelete event.
type AutoModerationRuleEventType ¶
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 ¶
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 ¶
type AutoModerationRuleUpdate struct {
*AutoModerationRule
}
AutoModerationRuleUpdate is the data for an AutoModerationRuleUpdate event.
type AutoModerationTriggerMetadata ¶
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 ¶
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 ¶
MarshalJSON is a method for marshaling Button to a JSON object.
func (Button) Type ¶
func (Button) Type() ComponentType
Type is a method to get the type of a component.
type ButtonStyle ¶
type ButtonStyle uint
ButtonStyle is style of button.
const ( // PrimaryButton is a button with blurple color. PrimaryButton ButtonStyle = 1 // SecondaryButton is a button with grey color. SecondaryButton ButtonStyle = 2 // SuccessButton is a button with green color. SuccessButton ButtonStyle = 3 // DangerButton is a button with red color. DangerButton ButtonStyle = 4 // LinkButton is a special type of button which navigates to a URL. Has grey color. LinkButton ButtonStyle = 5 )
Button styles.
type Channel ¶
type Channel struct { // The ID of the channel. ID string `json:"id"` // The ID of the guild to which the channel belongs, if it is in a guild. // Else, this ID is empty (e.g. DM channels). GuildID string `json:"guild_id"` // The name of the channel. Name string `json:"name"` // The topic of the channel. Topic string `json:"topic"` // The type of the channel. Type ChannelType `json:"type"` // The ID of the last message sent in the channel. This is not // guaranteed to be an ID of a valid message. LastMessageID string `json:"last_message_id"` // The timestamp of the last pinned message in the channel. // nil if the channel has no pinned messages. LastPinTimestamp *time.Time `json:"last_pin_timestamp"` // An approximate count of messages in a thread, stops counting at 50 MessageCount int `json:"message_count"` // An approximate count of users in a thread, stops counting at 50 MemberCount int `json:"member_count"` // 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. For threads - id of the channel thread was created in. ParentID string `json:"parent_id"` // Amount of seconds a user has to wait before sending another message or creating another thread (0-21600) // bots, as well as users with the permission manage_messages or manage_channel, are unaffected RateLimitPerUser int `json:"rate_limit_per_user"` // ID of the creator of the group DM or thread OwnerID string `json:"owner_id"` // ApplicationID of the DM creator Zeroed if guild channel or not a bot user ApplicationID string `json:"application_id"` // Thread-specific fields not needed by other channels ThreadMetadata *ThreadMetadata `json:"thread_metadata,omitempty"` // Thread member object for the current user, if they have joined the thread, only included on certain API endpoints Member *ThreadMember `json:"thread_member"` // All thread members. State channels only. Members []*ThreadMember `json:"-"` // Channel flags. 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 []string `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.
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 string `json:"parent_id,omitempty"` RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"` Flags *ChannelFlags `json:"flags,omitempty"` DefaultThreadRateLimitPerUser *int `json:"default_thread_rate_limit_per_user,omitempty"` Archived *bool `json:"archived,omitempty"` AutoArchiveDuration int `json:"auto_archive_duration,omitempty"` Locked *bool `json:"locked,omitempty"` Invitable *bool `json:"invitable,omitempty"` AvailableTags *[]ForumTag `json:"available_tags,omitempty"` DefaultReactionEmoji *ForumDefaultReaction `json:"default_reaction_emoji,omitempty"` DefaultSortOrder *ForumSortOrderType `json:"default_sort_order,omitempty"` // TODO: null DefaultForumLayout *ForumLayout `json:"default_forum_layout,omitempty"` // NOTE: forum threads only AppliedTags *[]string `json:"applied_tags,omitempty"` }
A ChannelEdit holds Channel Field data for a channel edit.
type ChannelFlags ¶
type ChannelFlags int
ChannelFlags represent flags of a channel/thread.
const ( // ChannelFlagPinned indicates whether the thread is pinned in the forum channel. // NOTE: forum threads only. ChannelFlagPinned ChannelFlags = 1 << 1 // ChannelFlagRequireTag indicates whether a tag is required to be specified when creating a thread. // NOTE: forum channels only. ChannelFlagRequireTag ChannelFlags = 1 << 4 )
Block containing known ChannelFlags values.
type ChannelFollow ¶
type ChannelFollow struct { ChannelID string `json:"channel_id"` WebhookID string `json:"webhook_id"` }
A ChannelFollow holds data returned after following a news channel
type ChannelPinsUpdate ¶
type ChannelPinsUpdate struct { LastPinTimestamp string `json:"last_pin_timestamp"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` }
ChannelPinsUpdate stores data for a ChannelPinsUpdate event.
type ChannelType ¶
type ChannelType int
ChannelType is the type of a Channel
const ( ChannelTypeGuildText ChannelType = 0 ChannelTypeDM ChannelType = 1 ChannelTypeGuildVoice ChannelType = 2 ChannelTypeGroupDM ChannelType = 3 ChannelTypeGuildCategory ChannelType = 4 ChannelTypeGuildNews ChannelType = 5 ChannelTypeGuildStore ChannelType = 6 ChannelTypeGuildNewsThread ChannelType = 10 ChannelTypeGuildPublicThread ChannelType = 11 ChannelTypeGuildPrivateThread ChannelType = 12 ChannelTypeGuildStageVoice ChannelType = 13 ChannelTypeGuildForum ChannelType = 15 ChannelTypeGuildMedia ChannelType = 16 )
Block contains known ChannelType values
type ChannelUpdate ¶
type ChannelUpdate struct {
*Channel
}
ChannelUpdate is the data for a ChannelUpdate event.
type ClientStatus ¶
type ClientStatus struct { Desktop Status `json:"desktop"` Mobile Status `json:"mobile"` Web Status `json:"web"` }
ClientStatus stores the online, offline, idle, or dnd status of each device of a Guild member.
type ComponentEmoji ¶
type ComponentEmoji struct { Name string `json:"name,omitempty"` ID string `json:"id,omitempty"` Animated bool `json:"animated,omitempty"` }
ComponentEmoji represents button emoji, if it does have one.
type ComponentType ¶
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 synthetic event and is not dispatched by Discord.
type Disconnect ¶
type Disconnect struct{}
Disconnect is the data for a Disconnect event. This is a synthetic event and is not dispatched by Discord.
type EmbedType ¶
type EmbedType string
EmbedType is the type of embed https://discord.com/developers/docs/resources/channel#embed-object-embed-types
type Emoji ¶
type Emoji struct { ID string `json:"id"` Name string `json:"name"` Roles []string `json:"roles"` User *User `json:"user"` RequireColons bool `json:"require_colons"` Managed bool `json:"managed"` Animated bool `json:"animated"` Available bool `json:"available"` }
Emoji struct holds data related to Emoji's
func (*Emoji) APIName ¶
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 EmojiParams ¶
type EmojiParams struct { // Name of the emoji Name string `json:"name,omitempty"` // A base64 encoded emoji image, has to be smaller than 256KB. // NOTE: can be only set on creation. Image string `json:"image,omitempty"` // Roles for which this emoji will be available. Roles []string `json:"roles,omitempty"` }
EmojiParams represents parameters needed to create or update an Emoji.
type Event ¶
type Event struct { Operation int `json:"op"` Sequence int64 `json:"s"` Type string `json:"t"` RawData json.RawMessage `json:"d"` // Struct contains one of the other types in this file. Struct interface{} `json:"-"` }
Event provides a basic initial struct for all websocket events.
type EventHandler ¶
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 ExpireBehavior ¶
type ExpireBehavior int
ExpireBehavior of Integration https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
const ( ExpireBehaviorRemoveRole ExpireBehavior = 0 ExpireBehaviorKick ExpireBehavior = 1 )
Block of valid ExpireBehaviors
type ExplicitContentFilterLevel ¶
type ExplicitContentFilterLevel int
ExplicitContentFilterLevel type definition
const ( ExplicitContentFilterDisabled ExplicitContentFilterLevel = 0 ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterLevel = 1 ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2 )
Constants for ExplicitContentFilterLevel levels from 0 to 2 inclusive
type ForumDefaultReaction ¶
type ForumDefaultReaction struct { // The id of a guild's custom emoji. EmojiID string `json:"emoji_id,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 ¶
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 ¶
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 ¶
type ForumTag struct { ID string `json:"id,omitempty"` Name string `json:"name"` Moderated bool `json:"moderated"` EmojiID string `json:"emoji_id,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 GatewayBotResponse ¶
type GatewayBotResponse struct { URL string `json:"url"` Shards int `json:"shards"` SessionStartLimit SessionInformation `json:"session_start_limit"` }
GatewayBotResponse stores the data for the gateway/bot response
type GatewayStatusUpdate ¶
type GatewayStatusUpdate struct { Since int `json:"since"` Game Activity `json:"game"` Status string `json:"status"` AFK bool `json:"afk"` }
GatewayStatusUpdate is sent by the client to indicate a presence or status update https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
type Guild ¶
type Guild struct { // The ID of the guild. ID string `json:"id"` // The name of the guild. (2–100 characters) Name string `json:"name"` // The hash of the guild's icon. Use Session.GuildIcon // to retrieve the icon itself. Icon string `json:"icon"` // The voice region of the guild. Region string `json:"region"` // The ID of the AFK voice channel. AfkChannelID string `json:"afk_channel_id"` // The user ID of the owner of the guild. OwnerID string `json:"owner_id"` // If we are the owner of the guild Owner bool `json:"owner"` // The time at which the current user joined the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. JoinedAt time.Time `json:"joined_at"` // The hash of the guild's discovery splash. DiscoverySplash string `json:"discovery_splash"` // The hash of the guild's splash. Splash string `json:"splash"` // The timeout, in seconds, before a user is considered AFK in voice. AfkTimeout int `json:"afk_timeout"` // The number of members in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. MemberCount int `json:"member_count"` // The verification level required for the guild. VerificationLevel VerificationLevel `json:"verification_level"` // Whether the guild is considered large. This is // determined by a member threshold in the identify packet, // and is currently hard-coded at 250 members in the library. Large bool `json:"large"` // The default message notification setting for the guild. DefaultMessageNotifications MessageNotifications `json:"default_message_notifications"` // A list of roles in the guild. Roles []*Role `json:"roles"` // A list of the custom emojis present in the guild. Emojis []*Emoji `json:"emojis"` // A list of the 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"` // The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned) MaxPresences int `json:"max_presences"` // The maximum number of members for the guild MaxMembers int `json:"max_members"` // A list of channels in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. Channels []*Channel `json:"channels"` // A list of all active threads in the guild that current user has permission to view // This field is only present in GUILD_CREATE events and websocket // update events and thus is only present in state-cached guilds. 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"` // 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 NSFW Level of the guild NSFWLevel GuildNSFWLevel `json:"nsfw_level"` // The list of enabled guild features Features []GuildFeature `json:"features"` // Required MFA level for the guild MfaLevel MfaLevel `json:"mfa_level"` // The application id of the guild if bot created. ApplicationID string `json:"application_id"` // Whether or not the Server Widget is enabled WidgetEnabled bool `json:"widget_enabled"` // The Channel ID for the Server Widget WidgetChannelID string `json:"widget_channel_id"` // The Channel ID to which system messages are sent (eg join and leave messages) SystemChannelID string `json:"system_channel_id"` // The System channel flags SystemChannelFlags SystemChannelFlag `json:"system_channel_flags"` // The ID of the rules channel ID, used for rules. RulesChannelID string `json:"rules_channel_id"` // the vanity url code for the guild VanityURLCode string `json:"vanity_url_code"` // the description for the guild Description string `json:"description"` // The hash of the guild's banner Banner string `json:"banner"` // The premium tier of the guild PremiumTier PremiumTier `json:"premium_tier"` // The total number of users currently boosting this server PremiumSubscriptionCount int `json:"premium_subscription_count"` // The preferred locale of a guild with the "PUBLIC" feature; used in server discovery and notices from Discord; defaults to "en-US" PreferredLocale string `json:"preferred_locale"` // The id of the channel where admins and moderators of guilds with the "PUBLIC" feature receive notices from Discord PublicUpdatesChannelID string `json:"public_updates_channel_id"` // The maximum amount of users in a video channel MaxVideoChannelUsers int `json:"max_video_channel_users"` // Approximate number of members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true ApproximateMemberCount int `json:"approximate_member_count"` // Approximate number of non-offline members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true ApproximatePresenceCount int `json:"approximate_presence_count"` // Permissions of our user Permissions int64 `json:"permissions,string"` // Stage instances in the guild StageInstances []*StageInstance `json:"stage_instances"` }
A Guild holds all data related to a specific Discord Guild. Guilds are also sometimes referred to as Servers in the Discord client.
type GuildApplicationCommandPermissions ¶
type GuildApplicationCommandPermissions struct { ID string `json:"id"` ApplicationID string `json:"application_id"` GuildID string `json:"guild_id"` Permissions []*ApplicationCommandPermissions `json:"permissions"` }
GuildApplicationCommandPermissions represents all permissions for a single guild command.
type GuildAuditLog ¶
type GuildAuditLog struct { Webhooks []*Webhook `json:"webhooks,omitempty"` Users []*User `json:"users,omitempty"` AuditLogEntries []*AuditLogEntry `json:"audit_log_entries"` Integrations []*Integration `json:"integrations"` }
A GuildAuditLog stores data for a guild audit log. https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
type GuildAuditLogEntryCreate ¶
type GuildAuditLogEntryCreate struct {
*AuditLogEntry
}
GuildAuditLogEntryCreate is the data for a GuildAuditLogEntryCreate event.
type GuildBanAdd ¶
GuildBanAdd is the data for a GuildBanAdd event.
type GuildBanRemove ¶
GuildBanRemove is the data for a GuildBanRemove event.
type GuildChannelCreateData ¶
type GuildChannelCreateData struct { Name string `json:"name"` Type ChannelType `json:"type"` Topic string `json:"topic,omitempty"` Bitrate int `json:"bitrate,omitempty"` UserLimit int `json:"user_limit,omitempty"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` Position int `json:"position,omitempty"` PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"` ParentID string `json:"parent_id,omitempty"` NSFW bool `json:"nsfw,omitempty"` }
GuildChannelCreateData is provided to GuildChannelCreateComplex
type GuildCreate ¶
type GuildCreate struct {
*Guild
}
GuildCreate is the data for a GuildCreate event.
type GuildDelete ¶
GuildDelete is the data for a GuildDelete event.
type GuildEmbed ¶
type GuildEmbed struct { Enabled *bool `json:"enabled,omitempty"` ChannelID string `json:"channel_id,omitempty"` }
A GuildEmbed stores data for a guild embed.
type GuildEmojisUpdate ¶
A GuildEmojisUpdate is the data for a guild emoji update event.
type GuildFeature ¶
type GuildFeature string
GuildFeature indicates the presence of a feature in a guild
const ( GuildFeatureAnimatedBanner GuildFeature = "ANIMATED_BANNER" GuildFeatureAnimatedIcon GuildFeature = "ANIMATED_ICON" GuildFeatureAutoModeration GuildFeature = "AUTO_MODERATION" GuildFeatureBanner GuildFeature = "BANNER" GuildFeatureCommunity GuildFeature = "COMMUNITY" GuildFeatureDiscoverable GuildFeature = "DISCOVERABLE" GuildFeatureFeaturable GuildFeature = "FEATURABLE" GuildFeatureInviteSplash GuildFeature = "INVITE_SPLASH" GuildFeatureMemberVerificationGateEnabled GuildFeature = "MEMBER_VERIFICATION_GATE_ENABLED" GuildFeatureMonetizationEnabled GuildFeature = "MONETIZATION_ENABLED" GuildFeatureMoreStickers GuildFeature = "MORE_STICKERS" GuildFeatureNews GuildFeature = "NEWS" GuildFeaturePartnered GuildFeature = "PARTNERED" GuildFeaturePreviewEnabled GuildFeature = "PREVIEW_ENABLED" GuildFeaturePrivateThreads GuildFeature = "PRIVATE_THREADS" GuildFeatureRoleIcons GuildFeature = "ROLE_ICONS" GuildFeatureTicketedEventsEnabled GuildFeature = "TICKETED_EVENTS_ENABLED" GuildFeatureVanityURL GuildFeature = "VANITY_URL" GuildFeatureVerified GuildFeature = "VERIFIED" GuildFeatureVipRegions GuildFeature = "VIP_REGIONS" GuildFeatureWelcomeScreenEnabled GuildFeature = "WELCOME_SCREEN_ENABLED" )
Constants for GuildFeature
type GuildIntegrationsUpdate ¶
type GuildIntegrationsUpdate struct {
GuildID string `json:"guild_id"`
}
GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
type GuildMemberAdd ¶
type GuildMemberAdd struct {
*Member
}
GuildMemberAdd is the data for a GuildMemberAdd event.
type GuildMemberAddParams ¶
type GuildMemberAddParams struct { // Valid access_token for the user. AccessToken string `json:"access_token"` // Value to set users nickname to. Nick string `json:"nick,omitempty"` // A list of role ID's to set on the member. Roles []string `json:"roles,omitempty"` // Whether the user is muted. Mute bool `json:"mute,omitempty"` // Whether the user is deafened. Deaf bool `json:"deaf,omitempty"` }
GuildMemberAddParams stores data needed to add a user to a guild. NOTE: All fields are optional, except AccessToken.
type GuildMemberParams ¶
type GuildMemberParams struct { // Value to set user's nickname to. Nick string `json:"nick,omitempty"` // Array of role ids the member is assigned. Roles *[]string `json:"roles,omitempty"` // ID of channel to move user to (if they are connected to voice). // Set to "" to remove user from a voice channel. ChannelID *string `json:"channel_id,omitempty"` // Whether the user is muted in voice channels. Mute *bool `json:"mute,omitempty"` // Whether the user is deafened in voice channels. Deaf *bool `json:"deaf,omitempty"` // When the user's timeout will expire and the user will be able // to communicate in the guild again (up to 28 days in the future). // Set to time.Time{} to remove timeout. CommunicationDisabledUntil *time.Time `json:"communication_disabled_until,omitempty"` }
GuildMemberParams stores data needed to update a member https://discord.com/developers/docs/resources/guild#modify-guild-member
func (GuildMemberParams) MarshalJSON ¶
func (p GuildMemberParams) MarshalJSON() (res []byte, err error)
MarshalJSON is a helper function to marshal GuildMemberParams.
type GuildMemberRemove ¶
type GuildMemberRemove struct {
*Member
}
GuildMemberRemove is the data for a GuildMemberRemove event.
type GuildMemberUpdate ¶
GuildMemberUpdate is the data for a GuildMemberUpdate event.
type GuildMembersChunk ¶
type GuildMembersChunk struct { GuildID string `json:"guild_id"` Members []*Member `json:"members"` ChunkIndex int `json:"chunk_index"` ChunkCount int `json:"chunk_count"` NotFound []string `json:"not_found,omitempty"` Presences []*Presence `json:"presences,omitempty"` Nonce string `json:"nonce,omitempty"` }
A GuildMembersChunk is the data for a GuildMembersChunk event.
type GuildNSFWLevel ¶
type GuildNSFWLevel int
GuildNSFWLevel type definition
const ( GuildNSFWLevelDefault GuildNSFWLevel = 0 GuildNSFWLevelExplicit GuildNSFWLevel = 1 GuildNSFWLevelSafe GuildNSFWLevel = 2 GuildNSFWLevelAgeRestricted GuildNSFWLevel = 3 )
Constants for GuildNSFWLevel levels from 0 to 3 inclusive
type GuildOnboarding ¶
type GuildOnboarding struct { // ID of the guild this onboarding flow is part of. GuildID string `json:"guild_id,omitempty"` // Prompts shown during onboarding and in the customize community (Channels & Roles) tab. Prompts *[]GuildOnboardingPrompt `json:"prompts,omitempty"` // Channel IDs that members get opted into automatically. DefaultChannelIDs []string `json:"default_channel_ids,omitempty"` // Whether onboarding is enabled in the guild. Enabled *bool `json:"enabled,omitempty"` // Mode of onboarding. Mode *GuildOnboardingMode `json:"mode,omitempty"` }
GuildOnboarding represents the onboarding flow for a guild. https://discord.com/developers/docs/resources/guild#guild-onboarding-object
type GuildOnboardingMode ¶
type GuildOnboardingMode int
GuildOnboardingMode defines the criteria used to satisfy constraints that are required for enabling onboarding. https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-mode
const ( // GuildOnboardingModeDefault counts default channels towards constraints. GuildOnboardingModeDefault GuildOnboardingMode = 0 // GuildOnboardingModeAdvanced counts default channels and questions towards constraints. GuildOnboardingModeAdvanced GuildOnboardingMode = 1 )
Block containing known GuildOnboardingMode values.
type GuildOnboardingPrompt ¶
type GuildOnboardingPrompt struct { // ID of the prompt. // NOTE: always requires to be a valid snowflake (e.g. "0"), see // https://github.com/discord/discord-api-docs/issues/6320 for more information. ID string `json:"id,omitempty"` // Type of the prompt. Type GuildOnboardingPromptType `json:"type"` // Options available within the prompt. Options []GuildOnboardingPromptOption `json:"options"` // Title of the prompt. Title string `json:"title"` // Indicates whether users are limited to selecting one option for the prompt. SingleSelect bool `json:"single_select"` // Indicates whether the prompt is required before a user completes the onboarding flow. Required bool `json:"required"` // Indicates whether the prompt is present in the onboarding flow. // If false, the prompt will only appear in the customize community (Channels & Roles) tab. InOnboarding bool `json:"in_onboarding"` }
GuildOnboardingPrompt is a prompt shown during onboarding and in the customize community (Channels & Roles) tab. https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
type GuildOnboardingPromptOption ¶
type GuildOnboardingPromptOption struct { // ID of the prompt option. ID string `json:"id,omitempty"` // IDs for channels a member is added to when the option is selected. ChannelIDs []string `json:"channel_ids"` // IDs for roles assigned to a member when the option is selected. RoleIDs []string `json:"role_ids"` // Emoji of the option. // NOTE: when creating or updating a prompt option // EmojiID, EmojiName and EmojiAnimated should be used instead. Emoji *Emoji `json:"emoji,omitempty"` // Title of the option. Title string `json:"title"` // Description of the option. Description string `json:"description"` // ID of the option's emoji. // NOTE: only used when creating or updating a prompt option. EmojiID string `json:"emoji_id,omitempty"` // Name of the option's emoji. // NOTE: only used when creating or updating a prompt option. EmojiName string `json:"emoji_name,omitempty"` // Whether the option's emoji is animated. // NOTE: only used when creating or updating a prompt option. EmojiAnimated *bool `json:"emoji_animated,omitempty"` }
GuildOnboardingPromptOption is an option available within an onboarding prompt. https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
type GuildOnboardingPromptType ¶
type GuildOnboardingPromptType int
GuildOnboardingPromptType is the type of an onboarding prompt. https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types
const ( GuildOnboardingPromptTypeMultipleChoice GuildOnboardingPromptType = 0 GuildOnboardingPromptTypeDropdown GuildOnboardingPromptType = 1 )
Block containing known GuildOnboardingPromptType values.
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? ExplicitContentFilter int `json:"explicit_content_filter,omitempty"` AfkChannelID string `json:"afk_channel_id,omitempty"` AfkTimeout int `json:"afk_timeout,omitempty"` Icon string `json:"icon,omitempty"` OwnerID string `json:"owner_id,omitempty"` Splash string `json:"splash,omitempty"` DiscoverySplash string `json:"discovery_splash,omitempty"` Banner string `json:"banner,omitempty"` SystemChannelID string `json:"system_channel_id,omitempty"` SystemChannelFlags SystemChannelFlag `json:"system_channel_flags,omitempty"` RulesChannelID string `json:"rules_channel_id,omitempty"` PublicUpdatesChannelID string `json:"public_updates_channel_id,omitempty"` PreferredLocale Locale `json:"preferred_locale,omitempty"` Features []GuildFeature `json:"features,omitempty"` Description string `json:"description,omitempty"` PremiumProgressBarEnabled *bool `json:"premium_progress_bar_enabled,omitempty"` }
A GuildParams stores all the data needed to update discord guild settings
type GuildPreview ¶
type GuildPreview struct { // The ID of the guild. ID string `json:"id"` // The name of the guild. (2–100 characters) Name string `json:"name"` // The hash of the guild's icon. Use Session.GuildIcon // to retrieve the icon itself. Icon string `json:"icon"` // The hash of the guild's splash. Splash string `json:"splash"` // The hash of the guild's discovery splash. DiscoverySplash string `json:"discovery_splash"` // A list of the custom emojis present in the guild. Emojis []*Emoji `json:"emojis"` // The list of enabled guild features Features []string `json:"features"` // Approximate number of members in this guild // NOTE: this field is only filled when using GuildWithCounts ApproximateMemberCount int `json:"approximate_member_count"` // Approximate number of non-offline members in this guild // NOTE: this field is only filled when using GuildWithCounts ApproximatePresenceCount int `json:"approximate_presence_count"` // the description for the guild Description string `json:"description"` }
A GuildPreview holds data related to a specific public Discord Guild, even if the user is not in the guild.
func (*GuildPreview) IconURL ¶
func (g *GuildPreview) IconURL(size string) string
IconURL returns a URL to the guild's icon.
size: The size of the desired icon image as a power of two Image size can be any power of two between 16 and 4096.
type GuildRoleCreate ¶
type GuildRoleCreate struct {
*GuildRole
}
GuildRoleCreate is the data for a GuildRoleCreate event.
type GuildRoleDelete ¶
A GuildRoleDelete is the data for a GuildRoleDelete event.
type GuildRoleUpdate ¶
type GuildRoleUpdate struct {
*GuildRole
}
GuildRoleUpdate is the data for a GuildRoleUpdate event.
type GuildScheduledEvent ¶
type GuildScheduledEvent struct { // The ID of the scheduled event ID string `json:"id"` // The guild id which the scheduled event belongs to GuildID string `json:"guild_id"` // The channel id in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL ChannelID string `json:"channel_id"` // The id of the user that created the scheduled event CreatorID string `json:"creator_id"` // The name of the scheduled event (1-100 characters) Name string `json:"name"` // The description of the scheduled event (1-1000 characters) Description string `json:"description"` // The time the scheduled event will start ScheduledStartTime time.Time `json:"scheduled_start_time"` // The time the scheduled event will end, required only when entity_type is EXTERNAL ScheduledEndTime *time.Time `json:"scheduled_end_time"` // The privacy level of the scheduled event PrivacyLevel GuildScheduledEventPrivacyLevel `json:"privacy_level"` // The status of the scheduled event Status GuildScheduledEventStatus `json:"status"` // Type of the entity where event would be hosted // See field requirements // https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type EntityType GuildScheduledEventEntityType `json:"entity_type"` // The id of an entity associated with a guild scheduled event EntityID string `json:"entity_id"` // Additional metadata for the guild scheduled event EntityMetadata GuildScheduledEventEntityMetadata `json:"entity_metadata"` // The user that created the scheduled event Creator *User `json:"creator"` // The number of users subscribed to the scheduled event UserCount int `json:"user_count"` // The cover image hash of the scheduled event // see https://discord.com/developers/docs/reference#image-formatting for more // information about image formatting Image string `json:"image"` }
GuildScheduledEvent is a representation of a scheduled event in a guild. Only for retrieval of the data. https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event
type GuildScheduledEventCreate ¶
type GuildScheduledEventCreate struct {
*GuildScheduledEvent
}
GuildScheduledEventCreate is the data for a GuildScheduledEventCreate event.
type GuildScheduledEventDelete ¶
type GuildScheduledEventDelete struct {
*GuildScheduledEvent
}
GuildScheduledEventDelete is the data for a GuildScheduledEventDelete event.
type GuildScheduledEventEntityMetadata ¶
type GuildScheduledEventEntityMetadata struct { // location of the event (1-100 characters) // required for events with 'entity_type': EXTERNAL Location string `json:"location"` }
GuildScheduledEventEntityMetadata holds additional metadata for guild scheduled event.
type GuildScheduledEventEntityType ¶
type GuildScheduledEventEntityType int
GuildScheduledEventEntityType is the type of entity associated with a guild scheduled event. https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types
const ( // GuildScheduledEventEntityTypeStageInstance represents a stage channel GuildScheduledEventEntityTypeStageInstance GuildScheduledEventEntityType = 1 // GuildScheduledEventEntityTypeVoice represents a voice channel GuildScheduledEventEntityTypeVoice GuildScheduledEventEntityType = 2 // GuildScheduledEventEntityTypeExternal represents an external event GuildScheduledEventEntityTypeExternal GuildScheduledEventEntityType = 3 )
type GuildScheduledEventParams ¶
type GuildScheduledEventParams struct { // The channel id in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL ChannelID string `json:"channel_id,omitempty"` // The name of the scheduled event (1-100 characters) Name string `json:"name,omitempty"` // The description of the scheduled event (1-1000 characters) Description string `json:"description,omitempty"` // The time the scheduled event will start ScheduledStartTime *time.Time `json:"scheduled_start_time,omitempty"` // The time the scheduled event will end, required only when entity_type is EXTERNAL ScheduledEndTime *time.Time `json:"scheduled_end_time,omitempty"` // The privacy level of the scheduled event PrivacyLevel GuildScheduledEventPrivacyLevel `json:"privacy_level,omitempty"` // The status of the scheduled event Status GuildScheduledEventStatus `json:"status,omitempty"` // Type of the entity where event would be hosted // See field requirements // https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type EntityType GuildScheduledEventEntityType `json:"entity_type,omitempty"` // Additional metadata for the guild scheduled event EntityMetadata *GuildScheduledEventEntityMetadata `json:"entity_metadata,omitempty"` // The cover image hash of the scheduled event // see https://discord.com/developers/docs/reference#image-formatting for more // information about image formatting Image string `json:"image,omitempty"` }
GuildScheduledEventParams are the parameters allowed for creating or updating a scheduled event https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
func (GuildScheduledEventParams) MarshalJSON ¶
func (p GuildScheduledEventParams) MarshalJSON() ([]byte, error)
MarshalJSON is a helper function to marshal GuildScheduledEventParams
type GuildScheduledEventPrivacyLevel ¶
type GuildScheduledEventPrivacyLevel int
GuildScheduledEventPrivacyLevel is the privacy level of a scheduled event. https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level
const ( // GuildScheduledEventPrivacyLevelGuildOnly makes the scheduled // event is only accessible to guild members GuildScheduledEventPrivacyLevelGuildOnly GuildScheduledEventPrivacyLevel = 2 )
type GuildScheduledEventStatus ¶
type GuildScheduledEventStatus int
GuildScheduledEventStatus is the status of a scheduled event Valid Guild Scheduled Event Status Transitions : SCHEDULED --> ACTIVE --> COMPLETED SCHEDULED --> CANCELED https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status
const ( // GuildScheduledEventStatusScheduled represents the current event is in scheduled state GuildScheduledEventStatusScheduled GuildScheduledEventStatus = 1 // GuildScheduledEventStatusActive represents the current event is in active state GuildScheduledEventStatusActive GuildScheduledEventStatus = 2 // GuildScheduledEventStatusCompleted represents the current event is in completed state GuildScheduledEventStatusCompleted GuildScheduledEventStatus = 3 // GuildScheduledEventStatusCanceled represents the current event is in canceled state GuildScheduledEventStatusCanceled GuildScheduledEventStatus = 4 )
type GuildScheduledEventUpdate ¶
type GuildScheduledEventUpdate struct {
*GuildScheduledEvent
}
GuildScheduledEventUpdate is the data for a GuildScheduledEventUpdate event.
type GuildScheduledEventUser ¶
type GuildScheduledEventUser struct { GuildScheduledEventID string `json:"guild_scheduled_event_id"` User *User `json:"user"` Member *Member `json:"member"` }
GuildScheduledEventUser is a user subscribed to a scheduled event. https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object
type GuildScheduledEventUserAdd ¶
type GuildScheduledEventUserAdd struct { GuildScheduledEventID string `json:"guild_scheduled_event_id"` UserID string `json:"user_id"` GuildID string `json:"guild_id"` }
GuildScheduledEventUserAdd is the data for a GuildScheduledEventUserAdd event.
type GuildScheduledEventUserRemove ¶
type GuildScheduledEventUserRemove struct { GuildScheduledEventID string `json:"guild_scheduled_event_id"` UserID string `json:"user_id"` GuildID string `json:"guild_id"` }
GuildScheduledEventUserRemove is the data for a GuildScheduledEventUserRemove event.
type GuildTemplate ¶
type GuildTemplate struct { // The unique code for the guild template Code string `json:"code"` // The name of the template Name string `json:"name,omitempty"` // The description for the template Description *string `json:"description,omitempty"` // The number of times this template has been used UsageCount int `json:"usage_count"` // The ID of the user who created the template CreatorID string `json:"creator_id"` // The user who created the template Creator *User `json:"creator"` // The timestamp of when the template was created CreatedAt time.Time `json:"created_at"` // The timestamp of when the template was last synced UpdatedAt time.Time `json:"updated_at"` // The ID of the guild the template was based on SourceGuildID string `json:"source_guild_id"` // The guild 'snapshot' this template contains SerializedSourceGuild *Guild `json:"serialized_source_guild"` // Whether the template has unsynced changes IsDirty bool `json:"is_dirty"` }
A GuildTemplate represents a replicable template for guild creation
type GuildTemplateParams ¶
type GuildTemplateParams struct { // The name of the template (1-100 characters) Name string `json:"name,omitempty"` // The description of the template (0-120 characters) Description string `json:"description,omitempty"` }
GuildTemplateParams stores the data needed to create or update a GuildTemplate.
type GuildUpdate ¶
type GuildUpdate struct {
*Guild
}
GuildUpdate is the data for a GuildUpdate event.
type Identify ¶
type Identify struct { Token string `json:"token"` Properties IdentifyProperties `json:"properties"` Compress bool `json:"compress"` LargeThreshold int `json:"large_threshold"` Shard *[2]int `json:"shard,omitempty"` Presence GatewayStatusUpdate `json:"presence,omitempty"` Intents Intent `json:"intents"` }
Identify is sent during initial handshake with the discord gateway. https://discord.com/developers/docs/topics/gateway#identify
type IdentifyProperties ¶
type IdentifyProperties struct { OS string `json:"$os"` Browser string `json:"$browser"` Device string `json:"$device"` Referer string `json:"$referer"` ReferringDomain string `json:"$referring_domain"` }
IdentifyProperties contains the "properties" portion of an Identify packet https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties
type Integration ¶
type Integration struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` Enabled bool `json:"enabled"` Syncing bool `json:"syncing"` RoleID string `json:"role_id"` EnableEmoticons bool `json:"enable_emoticons"` ExpireBehavior ExpireBehavior `json:"expire_behavior"` ExpireGracePeriod int `json:"expire_grace_period"` User *User `json:"user"` Account IntegrationAccount `json:"account"` SyncedAt time.Time `json:"synced_at"` }
Integration stores integration information
type IntegrationAccount ¶
IntegrationAccount is integration account information sent by the UserConnections endpoint
type Intent ¶
type Intent int
Intent is the type of a Gateway Intent https://discord.com/developers/docs/topics/gateway#gateway-intents
const ( IntentGuilds Intent = 1 << 0 IntentGuildMembers Intent = 1 << 1 IntentGuildModeration Intent = 1 << 2 IntentGuildEmojis Intent = 1 << 3 IntentGuildIntegrations Intent = 1 << 4 IntentGuildWebhooks Intent = 1 << 5 IntentGuildInvites Intent = 1 << 6 IntentGuildVoiceStates Intent = 1 << 7 IntentGuildPresences Intent = 1 << 8 IntentGuildMessages Intent = 1 << 9 IntentGuildMessageReactions Intent = 1 << 10 IntentGuildMessageTyping Intent = 1 << 11 IntentDirectMessages Intent = 1 << 12 IntentDirectMessageReactions Intent = 1 << 13 IntentDirectMessageTyping Intent = 1 << 14 IntentMessageContent Intent = 1 << 15 IntentGuildScheduledEvents Intent = 1 << 16 IntentAutoModerationConfiguration Intent = 1 << 20 IntentAutoModerationExecution Intent = 1 << 21 IntentGuildBans Intent = IntentGuildModeration IntentsGuilds Intent = 1 << 0 IntentsGuildMembers Intent = 1 << 1 IntentsGuildBans Intent = 1 << 2 IntentsGuildEmojis Intent = 1 << 3 IntentsGuildIntegrations Intent = 1 << 4 IntentsGuildWebhooks Intent = 1 << 5 IntentsGuildInvites Intent = 1 << 6 IntentsGuildVoiceStates Intent = 1 << 7 IntentsGuildPresences Intent = 1 << 8 IntentsGuildMessages Intent = 1 << 9 IntentsGuildMessageReactions Intent = 1 << 10 IntentsGuildMessageTyping Intent = 1 << 11 IntentsDirectMessages Intent = 1 << 12 IntentsDirectMessageReactions Intent = 1 << 13 IntentsDirectMessageTyping Intent = 1 << 14 IntentsMessageContent Intent = 1 << 15 IntentsGuildScheduledEvents Intent = 1 << 16 IntentsAllWithoutPrivileged = IntentGuilds | IntentGuildBans | IntentGuildEmojis | IntentGuildIntegrations | IntentGuildWebhooks | IntentGuildInvites | IntentGuildVoiceStates | IntentGuildMessages | IntentGuildMessageReactions | IntentGuildMessageTyping | IntentDirectMessages | IntentDirectMessageReactions | IntentDirectMessageTyping | IntentGuildScheduledEvents | IntentAutoModerationConfiguration | IntentAutoModerationExecution IntentsAll = IntentsAllWithoutPrivileged | IntentGuildMembers | IntentGuildPresences | IntentMessageContent IntentsNone Intent = 0 )
Constants for the different bit offsets of intents
func MakeIntent ¶
MakeIntent used to help convert a gateway intent value for use in the Identify structure; this was useful to help support the use of a pointer type when intents were optional. This is now a no-op, and is not necessary to use.
type Interaction ¶
type Interaction struct { ID string `json:"id"` AppID string `json:"application_id"` Type InteractionType `json:"type"` Data InteractionData `json:"data"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` // The message on which interaction was used. // NOTE: this field is only filled when a button click triggered the interaction. Otherwise it will be nil. Message *Message `json:"message"` // Bitwise set of permissions the app or bot has within the channel the interaction was sent from AppPermissions int64 `json:"app_permissions,string"` // 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"` }
Interaction represents data of an interaction.
func (Interaction) ApplicationCommandData ¶
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 ¶
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 ¶
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 InteractionCreate ¶
type InteractionCreate struct {
*Interaction
}
InteractionCreate is the data for a InteractionCreate event
func (*InteractionCreate) UnmarshalJSON ¶
func (i *InteractionCreate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal Interaction object.
type InteractionData ¶
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 ¶
type InteractionResponseData struct { TTS bool `json:"tts"` Content string `json:"content"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` Files []*File `json:"-"` Attachments *[]*MessageAttachment `json:"attachments,omitempty"` // NOTE: only MessageFlagsSuppressEmbeds and MessageFlagsEphemeral can be set. Flags MessageFlags `json:"flags,omitempty"` // 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 ¶
func (t InteractionType) String() string
type Invite ¶
type Invite struct { Guild *Guild `json:"guild"` Channel *Channel `json:"channel"` Inviter *User `json:"inviter"` Code string `json:"code"` CreatedAt time.Time `json:"created_at"` MaxAge int `json:"max_age"` Uses int `json:"uses"` MaxUses int `json:"max_uses"` Revoked bool `json:"revoked"` Temporary bool `json:"temporary"` Unique bool `json:"unique"` TargetUser *User `json:"target_user"` TargetType InviteTargetType `json:"target_type"` TargetApplication *Application `json:"target_application"` // will only be filled when using InviteWithCounts ApproximatePresenceCount int `json:"approximate_presence_count"` ApproximateMemberCount int `json:"approximate_member_count"` ExpiresAt *time.Time `json:"expires_at"` }
A Invite stores all data related to a specific Discord Guild or Channel invite.
type InviteCreate ¶
type InviteCreate struct { *Invite ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` }
InviteCreate is the data for a InviteCreate event
type InviteDelete ¶
type InviteDelete struct { ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` Code string `json:"code"` }
InviteDelete is the data for a InviteDelete event
type InviteTargetType ¶
type InviteTargetType uint8
InviteTargetType indicates the type of target of an invite https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
const ( InviteTargetStream InviteTargetType = 1 InviteTargetEmbeddedApplication InviteTargetType = 2 )
Invite target types
type Locale ¶
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" SpanishLATAM Locale = "es-419" 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 string `json:"guild_id"` // The time at which the member joined the guild. JoinedAt time.Time `json:"joined_at"` // The nickname of the member, if they have one. Nick string `json:"nick"` // Whether the member is deafened at a guild level. Deaf bool `json:"deaf"` // Whether the member is muted at a guild level. Mute bool `json:"mute"` // The hash of the avatar for the guild member, if any. Avatar string `json:"avatar"` // The underlying user on which the member is based. User *User `json:"user"` // A list of IDs of the roles which are possessed by the member. Roles []string `json:"roles"` // When the user used their Nitro boost on the server PremiumSince *time.Time `json:"premium_since"` // 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"` // Is true while the member hasn't accepted the membership screen. Pending bool `json:"pending"` // Total permissions of the member in the channel, including overrides, returned when in the interaction object. Permissions int64 `json:"permissions,string"` // The time at which the member's timeout will expire. // Time in the past or nil if the user is not timed out. CommunicationDisabledUntil *time.Time `json:"communication_disabled_until"` }
A Member stores user information for Guild members. A guild member represents a certain user's presence in a guild.
func (*Member) AvatarURL ¶
AvatarURL returns the URL of the member'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.
func (*Member) DisplayName ¶
DisplayName returns the member's guild nickname if they have one, otherwise it returns their discord display name.
type MemberFlags ¶
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 MembershipState ¶
type MembershipState int
The MembershipState represents whether the user is in the team or has been invited into it
const ( MembershipStateInvited MembershipState = 1 MembershipStateAccepted MembershipState = 2 )
Constants for the different stages of the MembershipState
type Message ¶
type Message struct { // The ID of the message. ID string `json:"id"` // The ID of the channel in which the message was sent. ChannelID string `json:"channel_id"` // The ID of the guild in which the message was sent. GuildID string `json:"guild_id,omitempty"` // The content of the message. Content string `json:"content"` // The time at which the messsage was sent. // CAUTION: this field may be removed in a // future API version; it is safer to calculate // the creation time via the ID. Timestamp time.Time `json:"timestamp"` // The time at which the last edit of the message // occurred, if it has been edited. EditedTimestamp *time.Time `json:"edited_timestamp"` // The roles mentioned in the message. MentionRoles []string `json:"mention_roles"` // Whether the message is text-to-speech. TTS bool `json:"tts"` // Whether the message mentions everyone. MentionEveryone bool `json:"mention_everyone"` // The author of the message. This is not guaranteed to be a // valid user (webhook-sent messages do not possess a full author). Author *User `json:"author"` // A list of attachments present in the message. Attachments []*MessageAttachment `json:"attachments"` // A list of components attached to the message. Components []MessageComponent `json:"-"` // A list of embeds present in the message. Embeds []*MessageEmbed `json:"embeds"` // A list of users mentioned in the message. Mentions []*User `json:"mentions"` // A list of reactions to the message. Reactions []*MessageReactions `json:"reactions"` // Whether the message is pinned or not. Pinned bool `json:"pinned"` // The type of the message. Type MessageType `json:"type"` // The webhook ID of the message, if it was generated by a webhook WebhookID string `json:"webhook_id"` // Member properties for this message's author, // contains only partial information Member *Member `json:"member"` // Channels specifically mentioned in this message // Not all channel mentions in a message will appear in mention_channels. // Only textual channels that are visible to everyone in a lurkable guild will ever be included. // Only crossposted messages (via Channel Following) currently include mention_channels at all. // If no mentions in the message meet these requirements, this field will not be sent. MentionChannels []*Channel `json:"mention_channels"` // Is sent with Rich Presence-related chat embeds Activity *MessageActivity `json:"activity"` // Is sent with Rich Presence-related chat embeds Application *MessageApplication `json:"application"` // MessageReference contains reference data sent with crossposted or reply messages. // This does not contain the reference *to* this message; this is for when *this* message references another. // To generate a reference to this message, use (*Message).Reference(). MessageReference *MessageReference `json:"message_reference"` // The message associated with the message_reference // 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"` // 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"` // The thread that was started from this message, includes thread member object Thread *Channel `json:"thread,omitempty"` // An array of StickerItem objects, representing sent stickers, if there were any. StickerItems []*StickerItem `json:"sticker_items"` }
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) GetCustomEmojis ¶
GetCustomEmojis pulls out all the custom (Non-unicode) emojis from a message and returns a Slice of the Emoji struct.
func (*Message) Reference ¶
func (m *Message) Reference() *MessageReference
Reference returns a MessageReference of the given message.
func (*Message) SoftReference ¶
func (m *Message) SoftReference() *MessageReference
SoftReference returns a MessageReference of the given message. If the message doesn't exist it will instead be sent as a non-reply message.
func (*Message) UnmarshalJSON ¶
UnmarshalJSON is a helper function to unmarshal the Message.
type MessageActivity ¶
type MessageActivity struct { Type MessageActivityType `json:"type"` PartyID string `json:"party_id"` }
MessageActivity is sent with Rich Presence-related chat embeds
type MessageActivityType ¶
type MessageActivityType int
MessageActivityType is the type of message activity
const ( MessageActivityTypeJoin MessageActivityType = 1 MessageActivityTypeSpectate MessageActivityType = 2 MessageActivityTypeListen MessageActivityType = 3 MessageActivityTypeJoinRequest MessageActivityType = 5 )
Constants for the different types of Message Activity
type MessageAllowedMentions ¶
type MessageAllowedMentions struct { // The mention types that are allowed to be parsed in this message. // Please note that this is purposely **not** marked as omitempty, // so if a zero-value MessageAllowedMentions object is provided no // mentions will be allowed. Parse []AllowedMentionType `json:"parse"` // A list of role IDs to allow. This cannot be used when specifying // AllowedMentionTypeRoles in the Parse slice. Roles []string `json:"roles,omitempty"` // A list of user IDs to allow. This cannot be used when specifying // AllowedMentionTypeUsers in the Parse slice. Users []string `json:"users,omitempty"` // For replies, whether to mention the author of the message being replied to RepliedUser bool `json:"replied_user"` }
MessageAllowedMentions allows the user to specify which mentions Discord is allowed to parse in this message. This is useful when sending user input as a message, as it prevents unwanted mentions. If this type is used, all mentions must be explicitly whitelisted, either by putting an AllowedMentionType in the Parse slice (allowing all mentions of that type) or, in the case of roles and users, explicitly allowing those mentions on an ID-by-ID basis. For more information on this functionality, see: https://discordapp.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-reference
type MessageApplication ¶
type MessageApplication struct { ID string `json:"id"` CoverImage string `json:"cover_image"` Description string `json:"description"` Icon string `json:"icon"` Name string `json:"name"` }
MessageApplication is sent with Rich Presence-related chat embeds
type MessageAttachment ¶
type MessageAttachment struct { ID string `json:"id"` URL string `json:"url"` ProxyURL string `json:"proxy_url"` Filename string `json:"filename"` ContentType string `json:"content_type"` Width int `json:"width"` Height int `json:"height"` Size int `json:"size"` Ephemeral bool `json:"ephemeral"` }
A MessageAttachment stores data for message attachments.
type MessageComponent ¶
type MessageComponent interface { json.Marshaler Type() ComponentType }
MessageComponent is a base interface for all message components.
func MessageComponentFromJSON ¶
func MessageComponentFromJSON(b []byte) (MessageComponent, error)
MessageComponentFromJSON is a helper function for unmarshaling message components
type MessageComponentInteractionData ¶
type MessageComponentInteractionData struct { CustomID string `json:"custom_id"` ComponentType ComponentType `json:"component_type"` Resolved MessageComponentInteractionDataResolved `json:"resolved"` // 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 ¶
func (MessageComponentInteractionData) Type() InteractionType
Type returns the type of interaction data.
type MessageComponentInteractionDataResolved ¶
type MessageComponentInteractionDataResolved struct { Users map[string]*User `json:"users"` Members map[string]*Member `json:"members"` Roles map[string]*Role `json:"roles"` Channels map[string]*Channel `json:"channels"` }
MessageComponentInteractionDataResolved contains the resolved data of selected option.
type MessageCreate ¶
type MessageCreate struct {
*Message
}
MessageCreate is the data for a MessageCreate event.
func (*MessageCreate) UnmarshalJSON ¶
func (m *MessageCreate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageCreate object.
type MessageDelete ¶
MessageDelete is the data for a MessageDelete event.
func (*MessageDelete) UnmarshalJSON ¶
func (m *MessageDelete) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageDelete object.
type MessageDeleteBulk ¶
type MessageDeleteBulk struct { Messages []string `json:"ids"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` }
MessageDeleteBulk is the data for a MessageDeleteBulk event
type MessageEdit ¶
type MessageEdit struct { Content *string `json:"content,omitempty"` Components *[]MessageComponent `json:"components,omitempty"` Embeds *[]*MessageEmbed `json:"embeds,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` Flags MessageFlags `json:"flags,omitempty"` // Files to append to the message Files []*File `json:"-"` // Overwrite existing attachments Attachments *[]*MessageAttachment `json:"attachments,omitempty"` ID string Channel string // TODO: Remove this when compatibility is not required. Embed *MessageEmbed `json:"-"` }
MessageEdit is used to chain parameters via ChannelMessageEditComplex, which is also where you should get the instance from.
func NewMessageEdit ¶
func NewMessageEdit(channelID string, messageID string) *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) SetEmbed ¶
func (m *MessageEdit) SetEmbed(embed *MessageEmbed) *MessageEdit
SetEmbed is a convenience function for setting the embed, so you can chain commands.
func (*MessageEdit) SetEmbeds ¶
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 EmbedType `json:"type,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Timestamp string `json:"timestamp,omitempty"` Color int `json:"color,omitempty"` Image *MessageEmbedImage `json:"image,omitempty"` Thumbnail *MessageEmbedThumbnail `json:"thumbnail,omitempty"` Video *MessageEmbedVideo `json:"video,omitempty"` Provider *MessageEmbedProvider `json:"provider,omitempty"` Author *MessageEmbedAuthor `json:"author,omitempty"` Fields []*MessageEmbedField `json:"fields,omitempty"` }
An MessageEmbed stores data for message embeds.
type MessageEmbedAuthor ¶
type MessageEmbedAuthor struct { URL string `json:"url,omitempty"` Name string `json:"name"` 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"` Value string `json:"value"` 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"` 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"` 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"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` }
MessageEmbedVideo is a part of a MessageEmbed struct.
type MessageFlags ¶
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 // TODO: deprecated, remove when compatibility is not needed MessageFlagsSupressEmbeds 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 string `json:"id"` 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 MessageNotifications ¶
type MessageNotifications int
MessageNotifications is the notification level for a guild https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
const ( MessageNotificationsAllMessages MessageNotifications = 0 MessageNotificationsOnlyMentions MessageNotifications = 1 )
Block containing known MessageNotifications values
type MessageReaction ¶
type MessageReaction struct { UserID string `json:"user_id"` MessageID string `json:"message_id"` Emoji Emoji `json:"emoji"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` }
MessageReaction stores the data for a message reaction.
type MessageReactionAdd ¶
type MessageReactionAdd struct { *MessageReaction Member *Member `json:"member,omitempty"` }
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 MessageReactions ¶
type MessageReactions struct { Count int `json:"count"` Me bool `json:"me"` Emoji *Emoji `json:"emoji"` }
MessageReactions holds a reactions object for a message.
type MessageReference ¶
type MessageReference struct { MessageID string `json:"message_id"` ChannelID string `json:"channel_id,omitempty"` GuildID string `json:"guild_id,omitempty"` FailIfNotExists *bool `json:"fail_if_not_exists,omitempty"` }
MessageReference contains reference data sent with crossposted messages
type MessageSend ¶
type MessageSend struct { Content string `json:"content,omitempty"` Embeds []*MessageEmbed `json:"embeds"` TTS bool `json:"tts"` Components []MessageComponent `json:"components"` Files []*File `json:"-"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` Reference *MessageReference `json:"message_reference,omitempty"` StickerIDs []string `json:"sticker_ids"` Flags MessageFlags `json:"flags,omitempty"` // TODO: Remove this when compatibility is not required. File *File `json:"-"` // TODO: Remove this when compatibility is not required. Embed *MessageEmbed `json:"-"` }
MessageSend stores all parameters you can send with ChannelMessageSendComplex.
type MessageType ¶
type MessageType int
MessageType is the type of Message https://discord.com/developers/docs/resources/channel#message-object-message-types
const ( MessageTypeDefault MessageType = 0 MessageTypeRecipientAdd MessageType = 1 MessageTypeRecipientRemove MessageType = 2 MessageTypeCall MessageType = 3 MessageTypeChannelNameChange MessageType = 4 MessageTypeChannelIconChange MessageType = 5 MessageTypeChannelPinnedMessage MessageType = 6 MessageTypeGuildMemberJoin MessageType = 7 MessageTypeUserPremiumGuildSubscription MessageType = 8 MessageTypeUserPremiumGuildSubscriptionTierOne MessageType = 9 MessageTypeUserPremiumGuildSubscriptionTierTwo MessageType = 10 MessageTypeUserPremiumGuildSubscriptionTierThree MessageType = 11 MessageTypeChannelFollowAdd MessageType = 12 MessageTypeGuildDiscoveryDisqualified MessageType = 14 MessageTypeGuildDiscoveryRequalified MessageType = 15 MessageTypeThreadCreated MessageType = 18 MessageTypeReply MessageType = 19 MessageTypeChatInputCommand MessageType = 20 MessageTypeThreadStarterMessage MessageType = 21 MessageTypeContextMenuCommand MessageType = 23 )
Block contains the valid known MessageType values
type MessageUpdate ¶
type MessageUpdate struct { *Message // BeforeUpdate will be nil if the Message was not previously cached in the state cache. BeforeUpdate *Message `json:"-"` }
MessageUpdate is the data for a MessageUpdate event.
func (*MessageUpdate) UnmarshalJSON ¶
func (m *MessageUpdate) UnmarshalJSON(b []byte) error
UnmarshalJSON is a helper function to unmarshal MessageUpdate object.
type ModalSubmitInteractionData ¶
type ModalSubmitInteractionData struct { CustomID string `json:"custom_id"` Components []MessageComponent `json:"-"` }
ModalSubmitInteractionData contains the data of modal submit interaction.
func (ModalSubmitInteractionData) Type ¶
func (ModalSubmitInteractionData) Type() InteractionType
Type returns the type of interaction data.
func (*ModalSubmitInteractionData) UnmarshalJSON ¶
func (d *ModalSubmitInteractionData) UnmarshalJSON(data []byte) error
UnmarshalJSON is a helper function to correctly unmarshal Components.
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 Party ¶
Party defines the Party field in the Activity struct https://discord.com/developers/docs/topics/gateway#activity-object
type PermissionOverwrite ¶
type PermissionOverwrite struct { ID string `json:"id"` Type PermissionOverwriteType `json:"type"` Deny int64 `json:"deny,string"` Allow int64 `json:"allow,string"` }
A PermissionOverwrite holds permission overwrite data for a Channel
type PermissionOverwriteType ¶
type PermissionOverwriteType int
PermissionOverwriteType represents the type of resource on which a permission overwrite acts.
const ( PermissionOverwriteTypeRole PermissionOverwriteType = 0 PermissionOverwriteTypeMember PermissionOverwriteType = 1 )
The possible permission overwrite types.
type PremiumTier ¶
type PremiumTier int
PremiumTier type definition
const ( PremiumTierNone PremiumTier = 0 PremiumTier1 PremiumTier = 1 PremiumTier2 PremiumTier = 2 PremiumTier3 PremiumTier = 3 )
Constants for PremiumTier levels from 0 to 3 inclusive
type Presence ¶
type Presence struct { User *User `json:"user"` Status Status `json:"status"` Activities []*Activity `json:"activities"` Since *int `json:"since"` ClientStatus ClientStatus `json:"client_status"` }
A Presence stores the online, offline, or idle and game status of Guild members.
type PresenceUpdate ¶
PresenceUpdate is the data for a PresenceUpdate event.
type PresencesReplace ¶
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 synthetic event and is not dispatched by Discord.
type RateLimitError ¶
type RateLimitError struct {
*RateLimit
}
RateLimitError is returned when a request exceeds a rate limit and ShouldRetryOnRateLimit is false. The request may be manually retried after waiting the duration specified by RetryAfter.
func (RateLimitError) Error ¶
func (e RateLimitError) Error() string
Error returns a rate limit error with rate limited endpoint and retry time.
type RateLimiter ¶
RateLimiter holds all ratelimit buckets
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) *Bucket
LockBucket Locks until a request can be made
func (*RateLimiter) LockBucketObject ¶
func (r *RateLimiter) LockBucketObject(b *Bucket) *Bucket
LockBucketObject Locks an already resolved bucket until a request can be made
type ReadState ¶
type ReadState struct { MentionCount int `json:"mention_count"` LastMessageID string `json:"last_message_id"` ID string `json:"id"` }
A ReadState stores data on the read state of channels.
type Ready ¶
type Ready struct { Version int `json:"v"` SessionID string `json:"session_id"` User *User `json:"user"` Shard *[2]int `json:"shard"` Application *Application `json:"application"` Guilds []*Guild `json:"guilds"` PrivateChannels []*Channel `json:"private_channels"` }
A Ready stores all data for the websocket READY event.
type RequestConfig ¶
type RequestConfig struct { Request *http.Request ShouldRetryOnRateLimit bool MaxRestRetries int Client *http.Client }
RequestConfig is an HTTP request configuration.
type RequestOption ¶
type RequestOption func(cfg *RequestConfig)
RequestOption is a function which mutates request configuration. It can be supplied as an argument to any REST method.
func WithAuditLogReason ¶
func WithAuditLogReason(reason string) RequestOption
WithAuditLogReason changes audit log reason associated with the request.
func WithClient ¶
func WithClient(client *http.Client) RequestOption
WithClient changes the HTTP client used for the request.
func WithContext ¶
func WithContext(ctx context.Context) RequestOption
WithContext changes context of the request.
func WithHeader ¶
func WithHeader(key, value string) RequestOption
WithHeader sets a header in the request.
func WithLocale ¶
func WithLocale(locale Locale) RequestOption
WithLocale changes accepted locale of the request.
func WithRestRetries ¶
func WithRestRetries(max int) RequestOption
WithRestRetries changes maximum amount of retries if request fails.
func WithRetryOnRatelimit ¶
func WithRetryOnRatelimit(retry bool) RequestOption
WithRetryOnRatelimit controls whether session will retry the request on rate limit.
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 string `json:"id"` // The name of the role. Name string `json:"name"` // Whether this role is managed by an integration, and // thus cannot be manually added to, or taken from, members. Managed bool `json:"managed"` // Whether this role is mentionable. Mentionable bool `json:"mentionable"` // Whether this role is hoisted (shows up separately in member list). Hoist bool `json:"hoist"` // The hex color of this role. Color int `json:"color"` // The position of this role in the guild's role hierarchy. Position int `json:"position"` // The permissions of the role on the guild (doesn't include channel overrides). // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the permission. Permissions int64 `json:"permissions,string"` // The hash of the role icon. Use Role.IconURL to retrieve the icon's URL. Icon string `json:"icon"` // The emoji assigned to this role. UnicodeEmoji string `json:"unicode_emoji"` }
A Role stores information about Discord guild member roles.
type RoleParams ¶
type RoleParams struct { // The role's name Name string `json:"name,omitempty"` // The color the role should have (as a decimal, not hex) Color *int `json:"color,omitempty"` // Whether to display the role's users separately Hoist *bool `json:"hoist,omitempty"` // The overall permissions number of the role Permissions *int64 `json:"permissions,omitempty,string"` // Whether this role is mentionable Mentionable *bool `json:"mentionable,omitempty"` // The role's unicode emoji. // NOTE: can only be set if the guild has the ROLE_ICONS feature. UnicodeEmoji *string `json:"unicode_emoji,omitempty"` // The role's icon image encoded in base64. // NOTE: can only be set if the guild has the ROLE_ICONS feature. Icon *string `json:"icon,omitempty"` }
RoleParams represents the parameters needed to create or update a Role
type Secrets ¶
type Secrets struct { Join string `json:"join,omitempty"` Spectate string `json:"spectate,omitempty"` Match string `json:"match,omitempty"` }
Secrets defines the Secrets field for the Activity struct https://discord.com/developers/docs/topics/gateway#activity-object
type SelectMenu ¶
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 ¶
func (s SelectMenu) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling SelectMenu to a JSON object.
func (SelectMenu) Type ¶
func (s SelectMenu) Type() ComponentType
Type is a method to get the type of a component.
type SelectMenuDefaultValue ¶
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 ¶
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 ¶
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 Session ¶
type Session struct { sync.RWMutex // Authentication token for this session // TODO: Remove Below, Deprecated, Use Identify struct Token string MFA bool // Debug for printing JSON request/responses Debug bool // Deprecated, will be removed. LogLevel int // Should the session reconnect the websocket on errors. ShouldReconnectOnError bool // Should voice connections reconnect on a session reconnect. ShouldReconnectVoiceOnSessionError bool // Should the session retry requests when rate limited. ShouldRetryOnRateLimit bool // Identify is sent during initial handshake with the discord gateway. // https://discord.com/developers/docs/topics/gateway#identify Identify Identify // TODO: Remove Below, Deprecated, Use Identify struct // Should the session request compressed websocket data. Compress bool // Sharding ShardID int ShardCount int // Should state tracking be enabled. // State tracking is the best way for getting the users // active guilds and the members of the guilds. StateEnabled bool // Whether or not to call event handlers synchronously. // e.g. false = launch event handlers in their own goroutines. SyncEvents bool // Whether the Data Websocket is ready DataReady bool // NOTE: Maye be deprecated soon // Max number of REST API retries MaxRestRetries int // Whether the Voice Websocket is ready VoiceReady bool // NOTE: Deprecated. // Whether the UDP Connection is ready UDPReady bool // NOTE: Deprecated // Stores a mapping of guild id's to VoiceConnections VoiceConnections map[string]*VoiceConnection // Managed state object, updated internally with events when // StateEnabled is true. State *State // The http client used for REST requests Client *http.Client // The dialer used for WebSocket connection Dialer *websocket.Dialer // The user agent used for REST APIs UserAgent string // Stores the last HeartbeatAck that was received (in UTC) LastHeartbeatAck time.Time // Stores the last Heartbeat sent (in UTC) LastHeartbeatSent time.Time // used to deal with rate limits Ratelimiter *RateLimiter // contains filtered or unexported fields }
A Session represents a connection to the Discord API.
func New ¶
New creates a new Discord session with provided token. If the token is for a bot, it must be prefixed with "Bot "
e.g. "Bot ..."
Or if it is an OAuth2 token, it must be prefixed with "Bearer "
e.g. "Bearer ..."
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://discord.com/developers/docs/topics/gateway#event-names There are also synthetic events fired by the library internally which are available for handling, like Connect, Disconnect, and RateLimit. events.go contains all of the Discord WSAPI and synthetic events that can be handled.
The return value of this method is a function, that when called will remove the event handler.
func (*Session) AddHandlerOnce ¶
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 string) (st *Application, err error)
Application returns an Application structure of a specific Application
appID : The ID of an Application
func (*Session) ApplicationAssets ¶
ApplicationAssets returns an application's assets
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) ApplicationCommand ¶
func (s *Session) ApplicationCommand(appID, guildID, cmdID string, options ...RequestOption) (cmd *ApplicationCommand, err error)
ApplicationCommand retrieves an application command by given ID. appID : The application ID. cmdID : Application command ID. guildID : Guild ID to retrieve guild-specific application command. If empty - retrieves global application command.
func (*Session) ApplicationCommandBulkOverwrite ¶
func (s *Session) ApplicationCommandBulkOverwrite(appID string, guildID string, commands []*ApplicationCommand, options ...RequestOption) (createdCommands []*ApplicationCommand, err error)
ApplicationCommandBulkOverwrite Creates commands overwriting existing commands. Returns a list of commands. appID : The application ID. commands : The commands to create.
func (*Session) ApplicationCommandCreate ¶
func (s *Session) ApplicationCommandCreate(appID string, guildID string, cmd *ApplicationCommand, options ...RequestOption) (ccmd *ApplicationCommand, err error)
ApplicationCommandCreate creates a global application command and returns it. appID : The application ID. guildID : Guild ID to create guild-specific application command. If empty - creates global application command. cmd : New application command data.
func (*Session) ApplicationCommandDelete ¶
func (s *Session) ApplicationCommandDelete(appID, guildID, cmdID string, options ...RequestOption) error
ApplicationCommandDelete deletes application command by ID. appID : The application ID. cmdID : Application command ID to delete. guildID : Guild ID to delete guild-specific application command. If empty - deletes global application command.
func (*Session) ApplicationCommandEdit ¶
func (s *Session) ApplicationCommandEdit(appID, guildID, cmdID string, cmd *ApplicationCommand, options ...RequestOption) (updated *ApplicationCommand, err error)
ApplicationCommandEdit edits application command and returns new command data. appID : The application ID. cmdID : Application command ID to edit. guildID : Guild ID to edit guild-specific application command. If empty - edits global application command. cmd : Updated application command data.
func (*Session) ApplicationCommandPermissions ¶
func (s *Session) ApplicationCommandPermissions(appID, guildID, cmdID string, options ...RequestOption) (permissions *GuildApplicationCommandPermissions, err error)
ApplicationCommandPermissions returns all permissions of an application command appID : The Application ID guildID : The guild ID containing the application command cmdID : The command ID to retrieve the permissions of
func (*Session) ApplicationCommandPermissionsBatchEdit ¶
func (s *Session) ApplicationCommandPermissionsBatchEdit(appID, guildID string, permissions []*GuildApplicationCommandPermissions, options ...RequestOption) (err error)
ApplicationCommandPermissionsBatchEdit edits the permissions of a batch of commands appID : The Application ID guildID : The guild ID to batch edit commands of permissions : A list of permissions paired with a command ID, guild ID, and application ID per application command
NOTE: This endpoint has been disabled with updates to command permissions (Permissions v2). Please use ApplicationCommandPermissionsEdit instead.
func (*Session) ApplicationCommandPermissionsEdit ¶
func (s *Session) ApplicationCommandPermissionsEdit(appID, guildID, cmdID string, permissions *ApplicationCommandPermissionsList, options ...RequestOption) (err error)
ApplicationCommandPermissionsEdit edits the permissions of an application command appID : The Application ID guildID : The guild ID containing the application command cmdID : The command ID to edit the permissions of permissions : An object containing a list of permissions for the application command
NOTE: Requires OAuth2 token with applications.commands.permissions.update scope
func (*Session) ApplicationCommands ¶
func (s *Session) ApplicationCommands(appID, guildID string, options ...RequestOption) (cmd []*ApplicationCommand, err error)
ApplicationCommands retrieves all commands in application. appID : The application ID. guildID : Guild ID to retrieve all guild-specific application commands. If empty - retrieves global application commands.
func (*Session) ApplicationCreate ¶
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) ApplicationRoleConnectionMetadata ¶
func (s *Session) ApplicationRoleConnectionMetadata(appID string) (st []*ApplicationRoleConnectionMetadata, err error)
ApplicationRoleConnectionMetadata returns application role connection metadata. appID : ID of the application
func (*Session) ApplicationRoleConnectionMetadataUpdate ¶
func (s *Session) ApplicationRoleConnectionMetadataUpdate(appID string, metadata []*ApplicationRoleConnectionMetadata) (st []*ApplicationRoleConnectionMetadata, err error)
ApplicationRoleConnectionMetadataUpdate updates and returns application role connection metadata. appID : ID of the application metadata : New metadata
func (*Session) ApplicationUpdate ¶
func (s *Session) ApplicationUpdate(appID string, 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) AutoModerationRule ¶
func (s *Session) AutoModerationRule(guildID, ruleID string, options ...RequestOption) (st *AutoModerationRule, err error)
AutoModerationRule returns an auto moderation rule. guildID : ID of the guild ruleID : ID of the auto moderation rule
func (*Session) AutoModerationRuleCreate ¶
func (s *Session) AutoModerationRuleCreate(guildID string, rule *AutoModerationRule, options ...RequestOption) (st *AutoModerationRule, err error)
AutoModerationRuleCreate creates an auto moderation rule with the given data and returns it. guildID : ID of the guild rule : Rule data
func (*Session) AutoModerationRuleDelete ¶
func (s *Session) AutoModerationRuleDelete(guildID, ruleID string, options ...RequestOption) (err error)
AutoModerationRuleDelete deletes an auto moderation rule. guildID : ID of the guild ruleID : ID of the auto moderation rule
func (*Session) AutoModerationRuleEdit ¶
func (s *Session) AutoModerationRuleEdit(guildID, ruleID string, rule *AutoModerationRule, options ...RequestOption) (st *AutoModerationRule, err error)
AutoModerationRuleEdit edits and returns the updated auto moderation rule. guildID : ID of the guild ruleID : ID of the auto moderation rule rule : New rule data
func (*Session) AutoModerationRules ¶
func (s *Session) AutoModerationRules(guildID string, options ...RequestOption) (st []*AutoModerationRule, err error)
AutoModerationRules returns a list of auto moderation rules. guildID : ID of the guild
func (*Session) Channel ¶
func (s *Session) Channel(channelID string, options ...RequestOption) (st *Channel, err error)
Channel returns a Channel structure of a specific Channel. channelID : The ID of the Channel you want returned.
func (*Session) ChannelDelete ¶
func (s *Session) ChannelDelete(channelID string, options ...RequestOption) (st *Channel, err error)
ChannelDelete deletes the given channel channelID : The ID of a Channel
func (*Session) ChannelEdit ¶
func (s *Session) ChannelEdit(channelID string, data *ChannelEdit, options ...RequestOption) (st *Channel, err error)
ChannelEdit edits the given channel and returns the updated Channel data. channelID : The ID of a Channel. data : New Channel data.
func (*Session) ChannelEditComplex ¶
func (s *Session) ChannelEditComplex(channelID string, data *ChannelEdit, options ...RequestOption) (st *Channel, err error)
ChannelEditComplex edits an existing channel, replacing the parameters entirely with ChannelEdit struct NOTE: deprecated, use ChannelEdit instead channelID : The ID of a Channel data : The channel struct to send
func (*Session) ChannelFileSend ¶
func (s *Session) ChannelFileSend(channelID, name string, r io.Reader, options ...RequestOption) (*Message, error)
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, content string, name string, r io.Reader, options ...RequestOption) (*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 ¶
func (s *Session) ChannelInviteCreate(channelID string, i Invite, options ...RequestOption) (st *Invite, err error)
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 ¶
func (s *Session) ChannelInvites(channelID string, options ...RequestOption) (st []*Invite, err error)
ChannelInvites returns an array of Invite structures for the given channel channelID : The ID of a Channel
func (*Session) ChannelMessage ¶
func (s *Session) ChannelMessage(channelID, messageID string, options ...RequestOption) (st *Message, err error)
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) ChannelMessageCrosspost ¶
func (s *Session) ChannelMessageCrosspost(channelID, messageID string, options ...RequestOption) (st *Message, err error)
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 ¶
func (s *Session) ChannelMessageDelete(channelID, messageID string, options ...RequestOption) (err error)
ChannelMessageDelete deletes a message from the Channel.
func (*Session) ChannelMessageEdit ¶
func (s *Session) ChannelMessageEdit(channelID, messageID, content string, options ...RequestOption) (*Message, error)
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(m *MessageEdit, options ...RequestOption) (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 string, embed *MessageEmbed, options ...RequestOption) (*Message, error)
ChannelMessageEditEmbed edits an existing message with embedded data. channelID : The ID of a Channel messageID : The ID of a Message embed : The embed data to send
func (*Session) ChannelMessageEditEmbeds ¶
func (s *Session) ChannelMessageEditEmbeds(channelID, messageID string, embeds []*MessageEmbed, options ...RequestOption) (*Message, error)
ChannelMessageEditEmbeds edits an existing message with multiple embedded data. channelID : The ID of a Channel messageID : The ID of a Message embeds : The embeds data to send
func (*Session) ChannelMessagePin ¶
func (s *Session) ChannelMessagePin(channelID, messageID string, options ...RequestOption) (err error)
ChannelMessagePin pins a message within a given channel. channelID: The ID of a channel. messageID: The ID of a message.
func (*Session) ChannelMessageSend ¶
func (s *Session) ChannelMessageSend(channelID string, content string, options ...RequestOption) (*Message, error)
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 string, data *MessageSend, options ...RequestOption) (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 string, embed *MessageEmbed, options ...RequestOption) (*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) ChannelMessageSendEmbedReply ¶
func (s *Session) ChannelMessageSendEmbedReply(channelID string, embed *MessageEmbed, reference *MessageReference, options ...RequestOption) (*Message, error)
ChannelMessageSendEmbedReply sends a message to the given channel with reference data and embedded data. channelID : The ID of a Channel. embed : The embed data to send. reference : The message reference to send.
func (*Session) ChannelMessageSendEmbeds ¶
func (s *Session) ChannelMessageSendEmbeds(channelID string, embeds []*MessageEmbed, options ...RequestOption) (*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) ChannelMessageSendEmbedsReply ¶
func (s *Session) ChannelMessageSendEmbedsReply(channelID string, embeds []*MessageEmbed, reference *MessageReference, options ...RequestOption) (*Message, error)
ChannelMessageSendEmbedsReply sends a message to the given channel with reference data and multiple embedded data. channelID : The ID of a Channel. embeds : The embeds data to send. reference : The message reference to send.
func (*Session) ChannelMessageSendReply ¶
func (s *Session) ChannelMessageSendReply(channelID string, content string, reference *MessageReference, options ...RequestOption) (*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 ¶
func (s *Session) ChannelMessageSendTTS(channelID string, content string, options ...RequestOption) (*Message, error)
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 ¶
func (s *Session) ChannelMessageUnpin(channelID, messageID string, options ...RequestOption) (err error)
ChannelMessageUnpin unpins a message within a given channel. channelID: The ID of a channel. messageID: The ID of a message.
func (*Session) ChannelMessages ¶
func (s *Session) ChannelMessages(channelID string, limit int, beforeID, afterID, aroundID string, options ...RequestOption) (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 ¶
func (s *Session) ChannelMessagesBulkDelete(channelID string, messages []string, options ...RequestOption) (err error)
ChannelMessagesBulkDelete bulk deletes the messages from the channel for the provided messageIDs. If only one messageID is in the slice call channelMessageDelete function. If the slice is empty do nothing. channelID : The ID of the channel for the messages to delete. messages : The IDs of the messages to be deleted. A slice of string IDs. A maximum of 100 messages.
func (*Session) ChannelMessagesPinned ¶
func (s *Session) ChannelMessagesPinned(channelID string, options ...RequestOption) (st []*Message, err error)
ChannelMessagesPinned returns an array of Message structures for pinned messages within a given channel channelID : The ID of a Channel.
func (*Session) ChannelNewsFollow ¶
func (s *Session) ChannelNewsFollow(channelID, targetID string, options ...RequestOption) (st *ChannelFollow, err error)
ChannelNewsFollow follows a news channel in the targetID channelID : The ID of a News Channel targetID : The ID of a Channel where the News Channel should post to
func (*Session) ChannelPermissionDelete ¶
func (s *Session) ChannelPermissionDelete(channelID, targetID string, options ...RequestOption) (err error)
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 string, targetType PermissionOverwriteType, allow, deny int64, options ...RequestOption) (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 ¶
func (s *Session) ChannelTyping(channelID string, options ...RequestOption) (err error)
ChannelTyping broadcasts to all members that authenticated user is typing in the given channel. channelID : The ID of a Channel
func (*Session) ChannelVoiceJoin ¶
func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *VoiceConnection, err error)
ChannelVoiceJoin joins the session user to a voice channel.
gID : Guild ID of the channel to join. cID : Channel ID of the channel to join. mute : If true, you will be set to muted upon joining. deaf : If true, you will be set to deafened upon joining.
func (*Session) ChannelVoiceJoinManual ¶
ChannelVoiceJoinManual initiates a voice session to a voice channel, but does not complete it.
This should only be used when the VoiceServerUpdate will be intercepted and used elsewhere.
gID : Guild ID of the channel to join. cID : Channel ID of the channel to join, leave empty to disconnect. mute : If true, you will be set to muted upon joining. deaf : If true, you will be set to deafened upon joining.
func (*Session) ChannelWebhooks ¶
func (s *Session) ChannelWebhooks(channelID string, options ...RequestOption) (st []*Webhook, err error)
ChannelWebhooks returns all webhooks for a given channel. channelID: The ID of a channel.
func (*Session) Close ¶
Close closes a websocket and stops all listening/heartbeat goroutines. TODO: Add support for Voice WS/UDP
func (*Session) CloseWithCode ¶
CloseWithCode closes a websocket using the provided closeCode and stops all listening/heartbeat goroutines. TODO: Add support for Voice WS/UDP connections
func (*Session) FollowupMessageCreate ¶
func (s *Session) FollowupMessageCreate(interaction *Interaction, wait bool, data *WebhookParams, options ...RequestOption) (*Message, error)
FollowupMessageCreate creates the followup message for an interaction. interaction : Interaction instance. wait : Waits for server confirmation of message send and ensures that the return struct is populated (it is nil otherwise) data : Data of the message to send.
func (*Session) FollowupMessageDelete ¶
func (s *Session) FollowupMessageDelete(interaction *Interaction, messageID string, options ...RequestOption) error
FollowupMessageDelete deletes a followup message of an interaction. interaction : Interaction instance. messageID : The followup message ID.
func (*Session) FollowupMessageEdit ¶
func (s *Session) FollowupMessageEdit(interaction *Interaction, messageID string, data *WebhookEdit, options ...RequestOption) (*Message, error)
FollowupMessageEdit edits a followup message of an interaction. interaction : Interaction instance. messageID : The followup message ID. data : Data to update the message
func (*Session) ForumThreadStart ¶
func (s *Session) ForumThreadStart(channelID, name string, archiveDuration int, content string, options ...RequestOption) (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 ¶
func (s *Session) ForumThreadStartComplex(channelID string, threadData *ThreadStart, messageData *MessageSend, options ...RequestOption) (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 ¶
func (s *Session) ForumThreadStartEmbed(channelID, name string, archiveDuration int, embed *MessageEmbed, options ...RequestOption) (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 ¶
func (s *Session) ForumThreadStartEmbeds(channelID, name string, archiveDuration int, embeds []*MessageEmbed, options ...RequestOption) (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) Gateway ¶
func (s *Session) Gateway(options ...RequestOption) (gateway string, err error)
Gateway returns the websocket Gateway address
func (*Session) GatewayBot ¶
func (s *Session) GatewayBot(options ...RequestOption) (st *GatewayBotResponse, err error)
GatewayBot returns the websocket Gateway address and the recommended number of shards
func (*Session) Guild ¶
func (s *Session) Guild(guildID string, options ...RequestOption) (st *Guild, err error)
Guild returns a Guild structure of a specific Guild. guildID : The ID of a Guild
func (*Session) GuildApplicationCommandsPermissions ¶
func (s *Session) GuildApplicationCommandsPermissions(appID, guildID string, options ...RequestOption) (permissions []*GuildApplicationCommandPermissions, err error)
GuildApplicationCommandsPermissions returns permissions for application commands in a guild. appID : The application ID guildID : Guild ID to retrieve application commands permissions for.
func (*Session) GuildAuditLog ¶
func (s *Session) GuildAuditLog(guildID, userID, beforeID string, actionType, limit int, options ...RequestOption) (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 ¶
func (s *Session) GuildBan(guildID, userID string, options ...RequestOption) (st *GuildBan, err error)
GuildBan finds ban by given guild and user id and returns GuildBan structure
func (*Session) GuildBanCreate ¶
func (s *Session) GuildBanCreate(guildID, userID string, days int, options ...RequestOption) (err error)
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, reason string, days int, options ...RequestOption) (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 ¶
func (s *Session) GuildBanDelete(guildID, userID string, options ...RequestOption) (err error)
GuildBanDelete removes the given user from the guild bans guildID : The ID of a Guild. userID : The ID of a User
func (*Session) GuildBans ¶
func (s *Session) GuildBans(guildID string, limit int, beforeID, afterID string, options ...RequestOption) (st []*GuildBan, err error)
GuildBans returns an array of GuildBan structures for bans in the given guild. guildID : The ID of a Guild limit : Max number of bans to return (max 1000) beforeID : If not empty all returned users will be after the given id afterID : If not empty all returned users will be before the given id
func (*Session) GuildChannelCreate ¶
func (s *Session) GuildChannelCreate(guildID, name string, ctype ChannelType, options ...RequestOption) (st *Channel, err error)
GuildChannelCreate creates a new channel in the given guild guildID : The ID of a Guild. name : Name of the channel (2-100 chars length) ctype : Type of the channel
func (*Session) GuildChannelCreateComplex ¶
func (s *Session) GuildChannelCreateComplex(guildID string, data GuildChannelCreateData, options ...RequestOption) (st *Channel, err error)
GuildChannelCreateComplex creates a new channel in the given guild guildID : The ID of a Guild data : A data struct describing the new Channel, Name and Type are mandatory, other fields depending on the type
func (*Session) GuildChannels ¶
func (s *Session) GuildChannels(guildID string, options ...RequestOption) (st []*Channel, err error)
GuildChannels returns an array of Channel structures for all channels of a given guild. guildID : The ID of a Guild.
func (*Session) GuildChannelsReorder ¶
func (s *Session) GuildChannelsReorder(guildID string, channels []*Channel, options ...RequestOption) (err error)
GuildChannelsReorder updates the order of channels in a guild guildID : The ID of a Guild. channels : Updated channels.
func (*Session) GuildCreate ¶
func (s *Session) GuildCreate(name string, options ...RequestOption) (st *Guild, err error)
GuildCreate creates a new Guild name : A name for the Guild (2-100 characters)
func (*Session) GuildCreateWithTemplate ¶
func (s *Session) GuildCreateWithTemplate(templateCode, name, icon string, options ...RequestOption) (st *Guild, err error)
GuildCreateWithTemplate creates a guild based on a GuildTemplate templateCode: The Code of a GuildTemplate name: The name of the guild (2-100) characters icon: base64 encoded 128x128 image for the guild icon
func (*Session) GuildDelete ¶
func (s *Session) GuildDelete(guildID string, options ...RequestOption) (err error)
GuildDelete deletes a Guild. guildID : The ID of a Guild
func (*Session) GuildEdit ¶
func (s *Session) GuildEdit(guildID string, g *GuildParams, options ...RequestOption) (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 string, options ...RequestOption) (st *GuildEmbed, err error)
GuildEmbed returns the embed for a Guild. guildID : The ID of a Guild.
func (*Session) GuildEmbedEdit ¶
func (s *Session) GuildEmbedEdit(guildID string, data *GuildEmbed, options ...RequestOption) (err error)
GuildEmbedEdit edits the embed of a Guild. guildID : The ID of a Guild. data : New GuildEmbed data.
func (*Session) GuildEmoji ¶
func (s *Session) GuildEmoji(guildID, emojiID string, options ...RequestOption) (emoji *Emoji, err error)
GuildEmoji returns specified emoji. guildID : The ID of a Guild emojiID : The ID of an Emoji to retrieve
func (*Session) GuildEmojiCreate ¶
func (s *Session) GuildEmojiCreate(guildID string, data *EmojiParams, options ...RequestOption) (emoji *Emoji, err error)
GuildEmojiCreate creates a new Emoji. guildID : The ID of a Guild. data : New Emoji data.
func (*Session) GuildEmojiDelete ¶
func (s *Session) GuildEmojiDelete(guildID, emojiID string, options ...RequestOption) (err error)
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 string, data *EmojiParams, options ...RequestOption) (emoji *Emoji, err error)
GuildEmojiEdit modifies and returns updated Emoji. guildID : The ID of a Guild. emojiID : The ID of an Emoji. data : Updated Emoji data.
func (*Session) GuildEmojis ¶
func (s *Session) GuildEmojis(guildID string, options ...RequestOption) (emoji []*Emoji, err error)
GuildEmojis returns all emoji guildID : The ID of a Guild.
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, integrationType, integrationID string, options ...RequestOption) (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 ¶
func (s *Session) GuildIntegrationDelete(guildID, integrationID string, options ...RequestOption) (err error)
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 string, expireBehavior, expireGracePeriod int, enableEmoticons bool, options ...RequestOption) (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) GuildIntegrations ¶
func (s *Session) GuildIntegrations(guildID string, options ...RequestOption) (st []*Integration, err error)
GuildIntegrations returns an array of Integrations for a guild. guildID : The ID of a Guild.
func (*Session) GuildInvites ¶
func (s *Session) GuildInvites(guildID string, options ...RequestOption) (st []*Invite, err error)
GuildInvites returns an array of Invite structures for the given guild guildID : The ID of a Guild.
func (*Session) GuildLeave ¶
func (s *Session) GuildLeave(guildID string, options ...RequestOption) (err error)
GuildLeave leaves a Guild. guildID : The ID of a Guild
func (*Session) GuildMember ¶
func (s *Session) GuildMember(guildID, userID string, options ...RequestOption) (st *Member, err error)
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(guildID, userID string, data *GuildMemberAddParams, options ...RequestOption) (err error)
GuildMemberAdd force joins a user to the guild. guildID : The ID of a Guild. userID : The ID of a User. data : Parameters of the user to add.
func (*Session) GuildMemberDeafen ¶
func (s *Session) GuildMemberDeafen(guildID string, userID string, deaf bool, options ...RequestOption) (err error)
GuildMemberDeafen server deafens a guild member guildID : The ID of a Guild. userID : The ID of a User. deaf : boolean value for if the user should be deafened
func (*Session) GuildMemberDelete ¶
func (s *Session) GuildMemberDelete(guildID, userID string, options ...RequestOption) (err error)
GuildMemberDelete removes the given user from the given guild. guildID : The ID of a Guild. userID : The ID of a User
func (*Session) GuildMemberDeleteWithReason ¶
func (s *Session) GuildMemberDeleteWithReason(guildID, userID, reason string, options ...RequestOption) (err error)
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 ¶
func (s *Session) GuildMemberEdit(guildID, userID string, data *GuildMemberParams, options ...RequestOption) (st *Member, err error)
GuildMemberEdit edits and returns updated member. guildID : The ID of a Guild. userID : The ID of a User. data : Updated GuildMember data.
func (*Session) GuildMemberEditComplex ¶
func (s *Session) GuildMemberEditComplex(guildID, userID string, data *GuildMemberParams, options ...RequestOption) (st *Member, err error)
GuildMemberEditComplex edits the nickname and roles of a member. NOTE: deprecated, use GuildMemberEdit instead.
guildID : The ID of a Guild. userID : The ID of a User. data : A GuildMemberEditData struct with the new nickname and roles
func (*Session) GuildMemberMove ¶
func (s *Session) GuildMemberMove(guildID string, userID string, channelID *string, options ...RequestOption) (err error)
GuildMemberMove moves a guild member from one voice channel to another/none guildID : The ID of a Guild. userID : The ID of a User. channelID : The ID of a channel to move user to or nil to remove from voice channel
NOTE : I am not entirely set on the name of this function and it may change prior to the final 1.0.0 release of Discordgo
func (*Session) GuildMemberMute ¶
func (s *Session) GuildMemberMute(guildID string, userID string, mute bool, options ...RequestOption) (err error)
GuildMemberMute server mutes a guild member guildID : The ID of a Guild. userID : The ID of a User. mute : boolean value for if the user should be muted
func (*Session) GuildMemberNickname ¶
func (s *Session) GuildMemberNickname(guildID, userID, nickname string, options ...RequestOption) (err error)
GuildMemberNickname updates the nickname of a guild member guildID : The ID of a guild userID : The ID of a user userID : The ID of a user or "@me" which is a shortcut of the current user ID nickname : The nickname of the member, "" will reset their nickname
func (*Session) GuildMemberRoleAdd ¶
func (s *Session) GuildMemberRoleAdd(guildID, userID, roleID string, options ...RequestOption) (err error)
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 ¶
func (s *Session) GuildMemberRoleRemove(guildID, userID, roleID string, options ...RequestOption) (err error)
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 ¶
func (s *Session) GuildMemberTimeout(guildID string, userID string, until *time.Time, options ...RequestOption) (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) GuildMembers ¶
func (s *Session) GuildMembers(guildID string, after string, limit int, options ...RequestOption) (st []*Member, err error)
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) GuildMembersSearch ¶
func (s *Session) GuildMembersSearch(guildID, query string, limit int, options ...RequestOption) (st []*Member, err error)
GuildMembersSearch returns a list of guild member objects whose username or nickname starts with a provided string guildID : The ID of a Guild query : Query string to match username(s) and nickname(s) against limit : Max number of members to return (default 1, min 1, max 1000)
func (*Session) GuildOnboarding ¶
func (s *Session) GuildOnboarding(guildID string, options ...RequestOption) (onboarding *GuildOnboarding, err error)
GuildOnboarding returns onboarding configuration of a guild. guildID : The ID of the guild
func (*Session) GuildOnboardingEdit ¶
func (s *Session) GuildOnboardingEdit(guildID string, o *GuildOnboarding, options ...RequestOption) (onboarding *GuildOnboarding, err error)
GuildOnboardingEdit edits onboarding configuration of a guild. guildID : The ID of the guild o : New GuildOnboarding data
func (*Session) GuildPreview ¶
func (s *Session) GuildPreview(guildID string, options ...RequestOption) (st *GuildPreview, err error)
GuildPreview returns a GuildPreview structure of a specific public Guild. guildID : The ID of a Guild
func (*Session) GuildPrune ¶
func (s *Session) GuildPrune(guildID string, days uint32, options ...RequestOption) (count uint32, err error)
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 ¶
func (s *Session) GuildPruneCount(guildID string, days uint32, options ...RequestOption) (count uint32, err error)
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 ¶
func (s *Session) GuildRoleCreate(guildID string, data *RoleParams, options ...RequestOption) (st *Role, err error)
GuildRoleCreate creates a new Guild Role and returns it. guildID : The ID of a Guild. data : New Role parameters.
func (*Session) GuildRoleDelete ¶
func (s *Session) GuildRoleDelete(guildID, roleID string, options ...RequestOption) (err error)
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 string, data *RoleParams, options ...RequestOption) (st *Role, err error)
GuildRoleEdit updates an existing Guild Role and returns updated Role data. guildID : The ID of a Guild. roleID : The ID of a Role. data : Updated Role data.
func (*Session) GuildRoleReorder ¶
func (s *Session) GuildRoleReorder(guildID string, roles []*Role, options ...RequestOption) (st []*Role, err error)
GuildRoleReorder reoders guild roles guildID : The ID of a Guild. roles : A list of ordered roles.
func (*Session) GuildRoles ¶
func (s *Session) GuildRoles(guildID string, options ...RequestOption) (st []*Role, err error)
GuildRoles returns all roles for a given guild. guildID : The ID of a Guild.
func (*Session) GuildScheduledEvent ¶
func (s *Session) GuildScheduledEvent(guildID, eventID string, userCount bool, options ...RequestOption) (st *GuildScheduledEvent, err error)
GuildScheduledEvent returns a specific GuildScheduledEvent in a guild guildID : The ID of a Guild eventID : The ID of the event userCount : Whether to include the user count in the response
func (*Session) GuildScheduledEventCreate ¶
func (s *Session) GuildScheduledEventCreate(guildID string, event *GuildScheduledEventParams, options ...RequestOption) (st *GuildScheduledEvent, err error)
GuildScheduledEventCreate creates a GuildScheduledEvent for a guild and returns it guildID : The ID of a Guild eventID : The ID of the event
func (*Session) GuildScheduledEventDelete ¶
func (s *Session) GuildScheduledEventDelete(guildID, eventID string, options ...RequestOption) (err error)
GuildScheduledEventDelete deletes a specific GuildScheduledEvent in a guild guildID : The ID of a Guild eventID : The ID of the event
func (*Session) GuildScheduledEventEdit ¶
func (s *Session) GuildScheduledEventEdit(guildID, eventID string, event *GuildScheduledEventParams, options ...RequestOption) (st *GuildScheduledEvent, err error)
GuildScheduledEventEdit updates a specific event for a guild and returns it. guildID : The ID of a Guild eventID : The ID of the event
func (*Session) GuildScheduledEventUsers ¶
func (s *Session) GuildScheduledEventUsers(guildID, eventID string, limit int, withMember bool, beforeID, afterID string, options ...RequestOption) (st []*GuildScheduledEventUser, err error)
GuildScheduledEventUsers returns an array of GuildScheduledEventUser for a particular event in a guild guildID : The ID of a Guild eventID : The ID of the event limit : The maximum number of users to return (Max 100) withMember : Whether to include the member object in the response beforeID : If is not empty all returned users entries will be before the given ID afterID : If is not empty all returned users entries will be after the given ID
func (*Session) GuildScheduledEvents ¶
func (s *Session) GuildScheduledEvents(guildID string, userCount bool, options ...RequestOption) (st []*GuildScheduledEvent, err error)
GuildScheduledEvents returns an array of GuildScheduledEvent for a guild guildID : The ID of a Guild userCount : Whether to include the user count in the response
func (*Session) GuildSplash ¶
func (s *Session) GuildSplash(guildID string, options ...RequestOption) (img image.Image, err error)
GuildSplash returns an image.Image of a guild splash image. guildID : The ID of a Guild.
func (*Session) GuildTemplate ¶
func (s *Session) GuildTemplate(templateCode string, options ...RequestOption) (st *GuildTemplate, err error)
GuildTemplate returns a GuildTemplate for the given code templateCode: The Code of a GuildTemplate
func (*Session) GuildTemplateCreate ¶
func (s *Session) GuildTemplateCreate(guildID string, data *GuildTemplateParams, options ...RequestOption) (st *GuildTemplate)
GuildTemplateCreate creates a template for the guild guildID : The ID of the guild data : Template metadata
func (*Session) GuildTemplateDelete ¶
func (s *Session) GuildTemplateDelete(guildID, templateCode string, options ...RequestOption) (err error)
GuildTemplateDelete deletes the template guildID: The ID of the guild templateCode: The code of the template
func (*Session) GuildTemplateEdit ¶
func (s *Session) GuildTemplateEdit(guildID, templateCode string, data *GuildTemplateParams, options ...RequestOption) (st *GuildTemplate, err error)
GuildTemplateEdit modifies the template's metadata guildID : The ID of the guild templateCode : The code of the template data : New template metadata
func (*Session) GuildTemplateSync ¶
func (s *Session) GuildTemplateSync(guildID, templateCode string, options ...RequestOption) (err error)
GuildTemplateSync syncs the template to the guild's current state guildID: The ID of the guild templateCode: The code of the template
func (*Session) GuildTemplates ¶
func (s *Session) GuildTemplates(guildID string, options ...RequestOption) (st []*GuildTemplate, err error)
GuildTemplates returns all of GuildTemplates guildID: The ID of the guild
func (*Session) GuildThreadsActive ¶
func (s *Session) GuildThreadsActive(guildID string, options ...RequestOption) (threads *ThreadsList, err error)
GuildThreadsActive returns all active threads for specified guild.
func (*Session) GuildWebhooks ¶
func (s *Session) GuildWebhooks(guildID string, options ...RequestOption) (st []*Webhook, err error)
GuildWebhooks returns all webhooks for a given guild. guildID: The ID of a Guild.
func (*Session) GuildWithCounts ¶
func (s *Session) GuildWithCounts(guildID string, options ...RequestOption) (st *Guild, err error)
GuildWithCounts returns a Guild structure of a specific Guild with approximate member and presence counts. guildID : The ID of a Guild
func (*Session) HeartbeatLatency ¶
HeartbeatLatency returns the latency between heartbeat acknowledgement and heartbeat send.
func (*Session) InteractionRespond ¶
func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse, options ...RequestOption) error
InteractionRespond creates the response to an interaction. interaction : Interaction instance. resp : Response message data.
func (*Session) InteractionResponse ¶
func (s *Session) InteractionResponse(interaction *Interaction, options ...RequestOption) (*Message, error)
InteractionResponse gets the response to an interaction. interaction : Interaction instance.
func (*Session) InteractionResponseDelete ¶
func (s *Session) InteractionResponseDelete(interaction *Interaction, options ...RequestOption) error
InteractionResponseDelete deletes the response to an interaction. interaction : Interaction instance.
func (*Session) InteractionResponseEdit ¶
func (s *Session) InteractionResponseEdit(interaction *Interaction, newresp *WebhookEdit, options ...RequestOption) (*Message, error)
InteractionResponseEdit edits the response to an interaction. interaction : Interaction instance. newresp : Updated response message data.
func (*Session) Invite ¶
func (s *Session) Invite(inviteID string, options ...RequestOption) (st *Invite, err error)
Invite returns an Invite structure of the given invite inviteID : The invite code
func (*Session) InviteAccept ¶
func (s *Session) InviteAccept(inviteID string, options ...RequestOption) (st *Invite, err error)
InviteAccept accepts an Invite to a Guild or Channel inviteID : The invite code
func (*Session) InviteComplex ¶
func (s *Session) InviteComplex(inviteID, guildScheduledEventID string, withCounts, withExpiration bool, options ...RequestOption) (st *Invite, err error)
InviteComplex returns an Invite structure of the given invite including specified fields. inviteID : The invite code guildScheduledEventID : If specified, includes specified guild scheduled event. withCounts : Whether to include approximate member counts or not withExpiration : Whether to include expiration time or not
func (*Session) InviteDelete ¶
func (s *Session) InviteDelete(inviteID string, options ...RequestOption) (st *Invite, err error)
InviteDelete deletes an existing invite inviteID : the code of an invite
func (*Session) InviteWithCounts ¶
func (s *Session) InviteWithCounts(inviteID string, options ...RequestOption) (st *Invite, err error)
InviteWithCounts returns an Invite structure of the given invite including approximate member counts inviteID : The invite code
func (*Session) MessageReactionAdd ¶
func (s *Session) MessageReactionAdd(channelID, messageID, emojiID string, options ...RequestOption) error
MessageReactionAdd creates an emoji reaction to a message. channelID : The channel ID. messageID : The message ID. emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier in name:id format (e.g. "hello:1234567654321")
func (*Session) MessageReactionRemove ¶
func (s *Session) MessageReactionRemove(channelID, messageID, emojiID, userID string, options ...RequestOption) error
MessageReactionRemove deletes an emoji reaction to a message. channelID : The channel ID. messageID : The message ID. emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier. userID : @me or ID of the user to delete the reaction for.
func (*Session) MessageReactions ¶
func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit int, beforeID, afterID string, options ...RequestOption) (st []*User, err error)
MessageReactions gets all the users reactions for a specific emoji. channelID : The channel ID. messageID : The message ID. emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier. limit : max number of users to return (max 100) beforeID : If provided all reactions returned will be before given ID. afterID : If provided all reactions returned will be after given ID.
func (*Session) MessageReactionsRemoveAll ¶
func (s *Session) MessageReactionsRemoveAll(channelID, messageID string, options ...RequestOption) error
MessageReactionsRemoveAll deletes all reactions from a message channelID : The channel ID messageID : The message ID.
func (*Session) MessageReactionsRemoveEmoji ¶
func (s *Session) MessageReactionsRemoveEmoji(channelID, messageID, emojiID string, options ...RequestOption) error
MessageReactionsRemoveEmoji deletes all reactions of a certain emoji from a message channelID : The channel ID messageID : The message ID emojiID : The emoji ID
func (*Session) MessageThreadStart ¶
func (s *Session) MessageThreadStart(channelID, messageID string, name string, archiveDuration int, options ...RequestOption) (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 ¶
func (s *Session) MessageThreadStartComplex(channelID, messageID string, data *ThreadStart, options ...RequestOption) (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) Open ¶
Open creates a websocket connection to Discord. See: https://discord.com/developers/docs/topics/gateway#connecting
func (*Session) Request ¶
func (s *Session) Request(method, urlStr string, data interface{}, options ...RequestOption) (response []byte, err error)
Request is the same as RequestWithBucketID but the bucket id is the same as the urlStr
func (*Session) RequestGuildMembers ¶
func (s *Session) RequestGuildMembers(guildID, query string, limit int, nonce string, presences bool) error
RequestGuildMembers requests guild members from the gateway The gateway responds with GuildMembersChunk events guildID : Single Guild ID to request members of query : String that username starts with, leave empty to return all members limit : Max number of items to return, or 0 to request all members matched nonce : Nonce to identify the Guild Members Chunk response presences : Whether to request presences of guild members
func (*Session) RequestGuildMembersBatch ¶
func (s *Session) RequestGuildMembersBatch(guildIDs []string, query string, limit int, nonce string, presences bool) (err error)
RequestGuildMembersBatch requests guild members from the gateway The gateway responds with GuildMembersChunk events guildID : Slice of guild IDs to request members of query : String that username starts with, leave empty to return all members limit : Max number of items to return, or 0 to request all members matched nonce : Nonce to identify the Guild Members Chunk response presences : Whether to request presences of guild members
NOTE: this function is deprecated, please use RequestGuildMembers instead
func (*Session) RequestGuildMembersBatchList ¶
func (s *Session) RequestGuildMembersBatchList(guildIDs []string, userIDs []string, limit int, nonce string, presences bool) (err error)
RequestGuildMembersBatchList requests guild members from the gateway The gateway responds with GuildMembersChunk events guildID : Slice of guild IDs to request members of userIDs : IDs of users to fetch limit : Max number of items to return, or 0 to request all members matched nonce : Nonce to identify the Guild Members Chunk response presences : Whether to request presences of guild members
NOTE: this function is deprecated, please use RequestGuildMembersList instead
func (*Session) RequestGuildMembersList ¶
func (s *Session) RequestGuildMembersList(guildID string, userIDs []string, limit int, nonce string, presences bool) error
RequestGuildMembersList requests guild members from the gateway The gateway responds with GuildMembersChunk events guildID : Single Guild ID to request members of userIDs : IDs of users to fetch limit : Max number of items to return, or 0 to request all members matched nonce : Nonce to identify the Guild Members Chunk response presences : Whether to request presences of guild members
func (*Session) RequestWithBucketID ¶
func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, bucketID string, options ...RequestOption) (response []byte, err error)
RequestWithBucketID makes a (GET/POST/...) Requests to Discord REST API with JSON data.
func (*Session) RequestWithLockedBucket ¶
func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b []byte, bucket *Bucket, sequence int, options ...RequestOption) (response []byte, err error)
RequestWithLockedBucket makes a request using a bucket that's already been locked
func (*Session) StageInstance ¶
func (s *Session) StageInstance(channelID string, options ...RequestOption) (si *StageInstance, err error)
StageInstance will retrieve a Stage instance by ID of the Stage channel. channelID : The ID of the Stage channel
func (*Session) StageInstanceCreate ¶
func (s *Session) StageInstanceCreate(data *StageInstanceParams, options ...RequestOption) (si *StageInstance, err error)
StageInstanceCreate creates and returns a new Stage instance associated to a Stage channel. data : Parameters needed to create a stage instance. data : The data of the Stage instance to create
func (*Session) StageInstanceDelete ¶
func (s *Session) StageInstanceDelete(channelID string, options ...RequestOption) (err error)
StageInstanceDelete will delete a Stage instance by ID of the Stage channel. channelID : The ID of the Stage channel
func (*Session) StageInstanceEdit ¶
func (s *Session) StageInstanceEdit(channelID string, data *StageInstanceParams, options ...RequestOption) (si *StageInstance, err error)
StageInstanceEdit will edit a Stage instance by ID of the Stage channel. channelID : The ID of the Stage channel data : The data to edit the Stage instance
func (*Session) ThreadJoin ¶
func (s *Session) ThreadJoin(id string, options ...RequestOption) error
ThreadJoin adds current user to a thread
func (*Session) ThreadLeave ¶
func (s *Session) ThreadLeave(id string, options ...RequestOption) error
ThreadLeave removes current user to a thread
func (*Session) ThreadMember ¶
func (s *Session) ThreadMember(threadID, memberID string, withMember bool, options ...RequestOption) (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 ¶
func (s *Session) ThreadMemberAdd(threadID, memberID string, options ...RequestOption) error
ThreadMemberAdd adds another member to a thread
func (*Session) ThreadMemberRemove ¶
func (s *Session) ThreadMemberRemove(threadID, memberID string, options ...RequestOption) error
ThreadMemberRemove removes another member from a thread
func (*Session) ThreadMembers ¶
func (s *Session) ThreadMembers(threadID string, limit int, withMember bool, afterID string, options ...RequestOption) (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 ¶
func (s *Session) ThreadStart(channelID, name string, typ ChannelType, archiveDuration int, options ...RequestOption) (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 ¶
func (s *Session) ThreadStartComplex(channelID string, data *ThreadStart, options ...RequestOption) (ch *Channel, err error)
ThreadStartComplex creates a new thread. channelID : Channel to create thread in data : Parameters of the thread
func (*Session) ThreadsActive ¶
func (s *Session) ThreadsActive(channelID string, options ...RequestOption) (threads *ThreadsList, err error)
ThreadsActive returns all active threads for specified channel.
func (*Session) ThreadsArchived ¶
func (s *Session) ThreadsArchived(channelID string, before *time.Time, limit int, options ...RequestOption) (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 ¶
func (s *Session) ThreadsPrivateArchived(channelID string, before *time.Time, limit int, options ...RequestOption) (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 ¶
func (s *Session) ThreadsPrivateJoinedArchived(channelID string, before *time.Time, limit int, options ...RequestOption) (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) UpdateCustomStatus ¶
UpdateCustomStatus is used to update the user's custom status. If state!="" then set the custom status. Else, set user to active and remove the custom status.
func (*Session) UpdateGameStatus ¶
UpdateGameStatus is used to update the user's status. If idle>0 then set status to idle. If name!="" then set game. if otherwise, set status to active, and no activity.
func (*Session) UpdateListeningStatus ¶
UpdateListeningStatus is used to set the user to "Listening to..." If name!="" then set to what user is listening to Else, set user to active and no activity.
func (*Session) UpdateStatusComplex ¶
func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error)
UpdateStatusComplex allows for sending the raw status update data untouched by discordgo.
func (*Session) UpdateStreamingStatus ¶
UpdateStreamingStatus is used to update the user's streaming status. If idle>0 then set status to idle. If name!="" then set game. If name!="" and url!="" then set the status type to streaming with the URL set. if otherwise, set status to active, and no game.
func (*Session) UpdateWatchStatus ¶
UpdateWatchStatus is used to update the user's watch status. If idle>0 then set status to idle. If name!="" then set movie/stream. if otherwise, set status to active, and no activity.
func (*Session) User ¶
func (s *Session) User(userID string, options ...RequestOption) (st *User, err error)
User returns the user details of the given userID userID : A user ID or "@me" which is a shortcut of current user ID
func (*Session) UserApplicationRoleConnection ¶
func (s *Session) UserApplicationRoleConnection(appID string) (st *ApplicationRoleConnection, err error)
UserApplicationRoleConnection returns user role connection to the specified application. appID : ID of the application
func (*Session) UserApplicationRoleConnectionUpdate ¶
func (s *Session) UserApplicationRoleConnectionUpdate(appID string, rconn *ApplicationRoleConnection) (st *ApplicationRoleConnection, err error)
UserApplicationRoleConnectionUpdate updates and returns user role connection to the specified application. appID : ID of the application connection : New ApplicationRoleConnection data
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 ¶
func (s *Session) UserChannelCreate(recipientID string, options ...RequestOption) (st *Channel, err error)
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 ¶
func (s *Session) UserChannelPermissions(userID, channelID string, fetchOptions ...RequestOption) (apermissions int64, err error)
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. fetchOptions : Options used to fetch guild, member or channel if they are not present in state.
NOTE: This function is now deprecated and will be removed in the future. Please see the same function inside state.go
func (*Session) UserConnections ¶
func (s *Session) UserConnections(options ...RequestOption) (conn []*UserConnection, err error)
UserConnections returns the user's connections
func (*Session) UserGuildMember ¶
func (s *Session) UserGuildMember(guildID string, options ...RequestOption) (st *Member, err error)
UserGuildMember returns a guild member object for the current user in the given Guild. guildID : ID of the guild
func (*Session) UserGuilds ¶
func (s *Session) UserGuilds(limit int, beforeID, afterID string, options ...RequestOption) (st []*UserGuild, err error)
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) UserUpdate ¶
func (s *Session) UserUpdate(username, avatar string, options ...RequestOption) (st *User, err error)
UserUpdate updates current user settings.
func (*Session) VoiceRegions ¶
func (s *Session) VoiceRegions(options ...RequestOption) (st []*VoiceRegion, err error)
VoiceRegions returns the voice server regions
func (*Session) Webhook ¶
func (s *Session) Webhook(webhookID string, options ...RequestOption) (st *Webhook, err error)
Webhook returns a webhook for a given ID webhookID: The ID of a webhook.
func (*Session) WebhookCreate ¶
func (s *Session) WebhookCreate(channelID, name, avatar string, options ...RequestOption) (st *Webhook, err error)
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 ¶
func (s *Session) WebhookDelete(webhookID string, options ...RequestOption) (err error)
WebhookDelete deletes a webhook for a given ID webhookID: The ID of a webhook.
func (*Session) WebhookDeleteWithToken ¶
func (s *Session) WebhookDeleteWithToken(webhookID, token string, options ...RequestOption) (st *Webhook, err error)
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, name, avatar, channelID string, options ...RequestOption) (st *Webhook, 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, token, name, avatar string, options ...RequestOption) (st *Webhook, 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, token string, wait bool, data *WebhookParams, options ...RequestOption) (st *Message, err error)
WebhookExecute executes a webhook. webhookID: The ID of a webhook. token : The auth token for the webhook wait : Waits for server confirmation of message send and ensures that the return struct is populated (it is nil otherwise)
func (*Session) WebhookMessage ¶
func (s *Session) WebhookMessage(webhookID, token, messageID string, options ...RequestOption) (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
func (*Session) WebhookMessageDelete ¶
func (s *Session) WebhookMessageDelete(webhookID, token, messageID string, options ...RequestOption) (err error)
WebhookMessageDelete deletes a webhook message. webhookID : The ID of a webhook token : The auth token for the webhook messageID : The ID of a message to edit
func (*Session) WebhookMessageEdit ¶
func (s *Session) WebhookMessageEdit(webhookID, token, messageID string, data *WebhookEdit, options ...RequestOption) (st *Message, err error)
WebhookMessageEdit edits a webhook message and returns a new one. webhookID : The ID of a webhook token : The auth token for the webhook messageID : The ID of message to edit
func (*Session) WebhookThreadExecute ¶
func (s *Session) WebhookThreadExecute(webhookID, token string, wait bool, threadID string, data *WebhookParams, options ...RequestOption) (st *Message, err error)
WebhookThreadExecute executes a webhook in a thread. webhookID: The ID of a webhook. token : The auth token for the webhook wait : Waits for server confirmation of message send and ensures that the return struct is populated (it is nil otherwise) threadID : Sends a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
func (*Session) WebhookWithToken ¶
func (s *Session) WebhookWithToken(webhookID, token string, options ...RequestOption) (st *Webhook, err error)
WebhookWithToken returns a webhook for a given ID webhookID: The ID of a webhook. token : The auth token for the webhook.
type SessionInformation ¶
type SessionInformation struct { Total int `json:"total,omitempty"` Remaining int `json:"remaining,omitempty"` ResetAfter int `json:"reset_after,omitempty"` MaxConcurrency int `json:"max_concurrency,omitempty"` }
SessionInformation provides the information for max concurrency sharding
type StageInstance ¶
type StageInstance struct { // The id of this Stage instance ID string `json:"id"` // The guild id of the associated Stage channel GuildID string `json:"guild_id"` // The id of the associated Stage channel ChannelID string `json:"channel_id"` // The topic of the Stage instance (1-120 characters) Topic string `json:"topic"` // The privacy level of the Stage instance // https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level PrivacyLevel StageInstancePrivacyLevel `json:"privacy_level"` // Whether or not Stage Discovery is disabled (deprecated) DiscoverableDisabled bool `json:"discoverable_disabled"` // The id of the scheduled event for this Stage instance GuildScheduledEventID string `json:"guild_scheduled_event_id"` }
StageInstance holds information about a live stage. https://discord.com/developers/docs/resources/stage-instance#stage-instance-resource
type StageInstanceEventCreate ¶
type StageInstanceEventCreate struct {
*StageInstance
}
StageInstanceEventCreate is the data for a StageInstanceEventCreate event.
type StageInstanceEventDelete ¶
type StageInstanceEventDelete struct {
*StageInstance
}
StageInstanceEventDelete is the data for a StageInstanceEventDelete event.
type StageInstanceEventUpdate ¶
type StageInstanceEventUpdate struct {
*StageInstance
}
StageInstanceEventUpdate is the data for a StageInstanceEventUpdate event.
type StageInstanceParams ¶
type StageInstanceParams struct { // ChannelID represents the id of the Stage channel ChannelID string `json:"channel_id,omitempty"` // Topic of the Stage instance (1-120 characters) Topic string `json:"topic,omitempty"` // PrivacyLevel of the Stage instance (default GUILD_ONLY) PrivacyLevel StageInstancePrivacyLevel `json:"privacy_level,omitempty"` // SendStartNotification will notify @everyone that a Stage instance has started SendStartNotification bool `json:"send_start_notification,omitempty"` }
StageInstanceParams represents the parameters needed to create or edit a stage instance
type StageInstancePrivacyLevel ¶
type StageInstancePrivacyLevel int
StageInstancePrivacyLevel represents the privacy level of a Stage instance https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
const ( // StageInstancePrivacyLevelPublic The Stage instance is visible publicly. (deprecated) StageInstancePrivacyLevelPublic StageInstancePrivacyLevel = 1 // StageInstancePrivacyLevelGuildOnly The Stage instance is visible to only guild members. StageInstancePrivacyLevelGuildOnly StageInstancePrivacyLevel = 2 )
type State ¶
type State struct { sync.RWMutex Ready // MaxMessageCount represents how many messages per channel the state will store. MaxMessageCount int TrackChannels bool TrackThreads bool TrackEmojis bool TrackMembers bool TrackThreadMembers 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) 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) MessageColor ¶
MessageColor returns the color of the author's name as displayed in the client associated with this message.
func (*State) MessagePermissions ¶
MessagePermissions returns the permissions of the author of the message in the channel in which it was sent.
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) 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) ThreadListSync ¶
func (s *State) ThreadListSync(tls *ThreadListSync) error
ThreadListSync syncs guild threads with provided ones.
func (*State) ThreadMemberUpdate ¶
func (s *State) ThreadMemberUpdate(mu *ThreadMemberUpdate) error
ThreadMemberUpdate sets or updates member data for the current user.
func (*State) ThreadMembersUpdate ¶
func (s *State) ThreadMembersUpdate(tmu *ThreadMembersUpdate) error
ThreadMembersUpdate updates thread members list
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.
func (*State) VoiceState ¶
func (s *State) VoiceState(guildID, userID string) (*VoiceState, error)
VoiceState gets a VoiceState by guild and user ID.
type Sticker ¶
type Sticker struct { ID string `json:"id"` PackID string `json:"pack_id"` 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 string `json:"guild_id"` User *User `json:"user"` SortValue int `json:"sort_value"` }
Sticker represents a sticker object that can be sent in a Message.
type StickerFormat ¶
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 ¶
type StickerItem struct { ID string `json:"id"` 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 ¶
type StickerPack struct { ID string `json:"id"` Stickers []*Sticker `json:"stickers"` Name string `json:"name"` SKUID string `json:"sku_id"` CoverStickerID string `json:"cover_sticker_id"` Description string `json:"description"` BannerAssetID string `json:"banner_asset_id"` }
StickerPack represents a pack of standard stickers.
type StickerType ¶
type StickerType int
StickerType is the type of sticker.
const ( StickerTypeStandard StickerType = 1 StickerTypeGuild StickerType = 2 )
Defines Sticker types.
type SystemChannelFlag ¶
type SystemChannelFlag int
SystemChannelFlag is the type of flags in the system channel (see SystemChannelFlag* consts) https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
const ( SystemChannelFlagsSuppressJoinNotifications SystemChannelFlag = 1 << 0 SystemChannelFlagsSuppressPremium SystemChannelFlag = 1 << 1 SystemChannelFlagsSuppressGuildReminderNotifications SystemChannelFlag = 1 << 2 SystemChannelFlagsSuppressJoinNotificationReplies SystemChannelFlag = 1 << 3 )
Block containing known SystemChannelFlag values
type Team ¶
type Team struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Icon string `json:"icon"` OwnerID string `json:"owner_user_id"` Members []*TeamMember `json:"members"` }
A Team struct stores the members of a Discord Developer Team as well as some metadata about it
type TeamMember ¶
type TeamMember struct { User *User `json:"user"` TeamID string `json:"team_id"` MembershipState MembershipState `json:"membership_state"` Permissions []string `json:"permissions"` }
A TeamMember struct stores values for a single Team Member, extending the normal User data - note that the user field is partial
type TextInput ¶
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 ¶
MarshalJSON is a method for marshaling TextInput to a JSON object.
func (TextInput) Type ¶
func (TextInput) Type() ComponentType
Type is a method to get the type of a component.
type TextInputStyle ¶
type TextInputStyle uint
TextInputStyle is style of text in TextInput component.
const ( TextInputShort TextInputStyle = 1 TextInputParagraph TextInputStyle = 2 )
Text styles
type ThreadCreate ¶
ThreadCreate is the data for a ThreadCreate event.
type ThreadDelete ¶
type ThreadDelete struct {
*Channel
}
ThreadDelete is the data for a ThreadDelete event.
type ThreadListSync ¶
type ThreadListSync struct { // The id of the guild GuildID string `json:"guild_id"` // 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. ChannelIDs []string `json:"channel_ids"` // All active threads in the given channels that the current user can access Threads []*Channel `json:"threads"` // All thread member objects from the synced threads for the current user, // indicating which threads the current user has been added to Members []*ThreadMember `json:"members"` }
ThreadListSync is the data for a ThreadListSync event.
type ThreadMember ¶
type ThreadMember struct { // The id of the thread ID string `json:"id,omitempty"` // The id of the user UserID string `json:"user_id,omitempty"` // The time the current user last joined the thread JoinTimestamp time.Time `json:"join_timestamp"` // Any user-thread settings, currently only used for notifications Flags int `json:"flags"` // Additional information about the user. // NOTE: only present if the withMember parameter is set to true // when calling Session.ThreadMembers or Session.ThreadMember. Member *Member `json:"member,omitempty"` }
ThreadMember is used to indicate whether a user has joined a thread or not. NOTE: ID and UserID are empty (omitted) on the member sent within each thread in the GUILD_CREATE event.
type ThreadMemberUpdate ¶
type ThreadMemberUpdate struct { *ThreadMember GuildID string `json:"guild_id"` }
ThreadMemberUpdate is the data for a ThreadMemberUpdate event.
type ThreadMembersUpdate ¶
type ThreadMembersUpdate struct { ID string `json:"id"` GuildID string `json:"guild_id"` MemberCount int `json:"member_count"` AddedMembers []AddedThreadMember `json:"added_members"` RemovedMembers []string `json:"removed_member_ids"` }
ThreadMembersUpdate is the data for a ThreadMembersUpdate event.
type ThreadMetadata ¶
type ThreadMetadata struct { // Whether the thread is archived Archived bool `json:"archived"` // Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 AutoArchiveDuration int `json:"auto_archive_duration"` // Timestamp when the thread's archive status was last changed, used for calculating recent activity ArchiveTimestamp time.Time `json:"archive_timestamp"` // Whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it Locked bool `json:"locked"` // Whether non-moderators can add other non-moderators to a thread; only available on private threads Invitable bool `json:"invitable"` }
ThreadMetadata contains a number of thread-specific channel fields that are not needed by other channel types.
type ThreadStart ¶
type ThreadStart struct { Name string `json:"name"` AutoArchiveDuration int `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 AppliedTags []string `json:"applied_tags,omitempty"` }
ThreadStart stores all parameters you can use with MessageThreadStartComplex or ThreadStartComplex
type ThreadUpdate ¶
ThreadUpdate is the data for a ThreadUpdate event.
type ThreadsList ¶
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) UnmarshalJSON ¶
func (t *TimeStamps) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSON into TimeStamps struct
type TooManyRequests ¶
type TooManyRequests struct { Bucket string `json:"bucket"` Message string `json:"message"` RetryAfter time.Duration `json:"retry_after"` }
A TooManyRequests struct holds information received from Discord when receiving a HTTP 429 response.
func (*TooManyRequests) UnmarshalJSON ¶
func (t *TooManyRequests) UnmarshalJSON(b []byte) error
UnmarshalJSON helps support translation of a milliseconds-based float into a time.Duration on TooManyRequests.
type TypingStart ¶
type TypingStart struct { UserID string `json:"user_id"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` Timestamp int `json:"timestamp"` }
TypingStart is the data for a TypingStart event.
type UpdateStatusData ¶
type UpdateStatusData struct { IdleSince *int `json:"since"` Activities []*Activity `json:"activities"` AFK bool `json:"afk"` Status string `json:"status"` }
UpdateStatusData is provided to UpdateStatusComplex()
type User ¶
type User struct { // The ID of the user. ID string `json:"id"` // The email of the user. This is only present when // the application possesses the email scope for the user. Email string `json:"email"` // The user's username. Username string `json:"username"` // The hash of the user's avatar. Use Session.UserAvatar // to retrieve the avatar itself. Avatar string `json:"avatar"` // The user's chosen language option. Locale string `json:"locale"` // The discriminator of the user (4 numbers after name). Discriminator string `json:"discriminator"` // The user's display name, if it is set. // For bots, this is the application name. GlobalName string `json:"global_name"` // The token of the user. This is only present for // the user represented by the current session. Token string `json:"token"` // Whether the user's email is verified. Verified bool `json:"verified"` // Whether the user has multi-factor authentication enabled. MFAEnabled bool `json:"mfa_enabled"` // The hash of the user's banner image. Banner string `json:"banner"` // User's banner color, encoded as an integer representation of hexadecimal color code AccentColor int `json:"accent_color"` // Whether the user is a bot. Bot bool `json:"bot"` // The public flags on a user's account. // This is a combination of bit masks; the presence of a certain flag can // be checked by performing a bitwise AND between this int and the flag. PublicFlags UserFlags `json:"public_flags"` // The type of Nitro subscription on a user's account. // Only available when the request is authorized via a Bearer token. PremiumType UserPremiumType `json:"premium_type"` // Whether the user is an Official Discord System user (part of the urgent message system). System bool `json:"system"` // The flags on a user's account. // Only available when the request is authorized via a Bearer token. Flags int `json:"flags"` }
A User stores all data for an individual Discord user.
func (*User) AvatarURL ¶
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.
func (*User) BannerURL ¶
BannerURL returns the URL of the users's banner image.
size: The size of the desired banner image as a power of two Image size can be any power of two between 16 and 4096.
func (*User) DefaultAvatarIndex ¶
DefaultAvatarIndex returns the index of the user's default avatar.
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 UserFlags ¶
type UserFlags int
UserFlags is the flags of "user" (see UserFlags* consts) https://discord.com/developers/docs/resources/user#user-object-user-flags
const ( UserFlagDiscordEmployee UserFlags = 1 << 0 UserFlagDiscordPartner UserFlags = 1 << 1 UserFlagHypeSquadEvents UserFlags = 1 << 2 UserFlagBugHunterLevel1 UserFlags = 1 << 3 UserFlagHouseBravery UserFlags = 1 << 6 UserFlagHouseBrilliance UserFlags = 1 << 7 UserFlagHouseBalance UserFlags = 1 << 8 UserFlagEarlySupporter UserFlags = 1 << 9 UserFlagTeamUser UserFlags = 1 << 10 UserFlagSystem UserFlags = 1 << 12 UserFlagBugHunterLevel2 UserFlags = 1 << 14 UserFlagVerifiedBot UserFlags = 1 << 16 UserFlagVerifiedBotDeveloper UserFlags = 1 << 17 UserFlagDiscordCertifiedModerator UserFlags = 1 << 18 UserFlagBotHTTPInteractions UserFlags = 1 << 19 UserFlagActiveBotDeveloper UserFlags = 1 << 22 )
Valid UserFlags values
type UserGuild ¶
type UserGuild struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon"` Owner bool `json:"owner"` Permissions int64 `json:"permissions,string"` Features []GuildFeature `json:"features"` }
A UserGuild holds a brief version of a Guild
type UserPremiumType ¶
type UserPremiumType int
UserPremiumType is the type of premium (nitro) subscription a user has (see UserPremiumType* consts). https://discord.com/developers/docs/resources/user#user-object-premium-types
const ( UserPremiumTypeNone UserPremiumType = 0 UserPremiumTypeNitroClassic UserPremiumType = 1 UserPremiumTypeNitro UserPremiumType = 2 UserPremiumTypeNitroBasic UserPremiumType = 3 )
Valid UserPremiumType values.
type VerificationLevel ¶
type VerificationLevel int
VerificationLevel type definition
const ( VerificationLevelNone VerificationLevel = 0 VerificationLevelLow VerificationLevel = 1 VerificationLevelMedium VerificationLevel = 2 VerificationLevelHigh VerificationLevel = 3 VerificationLevelVeryHigh VerificationLevel = 4 )
Constants for VerificationLevel levels from 0 to 4 inclusive
type VoiceConnection ¶
type VoiceConnection struct { sync.RWMutex Debug bool // If true, print extra logging -- DEPRECATED LogLevel int Ready bool // If true, voice is ready to send/receive audio UserID string GuildID string ChannelID string OpusSend chan []byte // Chan for sending opus audio OpusRecv chan *Packet // Chan for receiving opus audio // contains filtered or unexported fields }
A VoiceConnection struct holds all the data and functions related to a Discord Voice Connection.
func (*VoiceConnection) AddHandler ¶
func (v *VoiceConnection) AddHandler(h VoiceSpeakingUpdateHandler)
AddHandler adds a Handler for VoiceSpeakingUpdate events.
func (*VoiceConnection) ChangeChannel ¶
func (v *VoiceConnection) ChangeChannel(channelID string, mute, deaf bool) (err error)
ChangeChannel sends Discord a request to change channels within a Guild !!! NOTE !!! This function may be removed in favour of just using ChannelVoiceJoin
func (*VoiceConnection) Close ¶
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.
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 ¶
A VoiceRegion stores data for a specific voice region server.
type VoiceServerUpdate ¶
type VoiceServerUpdate struct { Token string `json:"token"` GuildID string `json:"guild_id"` Endpoint string `json:"endpoint"` }
VoiceServerUpdate is the data for a VoiceServerUpdate event.
type VoiceSpeakingUpdate ¶
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 { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` UserID string `json:"user_id"` Member *Member `json:"member"` SessionID string `json:"session_id"` Deaf bool `json:"deaf"` Mute bool `json:"mute"` SelfDeaf bool `json:"self_deaf"` SelfMute bool `json:"self_mute"` SelfStream bool `json:"self_stream"` SelfVideo bool `json:"self_video"` Suppress bool `json:"suppress"` RequestToSpeakTimestamp *time.Time `json:"request_to_speak_timestamp"` }
A VoiceState stores the voice states of Guilds
type VoiceStateUpdate ¶
type VoiceStateUpdate struct { *VoiceState // BeforeUpdate will be nil if the VoiceState was not previously cached in the state cache. BeforeUpdate *VoiceState `json:"-"` }
VoiceStateUpdate is the data for a VoiceStateUpdate event.
type Webhook ¶
type Webhook struct { ID string `json:"id"` Type WebhookType `json:"type"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` User *User `json:"user"` Name string `json:"name"` Avatar string `json:"avatar"` Token string `json:"token"` // ApplicationID is the bot/OAuth2 application that created this webhook ApplicationID string `json:"application_id,omitempty"` }
Webhook stores the data for a webhook.
type WebhookEdit ¶
type WebhookEdit struct { Content *string `json:"content,omitempty"` Components *[]MessageComponent `json:"components,omitempty"` Embeds *[]*MessageEmbed `json:"embeds,omitempty"` Files []*File `json:"-"` Attachments *[]*MessageAttachment `json:"attachments,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` }
WebhookEdit stores data for editing of a webhook message.
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"` Files []*File `json:"-"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` Attachments []*MessageAttachment `json:"attachments,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` // Only MessageFlagsSuppressEmbeds and MessageFlagsEphemeral can be set. // MessageFlagsEphemeral can only be set when using Followup Message Create endpoint. Flags MessageFlags `json:"flags,omitempty"` // Name of the thread to create. // NOTE: can only be set if the webhook channel is a forum. ThreadName string `json:"thread_name,omitempty"` }
WebhookParams is a struct for webhook params, used in the WebhookExecute command.
type WebhookType ¶
type WebhookType int
WebhookType is the type of Webhook (see WebhookType* consts) in the Webhook struct https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types
const ( WebhookTypeIncoming WebhookType = 1 WebhookTypeChannelFollower WebhookType = 2 )
Valid WebhookType values
type WebhooksUpdate ¶
type WebhooksUpdate struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` }
WebhooksUpdate is the data for a WebhooksUpdate event