Documentation
¶
Overview ¶
Package discord provides common structures that the whole repository uses. It does not (and should not) contain API-specific structures, or WS-specific structures.
Index ¶
- Constants
- Variables
- func DurationSinceEpoch(t time.Time) time.Duration
- func HasFlag(flag, has uint64) bool
- type APIEmoji
- type ActionRowComponent
- type Activity
- type ActivityAssets
- type ActivityFlags
- type ActivityParty
- type ActivitySecrets
- type ActivityTimestamps
- type ActivityType
- type AppID
- func (s AppID) Increment() uint16
- func (s AppID) IsNull() bool
- func (s AppID) IsValid() bool
- func (s AppID) MarshalJSON() ([]byte, error)
- func (s AppID) PID() uint8
- func (s AppID) String() string
- func (s AppID) Time() time.Time
- func (s *AppID) UnmarshalJSON(v []byte) error
- func (s AppID) Worker() uint8
- type ArchiveDuration
- type Attachment
- type AttachmentID
- func (s AttachmentID) Increment() uint16
- func (s AttachmentID) IsNull() bool
- func (s AttachmentID) IsValid() bool
- func (s AttachmentID) MarshalJSON() ([]byte, error)
- func (s AttachmentID) PID() uint8
- func (s AttachmentID) String() string
- func (s AttachmentID) Time() time.Time
- func (s *AttachmentID) UnmarshalJSON(v []byte) error
- func (s AttachmentID) Worker() uint8
- type AuditEntryInfo
- type AuditLog
- type AuditLogChange
- type AuditLogChangeKey
- type AuditLogEntry
- type AuditLogEntryID
- func (s AuditLogEntryID) Increment() uint16
- func (s AuditLogEntryID) IsNull() bool
- func (s AuditLogEntryID) IsValid() bool
- func (s AuditLogEntryID) MarshalJSON() ([]byte, error)
- func (s AuditLogEntryID) PID() uint8
- func (s AuditLogEntryID) String() string
- func (s AuditLogEntryID) Time() time.Time
- func (s *AuditLogEntryID) UnmarshalJSON(v []byte) error
- func (s AuditLogEntryID) Worker() uint8
- type AuditLogEvent
- type Ban
- type ButtonComponent
- type ButtonEmoji
- type ButtonStyle
- type Channel
- type ChannelID
- func (s ChannelID) Increment() uint16
- func (s ChannelID) IsNull() bool
- func (s ChannelID) IsValid() bool
- func (s ChannelID) MarshalJSON() ([]byte, error)
- func (s ChannelID) Mention() string
- func (s ChannelID) PID() uint8
- func (s ChannelID) String() string
- func (s ChannelID) Time() time.Time
- func (s *ChannelID) UnmarshalJSON(v []byte) error
- func (s ChannelID) Worker() uint8
- type ChannelMention
- type ChannelType
- type ClientStatus
- type Color
- type Command
- type CommandID
- func (s CommandID) Increment() uint16
- func (s CommandID) IsNull() bool
- func (s CommandID) IsValid() bool
- func (s CommandID) MarshalJSON() ([]byte, error)
- func (s CommandID) PID() uint8
- func (s CommandID) String() string
- func (s CommandID) Time() time.Time
- func (s *CommandID) UnmarshalJSON(v []byte) error
- func (s CommandID) Worker() uint8
- type CommandInteractionData
- type CommandOption
- type CommandOptionChoice
- type CommandOptionType
- type CommandPermissionType
- type CommandPermissions
- type CommandType
- type Component
- type ComponentInteractionData
- type ComponentType
- type ComponentWrap
- type Connection
- type ConnectionVisibility
- type Embed
- type EmbedAuthor
- type EmbedField
- type EmbedFooter
- type EmbedImage
- type EmbedProvider
- type EmbedThumbnail
- type EmbedType
- type EmbedVideo
- type Emoji
- type EmojiID
- func (s EmojiID) Increment() uint16
- func (s EmojiID) IsNull() bool
- func (s EmojiID) IsValid() bool
- func (s EmojiID) MarshalJSON() ([]byte, error)
- func (s EmojiID) PID() uint8
- func (s EmojiID) String() string
- func (s EmojiID) Time() time.Time
- func (s *EmojiID) UnmarshalJSON(v []byte) error
- func (s EmojiID) Worker() uint8
- type ExpireBehavior
- type ExplicitFilter
- type Guild
- func (g Guild) BannerURL() string
- func (g Guild) BannerURLWithType(t ImageType) string
- func (g Guild) CreatedAt() time.Time
- func (g Guild) DiscoverySplashURL() string
- func (g Guild) DiscoverySplashURLWithType(t ImageType) string
- func (g Guild) IconURL() string
- func (g Guild) IconURLWithType(t ImageType) string
- func (g Guild) SplashURL() string
- func (g Guild) SplashURLWithType(t ImageType) string
- type GuildCommandPermissions
- type GuildFeature
- type GuildID
- func (s GuildID) Increment() uint16
- func (s GuildID) IsNull() bool
- func (s GuildID) IsValid() bool
- func (s GuildID) MarshalJSON() ([]byte, error)
- func (s GuildID) PID() uint8
- func (s GuildID) String() string
- func (s GuildID) Time() time.Time
- func (s *GuildID) UnmarshalJSON(v []byte) error
- func (s GuildID) Worker() uint8
- type GuildPreview
- func (g GuildPreview) CreatedAt() time.Time
- func (g GuildPreview) DiscoverySplashURL() string
- func (g GuildPreview) DiscoverySplashURLWithType(t ImageType) string
- func (g GuildPreview) IconURL() string
- func (g GuildPreview) IconURLWithType(t ImageType) string
- func (g GuildPreview) SplashURL() string
- func (g GuildPreview) SplashURLWithType(t ImageType) string
- type GuildUser
- type GuildWidget
- type GuildWidgetSettings
- type Hash
- type ImageType
- type Integration
- type IntegrationAccount
- type IntegrationApplication
- type IntegrationID
- func (s IntegrationID) Increment() uint16
- func (s IntegrationID) IsNull() bool
- func (s IntegrationID) IsValid() bool
- func (s IntegrationID) MarshalJSON() ([]byte, error)
- func (s IntegrationID) PID() uint8
- func (s IntegrationID) String() string
- func (s IntegrationID) Time() time.Time
- func (s *IntegrationID) UnmarshalJSON(v []byte) error
- func (s IntegrationID) Worker() uint8
- type Interaction
- type InteractionData
- type InteractionID
- func (s InteractionID) Increment() uint16
- func (s InteractionID) IsNull() bool
- func (s InteractionID) IsValid() bool
- func (s InteractionID) MarshalJSON() ([]byte, error)
- func (s InteractionID) PID() uint8
- func (s InteractionID) String() string
- func (s InteractionID) Time() time.Time
- func (s *InteractionID) UnmarshalJSON(v []byte) error
- func (s InteractionID) Worker() uint8
- type InteractionOption
- type InteractionType
- type Invite
- type InviteMetadata
- type InviteUserType
- type MFALevel
- type Member
- type Message
- type MessageActivity
- type MessageActivityType
- type MessageApplication
- type MessageFlags
- type MessageID
- func (s MessageID) Increment() uint16
- func (s MessageID) IsNull() bool
- func (s MessageID) IsValid() bool
- func (s MessageID) MarshalJSON() ([]byte, error)
- func (s MessageID) PID() uint8
- func (s MessageID) String() string
- func (s MessageID) Time() time.Time
- func (s *MessageID) UnmarshalJSON(v []byte) error
- func (s MessageID) Worker() uint8
- type MessageReference
- type MessageType
- type Milliseconds
- type NitroBoost
- type Notification
- type OptionalSeconds
- type OverboundError
- type Overwrite
- type OverwriteType
- type Permissions
- type Presence
- type PrivacyLevel
- type Reaction
- type Relationship
- type RelationshipType
- type Role
- type RoleID
- func (s RoleID) Increment() uint16
- func (s RoleID) IsNull() bool
- func (s RoleID) IsValid() bool
- func (s RoleID) MarshalJSON() ([]byte, error)
- func (s RoleID) Mention() string
- func (s RoleID) PID() uint8
- func (s RoleID) String() string
- func (s RoleID) Time() time.Time
- func (s *RoleID) UnmarshalJSON(v []byte) error
- func (s RoleID) Worker() uint8
- type Seconds
- type SelectComponent
- type SelectComponentOption
- type Service
- type Snowflake
- func (s Snowflake) Increment() uint16
- func (s Snowflake) IsNull() bool
- func (s Snowflake) IsValid() bool
- func (s Snowflake) MarshalJSON() ([]byte, error)
- func (s Snowflake) PID() uint8
- func (s Snowflake) String() string
- func (s Snowflake) Time() time.Time
- func (s *Snowflake) UnmarshalJSON(v []byte) error
- func (s Snowflake) Worker() uint8
- type StageID
- func (s StageID) Increment() uint16
- func (s StageID) IsNull() bool
- func (s StageID) IsValid() bool
- func (s StageID) MarshalJSON() ([]byte, error)
- func (s StageID) PID() uint8
- func (s StageID) String() string
- func (s StageID) Time() time.Time
- func (s *StageID) UnmarshalJSON(v []byte) error
- func (s StageID) Worker() uint8
- type StageInstance
- type Status
- type Sticker
- type StickerFormatType
- type StickerID
- func (s StickerID) Increment() uint16
- func (s StickerID) IsNull() bool
- func (s StickerID) IsValid() bool
- func (s StickerID) MarshalJSON() ([]byte, error)
- func (s StickerID) PID() uint8
- func (s StickerID) String() string
- func (s StickerID) Time() time.Time
- func (s *StickerID) UnmarshalJSON(v []byte) error
- func (s StickerID) Worker() uint8
- type StickerPackID
- func (s StickerPackID) Increment() uint16
- func (s StickerPackID) IsNull() bool
- func (s StickerPackID) IsValid() bool
- func (s StickerPackID) MarshalJSON() ([]byte, error)
- func (s StickerPackID) PID() uint8
- func (s StickerPackID) String() string
- func (s StickerPackID) Time() time.Time
- func (s *StickerPackID) UnmarshalJSON(v []byte) error
- func (s StickerPackID) Worker() uint8
- type StickerType
- type SystemChannelFlags
- type ThreadMember
- type ThreadMemberFlags
- type ThreadMetadata
- type Timestamp
- type URL
- type UnixMsTimestamp
- type UnixTimestamp
- type UnknownComponent
- type UnknownInteractionData
- type User
- type UserFlags
- type UserID
- func (s UserID) Increment() uint16
- func (s UserID) IsNull() bool
- func (s UserID) IsValid() bool
- func (s UserID) MarshalJSON() ([]byte, error)
- func (s UserID) Mention() string
- func (s UserID) PID() uint8
- func (s UserID) String() string
- func (s UserID) Time() time.Time
- func (s *UserID) UnmarshalJSON(v []byte) error
- func (s UserID) Worker() uint8
- type UserNitro
- type Verification
- type VideoQualityMode
- type VoiceRegion
- type VoiceState
- type Webhook
- type WebhookID
- func (s WebhookID) Increment() uint16
- func (s WebhookID) IsNull() bool
- func (s WebhookID) IsValid() bool
- func (s WebhookID) MarshalJSON() ([]byte, error)
- func (s WebhookID) PID() uint8
- func (s WebhookID) String() string
- func (s WebhookID) Time() time.Time
- func (s *WebhookID) UnmarshalJSON(v []byte) error
- func (s WebhookID) Worker() uint8
- type WebhookType
Constants ¶
const ( RoleCommandPermission = iota + 1 UserCommandPermission )
const ( StickerFormatPNG = 1 StickerFormatAPNG = 2 StickerFormatLottie = 3 )
https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
const DefaultMaxPresences = 25000
Guild.MaxPresences is this value when it's 0. This happens because the Discord API sends JSON null, if the MaxPresences reach DefaultMaxPresences, which in turn will be serialized into 0.
const Epoch = 1420070400000 * time.Millisecond
Epoch is the Discord epoch constant in time.Duration (nanoseconds) since Unix epoch.
const NullAppID = AppID(NullSnowflake)
const NullAttachmentID = AttachmentID(NullSnowflake)
const NullAuditLogEntryID = AuditLogEntryID(NullSnowflake)
const NullChannelID = ChannelID(NullSnowflake)
const NullCommandID = CommandID(NullSnowflake)
const NullEmojiID = EmojiID(NullSnowflake)
const NullGuildID = GuildID(NullSnowflake)
const NullIntegrationID = IntegrationID(NullSnowflake)
const NullInteractionID = InteractionID(NullSnowflake)
const NullMessageID = MessageID(NullSnowflake)
const NullRoleID = RoleID(NullSnowflake)
const NullSecond = -1
NullSecond is used in cases where null should be used instead of a number or omitted. This is similar to NullSnowflake.
const NullSnowflake = ^Snowflake(0)
NullSnowflake gets encoded into a null. This is used for optional and nullable snowflake fields.
const NullStageID = StageID(NullSnowflake)
const NullStickerID = StickerID(NullSnowflake)
const NullStickerPackID = StickerPackID(NullSnowflake)
const NullUserID = UserID(NullSnowflake)
const NullWebhookID = WebhookID(NullSnowflake)
const TimestampFormat = time.RFC3339 // same as ISO8601
Variables ¶
var ErrNestedActionRow = errors.New("action row cannot have action row as a child")
var ZeroOptionalSeconds = NewOptionalSeconds(0)
ZeroOptionalSeconds are 0 OptionalSeconds.
Functions ¶
func DurationSinceEpoch ¶
DurationSinceEpoch returns the duration from the Discord epoch to current.
Types ¶
type APIEmoji ¶
type APIEmoji string
APIEmoji represents an emoji identifier string formatted to be used with the API. It is formatted using Emoji's APIString method as well as the NewCustomEmoji function. If the emoji is a stock Unicode emoji, then this string contains it. Otherwise, it is formatted like "emoji_name:123123123", where "123123123" is the emoji ID.
func NewCustomEmoji ¶
NewCustomEmoji creates a new Emoji using a custom guild emoji as base. Unicode emojis should be directly converted.
func (APIEmoji) PathString ¶
PathString returns the APIEmoji as a path-encoded string.
type ActionRowComponent ¶
type ActionRowComponent struct {
Components []Component `json:"components"`
}
ActionRowComponent is a row of components at the bottom of a message.
func (ActionRowComponent) MarshalJSON ¶
func (a ActionRowComponent) MarshalJSON() ([]byte, error)
MarshalJSON marshals the action row in the format Discord expects.
func (*ActionRowComponent) Type ¶
func (*ActionRowComponent) Type() ComponentType
Type implements the Component interface.
func (*ActionRowComponent) UnmarshalJSON ¶
func (a *ActionRowComponent) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals json into the components.
type Activity ¶
type Activity struct { Name string `json:"name"` URL URL `json:"url,omitempty"` Type ActivityType `json:"type"` Instance bool `json:"instance,omitempty"` Flags ActivityFlags `json:"flags,omitempty"` CreatedAt UnixTimestamp `json:"created_at,omitempty"` Timestamps *ActivityTimestamps `json:"timestamps,omitempty"` AppID AppID `json:"application_id,omitempty"` Details string `json:"details,omitempty"` State string `json:"state,omitempty"` // party status Emoji *Emoji `json:"emoji,omitempty"` Party *ActivityParty `json:"party,omitempty"` Assets *ActivityAssets `json:"assets,omitempty"` Secrets *ActivitySecrets `json:"secrets,omitempty"` // Undocumented fields SyncID string `json:"sync_id,omitempty"` SessionID string `json:"session_id,omitempty"` }
type ActivityAssets ¶
type ActivityFlags ¶
type ActivityFlags uint32
const ( InstanceActivity ActivityFlags = 1 << iota JoinActivity SpectateActivity JoinRequestActivity SyncActivity PlayActivity )
type ActivityParty ¶
type ActivitySecrets ¶
type ActivityTimestamps ¶
type ActivityTimestamps struct { Start UnixMsTimestamp `json:"start,omitempty"` End UnixMsTimestamp `json:"end,omitempty"` }
type ActivityType ¶
type ActivityType uint8
const ( // Playing $name GameActivity ActivityType = iota // Streaming $details StreamingActivity // Listening to $name ListeningActivity // Watching $name WatchingActivity // $emoji $state CustomActivity )
type ArchiveDuration ¶
type ArchiveDuration int
ArchiveDuration is the duration after which a thread without activity will be archived.
The duration's unit is minutes.
const ( OneHourArchive ArchiveDuration = 60 OneDayArchive ArchiveDuration = 24 * OneHourArchive // ThreeDaysArchive archives a thread after three days. // // This duration is only available to nitro boosted guilds. The Features // field of a Guild will indicate whether this is the case. ThreeDaysArchive ArchiveDuration = 3 * OneDayArchive // SevenDaysArchive archives a thread after seven days. // // This duration is only available to nitro boosted guilds. The Features // field of a Guild will indicate whether this is the case. SevenDaysArchive ArchiveDuration = 7 * OneDayArchive )
func (ArchiveDuration) Duration ¶
func (m ArchiveDuration) Duration() time.Duration
func (ArchiveDuration) String ¶
func (m ArchiveDuration) String() string
type Attachment ¶
type Attachment struct { // ID is the attachment id. ID AttachmentID `json:"id"` // Filename is the name of file attached. Filename string `json:"filename"` // ContentType is the media type of file. ContentType string `json:"content_type,omitempty"` // Size is the size of file in bytes. Size uint64 `json:"size"` // URL is the source url of file. URL URL `json:"url"` // Proxy is the a proxied url of file. Proxy URL `json:"proxy_url"` // Height is the height of the file, if it is an image. Height uint `json:"height,omitempty"` // Width is the width of the file, if it is an image. Width uint `json:"width,omitempty"` }
https://discord.com/developers/docs/resources/channel#attachment-object
type AttachmentID ¶
type AttachmentID Snowflake
func (AttachmentID) Increment ¶
func (s AttachmentID) Increment() uint16
func (AttachmentID) IsNull ¶
func (s AttachmentID) IsNull() bool
func (AttachmentID) IsValid ¶
func (s AttachmentID) IsValid() bool
func (AttachmentID) MarshalJSON ¶
func (s AttachmentID) MarshalJSON() ([]byte, error)
func (AttachmentID) PID ¶
func (s AttachmentID) PID() uint8
func (AttachmentID) String ¶
func (s AttachmentID) String() string
func (AttachmentID) Time ¶
func (s AttachmentID) Time() time.Time
func (*AttachmentID) UnmarshalJSON ¶
func (s *AttachmentID) UnmarshalJSON(v []byte) error
func (AttachmentID) Worker ¶
func (s AttachmentID) Worker() uint8
type AuditEntryInfo ¶
type AuditEntryInfo struct { // DeleteMemberDays is the number of days after which inactive members were // kicked. // // Events: MEMBER_PRUNE DeleteMemberDays string `json:"delete_member_days,omitempty"` // MembersRemoved is the number of members removed by the prune. // // Events: MEMBER_PRUNE MembersRemoved string `json:"members_removed,omitempty"` // ChannelID is the id of the channel in which the entities were targeted. // // Events: MEMBER_MOVE, MESSAGE_PIN, MESSAGE_UNPIN, MESSAGE_DELETE ChannelID ChannelID `json:"channel_id,omitempty"` // MessagesID is the id of the message that was targeted. // // Events: MESSAGE_PIN, MESSAGE_UNPIN MessageID MessageID `json:"message_id,omitempty"` // Count is the number of entities that were targeted. // // Events: MESSAGE_DELETE, MESSAGE_BULK_DELETE, MEMBER_DISCONNECT, // MEMBER_MOVE Count string `json:"count,omitempty"` // ID is the id of the overwritten entity. // // Events: CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE, // CHANNEL_OVERWRITE_DELETE ID Snowflake `json:"id,omitempty"` // Type is the type of overwritten entity. // // Events: CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE, // CHANNEL_OVERWRITE_DELETE Type OverwriteType `json:"type,string,omitempty"` // RoleName is the name of the role if type is "role". // // Events: CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE, // CHANNEL_OVERWRITE_DELETE RoleName string `json:"role_name,omitempty"` }
type AuditLog ¶
type AuditLog struct { // Webhooks is the list of webhooks found in the audit log. Webhooks []Webhook `json:"webhooks"` // Users is the list of users found in the audit log. Users []User `json:"users"` // Entries is the list of audit log entries. Entries []AuditLogEntry `json:"audit_log_entries"` // Integrations is a list ist of partial integration objects (only ID, // Name, Type, and Account). Integrations []Integration `json:"integrations"` }
https://discord.com/developers/docs/resources/audit-log#audit-log-object
type AuditLogChange ¶
type AuditLogChange struct { // Key is the name of audit log change key. Key AuditLogChangeKey `json:"key"` // NewValue is the new value of the key. NewValue json.Raw `json:"new_value,omitempty"` // OldValue is the old value of the key. OldValue json.Raw `json:"old_value,omitempty"` }
AuditLogChange is a single key type to changed value audit log entry. The type can be found in the key's comment. Values can be nil.
What ¶
I'm glad to see the same reaction that I had on you. In short, in this struct, the Key dictates what type NewValue and OldValue will have. They will always be the same type, but I will leave that as JSON for the user.
Usage ¶
The usage of this is pretty simple, as AuditLogChange already has a convenient method to use. Here's an example on how to do "owner_id":
if change.Key != discord.AuditGuildOwnerID { return errors.New("not owner ID") } // We know these are UserIDs because the comment said so for AuditGuildOwnerID. var oldOwnerID, newOwnerID discord.UserID if err := change.UnmarshalValues(&oldOwnerID, &newOwnerID); err != nil { return err } log.Println("Transferred ownership from user", oldOwnerID, "to", newOwnerID)
func (AuditLogChange) UnmarshalValues ¶
func (a AuditLogChange) UnmarshalValues(old, new interface{}) error
UnmarshalValues unmarshals the values of the AuditLogChange into the passed interfaces.
type AuditLogChangeKey ¶
type AuditLogChangeKey string
const ( // AuditGuildName gets sent if the guild's name was changed. // // Type: string AuditGuildName AuditLogChangeKey = "name" // AuditGuildIconHash gets sent if the guild's icon was changed. // // Type: Hash AuditGuildIconHash AuditLogChangeKey = "icon_hash" // AuditGuildSplashHash gets sent if the guild's invite splash page artwork // was changed. // // Type: Hash AuditGuildSplashHash AuditLogChangeKey = "splash_hash" // AuditGuildOwnerID gets sent if the guild's owner changed. // // Type: UserID AuditGuildOwnerID AuditLogChangeKey = "owner_id" // AuditGuildRegion gets sent if the guild's region changed. // // Type: string AuditGuildRegion AuditLogChangeKey = "region" // AuditGuildAFKChannelID gets sent if the guild's afk channel changed. // // Type: ChannelID AuditGuildAFKChannelID AuditLogChangeKey = "afk_channel_id" // AuditGuildAFKTimeout gets sent if the guild's afk timeout duration // changed. // // Type: Seconds AuditGuildAFKTimeout AuditLogChangeKey = "afk_timeout" // AuditGuildMFA gets sent if the two-factor auth requirement changed. // // Type: MFALevel AuditGuildMFA AuditLogChangeKey = "mfa_level" // AuditGuildVerification gets sent if the guild's required verification // level changed // // Type: Verification AuditGuildVerification AuditLogChangeKey = "verification_level" // AuditGuildExplicitFilter gets sent if there was a change in whose // messages are scanned and deleted for explicit content in the server. // // Type: ExplicitFilter AuditGuildExplicitFilter AuditLogChangeKey = "explicit_content_filter" // AuditGuildNotification gets sent if the default message notification // level changed. // // Type: Notification AuditGuildNotification AuditLogChangeKey = "default_message_notifications" // AuditGuildVanityURLCode gets sent if the guild invite vanity URL // changed. // // Type: string AuditGuildVanityURLCode AuditLogChangeKey = "vanity_url_code" // AuditGuildRoleAdd gets sent if a new role was added. // // Type: []Role{ID, Name} AuditGuildRoleAdd AuditLogChangeKey = "$add" // AuditGuildRoleRemove gets sent if a role was removed. // // Type: []Role{ID, Name} AuditGuildRoleRemove AuditLogChangeKey = "$remove" // AuditGuildPruneDeleteDays gets sent if there was a change in number of // days after which inactive and role-unassigned members are kicked. // // Type: int AuditGuildPruneDeleteDays AuditLogChangeKey = "prune_delete_days" // AuditGuildWidgetEnabled gets sent if the guild's widget was // enabled/disabled. // // Type: bool AuditGuildWidgetEnabled AuditLogChangeKey = "widget_enabled" // AuditGuildWidgetChannelID gets sent if the channel ID of the guild // widget changed. // // Type: ChannelID AuditGuildWidgetChannelID AuditLogChangeKey = "widget_channel_id" // AuditGuildSystemChannelID gets sent if the ID of the guild's system // channel changed. // // Type: ChannelID AuditGuildSystemChannelID AuditLogChangeKey = "system_channel_id" )
https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key
const ( // AuditChannelPosition gets sent if a text or voice channel position was // changed. // // Type: int AuditChannelPosition AuditLogChangeKey = "position" // AuditChannelTopic gets sent if the text channel topic changed. // // Type: string AuditChannelTopic AuditLogChangeKey = "topic" // AuditChannelBitrate gets sent if the voice channel bitrate changed. // // Type: uint AuditChannelBitrate AuditLogChangeKey = "bitrate" // AuditChannelPermissionOverwrites gets sent if the permissions on a // channel changed. // // Type: []Overwrite AuditChannelPermissionOverwrites AuditLogChangeKey = "permission_overwrites" // AuditChannelNSFW gets sent if the channel NSFW restriction changed. // // Type: bool AuditChannelNSFW AuditLogChangeKey = "nsfw" // AuditChannelApplicationID contains the application ID of the added or // removed webhook or bot. // // Type: AppID AuditChannelApplicationID AuditLogChangeKey = "application_id" // AuditChannelRateLimitPerUser gets sent if the amount of seconds a user // has to wait before sending another message changed. // // Type: Seconds AuditChannelRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user" )
const ( // AuditRolePermissions gets sent if the permissions for a role changed. // // Type: Permissions AuditRolePermissions AuditLogChangeKey = "permissions" // AuditRoleColor gets sent if the role color changed. // // Type: Color AuditRoleColor AuditLogChangeKey = "color" // AuditRoleHoist gets sent if the role is now displayed/no longer // displayed separate from online users. // // Type: bool AuditRoleHoist AuditLogChangeKey = "hoist" // AuditRoleMentionable gets sent if a role is now // mentionable/unmentionable. // // Type: bool AuditRoleMentionable AuditLogChangeKey = "mentionable" // AuditRoleAllow gets sent if a permission on a text or voice channel was // allowed for a role. // // Type: Permissions AuditRoleAllow AuditLogChangeKey = "allow" // AuditRoleDeny gets sent if a permission on a text or voice channel was // denied for a role. // // Type: Permissions AuditRoleDeny AuditLogChangeKey = "deny" )
const ( // AuditInviteCode gets sent if an invite code changed. // // Type: string AuditInviteCode AuditLogChangeKey = "code" // AuditInviteChannelID gets sent if the channel for an invite code // changed. // // Type: ChannelID AuditInviteChannelID AuditLogChangeKey = "channel_id" // AuditInviteInviterID specifies the person who created invite code // changed. // // Type: UserID AuditInviteInviterID AuditLogChangeKey = "inviter_id" // AuditInviteMaxUses specifies the change to max number of times invite // code can be used. // // Type: int AuditInviteMaxUses AuditLogChangeKey = "max_uses" // AuditInviteUses specifies the number of times invite code used changed. // // Type: int AuditInviteUses AuditLogChangeKey = "uses" // AuditInviteMaxAge specifies the how long invite code lasts // changed. // // Type: Seconds AuditInviteMaxAge AuditLogChangeKey = "max_age" // AuditInviteTemporary specifies if an invite code is temporary/never // expires. // // Type: bool AuditInviteTemporary AuditLogChangeKey = "temporary" )
const ( // AuditUserDeaf specifies if the user was server deafened/undeafened. // // Type: bool AuditUserDeaf AuditLogChangeKey = "deaf" // AuditUserMute specifies if the user was server muted/unmuted. // // Type: bool AuditUserMute AuditLogChangeKey = "mute" // AuditUserNick specifies the new nickname of the user. // // Type: string AuditUserNick AuditLogChangeKey = "nick" // AuditUserAvatar specifies the hash of the new user avatar. // // Type: Hash AuditUserAvatarHash AuditLogChangeKey = "avatar_hash" )
const ( // AuditAnyID specifies the ID of the changed entity - sometimes used in // conjunction with other keys. // // Type: Snowflake AuditAnyID AuditLogChangeKey = "id" // AuditAnyType is the type of the entity created. // Type ChannelType or string AuditAnyType AuditLogChangeKey = "type" )
const ( // AuditIntegrationEnableEmoticons gets sent if the integration emoticons // were enabled/disabled. // // Type: bool AuditIntegrationEnableEmoticons AuditLogChangeKey = "enable_emoticons" // AuditIntegrationExpireBehavior gets sent if the integration expiring // subscriber behavior changed. // // Type: ExpireBehavior AuditIntegrationExpireBehavior AuditLogChangeKey = "expire_behavior" // AuditIntegrationExpireGracePeriod gets sent if the integration expire // grace period changed. // // Type: int AuditIntegrationExpireGracePeriod AuditLogChangeKey = "expire_grace_period" )
type AuditLogEntry ¶
type AuditLogEntry struct { // ID is the id of the entry. ID AuditLogEntryID `json:"id"` // TargetID is the id of the affected entity (webhook, user, role, etc.). TargetID Snowflake `json:"target_id"` // Changes are the changes made to the TargetID. Changes []AuditLogChange `json:"changes,omitempty"` // UserID is the id of the user who made the changes. UserID UserID `json:"user_id"` // ActionType is the type of action that occurred. ActionType AuditLogEvent `json:"action_type"` // Options contains additional info for certain action types. Options AuditEntryInfo `json:"options,omitempty"` // Reason is the reason for the change (0-512 characters). Reason string `json:"reason,omitempty"` }
AuditLogEntry is a single entry in the audit log.
https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
func (AuditLogEntry) CreatedAt ¶
func (e AuditLogEntry) CreatedAt() time.Time
CreatedAt returns a time object representing when the audit log entry was created.
type AuditLogEntryID ¶
type AuditLogEntryID Snowflake
func (AuditLogEntryID) Increment ¶
func (s AuditLogEntryID) Increment() uint16
func (AuditLogEntryID) IsNull ¶
func (s AuditLogEntryID) IsNull() bool
func (AuditLogEntryID) IsValid ¶
func (s AuditLogEntryID) IsValid() bool
func (AuditLogEntryID) MarshalJSON ¶
func (s AuditLogEntryID) MarshalJSON() ([]byte, error)
func (AuditLogEntryID) PID ¶
func (s AuditLogEntryID) PID() uint8
func (AuditLogEntryID) String ¶
func (s AuditLogEntryID) String() string
func (AuditLogEntryID) Time ¶
func (s AuditLogEntryID) Time() time.Time
func (*AuditLogEntryID) UnmarshalJSON ¶
func (s *AuditLogEntryID) UnmarshalJSON(v []byte) error
func (AuditLogEntryID) Worker ¶
func (s AuditLogEntryID) Worker() uint8
type AuditLogEvent ¶
type AuditLogEvent uint8
AuditLogEvent is the type of audit log action that occurred.
const ( GuildUpdate AuditLogEvent = 1 ChannelCreate AuditLogEvent = 10 ChannelUpdate AuditLogEvent = 11 ChannelDelete AuditLogEvent = 12 ChannelOverwriteCreate AuditLogEvent = 13 ChannelOverwriteUpdate AuditLogEvent = 14 ChannelOverwriteDelete AuditLogEvent = 15 MemberKick AuditLogEvent = 20 MemberPrune AuditLogEvent = 21 MemberBanAdd AuditLogEvent = 22 MemberBanRemove AuditLogEvent = 23 MemberUpdate AuditLogEvent = 24 MemberRoleUpdate AuditLogEvent = 25 MemberMove AuditLogEvent = 26 MemberDisconnect AuditLogEvent = 27 BotAdd AuditLogEvent = 28 RoleCreate AuditLogEvent = 30 RoleUpdate AuditLogEvent = 31 RoleDelete AuditLogEvent = 32 InviteCreate AuditLogEvent = 40 InviteUpdate AuditLogEvent = 41 InviteDelete AuditLogEvent = 42 WebhookCreate AuditLogEvent = 50 WebhookUpdate AuditLogEvent = 51 WebhookDelete AuditLogEvent = 52 EmojiCreate AuditLogEvent = 60 EmojiUpdate AuditLogEvent = 61 EmojiDelete AuditLogEvent = 62 MessageDelete AuditLogEvent = 72 MessageBulkDelete AuditLogEvent = 73 MessagePin AuditLogEvent = 74 MessageUnpin AuditLogEvent = 75 IntegrationCreate AuditLogEvent = 80 IntegrationUpdate AuditLogEvent = 81 IntegrationDelete AuditLogEvent = 82 )
https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
type Ban ¶
type Ban struct { // Reason is the reason for the ban. Reason string `json:"reason,omitempty"` // User is the banned user. User User `json:"user"` }
https://discord.com/developers/docs/resources/guild#ban-object
type ButtonComponent ¶
type ButtonComponent struct { Label string `json:"label"` // CustomID attached to InteractionCreate event when clicked. CustomID string `json:"custom_id"` Style ButtonStyle `json:"style"` Emoji *ButtonEmoji `json:"emoji,omitempty"` // URL is only present on link-style buttons. URL URL `json:"url,omitempty"` Disabled bool `json:"disabled,omitempty"` }
ButtonComponent is a clickable button that may be added to an interaction response.
func (ButtonComponent) MarshalJSON ¶
func (b ButtonComponent) MarshalJSON() ([]byte, error)
MarshalJSON marshals the button in the format Discord expects.
func (*ButtonComponent) Type ¶
func (*ButtonComponent) Type() ComponentType
Type implements the Component interface.
type ButtonEmoji ¶
type ButtonEmoji struct { Name string `json:"name,omitempty"` ID EmojiID `json:"id,omitempty"` Animated bool `json:"animated,omitempty"` }
ButtonEmoji is the emoji displayed on the button before the text.
type ButtonStyle ¶
type ButtonStyle uint
ButtonStyle is the style to display a button in.
const ( // PrimaryButton is a blurple button. PrimaryButton ButtonStyle = iota + 1 // SecondaryButton is a grey button. SecondaryButton // SuccessButton is a green button. SuccessButton // DangerButton is a red button. DangerButton // LinkButton is a button that navigates to a URL. LinkButton )
All types of ButtonStyle documented.
type Channel ¶
type Channel struct { // ID is the id of this channel. ID ChannelID `json:"id"` // GuildID is the id of the guild. // // This field may be missing for some channel objects received over gateway // guild dispatches. GuildID GuildID `json:"guild_id,omitempty"` // Type is the type of channel. Type ChannelType `json:"type,omitempty"` // NSFW specifies whether the channel is nsfw. NSFW bool `json:"nsfw,omitempty"` // Position is the sorting position of the channel. Position int `json:"position,omitempty"` // Overwrites are the explicit permission overrides for members // and roles. Overwrites []Overwrite `json:"permission_overwrites,omitempty"` // Name is the name of the channel (2-100 characters). Name string `json:"name,omitempty"` // Topic is the channel topic (0-1024 characters). Topic string `json:"topic,omitempty"` // LastMessageID is the id of the last message sent in this channel (may // not point to an existing or valid message). LastMessageID MessageID `json:"last_message_id,omitempty"` // VoiceBitrate is the bitrate (in bits) of the voice channel. VoiceBitrate uint `json:"bitrate,omitempty"` // VoiceUserLimit is the user limit of the voice channel. VoiceUserLimit uint `json:"user_limit,omitempty"` // UserRateLimit is the amount of seconds a user has to wait before sending // another message (0-21600). Bots, as well as users with the permission // manage_messages or manage_channel, are unaffected. UserRateLimit Seconds `json:"rate_limit_per_user,omitempty"` // DMRecipients are the recipients of the DM. DMRecipients []User `json:"recipients,omitempty"` // Icon is the icon hash. Icon Hash `json:"icon,omitempty"` // OwnerID is the id of the DM or thread creator. OwnerID UserID `json:"owner_id,omitempty"` // AppID is the application id of the group DM creator if it is // bot-created. AppID AppID `json:"application_id,omitempty"` // ParentID for guild channels: id of the parent category for a channel // (each parent category can contain up to 50 channels), for threads: the // id of the text channel this thread was created. ParentID ChannelID `json:"parent_id,omitempty"` // LastPinTime is when the last pinned message was pinned. LastPinTime Timestamp `json:"last_pin_timestamp,omitempty"` // RTCRegionID is the voice region id for the voice channel. RTCRegionID string `json:"rtc_region,omitempty"` // VideoQualityMode is the camera video quality mode of the voice channel. VideoQualityMode VideoQualityMode `json:"video_quality_mode,omitempty"` // MessageCount is an approximate count of messages in a thread. However, // counting stops at 50. MessageCount int `json:"message_count,omitempty"` // MemberCount is an approximate count of users in a thread. However, // counting stops at 50. MemberCount int `json:"member_count,omitempty"` // ThreadMetadata contains thread-specific fields not needed by other // channels. ThreadMetadata *ThreadMetadata `json:"thread_metadata,omitempty"` // ThreadMember is the thread member object for the current user, if they // have joined the thread, only included on certain API endpoints. ThreadMember *ThreadMember `json:"thread_member,omitempty"` // DefaultAutoArchiveDuration is the default duration for newly created // threads, in minutes, to automatically archive the thread after recent // activity. DefaultAutoArchiveDuration ArchiveDuration `json:"default_auto_archive_duration,omitempty"` // SelfPermissions are the computed permissions for the invoking user in // the channel, including overwrites, only included when part of the // resolved data received on a slash command interaction. SelfPermissions Permissions `json:"permissions,omitempty,string"` }
Channel represents a guild or DM channel within Discord.
https://discord.com/developers/docs/resources/channel#channel-object
func (Channel) CreatedAt ¶
CreatedAt returns a time object representing when the channel was created.
func (Channel) IconURL ¶
IconURL returns the URL to the channel icon in the PNG format. An empty string is returned if there's no icon.
func (Channel) IconURLWithType ¶
IconURLWithType returns the URL to the channel icon using the passed ImageType. An empty string is returned if there's no icon.
Supported ImageTypes: PNG, JPEG, WebP
func (*Channel) UnmarshalJSON ¶
type ChannelID ¶
type ChannelID Snowflake
func (ChannelID) MarshalJSON ¶
func (*ChannelID) UnmarshalJSON ¶
type ChannelMention ¶
type ChannelMention struct { // ChannelID is the ID of the channel. ChannelID ChannelID `json:"id"` // GuildID is the ID of the guild containing the channel. GuildID GuildID `json:"guild_id"` // ChannelType is the type of channel. ChannelType ChannelType `json:"type"` // ChannelName is the name of the channel. ChannelName string `json:"name"` }
https://discord.com/developers/docs/resources/channel#channel-mention-object
type ChannelType ¶
type ChannelType uint8
const ( // GuildText is a text channel within a server. GuildText ChannelType = iota // DirectMessage is a direct message between users. DirectMessage // GuildVoice is a voice channel within a server. GuildVoice // GroupDM is a direct message between multiple users. GroupDM // GuildCategory is an organizational category that contains up to 50 // channels. GuildCategory // GuildNews is a channel that users can follow and crosspost into their // own server. GuildNews // GuildStore is a channel in which game developers can sell their game on // Discord. GuildStore // GuildNewsThread is a temporary sub-channel within a GUILD_NEWS channel GuildNewsThread // GuildPublicThread is a temporary sub-channel within a GUILD_TEXT // channel. GuildPublicThread // GuildPrivateThread isa temporary sub-channel within a GUILD_TEXT channel // that is only viewable by those invited and those with the MANAGE_THREADS // permission. GuildPrivateThread // GuildStageVoice is a voice channel for hosting events with an audience. GuildStageVoice )
https://discord.com/developers/docs/resources/channel#channel-object-channel-types
type ClientStatus ¶
type ClientStatus struct { // Desktop is the user's status set for an active desktop (Windows, // Linux, Mac) application session. Desktop Status `json:"desktop,omitempty"` // Mobile is the user's status set for an active mobile (iOS, Android) // application session. Mobile Status `json:"mobile,omitempty"` // Web is the user's status set for an active web (browser, bot // account) application session. Web Status `json:"web,omitempty"` }
type Color ¶
type Color int32
const NullColor Color = -1
var DefaultEmbedColor Color = 0x303030
var DefaultMemberColor Color = 0x0
DefaultMemberColor is the color used for members without colored roles.
func MemberColor ¶
MemberColor computes the effective color of the Member, taking into account the role colors.
func (Color) MarshalJSON ¶
func (*Color) UnmarshalJSON ¶
type Command ¶
type Command struct { // ID is the unique id of the command. ID CommandID `json:"id"` // Type is the type of command. Type CommandType `json:"type,omitempty"` // AppID is the unique id of the parent application. AppID AppID `json:"application_id"` // GuildID is the guild id of the command, if not global. GuildID GuildID `json:"guild_id,omitempty"` // Name is the 1-32 lowercase character name matching ^[\w-]{1,32}$. Name string `json:"name"` // Description is the 1-100 character description. Description string `json:"description"` // Options are the parameters for the command. // // Note that required options must be listed before optional options, and // a command, or each individual subcommand, can have a maximum of 25 // options. // // It is only present on ChatInputCommands. Options []CommandOption `json:"options,omitempty"` // NoDefaultPermissions defines whether the command is NOT enabled by // default when the app is added to a guild. NoDefaultPermission bool `json:"-"` }
Command is the base "command" model that belongs to an application. This is what you are creating when you POST a new command.
https://discord.com/developers/docs/interactions/slash-commands#application-command-object
func (Command) CreatedAt ¶
CreatedAt returns a time object representing when the command was created.
func (Command) MarshalJSON ¶
func (*Command) UnmarshalJSON ¶
type CommandID ¶
type CommandID Snowflake
func (CommandID) MarshalJSON ¶
func (*CommandID) UnmarshalJSON ¶
type CommandInteractionData ¶
type CommandInteractionData struct { ID CommandID `json:"id"` Name string `json:"name"` Options []InteractionOption `json:"options"` }
func (*CommandInteractionData) Type ¶
func (*CommandInteractionData) Type() InteractionType
type CommandOption ¶
type CommandOption struct { Type CommandOptionType `json:"type"` Name string `json:"name"` Description string `json:"description"` Required bool `json:"required"` Choices []CommandOptionChoice `json:"choices,omitempty"` Options []CommandOption `json:"options,omitempty"` }
type CommandOptionChoice ¶
type CommandOptionType ¶
type CommandOptionType uint
const ( SubcommandOption CommandOptionType = iota + 1 SubcommandGroupOption StringOption IntegerOption BooleanOption UserOption ChannelOption RoleOption MentionableOption NumberOption )
type CommandPermissionType ¶
type CommandPermissionType uint8
type CommandPermissions ¶
type CommandPermissions struct { ID Snowflake `json:"id"` Type CommandPermissionType `json:"type"` Permission bool `json:"permission"` }
type CommandType ¶
type CommandType uint
const ( ChatInputCommand CommandType = iota + 1 UserCommand MessageCommand )
type Component ¶
type Component interface { json.Marshaler Type() ComponentType }
Component is a component that can be attached to an interaction response.
func UnwrapComponents ¶
func UnwrapComponents(wraps []ComponentWrap) []Component
UnwrapComponents returns a slice of the underlying component interfaces.
type ComponentInteractionData ¶
type ComponentInteractionData struct { CustomID string `json:"custom_id"` ComponentType ComponentType `json:"component_type"` Values []string `json:"values"` }
func (*ComponentInteractionData) Type ¶
func (*ComponentInteractionData) Type() InteractionType
type ComponentType ¶
type ComponentType uint
ComponentType is the type of a component.
const ( ActionRowComponentType ComponentType = iota + 1 ButtonComponentType SelectComponentType )
type ComponentWrap ¶
type ComponentWrap struct {
Component Component
}
ComponentWrap wraps Component for the purpose of JSON unmarshalling. Type assertions should be made on Component to access the underlying data. The underlying types of the Component are pointer types.
func (*ComponentWrap) MarshalJSON ¶
func (c *ComponentWrap) MarshalJSON() ([]byte, error)
MarshalJSON marshals the component in the format Discord expects.
func (*ComponentWrap) Type ¶
func (c *ComponentWrap) Type() ComponentType
Type returns the underlying component's type.
func (*ComponentWrap) UnmarshalJSON ¶
func (c *ComponentWrap) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals json into the component.
type Connection ¶
type Connection struct { ID string `json:"id"` Name string `json:"name"` Type Service `json:"type"` Revoked bool `json:"revoked"` Verified bool `json:"verified"` FriendSync bool `json:"friend_sync"` ShowActivity bool `json:"show_activity"` Visibility ConnectionVisibility `json:"visibility"` // Only partial Integrations []Integration `json:"integrations"` }
type ConnectionVisibility ¶
type ConnectionVisibility uint8
const ( ConnectionNotVisible ConnectionVisibility = iota ConnectionVisibleEveryone )
type Embed ¶
type Embed struct { Title string `json:"title,omitempty"` Type EmbedType `json:"type,omitempty"` Description string `json:"description,omitempty"` URL URL `json:"url,omitempty"` Timestamp Timestamp `json:"timestamp,omitempty"` Color Color `json:"color,omitempty"` Image *EmbedImage `json:"image,omitempty"` Thumbnail *EmbedThumbnail `json:"thumbnail,omitempty"` Video *EmbedVideo `json:"video,omitempty"` Provider *EmbedProvider `json:"provider,omitempty"` Author *EmbedAuthor `json:"author,omitempty"` Fields []EmbedField `json:"fields,omitempty"` }
type EmbedAuthor ¶
type EmbedField ¶
type EmbedFooter ¶
type EmbedFooter struct {}
type EmbedImage ¶
type EmbedProvider ¶
type EmbedThumbnail ¶
type EmbedVideo ¶
type Emoji ¶
type Emoji struct { // ID is the ID of the Emoji. // The ID will be NullSnowflake, if the Emoji is a Unicode emoji. ID EmojiID `json:"id"` // Name is the name of the emoji. Name string `json:"name"` // RoleIDs are the roles the emoji is whitelisted to. // // This field is only available for custom emojis. RoleIDs []RoleID `json:"roles,omitempty"` // User is the user that created the emoji. // // This field is only available for custom emojis. User User `json:"user,omitempty"` // RequireColons specifies whether the emoji must be wrapped in colons. // // This field is only available for custom emojis. RequireColons bool `json:"require_colons,omitempty"` // Managed specifies whether the emoji is managed. // // This field is only available for custom emojis. Managed bool `json:"managed,omitempty"` // Animated specifies whether the emoji is animated. // // This field is only available for custom emojis. Animated bool `json:"animated,omitempty"` // Available specifies whether the emoji can be used. // This may be false due to loss of Server Boosts. // // This field is only available for custom emojis. Available bool `json:"available,omitempty"` }
https://discord.com/developers/docs/resources/emoji#emoji-object
func (Emoji) CreatedAt ¶
CreatedAt returns a time object representing when the emoji was created.
This will only work for custom emojis.
func (Emoji) EmojiURL ¶
EmojiURL returns the URL of the emoji and auto-detects a suitable type.
This will only work for custom emojis.
func (Emoji) EmojiURLWithType ¶
EmojiURLWithType returns the URL to the emoji's image.
This will only work for custom emojis.
Supported ImageTypes: PNG, GIF
type ExpireBehavior ¶
type ExpireBehavior uint8
ExpireBehavior is the integration expire behavior that regulates what happens, if a subscriber expires.
const ( // RemoveRole removes the role of the subscriber. RemoveRole ExpireBehavior = iota // Kick kicks the subscriber from the guild. Kick )
https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
type ExplicitFilter ¶
ExplicitFilter is the explicit content filter level of a guild.
const ( // NoContentFilter disables content filtering for the guild. NoContentFilter ExplicitFilter = iota // MembersWithoutRoles filters only members without roles. MembersWithoutRoles // AllMembers enables content filtering for all members. AllMembers )
https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
const NullExplicitFilter ExplicitFilter = enum.Null
NullExplicitFilter serialized to JSON null. This should only be used on nullable fields.
func (ExplicitFilter) MarshalJSON ¶
func (f ExplicitFilter) MarshalJSON() ([]byte, error)
func (*ExplicitFilter) UnmarshalJSON ¶
func (f *ExplicitFilter) UnmarshalJSON(b []byte) error
type Guild ¶
type Guild struct { // ID is the guild id. ID GuildID `json:"id"` // Name is the guild name (2-100 characters, excluding trailing and leading // whitespace). Name string `json:"name"` // Icon is the icon hash.&nullableUint64{} Icon Hash `json:"icon"` // Splash is the splash hash. Splash Hash `json:"splash,omitempty"` // DiscoverySplash is the discovery splash hash. // // Only present for guilds with the "DISCOVERABLE" feature. DiscoverySplash Hash `json:"discovery_splash,omitempty"` // Owner is true if the user is the owner of the guild. Owner bool `json:"owner,omitempty"` // Widget is true if the server widget is enabled. Widget bool `json:"widget_enabled,omitempty"` // SystemChannelFlags are the system channel flags. SystemChannelFlags SystemChannelFlags `json:"system_channel_flags"` // Verification is the verification level required for the guild. Verification Verification `json:"verification_level"` // Notification is the default message notifications level. Notification Notification `json:"default_message_notifications"` // ExplicitFilter is the explicit content filter level. ExplicitFilter ExplicitFilter `json:"explicit_content_filter"` // NitroBoost is the premium tier (Server Boost level). NitroBoost NitroBoost `json:"premium_tier"` // MFA is the required MFA level for the guild. MFA MFALevel `json:"mfa"` // OwnerID is the id of owner. OwnerID UserID `json:"owner_id"` // WidgetChannelID is the channel id that the widget will generate an // invite to, or null if set to no invite. WidgetChannelID ChannelID `json:"widget_channel_id,omitempty"` // SystemChannelID is the the id of the channel where guild notices such as // welcome messages and boost events are posted. SystemChannelID ChannelID `json:"system_channel_id,omitempty"` // Permissions are the total permissions for the user in the guild // (excludes overrides). Permissions Permissions `json:"permissions,string,omitempty"` // VoiceRegion is the voice region id for the guild. VoiceRegion string `json:"region"` // AFKChannelID is the id of the afk channel. AFKChannelID ChannelID `json:"afk_channel_id,omitempty"` // AFKTimeout is the afk timeout in seconds. AFKTimeout Seconds `json:"afk_timeout"` // Roles are the roles in the guild. Roles []Role `json:"roles"` // Emojis are the custom guild emojis. Emojis []Emoji `json:"emojis"` // Features are the enabled guild features. Features []GuildFeature `json:"guild_features"` // AppID is the application id of the guild creator if it is bot-created. // // This field is nullable. AppID AppID `json:"application_id,omitempty"` // RulesChannelID is the id of the channel where guilds with the "PUBLIC" // feature can display rules and/or guidelines. RulesChannelID ChannelID `json:"rules_channel_id"` // MaxPresences is the maximum number of presences for the guild (the // default value, currently 25000, is in effect when null is returned, so // effectively when this field is 0). MaxPresences uint64 `json:"max_presences,omitempty"` // MaxMembers the maximum number of members for the guild. MaxMembers uint64 `json:"max_members,omitempty"` // VanityURL is the the vanity url code for the guild. VanityURLCode string `json:"vanity_url_code,omitempty"` // Description is the description for the guild, if the guild is // discoverable. Description string `json:"description,omitempty"` // Banner is the banner hash. Banner Hash `json:"banner,omitempty"` // NitroBoosters is the number of boosts this guild currently has. NitroBoosters uint64 `json:"premium_subscription_count,omitempty"` // PreferredLocale is the 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"` // PublicUpdatesChannelID is the id of the channel where admins and // moderators of guilds with the "PUBLIC" feature receive notices from // Discord. PublicUpdatesChannelID ChannelID `json:"public_updates_channel_id"` // MaxVideoChannelUsers is the maximum amount of users in a video channel. MaxVideoChannelUsers uint64 `json:"max_video_channel_users,omitempty"` // ApproximateMembers is the approximate number of members in this guild, // returned by the GuildWithCount method. ApproximateMembers uint64 `json:"approximate_member_count,omitempty"` // ApproximatePresences is the approximate number of non-offline members in // this guild, returned by the GuildWithCount method. ApproximatePresences uint64 `json:"approximate_presence_count,omitempty"` }
https://discord.com/developers/docs/resources/guild#guild-object
func (Guild) BannerURL ¶
BannerURL returns the URL to the banner, which is the image on top of the channels list. This will always return a link to a PNG file.
func (Guild) BannerURLWithType ¶
BannerURLWithType returns the URL to the banner, which is the image on top of the channels list using the passed image type.
Supported ImageTypes: PNG, JPEG, WebP
func (Guild) DiscoverySplashURL ¶
DiscoverySplashURL returns the URL to the guild discovery splash. This will always return a link to a PNG file.
func (Guild) DiscoverySplashURLWithType ¶
DiscoverySplashURLWithType returns the URL to the guild discovery splash, using the passed ImageType.
Supported ImageTypes: PNG, JPEG, WebP
func (Guild) IconURL ¶
IconURL returns the URL to the guild icon and auto detects a suitable type. An empty string is returned if there's no icon.
func (Guild) IconURLWithType ¶
IconURLWithType returns the URL to the guild icon using the passed ImageType. An empty string is returned if there's no icon.
Supported ImageTypes: PNG, JPEG, WebP, GIF
func (Guild) SplashURL ¶
SplashURL returns the URL to the guild splash, which is the invite page's background. This will always return a link to a PNG file.
func (Guild) SplashURLWithType ¶
SplashURLWithType returns the URL to the guild splash, which is the invite page's background, using the passed ImageType.
Supported ImageTypes: PNG, JPEG, WebP
type GuildCommandPermissions ¶
type GuildCommandPermissions struct { ID CommandID `json:"id"` AppID AppID `json:"application_id"` GuildID GuildID `json:"guild_id"` Permissions []CommandPermissions `json:"permissions"` }
type GuildFeature ¶
type GuildFeature string
const ( // InviteSplash is set, if the guild has access to set an invite splash // background. InviteSplash GuildFeature = "INVITE_SPLASH" // VIPRegions is set, if the guild has access to set 384kbps bitrate in // voice (previously VIP voice servers). VIPRegions GuildFeature = "VIP_REGIONS" // VanityURL is set, if the guild has access to set a vanity URL. VanityURL GuildFeature = "VANITY_URL" // Verified is set, if the guild is verified. Verified GuildFeature = "VERIFIED" // Partnered is set, if the guild is partnered. Partnered GuildFeature = "PARTNERED" // Public is set, if the guild is public. Public GuildFeature = "PUBLIC" // Commerce is set, if the guild has access to use commerce features // (i.e. create store channels). Commerce GuildFeature = "COMMERCE" // News is set, if the guild has access to create news channels. News GuildFeature = "NEWS" // Discoverable is set, if the guild is able to be discovered in the // directory. Discoverable GuildFeature = "DISCOVERABLE" // Featurable is set, if the guild is able to be featured in the directory. Featurable GuildFeature = "FEATURABLE" // AnimatedIcon is set, if the guild has access to set an animated guild // icon. AnimatedIcon GuildFeature = "ANIMATED_ICON" // Banner is set, if the guild has access to set a guild banner image. Banner GuildFeature = "BANNER" )
https://discord.com/developers/docs/resources/guild#guild-object-guild-features
type GuildPreview ¶
type GuildPreview struct { // ID is the guild id. ID GuildID `json:"id"` // Name is the guild name (2-100 characters). Name string `json:"name"` // Icon is the icon hash. Icon Hash `json:"icon"` // Splash is the splash hash. Splash Hash `json:"splash"` // DiscoverySplash is the discovery splash hash. DiscoverySplash Hash `json:"discovery_splash"` // Emojis are the custom guild emojis. Emojis []Emoji `json:"emojis"` // Features are the enabled guild features. Features []GuildFeature `json:"guild_features"` // ApproximateMembers is the approximate number of members in this guild. ApproximateMembers uint64 `json:"approximate_member_count"` // ApproximatePresences is the approximate number of online members in this // guild. ApproximatePresences uint64 `json:"approximate_presence_count"` // Description is the description for the guild. Description string `json:"description,omitempty"` }
https://discord.com/developers/docs/resources/guild#guild-preview-object
func (GuildPreview) CreatedAt ¶
func (g GuildPreview) CreatedAt() time.Time
CreatedAt returns a time object representing when the guild the preview represents was created.
func (GuildPreview) DiscoverySplashURL ¶
func (g GuildPreview) DiscoverySplashURL() string
DiscoverySplashURL returns the URL to the guild discovery splash. This will always return a link to a PNG file.
func (GuildPreview) DiscoverySplashURLWithType ¶
func (g GuildPreview) DiscoverySplashURLWithType(t ImageType) string
DiscoverySplashURLWithType returns the URL to the guild discovery splash, using the passed ImageType.
Supported ImageTypes: PNG, JPEG, WebP
func (GuildPreview) IconURL ¶
func (g GuildPreview) IconURL() string
IconURL returns the URL to the guild icon and auto detects a suitable type. An empty string is returned if there's no icon.
func (GuildPreview) IconURLWithType ¶
func (g GuildPreview) IconURLWithType(t ImageType) string
IconURLWithType returns the URL to the guild icon using the passed ImageType. An empty string is returned if there's no icon.
Supported ImageTypes: PNG, JPEG, WebP, GIF
func (GuildPreview) SplashURL ¶
func (g GuildPreview) SplashURL() string
SplashURL returns the URL to the guild splash, which is the invite page's background. This will always return a link to a PNG file.
func (GuildPreview) SplashURLWithType ¶
func (g GuildPreview) SplashURLWithType(t ImageType) string
SplashURLWithType returns the URL to the guild splash, which is the invite page's background, using the passed ImageType.
Supported ImageTypes: PNG, JPEG, WebP
type GuildWidget ¶
type GuildWidget struct { // ID is the ID of the guild. ID GuildID `json:"id"` // Name is the name of the guild. Name string `json:"name"` // InviteURl is the url of an instant invite to the guild. InviteURL string `json:"instant_invite"` Channels []Channel `json:"channels"` Members []User `json:"members"` // Presence count is the amount of presences in the guild PresenceCount int `json:"presence_count"` }
https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
type GuildWidgetSettings ¶
type GuildWidgetSettings struct { // Enabled specifies whether the widget is enabled. Enabled bool `json:"enabled"` // ChannelID is the widget channel id. ChannelID ChannelID `json:"channel_id,omitempty"` }
https://discord.com/developers/docs/resources/guild#guild-widget-object
type ImageType ¶
type ImageType string
const ( // AutoImage chooses automatically between a PNG and GIF. AutoImage ImageType = "auto" // JPEGImage is the JPEG image type. JPEGImage ImageType = ".jpeg" // PNGImage is the PNG image type. PNGImage ImageType = ".png" // WebPImage is the WebP image type. WebPImage ImageType = ".webp" // GIFImage is the GIF image type. GIFImage ImageType = ".gif" )
type Integration ¶
type Integration struct { // ID is the integration id. ID IntegrationID `json:"id"` // Name is the integration name. Name string `json:"name"` // Type is the integration type (twitch, youtube, discord). Type Service `json:"type"` // Enables specifies if the integration is enabled. Enabled bool `json:"enabled"` // Syncing specifies if the integration is syncing. // This field is not provided for bot integrations. Syncing bool `json:"syncing,omitempty"` // RoleID is the id that this integration uses for "subscribers". // This field is not provided for bot integrations. RoleID RoleID `json:"role_id,omitempty"` // EnableEmoticons specifies whether emoticons should be synced for this // integration (twitch only currently). // This field is not provided for bot integrations. EnableEmoticons bool `json:"enable_emoticons,omitempty"` // ExpireBehavior is the behavior of expiring subscribers. // This field is not provided for bot integrations. ExpireBehavior ExpireBehavior `json:"expire_behavior,omitempty"` // ExpireGracePeriod is the grace period (in days) before expiring // subscribers. // This field is not provided for bot integrations. ExpireGracePeriod int `json:"expire_grace_period,omitempty"` // User is the user for this integration. // This field is not provided for bot integrations. User User `json:"user,omitempty"` // Account is the integration account information. Account IntegrationAccount `json:"account"` // SyncedAt specifies when this integration was last synced. // This field is not provided for bot integrations. SyncedAt Timestamp `json:"synced_at,omitempty"` // SubscriberCount specifies how many subscribers the integration has. // This field is not provided for bot integrations. SubscriberCount int `json:"subscriber_count,omitempty"` // Revoked specifies whether the integration has been revoked. // This field is not provided for bot integrations. Revoked bool `json:"revoked,omitempty"` // Application is the bot/OAuth2 application for integrations. Application *IntegrationApplication `json:"application,omitempty"` }
https://discord.com/developers/docs/resources/guild#integration-object
func (Integration) CreatedAt ¶
func (i Integration) CreatedAt() time.Time
CreatedAt returns a time object representing when the integration was created.
type IntegrationAccount ¶
type IntegrationAccount struct { // ID is the id of the account. ID string `json:"id"` // Name is the name of the account. Name string `json:"name"` }
https://discord.com/developers/docs/resources/guild#integration-account-object
type IntegrationApplication ¶
type IntegrationApplication struct { // ID is the id of the app. ID IntegrationID `json:"id"` // Name is the name of the app. Name string `json:"name"` // Icon is the icon hash of the app. Icon *Hash `json:"icon"` // Description is the description of the app. Description string `json:"description"` // Summary is a summary of the app. Summary string `json:"summary"` // Bot is the bot associated with the app. Bot User `json:"bot,omitempty"` }
https://discord.com/developers/docs/resources/guild#integration-application-object
func (IntegrationApplication) CreatedAt ¶
func (i IntegrationApplication) CreatedAt() time.Time
CreatedAt returns a time object representing when the integration application was created.
type IntegrationID ¶
type IntegrationID Snowflake
func (IntegrationID) Increment ¶
func (s IntegrationID) Increment() uint16
func (IntegrationID) IsNull ¶
func (s IntegrationID) IsNull() bool
func (IntegrationID) IsValid ¶
func (s IntegrationID) IsValid() bool
func (IntegrationID) MarshalJSON ¶
func (s IntegrationID) MarshalJSON() ([]byte, error)
func (IntegrationID) PID ¶
func (s IntegrationID) PID() uint8
func (IntegrationID) String ¶
func (s IntegrationID) String() string
func (IntegrationID) Time ¶
func (s IntegrationID) Time() time.Time
func (*IntegrationID) UnmarshalJSON ¶
func (s *IntegrationID) UnmarshalJSON(v []byte) error
func (IntegrationID) Worker ¶
func (s IntegrationID) Worker() uint8
type Interaction ¶
type Interaction struct { ID InteractionID `json:"id"` AppID AppID `json:"application_id"` Type InteractionType `json:"type"` Data InteractionData `json:"data,omitempty"` ChannelID ChannelID `json:"channel_id,omitempty"` Token string `json:"token"` Version int `json:"version"` // Message is the message the component was attached to. // Only present for component interactions, not command interactions. Message *Message `json:"message,omitempty"` // Member is only present if this came from a guild. Member *Member `json:"member,omitempty"` GuildID GuildID `json:"guild_id,omitempty"` // User is only present if this didn't come from a guild. User *User `json:"user,omitempty"` }
https://discord.com/developers/docs/topics/gateway#interactions
func (*Interaction) UnmarshalJSON ¶
func (i *Interaction) UnmarshalJSON(p []byte) error
type InteractionData ¶
type InteractionData interface {
Type() InteractionType
}
InteractionData holds the data of an interaction. Type assertions should be made on InteractionData to access the underlying data. The underlying types of the InteractionData are pointer types.
type InteractionID ¶
type InteractionID Snowflake
func (InteractionID) Increment ¶
func (s InteractionID) Increment() uint16
func (InteractionID) IsNull ¶
func (s InteractionID) IsNull() bool
func (InteractionID) IsValid ¶
func (s InteractionID) IsValid() bool
func (InteractionID) MarshalJSON ¶
func (s InteractionID) MarshalJSON() ([]byte, error)
func (InteractionID) PID ¶
func (s InteractionID) PID() uint8
func (InteractionID) String ¶
func (s InteractionID) String() string
func (InteractionID) Time ¶
func (s InteractionID) Time() time.Time
func (*InteractionID) UnmarshalJSON ¶
func (s *InteractionID) UnmarshalJSON(v []byte) error
func (InteractionID) Worker ¶
func (s InteractionID) Worker() uint8
type InteractionOption ¶
type InteractionOption struct { Name string `json:"name"` Value json.Raw `json:"value"` Options []InteractionOption `json:"options"` }
func (InteractionOption) Bool ¶
func (o InteractionOption) Bool() (bool, error)
func (InteractionOption) Float ¶
func (o InteractionOption) Float() (float64, error)
func (InteractionOption) Int ¶
func (o InteractionOption) Int() (int64, error)
func (InteractionOption) Snowflake ¶
func (o InteractionOption) Snowflake() (Snowflake, error)
func (InteractionOption) String ¶
func (o InteractionOption) String() string
String will return the value if the option's value is a valid string. Otherwise, it will return the raw JSON value of the other type.
type InteractionType ¶
type InteractionType uint
const ( PingInteraction InteractionType = iota + 1 CommandInteraction ComponentInteraction )
type Invite ¶
type Invite struct { // Code is the invite code (unique ID). Code string `json:"code"` // Guild is the partial guild this invite is for. Guild *Guild `json:"guild,omitempty"` // Channel is the partial channel this invite is for. Channel Channel `json:"channel"` // Inviter is the user who created the invite Inviter *User `json:"inviter,omitempty"` // Target is the target user for this invite. Target *User `json:"target_user,omitempty"` // Target type is the type of user target for this invite. TargetType InviteUserType `json:"target_user_type,omitempty"` // ApproximatePresences is the approximate count of online members (only // present when Target is set). ApproximatePresences uint `json:"approximate_presence_count,omitempty"` // ApproximateMembers is the approximate count of total members ApproximateMembers uint `json:"approximate_member_count,omitempty"` // InviteMetadata contains extra information about the invite. // So far, this field is only available when fetching Channel- or // GuildInvites. Additionally the Uses field is filled when getting the // VanityURL of a guild. InviteMetadata }
Invite represents a code that when used, adds a user to a guild or group DM channel.
https://discord.com/developers/docs/resources/invite#invite-object
type InviteMetadata ¶
type InviteMetadata struct { // Number of times this invite has been used Uses int `json:"uses"` // Max number of times this invite can be used MaxUses int `json:"max_uses"` // Duration (in seconds) after which the invite expires MaxAge Seconds `json:"max_age"` // Whether this invite only grants temporary membership Temporary bool `json:"temporary"` // When this invite was created CreatedAt Timestamp `json:"created_at"` }
Extra information about an invite, will extend the invite object.
https://discord.com/developers/docs/resources/invite#invite-metadata-object
type InviteUserType ¶
type InviteUserType uint8
https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
const ( InviteNormalUser InviteUserType = iota InviteUserStream )
type MFALevel ¶
type MFALevel uint8
MFALevel is the required MFA level for a guild.
type Member ¶
type Member struct { // User is the user this guild member represents. User User `json:"user"` // Nick is this users guild nickname. Nick string `json:"nick,omitempty"` // RoleIDs is an array of role object ids. RoleIDs []RoleID `json:"roles"` // Joined specifies when the user joined the guild. Joined Timestamp `json:"joined_at"` // BoostedSince specifies when the user started boosting the guild. BoostedSince Timestamp `json:"premium_since,omitempty"` // Deaf specifies whether the user is deafened in voice channels. Deaf bool `json:"deaf"` // Mute specifies whether the user is muted in voice channels. Mute bool `json:"mute"` // IsPending specifies whether the user has not yet passed the guild's Membership Screening requirements IsPending bool `json:"pending"` }
https://discord.com/developers/docs/resources/guild#guild-member-object
The field user won't be included in the member object attached to MESSAGE_CREATE and MESSAGE_UPDATE gateway events.
type Message ¶
type Message struct { // ID is the id of the message. ID MessageID `json:"id"` // ChannelID is the id of the channel the message was sent in. ChannelID ChannelID `json:"channel_id"` // GuildID is the id of the guild the message was sent in. GuildID GuildID `json:"guild_id,omitempty"` // Type is the type of message. Type MessageType `json:"type"` // Flags are the MessageFlags. Flags MessageFlags `json:"flags"` // TTS specifies whether the was a TTS message. TTS bool `json:"tts"` // Pinned specifies whether the message is pinned. Pinned bool `json:"pinned"` // MentionEveryone specifies whether the message mentions everyone. MentionEveryone bool `json:"mention_everyone"` // Mentions contains the users specifically mentioned in the message. // // The user objects in the mentions array will only have the partial // member field present in MESSAGE_CREATE and MESSAGE_UPDATE events from // text-based guild channels. Mentions []GuildUser `json:"mentions"` // MentionRoleIDs contains the ids of the roles specifically mentioned in // the message. MentionRoleIDs []RoleID `json:"mention_roles"` // MentionChannels are the channels specifically mentioned in the 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, the slice will be empty. MentionChannels []ChannelMention `json:"mention_channels,omitempty"` // Author is the author of the message. // // The author object follows the structure of the user object, but is only // a valid user in the case where the message is generated by a user or bot // user. If the message is generated by a webhook, the author object // corresponds to the webhook's id, username, and avatar. You can tell if a // message is generated by a webhook by checking for the webhook_id on the // message object. Author User `json:"author"` // Content contains the contents of the message. Content string `json:"content"` // Timestamp specifies when the message was sent Timestamp Timestamp `json:"timestamp,omitempty"` // EditedTimestamp specifies when this message was edited. // // IsValid() will return false, if the messages hasn't been edited. EditedTimestamp Timestamp `json:"edited_timestamp,omitempty"` // Attachments contains any attached files. Attachments []Attachment `json:"attachments"` // Embeds contains any embedded content. Embeds []Embed `json:"embeds"` // Reactions contains any reactions to the message. Reactions []Reaction `json:"reactions,omitempty"` // Components contains any attached components. Components []ComponentWrap `json:"components,omitempty"` // Used for validating a message was sent Nonce string `json:"nonce,omitempty"` // WebhookID contains the ID of the webhook, if the message was generated // by a webhook. WebhookID WebhookID `json:"webhook_id,omitempty"` // Activity is sent with Rich Presence-related chat embeds. Activity *MessageActivity `json:"activity,omitempty"` // Application is sent with Rich Presence-related chat embeds. Application *MessageApplication `json:"application,omitempty"` // Reference is the reference data sent with crossposted messages and // inline replies. Reference *MessageReference `json:"message_reference,omitempty"` // ReferencedMessage is the message that was replied to. If not present and // the type is InlinedReplyMessage, the backend couldn't fetch the // replied-to message. If null, the message was deleted. If present and // non-null, it is a message object ReferencedMessage *Message `json:"referenced_message,omitempty"` // Stickers contains the sticker sent with the message. Stickers []Sticker `json:"stickers,omitempty"` }
https://discord.com/developers/docs/resources/channel#message-object
type MessageActivity ¶
type MessageActivity struct { // Type is the type of message activity. Type MessageActivityType `json:"type"` // PartyID is the party_id from a Rich Presence event. PartyID string `json:"party_id,omitempty"` }
https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
type MessageActivityType ¶
type MessageActivityType uint8
const ( JoinMessage MessageActivityType = iota + 1 SpectateMessage ListenMessage JoinRequestMessage )
https://discord.com/developers/docs/resources/channel#message-object-message-activity-types
type MessageApplication ¶
type MessageApplication struct { // ID is the id of the application. ID AppID `json:"id"` // CoverID is the id of the embed's image asset. CoverID string `json:"cover_image,omitempty"` // Description is the application's description. Description string `json:"description"` // Icon is the id of the application's icon. Icon string `json:"icon"` // Name is the name of the application. Name string `json:"name"` }
https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
func (MessageApplication) CreatedAt ¶
func (m MessageApplication) CreatedAt() time.Time
CreatedAt returns a time object representing when the message application was created.
type MessageFlags ¶
const ( // CrosspostedMessage specifies whether the message has been published to // subscribed channels (via Channel Following). CrosspostedMessage MessageFlags = 1 << iota // MessageIsCrosspost specifies whether the message originated from a // message in another channel (via Channel Following). MessageIsCrosspost // SuppressEmbeds specifies whether to not include any embeds when // serializing the message. SuppressEmbeds // SourceMessageDeleted specifies whether the source message for the // crosspost has been deleted (via Channel Following). SourceMessageDeleted // UrgentMessage specifies whether the message came from the urgent message // system. UrgentMessage // MessageHasThread specifies whether the message has an associated thread // with the same id as the message MessageHasThread // EphemeralMessage specifies whether the message is only visible to // the user who invoked the Interaction EphemeralMessage // MessageLoading specifies whether the message is an Interaction Response // and the bot is "thinking" MessageLoading )
https://discord.com/developers/docs/resources/channel#message-object-message-flags
const NullMessage MessageFlags = enum.Null
NullMessage is the JSON null value of MessageFlags.
type MessageID ¶
type MessageID Snowflake
func (MessageID) MarshalJSON ¶
func (*MessageID) UnmarshalJSON ¶
type MessageReference ¶
type MessageReference struct { // MessageID is the id of the originating message. MessageID MessageID `json:"message_id,omitempty"` // ChannelID is the id of the originating message's channel. ChannelID ChannelID `json:"channel_id,omitempty"` // GuildID is the id of the originating message's guild. GuildID GuildID `json:"guild_id,omitempty"` }
MessageReference is used in four situations:
Crosspost messages ¶
Messages that originated from another channel (IS_CROSSPOST flag). These messages have all three fields, with data of the original message that was crossposted.
Channel Follow Add messages ¶
Automatic messages sent when a channel is followed into the current channel (type 12). These messages have the ChannelID and GuildID fields, with data of the followed announcement channel.
Pin messages ¶
Automatic messages sent when a message is pinned (type 6). These messages have MessageID and ChannelID, and GuildID if it is in a guild, with data of the message that was pinned.
Replies ¶
Messages replying to a previous message (type 19). These messages have MessageID, and ChannelID, and GuildID if it is in a guild, with data of the message that was replied to. The ChannelID and GuildID will be the same as the reply.
Replies are created by including a message_reference when sending a message. When sending, only MessageID is required. https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
type MessageType ¶
type MessageType uint8
const ( DefaultMessage MessageType = iota RecipientAddMessage RecipientRemoveMessage CallMessage ChannelNameChangeMessage ChannelIconChangeMessage ChannelPinnedMessage GuildMemberJoinMessage NitroBoostMessage NitroTier1Message NitroTier2Message NitroTier3Message ChannelFollowAddMessage GuildDiscoveryDisqualifiedMessage GuildDiscoveryRequalifiedMessage GuildDiscoveryGracePeriodInitialWarning GuildDiscoveryGracePeriodFinalWarning // ThreadCreatedMessage is a new message sent to the parent GuildText // channel, used to inform users that a thread has been created. It is // currently only sent in one case: when a GuildPublicThread is created // from an older message (older is still TBD, but is currently set to a // very small value). The message contains a message reference with the // GuildID and ChannelID of the thread. The content of the message is the // name of the thread. ThreadCreatedMessage InlinedReplyMessage ApplicationCommandMessage // ThreadStarterMessage is a new message sent as the first message in // threads that are started from an existing message in the parent channel. // It only contains a message reference field that points to the message // from which the thread was started. ThreadStarterMessage GuildInviteReminderMessage )
https://discord.com/developers/docs/resources/channel#message-object-message-types
type Milliseconds ¶
type Milliseconds float64
Milliseconds is in float64 because some Discord events return time with a trailing decimal.
func DurationToMilliseconds ¶
func DurationToMilliseconds(dura time.Duration) Milliseconds
func (Milliseconds) Duration ¶
func (ms Milliseconds) Duration() time.Duration
func (Milliseconds) String ¶
func (ms Milliseconds) String() string
type NitroBoost ¶
type NitroBoost uint8
NitroBoost is the premium tier (Server Boost level).
const ( NoNitroLevel NitroBoost = iota NitroLevel1 NitroLevel2 NitroLevel3 )
https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
type Notification ¶
Notification is the default message notification level of a guild.
const ( // AllMessages sends notifications for all messages. AllMessages Notification = iota // OnlyMentions sends notifications only on mention. OnlyMentions )
https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
const NullNotification Notification = enum.Null
NullNotification serialized to JSON null. This should only be used on nullable fields.
func (Notification) MarshalJSON ¶
func (n Notification) MarshalJSON() ([]byte, error)
func (*Notification) UnmarshalJSON ¶
func (n *Notification) UnmarshalJSON(b []byte) error
type OptionalSeconds ¶
type OptionalSeconds = *Seconds
OptionalSeconds is the option type for Seconds.
func NewOptionalSeconds ¶
func NewOptionalSeconds(s Seconds) OptionalSeconds
NewOptionalSeconds creates a new OptionalSeconds using the value of the passed Seconds.
type OverboundError ¶
func (*OverboundError) Error ¶
func (e *OverboundError) Error() string
type Overwrite ¶
type Overwrite struct { // ID is the role or user id. ID Snowflake `json:"id"` // Type indicates the entity overwritten: role or member. Type OverwriteType `json:"type"` // Allow is a permission bit set for granted permissions. Allow Permissions `json:"allow,string"` // Deny is a permission bit set for denied permissions. Deny Permissions `json:"deny,string"` }
https://discord.com/developers/docs/resources/channel#overwrite-object
type OverwriteType ¶
type OverwriteType uint8
OverwriteType is an enumerated type to indicate the entity being overwritten: role or member
const ( // OverwriteRole is an overwrite for a role. OverwriteRole OverwriteType = iota // OverwriteMember is an overwrite for a member. OverwriteMember )
func (*OverwriteType) UnmarshalJSON ¶
func (otype *OverwriteType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshalls both a string-quoted number and a regular number into OverwriteType. We need to do this because Discord is so bad that they can't even handle 1s and 0s properly.
type Permissions ¶
type Permissions uint64
const ( // Allows creation of instant invites PermissionCreateInstantInvite Permissions = 1 << iota // Allows kicking members PermissionKickMembers // Allows banning members PermissionBanMembers // Allows all permissions and bypasses channel permission overwrites PermissionAdministrator // Allows management and editing of channels PermissionManageChannels // Allows management and editing of the guild PermissionManageGuild // Allows for the addition of reactions to messages PermissionAddReactions // Allows for viewing of audit logs PermissionViewAuditLog // Allows for using priority speaker in a voice channel PermissionPrioritySpeaker // Allows the user to go live PermissionStream // Allows guild members to view a channel, which includes reading messages // in text channels PermissionViewChannel // Allows for sending messages in a channel PermissionSendMessages // Allows for sending of /tts messages PermissionSendTTSMessages // Allows for deletion of other users messages PermissionManageMessages // Links sent by users with this permission will be auto-embedded PermissionEmbedLinks // Allows for uploading images and files PermissionAttachFiles // Allows for reading of message history PermissionReadMessageHistory // Allows for using the @everyone tag to notify all users in a channel, // and the @here tag to notify all online users in a channel PermissionMentionEveryone // Allows the usage of custom emojis from other servers PermissionUseExternalEmojis // Allows for joining of a voice channel PermissionConnect // Allows for speaking in a voice channel PermissionSpeak // Allows for muting members in a voice channel PermissionMuteMembers // Allows for deafening of members in a voice channel PermissionDeafenMembers // Allows for moving of members between voice channels PermissionMoveMembers // Allows for using voice-activity-detection in a voice channel PermissionUseVAD // Allows for modification of own nickname PermissionChangeNickname // Allows for modification of other users nicknames PermissionManageNicknames // Allows management and editing of roles PermissionManageRoles // Allows management and editing of webhooks PermissionManageWebhooks // Allows members to use slash commands in text channels PermissionManageEmojisAndStickers // Allows members to use slash commands in text channels PermissionUseSlashCommands // Allows for requesting to speak in stage channels. (This permission is // under active development and may be changed or removed.) PermissionRequestToSpeak // Allows for deleting and archiving threads, and viewing all private // threads PermissionManageThreads // Allows for creating and participating in threads. PermissionUsePublicThreads // Allows for creating and participating in private threads. PermissionUsePrivateThreads // Allows the usage of custom stickers from other servers PermissionUseExternalStickers PermissionAllText = 0 | PermissionViewChannel | PermissionSendMessages | PermissionSendTTSMessages | PermissionManageMessages | PermissionEmbedLinks | PermissionAttachFiles | PermissionReadMessageHistory | PermissionMentionEveryone | PermissionUseExternalEmojis | PermissionUseSlashCommands | PermissionUsePublicThreads | PermissionUsePrivateThreads | PermissionUseExternalStickers PermissionAllVoice = 0 | PermissionViewChannel | PermissionConnect | PermissionSpeak | PermissionStream | PermissionMuteMembers | PermissionDeafenMembers | PermissionMoveMembers | PermissionUseVAD | PermissionPrioritySpeaker | PermissionRequestToSpeak PermissionAllChannel = 0 | PermissionAllText | PermissionAllVoice | PermissionCreateInstantInvite | PermissionManageRoles | PermissionManageChannels | PermissionAddReactions | PermissionViewAuditLog PermissionAll = 0 | PermissionAllChannel | PermissionKickMembers | PermissionBanMembers | PermissionManageGuild | PermissionAdministrator | PermissionManageWebhooks | PermissionManageEmojisAndStickers | PermissionManageNicknames | PermissionChangeNickname | PermissionManageThreads )
https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
func CalcOverwrites ¶
func CalcOverwrites(guild Guild, channel Channel, member Member) Permissions
func (Permissions) Add ¶
func (p Permissions) Add(perm Permissions) Permissions
func (Permissions) Has ¶
func (p Permissions) Has(perm Permissions) bool
type Presence ¶
type Presence struct { // User is the user presence is being updated for. Only the ID field is // guaranteed to be valid per Discord documentation. User User `json:"user"` // GuildID is the id of the guild GuildID GuildID `json:"guild_id"` // Status is either "idle", "dnd", "online", or "offline". Status Status `json:"status"` // Activities are the user's current activities. Activities []Activity `json:"activities"` // ClientStatus is the user's platform-dependent status. ClientStatus ClientStatus `json:"client_status"` }
Presence represents a partial Presence structure used by other structs to be easily embedded. It does not contain any ID to identify who it belongs to. For more information, refer to the PresenceUpdateEvent struct.
type PrivacyLevel ¶
type PrivacyLevel int
const ( // PublicStage is used if a StageInstance instance is visible publicly, such as on // StageInstance discovery. PublicStage PrivacyLevel = iota + 1 // GuildOnlyStage is used if a StageInstance instance is visible to only guild // members. GuildOnlyStage )
https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
type Reaction ¶
type Reaction struct { // Count is the amount of times the emoji has been used to react. Count int `json:"count"` // Me specifies whether the current user reacted using this emoji. Me bool `json:"me"` // Emoji contains emoji information. Emoji Emoji `json:"emoji"` }
https://discord.com/developers/docs/resources/channel#reaction-object
type Relationship ¶
type Relationship struct { UserID UserID `json:"id"` User User `json:"user"` Type RelationshipType `json:"type"` }
A Relationship between the logged in user and the user in the struct. This struct is undocumented.
type RelationshipType ¶
type RelationshipType uint8
RelationshipType is an enum for a relationship.
const ( FriendRelationship RelationshipType BlockedRelationship IncomingFriendRequest SentFriendRequest )
type Role ¶
type Role struct { // ID is the role id. ID RoleID `json:"id"` // Name is the role name. Name string `json:"name"` // Permissions is the permission bit set. Permissions Permissions `json:"permissions,string"` // Position is the position of this role. Position int `json:"position"` // Color is the integer representation of hexadecimal color code. Color Color `json:"color"` // Hoist specifies if this role is pinned in the user listing. Hoist bool `json:"hoist"` // Manages specifies whether this role is managed by an integration. Managed bool `json:"managed"` // Mentionable specifies whether this role is mentionable. Mentionable bool `json:"mentionable"` }
https://discord.com/developers/docs/topics/permissions#role-object
type Seconds ¶
type Seconds int
func DurationToSeconds ¶
func (Seconds) MarshalJSON ¶
func (*Seconds) UnmarshalJSON ¶
type SelectComponent ¶
type SelectComponent struct { CustomID string `json:"custom_id"` Options []SelectComponentOption `json:"options"` Placeholder string `json:"placeholder,omitempty"` MinValues option.Int `json:"min_values,omitempty"` MaxValues int `json:"max_values,omitempty"` Disabled bool `json:"disabled,omitempty"` }
SelectComponent is a clickable button that may be added to an interaction response.
func (SelectComponent) MarshalJSON ¶
func (s SelectComponent) MarshalJSON() ([]byte, error)
MarshalJSON marshals the select in the format Discord expects.
func (*SelectComponent) Type ¶
func (*SelectComponent) Type() ComponentType
Type implements the Component interface.
type SelectComponentOption ¶
type SelectComponentOption struct { Label string `json:"label"` Value string `json:"value"` Description string `json:"description,omitempty"` Emoji *ButtonEmoji `json:"emoji,omitempty"` Default bool `json:"default,omitempty"` }
type Snowflake ¶
type Snowflake uint64
func NewSnowflake ¶
func ParseSnowflake ¶
func (Snowflake) MarshalJSON ¶
func (*Snowflake) UnmarshalJSON ¶
type StageInstance ¶
type StageInstance struct { // ID is the id of this Stage instance. ID StageID `json:"id"` // GuildID is the guild id of the associated Stage channel. GuildID GuildID `json:"guild_id"` // ChannelID is the id of the associated Stage channel. ChannelID ChannelID `json:"channel_id"` // Topic is the topic of the Stage instance (1-120 characters). Topic string `json:"topic"` // PrivacyLevel is the privacy level of the Stage instance. PrivacyLevel PrivacyLevel `json:"privacy_level"` // NotDiscoverable defines whether or not Stage discovery is disabled. NotDiscoverable bool `json:"discoverable_disabled"` }
A StageInstance holds information about a live stage instance.
https://discord.com/developers/docs/resources/stage-instance#stage-instance-object
type Sticker ¶
type Sticker struct { // ID is the ID of the sticker. ID StickerID `json:"id"` // PackID is the ID of the pack the sticker is from. PackID StickerPackID `json:"pack_id,omitempty"` // Name is the name of the sticker. Name string `json:"name"` // Description is the description of the sticker. Description string `json:"description"` // Tags is a comma-delimited list of tags for the sticker. To get the list // as a slice, use TagList. Tags string `json:"tags"` // Type is the type of sticker. Type StickerType `json:"type"` // FormatType is the type of sticker format. FormatType StickerFormatType `json:"format_type"` // Available specifies whether this guild sticker can be used, may be false due to loss of Server Boosts. Available bool `json:"available,omitempty"` // GuildID is the id of the guild that owns this sticker. GuildID GuildID `json:"guild_id,omitempty"` // User is the user that uploaded the guild sticker User *User `json:"user,omitempty"` // SortValue is the standard sticker's sort order within its pack. SortValue *int `json:"sort_value,omitempty"` }
https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
func (Sticker) CreatedAt ¶
CreatedAt returns a time object representing when the sticker was created.
func (Sticker) PackCreatedAt ¶
PackCreatedAt returns a time object representing when the sticker's pack was created.
type StickerFormatType ¶
type StickerFormatType uint8
type StickerID ¶
type StickerID Snowflake
func (StickerID) MarshalJSON ¶
func (*StickerID) UnmarshalJSON ¶
type StickerPackID ¶
type StickerPackID Snowflake
func (StickerPackID) Increment ¶
func (s StickerPackID) Increment() uint16
func (StickerPackID) IsNull ¶
func (s StickerPackID) IsNull() bool
func (StickerPackID) IsValid ¶
func (s StickerPackID) IsValid() bool
func (StickerPackID) MarshalJSON ¶
func (s StickerPackID) MarshalJSON() ([]byte, error)
func (StickerPackID) PID ¶
func (s StickerPackID) PID() uint8
func (StickerPackID) String ¶
func (s StickerPackID) String() string
func (StickerPackID) Time ¶
func (s StickerPackID) Time() time.Time
func (*StickerPackID) UnmarshalJSON ¶
func (s *StickerPackID) UnmarshalJSON(v []byte) error
func (StickerPackID) Worker ¶
func (s StickerPackID) Worker() uint8
type StickerType ¶
type StickerType int
const ( // StandardSticker is an official sticker in a pack, part of Nitro or in a removed purchasable pack. StandardSticker StickerType = iota + 1 // GuildSticker is a sticker uploaded to a boosted guild for the guild's members. GuildSticker )
https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
type SystemChannelFlags ¶
type SystemChannelFlags uint8
const ( // SuppressJoinNotifications suppresses member join notifications. SuppressJoinNotifications SystemChannelFlags = 1 << iota // SuppressPremiumSubscriptions suppresses server boost notifications. SuppressPremiumSubscriptions )
https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
type ThreadMember ¶
type ThreadMember struct { // ID is the id of the thread. // // This field will be omitted on the member sent within each thread in the // guild create event. ID ChannelID `json:"id,omitempty"` // UserID is the id of the user. // // This field will be omitted on the member sent within each thread in the // guild create event. UserID UserID `json:"user_id,omitempty"` // Member is the member, only included in Thread Members Update Events. Member *Member `json:"member,omitempty"` // Presence is the presence, only included in Thread Members Update Events. Presence *Presence `json:"presence,omitempty"` // JoinTimestamp is the time the current user last joined the thread. JoinTimestamp Timestamp `json:"join_timestamp"` // Flags are any user-thread settings. Flags ThreadMemberFlags `json:"flags"` }
type ThreadMemberFlags ¶
type ThreadMemberFlags uint64
ThreadMemberFlags are the flags of a ThreadMember. Currently, none are documented.
type ThreadMetadata ¶
type ThreadMetadata struct { // Archived specifies whether the thread is archived. Archived bool `json:"archived"` // AutoArchiveDuration is the duration in minutes to automatically archive // the thread after recent activity. AutoArchiveDuration ArchiveDuration `json:"auto_archive_duration"` // ArchiveTimestamp timestamp when the thread's archive status was last // changed, used for calculating recent activity. ArchiveTimestamp Timestamp `json:"archive_timestamp"` // Locked specifies whether the thread is locked; when a thread is locked, // only users with MANAGE_THREADS can unarchive it. Locked bool `json:"locked"` // Invitable specifies whether non-moderators can add other // non-moderators to a thread; only available on private threads. Invitable bool `json:"invitable,omitempty"` }
ThreadMetadata contains a number of thread-specific channel fields that are not needed by other channel types.
https://discord.com/developers/docs/resources/channel#thread-metadata-object
type Timestamp ¶
Timestamp has a valid zero-value, which can be checked using the IsValid() method. This is useful for optional timestamps such as EditedTimestamp.
func NewTimestamp ¶
func NowTimestamp ¶
func NowTimestamp() Timestamp
func (Timestamp) MarshalJSON ¶
MarshalJSON returns null if Timestamp is not valid (zero). It returns the time formatted in RFC3339 otherwise.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON parses a nullable RFC3339 string into time.
type UnixMsTimestamp ¶
type UnixMsTimestamp int64
func TimeToMilliseconds ¶
func TimeToMilliseconds(t time.Time) UnixMsTimestamp
func (UnixMsTimestamp) String ¶
func (t UnixMsTimestamp) String() string
func (UnixMsTimestamp) Time ¶
func (t UnixMsTimestamp) Time() time.Time
type UnixTimestamp ¶
type UnixTimestamp int64
func (UnixTimestamp) String ¶
func (t UnixTimestamp) String() string
func (UnixTimestamp) Time ¶
func (t UnixTimestamp) Time() time.Time
type UnknownComponent ¶
UnknownComponent is reserved for components with unknown or not yet implemented components types.
func (*UnknownComponent) Type ¶
func (u *UnknownComponent) Type() ComponentType
Type implements the Component interface.
type UnknownInteractionData ¶
func (*UnknownInteractionData) Type ¶
func (u *UnknownInteractionData) Type() InteractionType
type User ¶
type User struct { ID UserID `json:"id"` Username string `json:"username"` Discriminator string `json:"discriminator"` Avatar Hash `json:"avatar"` Bot bool `json:"bot,omitempty"` MFA bool `json:"mfa_enabled,omitempty"` Nitro UserNitro `json:"premium_type,omitempty"` Flags UserFlags `json:"flags,omitempty"` PublicFlags UserFlags `json:"public_flags,omitempty"` DiscordSystem bool `json:"system,omitempty"` EmailVerified bool `json:"verified,omitempty"` Locale string `json:"locale,omitempty"` Email string `json:"email,omitempty"` Banner Hash `json:"banner,omitempty"` Accent Color `json:"accent_color,omitempty"` }
func (User) AvatarURL ¶
AvatarURL returns the URL of the Avatar Image. It automatically detects a suitable type.
func (User) AvatarURLWithType ¶
AvatarURLWithType returns the URL of the Avatar Image using the passed type. If the user has no Avatar, his default avatar will be returned. This requires ImageType Auto or PNG
Supported Image Types: PNG, JPEG, WebP, GIF (read above for caveat)
func (User) BannerURL ¶
BannerURL returns the URL of the Banner Image. It automatically detects a suitable type.
func (User) BannerURLWithType ¶
BannerURLWithType returns the URL of the Banner Image using the passed type. If the user has no Banner, an empty string will be returned.
type Verification ¶
Verification is the verification level required for a guild.
const ( // NoVerification required no verification. NoVerification Verification = iota // LowVerification requires a verified email LowVerification // MediumVerification requires the user be registered for at least 5 // minutes. MediumVerification // HighVerification requires the member be in the server for more than 10 // minutes. HighVerification // VeryHighVerification requires the member to have a verified phone // number. VeryHighVerification )
https://discord.com/developers/docs/resources/guild#guild-object-verification-level
const NullVerification Verification = enum.Null
NullVerification serialized to JSON null. This should only be used on nullable fields.
func (Verification) MarshalJSON ¶
func (v Verification) MarshalJSON() ([]byte, error)
func (*Verification) UnmarshalJSON ¶
func (v *Verification) UnmarshalJSON(b []byte) error
type VideoQualityMode ¶
type VideoQualityMode uint8
const ( AutoVideoQuality VideoQualityMode = iota + 1 FullVideoQuality )
https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
type VoiceRegion ¶
type VoiceState ¶
type VoiceState struct { // GuildID isn't available from the Guild struct. GuildID GuildID `json:"guild_id"` ChannelID ChannelID `json:"channel_id"` UserID UserID `json:"user_id"` Member *Member `json:"member,omitempty"` 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,omitempty"` Suppress bool `json:"suppress"` }
type Webhook ¶
type Webhook struct { // ID is the id of the webhook. ID WebhookID `json:"id"` // Type is the WebhookType of the webhook. Type WebhookType `json:"type"` // GuildID is the guild id this webhook is for, if any. GuildID GuildID `json:"guild_id,omitempty"` // ChannelID is the channel id this webhook is for, if any. ChannelID ChannelID `json:"channel_id"` // User is the user this webhook was created by. // // This field is not returned when getting a webhook with its token. User *User `json:"user,omitempty"` // Name is the default name of the webhook. Name string `json:"name"` // Avatar is the default user avatar hash of the webhook. Avatar Hash `json:"avatar"` // Token is the secure token of the webhook, returned for incoming // webhooks. Token string `json:"token,omitempty"` // ApplicationID is the bot/OAuth2 application that created this webhook. ApplicationID AppID `json:"application_id"` // SourceGuild is the guild of the channel that this webhook is following. // It is returned for channel follower webhooks. // // This field will only be filled partially. SourceGuild *Guild `json:"source_guild,omitempty"` // SourceChannel is the channel that this webhook is following. It is // returned for channel follower webhooks. // // This field will only be filled partially. SourceChannel *Channel `json:"source_channel,omitempty"` // URL is the url used for executing the webhook. It is returned by the // webhooks OAuth2 flow. URL URL `json:"url,omitempty"` }
Webhook is used to represent a webhook.
https://discord.com/developers/docs/resources/webhook#webhook-object
type WebhookID ¶
type WebhookID Snowflake
func (WebhookID) MarshalJSON ¶
func (*WebhookID) UnmarshalJSON ¶
type WebhookType ¶
type WebhookType uint8
const ( IncomingWebhook WebhookType ChannelFollowerWebhook )