Documentation ¶
Index ¶
- Constants
- type Activity
- type ActivityAssets
- type ActivityEmoji
- type ActivityFlag
- type ActivityParty
- type ActivitySecrets
- type ActivityTimestamp
- type ActivityType
- type Attachment
- type AttachmentArray
- type Ban
- type Channel
- type ChannelType
- type ClientStatus
- type DefaultMessageNotificationLvl
- type Discriminator
- type Embed
- type EmbedArray
- type EmbedAuthor
- type EmbedField
- type EmbedFieldArray
- type EmbedFooter
- type EmbedImage
- type EmbedProvider
- type EmbedThumbnail
- type EmbedType
- type EmbedVideo
- type Emoji
- type EmojiArr
- type ErrorUnsupportedType
- type ExplicitContentFilterLvl
- type Guild
- type GuildEmbed
- type GuildUnavailable
- type ID
- type Integration
- type IntegrationAccount
- type MFALvl
- type Member
- type MentionChannel
- type MentionChannelArr
- type Mentioner
- type Message
- type MessageActivity
- type MessageApplication
- type MessageFlag
- type MessageReference
- type MessageSticker
- type MessageStickerArr
- type MessageStickerFormatType
- type MessageType
- type PartialBan
- type PartialChannel
- type PartialEmoji
- type PermissionBit
- type PermissionOverwrite
- type PermissionOverwriteType
- type PremiumTier
- type PremiumType
- type Reaction
- type ReactionArr
- type Role
- type Snowflake
- func (s Snowflake) Date() time.Time
- func (s Snowflake) HexPrettyString() string
- func (s Snowflake) HexString() string
- func (s Snowflake) IsZero() bool
- func (s Snowflake) MarshalBinary() (data []byte, err error)
- func (s Snowflake) MarshalJSON() (data []byte, err error)
- func (s Snowflake) MarshalText() (text []byte, err error)
- func (s Snowflake) String() string
- func (s Snowflake) ToOptionalProto() *model.SnowflakeValue
- func (s Snowflake) ToProto() uint64
- func (s *Snowflake) UnmarshalBinary(text []byte) (err error)
- func (s *Snowflake) UnmarshalJSON(data []byte) (err error)
- func (s *Snowflake) UnmarshalText(text []byte) (err error)
- func (s Snowflake) Valid() bool
- type SnowflakeArray
- type Time
- type User
- type UserArr
- type UserConnection
- type UserFlag
- type UserPresence
- type VerificationLvl
- type VoiceRegion
- type VoiceState
Constants ¶
const ( PermissionOverwriteTypeRole uint8 = iota PermissionOverwriteTypeMember )
Deprecated: use PermissionOverwrite* instead (note the Type keyword is removed) PermissionOverwriteTypeMember => PermissionOverwriteMember
const ( PermissionCreateInstantInvite PermissionBit = 1 << iota PermissionKickMembers PermissionBanMembers PermissionAdministrator PermissionManageChannels PermissionManageServer PermissionAddReactions PermissionViewAuditLogs PermissionTextAll = PermissionReadMessages | PermissionSendMessages | PermissionSendTTSMessages | PermissionManageMessages | PermissionEmbedLinks | PermissionAttachFiles | PermissionReadMessageHistory | PermissionMentionEveryone PermissionAllVoice = PermissionVoiceConnect | PermissionVoiceSpeak | PermissionVoiceMuteMembers | PermissionVoiceDeafenMembers | PermissionVoiceMoveMembers | PermissionVoiceUseVAD PermissionChannelAll = PermissionTextAll | PermissionAllVoice | PermissionCreateInstantInvite | PermissionManageRoles | PermissionManageChannels | PermissionAddReactions | PermissionViewAuditLogs PermissionAll = PermissionChannelAll | PermissionKickMembers | PermissionBanMembers | PermissionManageServer | PermissionAdministrator )
Constants for the different bit offsets of general permissions
const ( MessageActivityTypeJoin MessageActivityTypeSpectate MessageActivityTypeListen MessageActivityTypeJoinRequest )
different message activity types
const (
AttachmentSpoilerPrefix = "SPOILER_"
)
const (
EpochDiscord uint64 = 1420070400000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct { Name string `json:"name"` Type ActivityType `json:"type"` URL string `json:"url,omitempty"` CreatedAt int `json:"created_at"` Timestamps *ActivityTimestamp `json:"timestamps,omitempty"` ApplicationID Snowflake `json:"application_id,omitempty"` Details string `json:"details,omitempty"` State string `json:"state,omitempty"` Emoji *ActivityEmoji `json:"emoji,omitempty"` Party *ActivityParty `json:"party,omitempty"` Assets *ActivityAssets `json:"assets,omitempty"` Secrets *ActivitySecrets `json:"secrets,omitempty"` Instance bool `json:"instance,omitempty"` Flags ActivityFlag `json:"flags,omitempty"` }
Activity https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
type ActivityAssets ¶
type ActivityAssets struct { LargeImage string `json:"large_image,omitempty"` // the id for a large asset of the activity, usually a snowflake LargeText string `json:"large_text,omitempty"` //text displayed when hovering over the large image of the activity SmallImage string `json:"small_image,omitempty"` // the id for a small asset of the activity, usually a snowflake SmallText string `json:"small_text,omitempty"` // text displayed when hovering over the small image of the activity }
ActivityAssets ...
type ActivityEmoji ¶
type ActivityEmoji struct { Name string `json:"name"` ID Snowflake `json:"id,omitempty"` Animated bool `json:"animated,omitempty"` }
ActivityEmoji ...
type ActivityFlag ¶
type ActivityFlag uint
ActivityFlag https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
const ( ActivityFlagInstance ActivityFlag = 1 << iota ActivityFlagJoin ActivityFlagSpectate ActivityFlagJoinRequest ActivityFlagSync ActivityFlagPlay )
flags for the Activity object to signify the type of action taken place
type ActivityParty ¶
type ActivityParty struct { ID string `json:"id,omitempty"` // the id of the party Size []int `json:"size,omitempty"` // used to show the party's current and maximum size }
ActivityParty ...
type ActivitySecrets ¶
type ActivitySecrets struct { Join string `json:"join,omitempty"` // the secret for joining a party Spectate string `json:"spectate,omitempty"` // the secret for spectating a game Match string `json:"match,omitempty"` // the secret for a specific instanced match }
ActivitySecrets ...
type ActivityTimestamp ¶
type ActivityTimestamp struct { Start int `json:"start,omitempty"` // unix time (in milliseconds) of when the activity started End int `json:"end,omitempty"` // unix time (in milliseconds) of when the activity ends }
ActivityTimestamp ...
type ActivityType ¶
type ActivityType uint
ActivityType https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
const ( ActivityTypeGame ActivityType = iota ActivityTypeStreaming ActivityTypeListening ActivityTypeCustom ActivityTypeCompeting )
type Attachment ¶
type Attachment struct { ID Snowflake `json:"id"` Filename string `json:"filename"` Size uint `json:"size"` URL string `json:"url"` ProxyURL string `json:"proxy_url"` Height uint `json:"height"` Width uint `json:"width"` SpoilerTag bool `json:"-"` }
Attachment https://discord.com/developers/docs/resources/channel#attachment-object
func (Attachment) ToProto ¶
func (a Attachment) ToProto() *model.MessageData_MessageAttachmentData
type AttachmentArray ¶
type AttachmentArray []*Attachment
func (AttachmentArray) ToProto ¶
func (a AttachmentArray) ToProto() []*model.MessageData_MessageAttachmentData
type Channel ¶
type Channel struct { ID Snowflake `json:"id"` Type ChannelType `json:"type"` GuildID Snowflake `json:"guild_id,omitempty"` Position int `json:"position,omitempty"` // can be less than 0 PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites,omitempty"` Name string `json:"name,omitempty"` Topic string `json:"topic,omitempty"` NSFW bool `json:"nsfw,omitempty"` LastMessageID Snowflake `json:"last_message_id,omitempty"` Bitrate uint `json:"bitrate,omitempty"` UserLimit uint `json:"user_limit,omitempty"` RateLimitPerUser uint `json:"rate_limit_per_user,omitempty"` Recipients []*User `json:"recipients,omitempty"` // empty if not DM/GroupDM Icon string `json:"icon,omitempty"` OwnerID Snowflake `json:"owner_id,omitempty"` ApplicationID Snowflake `json:"application_id,omitempty"` ParentID Snowflake `json:"parent_id,omitempty"` LastPinTimestamp Time `json:"last_pin_timestamp,omitempty"` }
Channel ...
type ChannelType ¶
type ChannelType uint
Channel types https://discord.com/developers/docs/resources/channel#channel-object-channel-types
const ( ChannelTypeGuildText ChannelType = iota ChannelTypeDM ChannelTypeGuildVoice ChannelTypeGroupDM ChannelTypeGuildCategory ChannelTypeGuildNews ChannelTypeGuildStore )
type ClientStatus ¶
type DefaultMessageNotificationLvl ¶
type DefaultMessageNotificationLvl uint
DefaultMessageNotificationLvl ... https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
const ( DefaultMessageNotificationLvlAllMessages DefaultMessageNotificationLvl = iota DefaultMessageNotificationLvlOnlyMentions )
different notification levels on new messages
func (*DefaultMessageNotificationLvl) AllMessages ¶
func (dmnl *DefaultMessageNotificationLvl) AllMessages() bool
AllMessages ...
func (*DefaultMessageNotificationLvl) OnlyMentions ¶
func (dmnl *DefaultMessageNotificationLvl) OnlyMentions() bool
OnlyMentions ...
type Discriminator ¶
type Discriminator uint16
Discriminator value
func NewDiscriminator ¶
func NewDiscriminator(d string) (discriminator Discriminator, err error)
NewDiscriminator Discord user discriminator hashtag
func (Discriminator) MarshalJSON ¶
func (d Discriminator) MarshalJSON() (data []byte, err error)
MarshalJSON see interface json.Marshaler
func (Discriminator) NotSet ¶
func (d Discriminator) NotSet() bool
NotSet checks if the discriminator is not set
func (Discriminator) String ¶
func (d Discriminator) String() (str string)
func (*Discriminator) UnmarshalJSON ¶
func (d *Discriminator) UnmarshalJSON(data []byte) error
UnmarshalJSON see interface json.Unmarshaler
type Embed ¶
type Embed struct { Title string `json:"title,omitempty"` // title of embed Type EmbedType `json:"type,omitempty"` // type of embed (always "rich" for webhook embeds) Description string `json:"description,omitempty"` // description of embed URL string `json:"url,omitempty"` // url of embed Timestamp Time `json:"timestamp,omitempty"` // timestamp timestamp of embed content Color int `json:"color,omitempty"` // color code of the embed Image *EmbedImage `json:"image,omitempty"` // embed image object image information Thumbnail *EmbedThumbnail `json:"thumbnail,omitempty"` // embed thumbnail object thumbnail information Video *EmbedVideo `json:"video,omitempty"` // embed video object video information Provider *EmbedProvider `json:"provider,omitempty"` // embed provider object provider information Author *EmbedAuthor `json:"author,omitempty"` // embed author object author information Fields EmbedFieldArray `json:"fields,omitempty"` // array of embed field objects fields information }
Embed https://discord.com/developers/docs/resources/channel#embed-object
func (Embed) ToProto ¶
func (e Embed) ToProto() *model.MessageData_MessageEmbedData
type EmbedArray ¶
type EmbedArray []*Embed
func (EmbedArray) ToProto ¶
func (a EmbedArray) ToProto() []*model.MessageData_MessageEmbedData
type EmbedAuthor ¶
type EmbedAuthor struct { Name string `json:"name,omitempty"` // ?| , name of author URL string `json:"url,omitempty"` // ?| , url of author IconURL string `json:"icon_url,omitempty"` // ?| , url of author icon (only supports http(s) and attachments) ProxyIconURL string `json:"proxy_icon_url,omitempty"` // ?| , a proxied url of author icon }
EmbedAuthor https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
func (*EmbedAuthor) ToProto ¶
func (e *EmbedAuthor) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedAuthorData
type EmbedField ¶
type EmbedField struct { Name string `json:"name"` // | , name of the field Value string `json:"value"` // | , value of the field Inline bool `json:"inline,omitempty"` // ?| , whether or not this field should display inline }
EmbedField https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
func (*EmbedField) ToProto ¶
func (e *EmbedField) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedFieldData
type EmbedFieldArray ¶
type EmbedFieldArray []*EmbedField
func (EmbedFieldArray) ToProto ¶
func (a EmbedFieldArray) ToProto() []*model.MessageData_MessageEmbedData_MessageEmbedFieldData
type EmbedFooter ¶
type EmbedFooter struct {}
EmbedFooter https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
func (*EmbedFooter) ToProto ¶
func (e *EmbedFooter) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedFooterData
type EmbedImage ¶
type EmbedImage struct { URL string `json:"url,omitempty"` // ?| , source url of image (only supports http(s) and attachments) ProxyURL string `json:"proxy_url,omitempty"` // ?| , a proxied url of the image Height int `json:"height,omitempty"` // ?| , height of image Width int `json:"width,omitempty"` // ?| , width of image }
EmbedImage https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
func (*EmbedImage) ToProto ¶
func (e *EmbedImage) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedImageData
type EmbedProvider ¶
type EmbedProvider struct { Name string `json:"name,omitempty"` // ?| , name of provider URL string `json:"url,omitempty"` // ?| , url of provider }
EmbedProvider https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure
func (*EmbedProvider) ToProto ¶
func (e *EmbedProvider) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedProviderData
type EmbedThumbnail ¶
type EmbedThumbnail struct { URL string `json:"url,omitempty"` // ?| , source url of image (only supports http(s) and attachments) ProxyURL string `json:"proxy_url,omitempty"` // ?| , a proxied url of the image Height int `json:"height,omitempty"` // ?| , height of image Width int `json:"width,omitempty"` // ?| , width of image }
EmbedThumbnail https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
func (*EmbedThumbnail) ToProto ¶
func (e *EmbedThumbnail) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedThumbnailData
type EmbedType ¶
type EmbedType string
func (EmbedType) ToProto ¶
func (e EmbedType) ToProto() model.MessageData_MessageEmbedData_MessageEmbedType
type EmbedVideo ¶
type EmbedVideo struct { URL string `json:"url,omitempty"` // ?| , source url of video Height int `json:"height,omitempty"` // ?| , height of video Width int `json:"width,omitempty"` // ?| , width of video }
EmbedVideo https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
func (*EmbedVideo) ToProto ¶
func (e *EmbedVideo) ToProto() *model.MessageData_MessageEmbedData_MessageEmbedVideoData
type Emoji ¶
type Emoji struct { ID Snowflake `json:"id"` Name string `json:"name"` Roles SnowflakeArray `json:"roles,omitempty"` User *User `json:"user,omitempty"` // the user who created the emoji RequireColons bool `json:"require_colons,omitempty"` Managed bool `json:"managed,omitempty"` Animated bool `json:"animated,omitempty"` Available bool `json:"available,omitempty"` }
Emoji ...
func (*Emoji) ToMessageProto ¶
func (u *Emoji) ToMessageProto() *model.MessageData_MessageReactionEmojiData
type ErrorUnsupportedType ¶
type ErrorUnsupportedType struct {
// contains filtered or unexported fields
}
ErrorUnsupportedType used when the given param type is not supported
func (*ErrorUnsupportedType) Error ¶
func (e *ErrorUnsupportedType) Error() string
type ExplicitContentFilterLvl ¶
type ExplicitContentFilterLvl uint
ExplicitContentFilterLvl ... https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
const ( ExplicitContentFilterLvlDisabled ExplicitContentFilterLvl = iota ExplicitContentFilterLvlMembersWithoutRoles ExplicitContentFilterLvlAllMembers )
Explicit content filter levels
func (*ExplicitContentFilterLvl) AllMembers ¶
func (ecfl *ExplicitContentFilterLvl) AllMembers() bool
AllMembers if the filter applies for all members regardles of them having a role or not
func (*ExplicitContentFilterLvl) Disabled ¶
func (ecfl *ExplicitContentFilterLvl) Disabled() bool
Disabled if the content filter is disabled
func (*ExplicitContentFilterLvl) MembersWithoutRoles ¶
func (ecfl *ExplicitContentFilterLvl) MembersWithoutRoles() bool
MembersWithoutRoles if the filter only applies for members without a role
type Guild ¶
type Guild struct { ID Snowflake `json:"id"` ApplicationID Snowflake `json:"application_id"` // |? Name string `json:"name" merge:"true"` Icon string `json:"icon" merge:"true"` // |?, icon hash Splash string `json:"splash" merge:"true"` // |?, image hash Owner bool `json:"owner,omitempty"` // ?| OwnerID Snowflake `json:"owner_id" merge:"true"` Permissions PermissionBit `json:"permissions,omitempty"` // ?|, permission flags for connected user `/users/@me/guilds` Region string `json:"region" merge:"true"` AfkChannelID Snowflake `json:"afk_channel_id" merge:"true"` // |? AfkTimeout uint `json:"afk_timeout" merge:"true"` VerificationLevel VerificationLvl `json:"verification_level" merge:"true"` DefaultMessageNotifications DefaultMessageNotificationLvl `json:"default_message_notifications" merge:"true"` ExplicitContentFilter ExplicitContentFilterLvl `json:"explicit_content_filter" merge:"true"` Roles []*Role `json:"roles"` Emojis []*Emoji `json:"emojis" merge:"true"` Features []string `json:"features" merge:"true"` MFALevel MFALvl `json:"mfa_level" merge:"true"` WidgetEnabled bool `json:"widget_enabled,omit_empty" merge:"true"` // | WidgetChannelID Snowflake `json:"widget_channel_id,omit_empty" merge:"true"` // |? SystemChannelID Snowflake `json:"system_channel_id,omitempty" merge:"true"` // |? DiscoverySplash string `json:"discovery_splash,omitempty" merge:"true"` VanityUrl string `json:"vanity_url_code,omitempty" merge:"true"` Description string `json:"description,omitempty" merge:"true"` Banner string `json:"banner,omitempty" merge:"true"` PremiumTier PremiumTier `json:"premium_tier" merge:"true"` PremiumSubscriptionCount uint `json:"premium_subscription_count,omitempty" merge:"true"` MaxPresences uint `json:"max_presences,omitempty" merge:"true"` MaxMembers uint `json:"max_members,omitempty" merge:"true"` PublicUpdatesChannel Snowflake `json:"public_updates_channel_id,omitempty" merge:"true"` RulesChannel Snowflake `json:"rules_channel_id,omitempty" merge:"true"` JoinedAt *Time `json:"joined_at,omitempty" merge:"true"` // ?*| Large bool `json:"large,omitempty" merge:"true"` // ?*| MemberCount uint `json:"member_count,omitempty"` // ?*| VoiceStates []*VoiceState `json:"voice_states,omitempty"` // ?*| Members []*Member `json:"members,omitempty"` // ?*| Channels []*Channel `json:"channels,omitempty"` // ?*| Presences []*UserPresence `json:"presences,omitempty"` // ?*| }
Guild Guilds in Discord represent an isolated collection of Users and Channels,
and are often referred to as "servers" in the UI.
https://discord.com/developers/docs/resources/guild#guild-object Fields with `*` are only sent within the GUILD_CREATE event reviewed: 2018-08-25 ++gen_merge
type GuildUnavailable ¶
type GuildUnavailable struct {}
GuildUnavailable is a partial Guild object.
func (GuildUnavailable) ToProto ¶
func (g GuildUnavailable) ToProto() *model.GuildData
type Integration ¶
type Integration struct { ID Snowflake `json:"id"` Name string `json:"name"` Type string `json:"type"` Enabled bool `json:"enabled"` Syncing bool `json:"syncing"` RoleID Snowflake `json:"role_id"` ExpireBehavior int `json:"expire_behavior"` ExpireGracePeriod int `json:"expire_grace_period"` User *User `json:"user"` Account *IntegrationAccount `json:"account"` }
Integration https://discord.com/developers/docs/resources/guild#integration-object
type IntegrationAccount ¶
type IntegrationAccount struct { ID string `json:"id"` // id of the account Name string `json:"name"` // name of the account }
IntegrationAccount https://discord.com/developers/docs/resources/guild#integration-account-object
type MFALvl ¶
type MFALvl uint
MFALvl ... https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
type Member ¶
type Member struct { GuildID Snowflake `json:"guild_id,omitempty"` User *User `json:"user"` Nick string `json:"nick,omitempty"` Roles SnowflakeArray `json:"roles"` JoinedAt Time `json:"joined_at,omitempty"` PremiumSince Time `json:"premium_since,omitempty"` Deaf bool `json:"deaf"` Mute bool `json:"mute"` Pending bool `json:"pending"` }
Member https://discord.com/developers/docs/resources/guild#guild-member-object
func (*Member) ToProto ¶
func (m *Member) ToProto() *model.MemberData
func (*Member) ToProtoForMessageCreateOrUpdate ¶
func (m *Member) ToProtoForMessageCreateOrUpdate(userId uint64) *model.MemberData
type MentionChannel ¶
type MentionChannel struct { ID Snowflake `json:"id"` GuildID Snowflake `json:"guild_id"` Type ChannelType `json:"type"` Name string `json:"name"` }
func (MentionChannel) ToProto ¶
func (m MentionChannel) ToProto() *model.MessageData_MessageMentionChannelData
type MentionChannelArr ¶
type MentionChannelArr []*MentionChannel
func (MentionChannelArr) ToProto ¶
func (a MentionChannelArr) ToProto() []*model.MessageData_MessageMentionChannelData
type Mentioner ¶
type Mentioner interface {
Mention() string
}
Mentioner can be implemented by any type that is mentionable. https://discord.com/developers/docs/reference#message-formatting-formats
type Message ¶
type Message struct { ID Snowflake `json:"id"` ChannelID Snowflake `json:"channel_id"` GuildID Snowflake `json:"guild_id"` Author *User `json:"author"` Member *Member `json:"member"` Content string `json:"content"` Timestamp Time `json:"timestamp"` EditedTimestamp Time `json:"edited_timestamp"` // ? Tts bool `json:"tts"` MentionEveryone bool `json:"mention_everyone"` Mentions UserArr `json:"mentions"` MentionRoles SnowflakeArray `json:"mention_roles"` // TODO: confirm this is being parsed correctly MentionChannels MentionChannelArr `json:"mention_channels"` Attachments AttachmentArray `json:"attachments"` Embeds EmbedArray `json:"embeds"` Reactions ReactionArr `json:"reactions"` // ? Nonce interface{} `json:"nonce"` // NOT A SNOWFLAKE! DONT TOUCH! Pinned bool `json:"pinned"` WebhookID Snowflake `json:"webhook_id"` // ? Type MessageType `json:"type"` Activity MessageActivity `json:"activity"` Application MessageApplication `json:"application"` MessageReference *MessageReference `json:"message_reference"` ReferencedMessage *Message `json:"referenced_message"` Flags MessageFlag `json:"flags"` Stickers MessageStickerArr `json:"stickers"` // SpoilerTagContent is only true if the entire message text is tagged as a spoiler (aka completely wrapped in ||) SpoilerTagContent bool `json:"-"` SpoilerTagAllAttachments bool `json:"-"` HasSpoilerImage bool `json:"-"` }
Message https://discord.com/developers/docs/resources/channel#message-object-message-structure
func (Message) ToPartialProto ¶
func (m Message) ToPartialProto() *event2.MessageUpdateEvent_PayloadData
func (Message) ToProto ¶
func (m Message) ToProto() *model.MessageData
func (Message) ToProtoForMessageCreateOrUpdate ¶
func (m Message) ToProtoForMessageCreateOrUpdate() *model.MessageData
type MessageActivity ¶
MessageActivity https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
func (MessageActivity) ToProto ¶
func (m MessageActivity) ToProto() *model.MessageData_MessageActivityData
type MessageApplication ¶
type MessageApplication struct { ID Snowflake `json:"id"` CoverImage string `json:"cover_image"` Description string `json:"description"` Icon string `json:"icon"` Name string `json:"name"` }
MessageApplication https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
func (MessageApplication) ToProto ¶
func (m MessageApplication) ToProto() *model.MessageData_MessageApplicationData
type MessageFlag ¶
type MessageFlag uint
MessageFlag https://discord.com/developers/docs/resources/channel#message-object-message-flags
const ( MessageFlagCrossposted MessageFlag = 1 << iota MessageFlagIsCrosspost MessageFlagSupressEmbeds MessageFlagSourceMessageDeleted MessageFlagUrgent )
type MessageReference ¶
type MessageReference struct { MessageID Snowflake `json:"message_id"` ChannelID Snowflake `json:"channel_id"` GuildID Snowflake `json:"guild_id"` }
func (*MessageReference) ToProto ¶
func (m *MessageReference) ToProto() *model.MessageData_MessageReferenceData
type MessageSticker ¶
type MessageSticker struct { ID Snowflake `json:"id"` PackID Snowflake `json:"pack_id"` Name string `json:"name"` Description string `json:"description"` Tags string `json:"tags"` Asset string `json:"asset"` PreviewAsset string `json:"preview_asset"` FormatType MessageStickerFormatType `json:"format_type"` }
func (MessageSticker) ToProto ¶
func (m MessageSticker) ToProto() *model.MessageData_MessageStickerData
type MessageStickerArr ¶
type MessageStickerArr []*MessageSticker
func (MessageStickerArr) ToProto ¶
func (a MessageStickerArr) ToProto() []*model.MessageData_MessageStickerData
type MessageStickerFormatType ¶
type MessageStickerFormatType int
const ( MessageStickerFormatUnknown MessageStickerFormatType = iota MessageStickerFormatPNG MessageStickerFormatAPNG MessageStickerFormatLOTTIE )
type MessageType ¶
type MessageType uint // TODO: once auto generated, un-export this.
The different message types usually generated by Discord. eg. "a new user joined"
const ( MessageTypeUnknown MessageType = iota MessageTypeDefault MessageTypeRecipientAdd MessageTypeRecipientRemove MessageTypeCall MessageTypeChannelNameChange MessageTypeChannelIconChange MessageTypeChannelPinnedMessage MessageTypeGuildMemberJoin MessageTypeUserPremiumGuildSubscription MessageTypeUserPremiumGuildSubscriptionTier1 MessageTypeUserPremiumGuildSubscriptionTier2 MessageTypeUserPremiumGuildSubscriptionTier3 MessageTypeChannelFollowAdd MessageTypeGuildDiscoveryDisqualified MessageTypeGuildDiscoveryRequalified MessageTypeReply MessageTypeApplicationCommand )
type PartialBan ¶
PartialBan is used by audit logs
type PartialChannel ¶
type PartialChannel struct { ID Snowflake `json:"id"` Name string `json:"name"` Type ChannelType `json:"type"` }
PartialChannel ... example of partial channel // "channel": { // "id": "165176875973476352", // "name": "illuminati", // "type": 0 // }
type PartialEmoji ¶
type PartialEmoji = Emoji
type PermissionBit ¶
type PermissionBit uint64
PermissionBit is used to define the permission bit(s) which are set.
const ( PermissionReadMessages PermissionBit = 1 << (iota + 10) PermissionSendMessages PermissionSendTTSMessages PermissionManageMessages PermissionEmbedLinks PermissionAttachFiles PermissionReadMessageHistory PermissionMentionEveryone PermissionUseExternalEmojis PermissionViewGuildInsights )
Constants for the different bit offsets of text channel permissions
const ( PermissionVoiceConnect PermissionBit = 1 << (iota + 20) PermissionVoiceSpeak PermissionVoiceMuteMembers PermissionVoiceDeafenMembers PermissionVoiceMoveMembers PermissionVoiceUseVAD PermissionVoicePrioritySpeaker PermissionBit = 1 << (iota + 2) PermissionStream )
Constants for the different bit offsets of voice permissions
const ( PermissionChangeNickname PermissionBit = 1 << (iota + 26) PermissionManageNicknames PermissionManageRoles PermissionManageWebhooks PermissionManageEmojis )
Constants for general management.
func (PermissionBit) Contains ¶
func (b PermissionBit) Contains(Bits PermissionBit) bool
Contains is used to check if the permission bits contains the bits specified.
func (*PermissionBit) MarshalJSON ¶
func (b *PermissionBit) MarshalJSON() ([]byte, error)
func (*PermissionBit) UnmarshalJSON ¶
func (b *PermissionBit) UnmarshalJSON(bytes []byte) error
type PermissionOverwrite ¶
type PermissionOverwrite struct { ID Snowflake `json:"id"` // role or user id Type PermissionOverwriteType `json:"type"` Allow PermissionBit `json:"allow"` Deny PermissionBit `json:"deny"` }
PermissionOverwrite https://discord.com/developers/docs/resources/channel#overwrite-object
WARNING! Discord is bugged, and the Type field needs to be a string to read Permission Overwrites from audit log
type PermissionOverwriteType ¶
type PermissionOverwriteType uint8
const ( PermissionOverwriteRole PermissionOverwriteType = iota PermissionOverwriteMember )
type PremiumTier ¶
type PremiumTier uint
PremiumTier ... https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
const ( PremiumTierNone PremiumTier = iota PremiumTier1 PremiumTier2 PremiumTier3 )
the different premium tier levels
type PremiumType ¶
type PremiumType int
const ( PremiumTypeNone PremiumType = iota PremiumTypeNitroClassic PremiumTypeNitro )
func (PremiumType) String ¶
func (p PremiumType) String() (t string)
type Reaction ¶
type Reaction struct { Count uint `json:"count"` Me bool `json:"me"` Emoji *PartialEmoji `json:"Emoji"` }
Reaction ... https://discord.com/developers/docs/resources/channel#reaction-object
func (*Reaction) ToProto ¶
func (u *Reaction) ToProto() *model.MessageData_MessageReactionData
type ReactionArr ¶
type ReactionArr []*Reaction
func (ReactionArr) ToProto ¶
func (a ReactionArr) ToProto() []*model.MessageData_MessageReactionData
type Role ¶
type Role struct { ID Snowflake `json:"id"` Name string `json:"name"` Color uint `json:"color"` Hoist bool `json:"hoist"` Position int `json:"position"` // can be -1 Permissions PermissionBit `json:"permissions"` Managed bool `json:"managed"` Mentionable bool `json:"mentionable"` // contains filtered or unexported fields }
Role https://discord.com/developers/docs/topics/permissions#role-object
type Snowflake ¶
type Snowflake uint64
Snowflake twitter snowflake design
func NewSnowflake ¶
NewID creates a new Snowflake Snowflake from a uint64.
func (Snowflake) HexPrettyString ¶
HexPrettyString converts the Snowflake into a hexadecimal string with the hex prefix 0x
func (Snowflake) IsZero ¶
IsZero since snowflake exists of several parts, including a timestamp,
I assume a valid snowflake Snowflake is never 0.
func (Snowflake) MarshalBinary ¶
MarshalBinary create a binary literal representation as a string
func (Snowflake) MarshalJSON ¶
func (Snowflake) MarshalText ¶
func (Snowflake) ToOptionalProto ¶
func (s Snowflake) ToOptionalProto() *model.SnowflakeValue
func (*Snowflake) UnmarshalBinary ¶
func (*Snowflake) UnmarshalJSON ¶
func (*Snowflake) UnmarshalText ¶
type SnowflakeArray ¶
type SnowflakeArray []Snowflake
func (SnowflakeArray) ToOptionalProto ¶
func (s SnowflakeArray) ToOptionalProto() *model.SnowflakeListValue
func (SnowflakeArray) ToProto ¶
func (s SnowflakeArray) ToProto() []uint64
type Time ¶
Time handles Discord timestamps
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler. error: https://stackoverflow.com/questions/28464711/go-strange-json-hyphen-unmarshall-error
func (Time) String ¶
String returns the timestamp as a Discord formatted timestamp. Formatting with time.RFC3331 does not suffice.
func (Time) ToProto ¶
func (t Time) ToProto() *timestamppb.Timestamp
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type User ¶
type User struct { ID Snowflake `json:"id,omitempty"` Username string `json:"username,omitempty"` Discriminator Discriminator `json:"discriminator,omitempty"` Avatar string `json:"avatar"` // data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA Bot bool `json:"bot,omitempty"` System bool `json:"system,omitempty"` MFAEnabled bool `json:"mfa_enabled,omitempty"` Locale string `json:"locale,omitempty"` Verified bool `json:"verified,omitempty"` Email string `json:"email,omitempty"` Flags UserFlag `json:"flag,omitempty"` PremiumType PremiumType `json:"premium_type,omitempty"` PublicFlags UserFlag `json:"public_flag,omitempty"` PartialMember *Member `json:"member"` // may be populated by Message }
User the Discord user object which is reused in most other data structures.
type UserArr ¶
type UserArr []*User
func (UserArr) ToMentionProto ¶
func (a UserArr) ToMentionProto() []*model.MessageData_MessageMentionData
type UserConnection ¶
type UserConnection struct { ID string `json:"id"` // id of the connection account Name string `json:"name"` // the username of the connection account Type string `json:"type"` // the service of the connection (twitch, youtube) Revoked bool `json:"revoked"` // whether the connection is revoked }
UserConnection ...
type UserFlag ¶
type UserFlag uint64
const ( UserFlagNone UserFlag = 0 UserFlagDiscordEmployee UserFlag = 1 << iota UserFlagDiscordPartner UserFlagHypeSquadEvents UserFlagBugHunterLevel1 UserFlagHouseBravery UserFlagHouseBrilliance UserFlagHouseBalance UserFlagEarlySupporter UserFlagTeamUser UserFlagSystem UserFlagBugHunterLevel2 UserFlagVerifiedBot UserFlagVerifiedBotDeveloper )
type UserPresence ¶
type UserPresence struct { User *User `json:"user"` Roles []Snowflake `json:"roles"` Game *Activity `json:"activity"` GuildID Snowflake `json:"guild_id"` Nick string `json:"nick"` Status string `json:"status"` }
UserPresence presence info for a guild member or friend/user in a DM
type VerificationLvl ¶
type VerificationLvl uint
VerificationLvl ... https://discord.com/developers/docs/resources/guild#guild-object-verification-level
const ( VerificationLvlNone VerificationLvl = iota VerificationLvlLow VerificationLvlMedium VerificationLvlHigh VerificationLvlVeryHigh )
the different verification levels
func (*VerificationLvl) High ¶
func (vl *VerificationLvl) High() bool
High (╯°□°)╯︵ ┻━┻ - must be a member of the server for longer than 10 minutes
func (*VerificationLvl) Low ¶
func (vl *VerificationLvl) Low() bool
Low must have verified email on account
func (*VerificationLvl) Medium ¶
func (vl *VerificationLvl) Medium() bool
Medium must be registered on Discord for longer than 5 minutes
func (*VerificationLvl) VeryHigh ¶
func (vl *VerificationLvl) VeryHigh() bool
VeryHigh ┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻ - must have a verified phone number
type VoiceRegion ¶
type VoiceRegion struct { // Snowflake unique Snowflake for the region ID string `json:"id"` // Name name of the region Name string `json:"name"` // SampleHostname an example hostname for the region SampleHostname string `json:"sample_hostname"` // SamplePort an example port for the region SamplePort uint `json:"sample_port"` // VIP true if this is a vip-only server VIP bool `json:"vip"` // Optimal true for a single server that is closest to the current user's Client Optimal bool `json:"optimal"` // Deprecated whether this is a deprecated voice region (avoid switching to these) Deprecated bool `json:"deprecated"` // Custom whether this is a custom voice region (used for events/etc) Custom bool `json:"custom"` }
VoiceRegion voice region structure https://discord.com/developers/docs/resources/voice#voice-region
type VoiceState ¶
type VoiceState struct { // GuildID the guild id this voice state is for GuildID Snowflake `json:"guild_id,omitempty"` // ? | // ChannelID the channel id this user is connected to ChannelID Snowflake `json:"channel_id"` // | ? // UserID the user id this voice state is for UserID Snowflake `json:"user_id"` // | // the guild member this voice state is for Member *Member `json:"member,omitempty"` // SessionID the session id for this voice state SessionID string `json:"session_id"` // | // Deaf whether this user is deafened by the server Deaf bool `json:"deaf"` // | // Mute whether this user is muted by the server Mute bool `json:"mute"` // | // SelfDeaf whether this user is locally deafened SelfDeaf bool `json:"self_deaf"` // | // SelfMute whether this user is locally muted SelfMute bool `json:"self_mute"` // | // Suppress whether this user is muted by the current user Suppress bool `json:"suppress"` // | }
VoiceState Voice State structure https://discord.com/developers/docs/resources/voice#voice-state-object reviewed 2018-09-29