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 HasFlag(flag, has uint64) bool
- func TimeToDiscordEpoch(t time.Time) int64
- type Activity
- type ActivityAssets
- type ActivityFlags
- type ActivityParty
- type ActivitySecrets
- type ActivityTimestamp
- type ActivityType
- type Attachment
- type AuditEntryInfo
- type AuditLog
- type AuditLogChange
- type AuditLogChangeChannel
- type AuditLogChangeGuild
- type AuditLogChangeIntegration
- type AuditLogChangeInvite
- type AuditLogChangeKey
- type AuditLogChangeRole
- type AuditLogChangeUser
- type AuditLogEntries
- type AuditLogEvent
- type Ban
- type Channel
- type ChannelMention
- type ChannelOverwritten
- type ChannelType
- type Color
- 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 ErrOverbound
- type ExplicitFilter
- type Guild
- type GuildEmbed
- type GuildFeature
- type GuildUser
- type Hash
- type Integration
- type Invite
- type InviteMetadata
- type InviteUserType
- type MFALevel
- type Member
- type Message
- type MessageActivity
- type MessageActivityType
- type MessageApplication
- type MessageFlags
- type MessageReference
- type MessageType
- type Milliseconds
- type NitroBoost
- type Notification
- type Overwrite
- type OverwriteType
- type Permissions
- type Presence
- type Reaction
- type Role
- type Seconds
- type Service
- type Snowflake
- func (s Snowflake) Increment() uint16
- 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) Valid() bool
- func (s Snowflake) Worker() uint8
- type Status
- type Timestamp
- type URL
- type UnixMsTimestamp
- type UnixTimestamp
- type User
- type UserFlags
- type UserNitro
- type Verification
- type VoiceRegion
- type VoiceState
- type Webhook
- type WebhookType
Constants ¶
const DefaultMaxPresences = 5000
Guild.MaxPresences is 5000 when it's 0. Seriously. The fucker who thought of this API thought it was also a good idea to return "null" instead of "5000." What the fucK? It has the same byte count, thus the same size. Sending the number over means it could be changed anytime and not force the developers to recheck. You could make the change right today and it would just work on all the clients. But no. IT'S FUCKING NULL!
const DiscordEpoch = 1420070400000 * int64(time.Millisecond)
const TimestampFormat = time.RFC3339 // same as ISO8601
Variables ¶
var DefaultAvatarURL = "https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png"
DefaultAvatarURL is the link to the default green avatar on Discord. It's returned from AvatarURL() if the user doesn't have an avatar.
Functions ¶
func HasFlag ¶ added in v0.6.2
HasFlag is returns true if has is in the flag. In other words, it checks if has is OR'd into flag. This function could be used for different constants such as Permission.
func TimeToDiscordEpoch ¶
Types ¶
type Activity ¶
type Activity struct { Name string `json:"name"` Type ActivityType `json:"type"` URL URL `json:"url,omitempty"` CreatedAt UnixTimestamp `json:"created_at,omitempty"` Timestamps *ActivityTimestamp `json:"timestamps,omitempty"` ApplicationID Snowflake `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"` Instance bool `json:"instance,omitempty"` Flags ActivityFlags `json:"flags,omitempty"` // Undocumented fields SyncID string `json:"sync_id,omitempty"` SessionID string `json:"session_id,omitempty"` }
type ActivityAssets ¶ added in v0.2.0
type ActivityFlags ¶
type ActivityFlags uint32
const ( InstanceActivity ActivityFlags = 1 << iota JoinActivity SpectateActivity JoinRequestActivity SyncActivity PlayActivity )
type ActivityParty ¶ added in v0.2.0
type ActivitySecrets ¶ added in v0.2.0
type ActivityTimestamp ¶ added in v0.2.0
type ActivityTimestamp 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 // $emoji $state CustomActivity )
type Attachment ¶
type AuditEntryInfo ¶ added in v0.6.3
type AuditEntryInfo struct { // MEMBER_PRUNE DeleteMemberDays string `json:"delete_member_days,omitempty"` // MEMBER_PRUNE MembersRemoved string `json:"members_removed,omitempty"` // MEMBER_MOVE & MESSAGE_PIN & MESSAGE_UNPIN & MESSAGE_DELETE ChannelID Snowflake `json:"channel_id,omitempty"` // MESSAGE_PIN & MESSAGE_UNPIN MessageID Snowflake `json:"message_id,omitempty"` // MESSAGE_DELETE & MESSAGE_BULK_DELETE & MEMBER_DISCONNECT & MEMBER_MOVE Count string `json:"count,omitempty"` // CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE ID Snowflake `json:"id,omitempty"` // CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE Type ChannelOverwritten `json:"type,omitempty"` // CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE RoleName string `json:"role_name,omitempty"` }
type AuditLog ¶ added in v0.6.3
type AuditLog struct { // List of webhooks found in the audit log Webhooks []Webhook `json:"webhooks"` // List of users found in the audit log Users []User `json:"users"` // List of audit log entries Entries []AuditLogEntries `json:"audit_log_entries"` // List of partial integration objects, only ID, Name, Type, and Account Integrations []Integration `json:"integrations"` }
type AuditLogChange ¶ added in v0.6.3
type AuditLogChange struct { Key string `json:"key"` NewValue *AuditLogChangeKey `json:"new_value,omitempty"` OldValue *AuditLogChangeKey `json:"old_value,omitempty"` }
type AuditLogChangeChannel ¶ added in v0.6.3
type AuditLogChangeChannel struct { // Text channel topic changed Topic string `json:"topic,omitempty"` // Voice channel bitrate changed Bitrate uint `json:"bitrate,omitempty"` // Permissions on a channel changed Permissions []Overwrite `json:"permission_overwrites,omitempty"` // Channel NSFW restriction changed NSFW bool `json:"nsfw,omitempty"` // Application ID of the added or removed webhook or bot ApplicationID Snowflake `json:"application_id,omitempty"` // Amount of seconds a user has to wait before sending another message // changed UserRateLimit Seconds `json:"rate_limit_per_user,omitempty"` }
AuditLogChangeChannel is the audit log key for Channel.
type AuditLogChangeGuild ¶ added in v0.6.3
type AuditLogChangeGuild struct { // Name changed Name string `json:"name,omitempty"` // Icon changed IconHash string `json:"icon_hash,omitempty"` // Invite splash page artwork changed SplashHash string `json:"splash_hash,omitempty"` // Owner changed OwnerID Snowflake `json:"owner_id,omitempty"` // Region changed Region string `json:"region,omitempty"` // AFK channel changed AfkChannelID Snowflake `json:"afk_channel_id,omitempty"` // AFK timeout duration changed AFKTimeout Seconds `json:"afk_timeout,omitempty"` // Two-factor auth requirement changed MFA MFALevel `json:"mfa_level,omitempty"` // Required verification level changed Verification Verification `json:"verification_level,omitempty"` // Change in whose messages are scanned and deleted for explicit content in // the server ExplicitFilter ExplicitFilter `json:"explicit_content_filter,omitempty"` // Default message notification level changed Notification Notification `json:"default_message_notifications,omitempty"` // Guild invite vanity url changed VanityURLCode string `json:"vanity_url_code,omitempty"` // New role added, only ID and Name are available RoleAdd []Role `json:"$add,omitempty"` // Role removed, partial similar to RoleAdd RoleRemove []Role `json:"$remove,omitempty"` // Change in number of days after which inactive and role-unassigned members // are kicked PruneDeleteDays int `json:"prune_delete_days,omitempty"` // Server widget enabled/disable WidgetEnabled bool `json:"widget_enabled,omitempty"` // Channel id of the server widget changed WidgetChannelID Snowflake `json:"widget_channel_id,omitempty"` // ID of the system channel changed SystemChannelID Snowflake `json:"system_channel_id,omitempty"` }
AuditLogChangeGuild is the audit log key for Guild.
type AuditLogChangeIntegration ¶ added in v0.6.3
type AuditLogChangeIntegration struct { // Integration emoticons enabled/disabled EnableEmoticons bool `json:"enable_emoticons,omitempty"` // Integration expiring subscriber behavior changed ExpireBehavior int `json:"expire_behavior,omitempty"` // Integration expire grace period changed ExpireGracePeriod int `json:"expire_grace_period,omitempty"` }
AuditLogChangeIntegration is the audit log key for Integration.
type AuditLogChangeInvite ¶ added in v0.6.3
type AuditLogChangeInvite struct { // Invite code changed Code string `json:"code,omitempty"` // Channel for invite code changed ChannelID Snowflake `json:"channel_id,omitempty"` // Person who created invite code changed InviterID Snowflake `json:"inviter_id,omitempty"` // Change to max number of times invite code can be used MaxUses int `json:"max_uses,omitempty"` // Number of times invite code used changed Uses int `json:"uses,omitempty"` // How long invite code lasts changed MaxAge Seconds `json:"max_age,omitempty"` // Invite code is temporary/never expires Temporary bool `json:"temporary,omitempty"` }
AuditLogChangeInvite is the audit log key for InviteMetadata.
type AuditLogChangeKey ¶ added in v0.6.3
type AuditLogChangeKey struct { // The ID of the changed entity - sometimes used in conjunction with other // keys ID Snowflake `json:"snowflake"` // Type of entity created, either a ChannelType (int) or string. Type json.AlwaysString `json:"type"` *AuditLogChangeGuild *AuditLogChangeChannel *AuditLogChangeRole *AuditLogChangeInvite *AuditLogChangeUser *AuditLogChangeIntegration }
type AuditLogChangeRole ¶ added in v0.6.3
type AuditLogChangeRole struct { // Permissions for a role changed Permissions Permissions `json:"permissions,omitempty"` // Role color changed Color Color `json:"color,omitempty"` // Role is now displayed/no longer displayed separate from online users Hoist bool `json:"hoist,omitempty"` // Role is now mentionable/unmentionable Mentionable bool `json:"mentionable,omitempty"` // A permission on a text or voice channel was allowed for a role Allow Permissions `json:"allow,omitempty"` // A permission on a text or voice channel was denied for a role Deny Permissions `json:"deny,omitempty"` }
AuditLogChangeRole is the audit log key for Role.
type AuditLogChangeUser ¶ added in v0.6.3
type AuditLogChangeUser struct { // User server deafened/undeafened Deaf bool `json:"deaf,omitempty"` // User server muted/unmuted Mute bool `json:"mute,omitempty"` // User nickname changed Nick string `json:"nick,omitempty"` // User avatar changed Avatar Hash `json:"avatar_hash,omitempty"` }
AuditLogChangeUser is the audit log key for User.
type AuditLogEntries ¶ added in v0.6.3
type AuditLogEntries struct { ID Snowflake `json:"id"` UserID Snowflake `json:"user_id"` TargetID string `json:"target_id,omitempty"` ActionType AuditLogEvent `json:"action_type"` Changes []AuditLogChange `json:"changes,omitempty"` Options AuditEntryInfo `json:"options,omitempty"` Reason string `json:"reason,omitempty"` }
type AuditLogEvent ¶ added in v0.6.3
type AuditLogEvent uint8
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 )
type Channel ¶
type Channel struct { ID Snowflake `json:"id,string"` Type ChannelType `json:"type"` GuildID Snowflake `json:"guild_id,string,omitempty"` Position int `json:"position,omitempty"` Name string `json:"name,omitempty"` // 2-100 chars Topic string `json:"topic,omitempty"` // 0-1024 chars NSFW bool `json:"nsfw"` Icon Hash `json:"icon,omitempty"` // Direct Messaging fields DMOwnerID Snowflake `json:"owner_id,string,omitempty"` DMRecipients []User `json:"recipients,omitempty"` // AppID of the group DM creator if it's bot-created AppID Snowflake `json:"application_id,string,omitempty"` // ID of the category the channel is in, if any. CategoryID Snowflake `json:"parent_id,string,omitempty"` LastPinTime Timestamp `json:"last_pin_timestamp,omitempty"` // Explicit permission overrides for members and roles. Permissions []Overwrite `json:"permission_overwrites,omitempty"` // ID of the last message, may not point to a valid one. LastMessageID Snowflake `json:"last_message_id,string,omitempty"` // Slow mode duration. Bots and people with "manage_messages" or // "manage_channel" permissions are unaffected. UserRateLimit Seconds `json:"rate_limit_per_user,omitempty"` // Voice, so GuildVoice only VoiceBitrate uint `json:"bitrate,omitempty"` VoiceUserLimit uint `json:"user_limit,omitempty"` }
type ChannelMention ¶
type ChannelMention struct { ChannelID Snowflake `json:"id,string"` GuildID Snowflake `json:"guild_id,string"` ChannelType ChannelType `json:"type"` ChannelName string `json:"name"` }
type ChannelOverwritten ¶ added in v0.6.3
type ChannelOverwritten string
ChannelOverwritten is the type of overwritten entity in (AuditEntryInfo).Type.
const ( MemberChannelOverwritten ChannelOverwritten = "member" RoleChannelOverwritten ChannelOverwritten = "role" )
type ChannelType ¶
type ChannelType uint8
const ( GuildText ChannelType = iota DirectMessage GuildVoice GroupDM GuildCategory GuildNews GuildStore )
type Color ¶
type Color uint32
var DefaultEmbedColor Color = 0x303030
var DefaultMemberColor Color = 0x0
DefaultMemberColor is the color used for members without colored roles.
func MemberColor ¶ added in v0.0.7
type Connection ¶
type Connection struct { ID Snowflake `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 Snowflake `json:"id,string"` // 0 for Unicode emojis Name string `json:"name"` RoleIDs []Snowflake `json:"roles,omitempty"` User User `json:"user,omitempty"` RequireColons bool `json:"require_colons,omitempty"` Managed bool `json:"managed,omitempty"` Animated bool `json:"animated,omitempty"` }
type ErrOverbound ¶
func (ErrOverbound) Error ¶
func (e ErrOverbound) Error() string
type ExplicitFilter ¶
type ExplicitFilter uint8
const ( NoContentFilter ExplicitFilter = iota MembersWithoutRoles AllMembers )
type Guild ¶
type Guild struct { ID Snowflake `json:"id,string"` Name string `json:"name"` Icon Hash `json:"icon"` Splash Hash `json:"splash,omitempty"` // server invite bg Owner bool `json:"owner,omitempty"` // self is owner OwnerID Snowflake `json:"owner_id,string"` Permissions Permissions `json:"permissions,omitempty"` VoiceRegion string `json:"region"` AFKChannelID Snowflake `json:"afk_channel_id,string,omitempty"` AFKTimeout Seconds `json:"afk_timeout"` Embeddable bool `json:"embed_enabled,omitempty"` EmbedChannelID Snowflake `json:"embed_channel_id,string,omitempty"` Verification Verification `json:"verification_level"` Notification Notification `json:"default_message_notifications"` ExplicitFilter ExplicitFilter `json:"explicit_content_filter"` Roles []Role `json:"roles"` Emojis []Emoji `json:"emojis"` Features []GuildFeature `json:"guild_features"` MFA MFALevel `json:"mfa"` AppID Snowflake `json:"application_id,string,omitempty"` Widget bool `json:"widget_enabled,omitempty"` WidgetChannelID Snowflake `json:"widget_channel_id,string,omitempty"` SystemChannelID Snowflake `json:"system_channel_id,string,omitempty"` // It's DefaultMaxPresences when MaxPresences is 0. MaxPresences uint64 `json:"max_presences,omitempty"` MaxMembers uint64 `json:"max_members,omitempty"` VanityURLCode string `json:"vanity_url_code,omitempty"` Description string `json:"description,omitempty"` Banner Hash `json:"banner,omitempty"` NitroBoost NitroBoost `json:"premium_tier"` NitroBoosters uint64 `json:"premium_subscription_count,omitempty"` // Defaults to en-US, only set if guild has DISCOVERABLE PreferredLocale string `json:"preferred_locale"` }
func (Guild) BannerURL ¶ added in v0.1.1
BannerURL returns the URL to the banner, which is the image on top of the channels list.
type GuildEmbed ¶
type GuildFeature ¶
type GuildFeature string
const ( // Guild has access to set an invite splash background InviteSplash GuildFeature = "INVITE_SPLASH" // Guild has access to set 384kbps bitrate in voice (previously VIP voice // servers) VIPRegions GuildFeature = "VIP_REGIONS" // Guild has access to set a vanity URL VanityURL GuildFeature = "VANITY_URL" // Guild is verified Verified GuildFeature = "VERIFIED" // Guild is partnered Partnered GuildFeature = "PARTNERED" // Guild is public Public GuildFeature = "PUBLIC" // Guild has access to use commerce features (i.e. create store channels) Commerce GuildFeature = "COMMERCE" // Guild has access to create news channels News GuildFeature = "NEWS" // Guild is able to be discovered in the directory Discoverable GuildFeature = "DISCOVERABLE" // Guild is able to be featured in the directory Featurable GuildFeature = "FEATURABLE" // Guild has access to set an animated guild icon AnimatedIcon GuildFeature = "ANIMATED_ICON" // Guild has access to set a guild banner image Banner GuildFeature = "BANNER" )
type Integration ¶
type Integration struct { ID Snowflake `json:"id"` Name string `json:"name"` Type Service `json:"type"` Enabled bool `json:"enabled"` Syncing bool `json:"syncing"` // used for subscribers RoleID Snowflake `json:"role_id"` ExpireBehavior int `json:"expire_behavior"` ExpireGracePeriod int `json:"expire_grace_period"` User User `json:"user"` Account struct { ID string `json:"id"` Name string `json:"name"` } `json:"account"` SyncedAt Timestamp `json:"synced_at"` }
type Invite ¶
type Invite struct { Code string `json:"code"` Channel Channel `json:"channel"` // partial Guild *Guild `json:"guild,omitempty"` // partial ApproxMembers uint `json:"approximate_members_count,omitempty"` Target *User `json:"target_user,omitempty"` // partial TargetType InviteUserType `json:"target_user_type,omitempty"` // Only available if Target is ApproxPresences uint `json:"approximate_presence_count,omitempty"` }
type InviteMetadata ¶ added in v0.6.3
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.
type InviteUserType ¶
type InviteUserType uint8
const ( InviteNormalUser InviteUserType = iota InviteUserStream )
type Member ¶
type Message ¶
type Message struct { ID Snowflake `json:"id,string"` Type MessageType `json:"type"` ChannelID Snowflake `json:"channel_id,string"` GuildID Snowflake `json:"guild_id,string,omitempty"` // 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 string `json:"content"` Timestamp Timestamp `json:"timestamp,omitempty"` EditedTimestamp Timestamp `json:"edited_timestamp,omitempty"` TTS bool `json:"tts"` Pinned bool `json:"pinned"` // 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 []Snowflake `json:"mention_roles"` MentionEveryone bool `json:"mention_everyone"` // Not all channel mentions in a message will appear in mention_channels. MentionChannels []ChannelMention `json:"mention_channels,omitempty"` Attachments []Attachment `json:"attachments"` Embeds []Embed `json:"embeds"` Reactions []Reaction `json:"reactions,omitempty"` // Used for validating a message was sent Nonce string `json:"nonce,omitempty"` WebhookID Snowflake `json:"webhook_id,string,omitempty"` Activity *MessageActivity `json:"activity,omitempty"` Application *MessageApplication `json:"application,omitempty"` Reference *MessageReference `json:"message_reference,omitempty"` Flags MessageFlags `json:"flags"` }
type MessageActivity ¶
type MessageActivity struct { Type MessageActivityType `json:"type"` // From a Rich Presence event PartyID string `json:"party_id,omitempty"` }
type MessageActivityType ¶
type MessageActivityType uint8
const ( JoinMessage MessageActivityType = iota + 1 SpectateMessage ListenMessage JoinRequestMessage )
type MessageApplication ¶
type MessageFlags ¶
type MessageFlags uint32
const ( CrosspostedMessage MessageFlags = 1 << iota MessageIsCrosspost SuppressEmbeds SourceMessageDeleted UrgentMessage )
type MessageReference ¶
type MessageType ¶
type MessageType uint8
const ( DefaultMessage MessageType = iota RecipientAddMessage RecipientRemoveMessage CallMessage ChannelNameChangeMessage ChannelIconChangeMessage ChannelPinnedMessage GuildMemberJoinMessage NitroBoostMessage NitroTier1Message NitroTier2Message NitroTier3Message ChannelFollowAddMessage GuildDiscoveryDisqualifiedMessage GuildDiscoveryRequalifiedMessage )
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
const ( NoNitroLevel NitroBoost = iota NitroLevel1 NitroLevel2 NitroLevel3 )
type Overwrite ¶
type Overwrite struct { ID Snowflake `json:"id,string,omitempty"` Type OverwriteType `json:"type"` Allow Permissions `json:"allow"` Deny Permissions `json:"deny"` }
type OverwriteType ¶
type OverwriteType string
const ( OverwriteRole OverwriteType = "role" OverwriteMember OverwriteType = "member" )
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 management and editing of emojis PermissionManageEmojis PermissionAllText = 0 | PermissionViewChannel | PermissionSendMessages | PermissionSendTTSMessages | PermissionManageMessages | PermissionEmbedLinks | PermissionAttachFiles | PermissionReadMessageHistory | PermissionMentionEveryone | PermissionUseExternalEmojis PermissionAllVoice = 0 | PermissionConnect | PermissionSpeak | PermissionMuteMembers | PermissionDeafenMembers | PermissionMoveMembers | PermissionUseVAD | PermissionPrioritySpeaker PermissionAllChannel = 0 | PermissionAllText | PermissionAllVoice | PermissionCreateInstantInvite | PermissionManageRoles | PermissionManageChannels | PermissionAddReactions | PermissionViewAuditLog PermissionAll = 0 | PermissionAllChannel | PermissionKickMembers | PermissionBanMembers | PermissionManageGuild | PermissionAdministrator | PermissionManageWebhooks | PermissionManageEmojis | PermissionManageNicknames | PermissionChangeNickname )
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 User `json:"user"` RoleIDs []Snowflake `json:"roles"` Nick string `json:"nick"` GuildID Snowflake `json:"guild_id"` PremiumSince Timestamp `json:"premium_since,omitempty"` Game *Activity `json:"game"` Activities []Activity `json:"activities"` Status Status `json:"status"` ClientStatus struct { Desktop Status `json:"desktop,omitempty"` Mobile Status `json:"mobile,omitempty"` Web Status `json:"web,omitempty"` } `json:"client_status"` }
type Role ¶
type Role struct { ID Snowflake `json:"id,string"` Name string `json:"name"` Color Color `json:"color"` Hoist bool `json:"hoist"` // if the role is separated Position int `json:"position"` Permissions Permissions `json:"permissions"` Managed bool `json:"managed"` Mentionable bool `json:"mentionable"` }
type Snowflake ¶
type Snowflake int64
func NewSnowflake ¶
func ParseSnowflake ¶ added in v0.0.9
func (*Snowflake) MarshalJSON ¶
func (*Snowflake) UnmarshalJSON ¶
type Timestamp ¶
Timestamp has a valid zero-value, which can be checked using the Valid() method. This is useful for optional timestamps such as EditedTimestamp.
func NewTimestamp ¶ added in v0.0.13
func NowTimestamp ¶ added in v0.0.13
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 ¶ added in v0.2.0
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 User ¶
type User struct { ID Snowflake `json:"id,string"` Username string `json:"username"` Discriminator string `json:"discriminator"` Avatar Hash `json:"avatar"` Bot bool `json:"bot,omitempty"` MFA bool `json:"mfa_enabled,omitempty"` DiscordSystem bool `json:"system,omitempty"` EmailVerified bool `json:"verified,omitempty"` Locale string `json:"locale,omitempty"` Email string `json:"email,omitempty"` Flags UserFlags `json:"flags,omitempty"` PublicFlags UserFlags `json:"public_flags,omitempty"` Nitro UserNitro `json:"premium_type,omitempty"` }
type Verification ¶
type Verification uint8
const ( 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 )
type VoiceRegion ¶
type VoiceState ¶
type VoiceState struct { // GuildID isn't available from the Guild struct. GuildID Snowflake `json:"guild_id,string"` ChannelID Snowflake `json:"channel_id,string"` UserID Snowflake `json:"user_id,string"` 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 Snowflake `json:"id"` Type WebhookType `json:"type"` User User `json:"user"` // creator GuildID Snowflake `json:"guild_id,omitempty"` ChannelID Snowflake `json:"channel_id"` Name string `json:"name"` Avatar Hash `json:"avatar"` Token string `json:"token"` // incoming webhooks only }
type WebhookType ¶
type WebhookType uint8
const ( IncomingWebhook WebhookType ChannelFollowerWebhook )