structs.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. // Discordgo - Discord bindings for Go
  2. // Available at https://github.com/bwmarrin/discordgo
  3. // Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved.
  4. // Use of this source code is governed by a BSD-style
  5. // license that can be found in the LICENSE file.
  6. // This file contains all structures for the discordgo package. These
  7. // may be moved about later into separate files but I find it easier to have
  8. // them all located together.
  9. package discordgo
  10. import (
  11. "encoding/json"
  12. "net/http"
  13. "sync"
  14. "time"
  15. "github.com/gorilla/websocket"
  16. )
  17. // A Session represents a connection to the Discord API.
  18. type Session struct {
  19. sync.RWMutex
  20. // General configurable settings.
  21. // Authentication token for this session
  22. Token string
  23. MFA bool
  24. // Debug for printing JSON request/responses
  25. Debug bool // Deprecated, will be removed.
  26. LogLevel int
  27. // Should the session reconnect the websocket on errors.
  28. ShouldReconnectOnError bool
  29. // Should the session request compressed websocket data.
  30. Compress bool
  31. // Sharding
  32. ShardID int
  33. ShardCount int
  34. // Should state tracking be enabled.
  35. // State tracking is the best way for getting the the users
  36. // active guilds and the members of the guilds.
  37. StateEnabled bool
  38. // Whether or not to call event handlers synchronously.
  39. // e.g false = launch event handlers in their own goroutines.
  40. SyncEvents bool
  41. // Exposed but should not be modified by User.
  42. // Whether the Data Websocket is ready
  43. DataReady bool // NOTE: Maye be deprecated soon
  44. // Max number of REST API retries
  45. MaxRestRetries int
  46. // Status stores the currect status of the websocket connection
  47. // this is being tested, may stay, may go away.
  48. status int32
  49. // Whether the Voice Websocket is ready
  50. VoiceReady bool // NOTE: Deprecated.
  51. // Whether the UDP Connection is ready
  52. UDPReady bool // NOTE: Deprecated
  53. // Stores a mapping of guild id's to VoiceConnections
  54. VoiceConnections map[string]*VoiceConnection
  55. // Managed state object, updated internally with events when
  56. // StateEnabled is true.
  57. State *State
  58. // The http client used for REST requests
  59. Client *http.Client
  60. // Stores the last HeartbeatAck that was recieved (in UTC)
  61. LastHeartbeatAck time.Time
  62. // used to deal with rate limits
  63. Ratelimiter *RateLimiter
  64. // Event handlers
  65. handlersMu sync.RWMutex
  66. handlers map[string][]*eventHandlerInstance
  67. onceHandlers map[string][]*eventHandlerInstance
  68. // The websocket connection.
  69. wsConn *websocket.Conn
  70. // When nil, the session is not listening.
  71. listening chan interface{}
  72. // sequence tracks the current gateway api websocket sequence number
  73. sequence *int64
  74. // stores sessions current Discord Gateway
  75. gateway string
  76. // stores session ID of current Gateway connection
  77. sessionID string
  78. // used to make sure gateway websocket writes do not happen concurrently
  79. wsMutex sync.Mutex
  80. }
  81. // A VoiceRegion stores data for a specific voice region server.
  82. type VoiceRegion struct {
  83. ID string `json:"id"`
  84. Name string `json:"name"`
  85. Hostname string `json:"sample_hostname"`
  86. Port int `json:"sample_port"`
  87. }
  88. // A VoiceICE stores data for voice ICE servers.
  89. type VoiceICE struct {
  90. TTL string `json:"ttl"`
  91. Servers []*ICEServer `json:"servers"`
  92. }
  93. // A ICEServer stores data for a specific voice ICE server.
  94. type ICEServer struct {
  95. URL string `json:"url"`
  96. Username string `json:"username"`
  97. Credential string `json:"credential"`
  98. }
  99. // A Invite stores all data related to a specific Discord Guild or Channel invite.
  100. type Invite struct {
  101. Guild *Guild `json:"guild"`
  102. Channel *Channel `json:"channel"`
  103. Inviter *User `json:"inviter"`
  104. Code string `json:"code"`
  105. CreatedAt Timestamp `json:"created_at"`
  106. MaxAge int `json:"max_age"`
  107. Uses int `json:"uses"`
  108. MaxUses int `json:"max_uses"`
  109. Revoked bool `json:"revoked"`
  110. Temporary bool `json:"temporary"`
  111. Unique bool `json:"unique"`
  112. }
  113. // ChannelType is the type of a Channel
  114. type ChannelType int
  115. // Block contains known ChannelType values
  116. const (
  117. ChannelTypeGuildText ChannelType = iota
  118. ChannelTypeDM
  119. ChannelTypeGuildVoice
  120. ChannelTypeGroupDM
  121. ChannelTypeGuildCategory
  122. )
  123. // A Channel holds all data related to an individual Discord channel.
  124. type Channel struct {
  125. ID string `json:"id"`
  126. GuildID string `json:"guild_id"`
  127. Name string `json:"name"`
  128. Topic string `json:"topic"`
  129. Type ChannelType `json:"type"`
  130. LastMessageID string `json:"last_message_id"`
  131. NSFW bool `json:"nsfw"`
  132. Position int `json:"position"`
  133. Bitrate int `json:"bitrate"`
  134. Recipients []*User `json:"recipients"`
  135. Messages []*Message `json:"-"`
  136. PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites"`
  137. ParentID string `json:"parent_id"`
  138. }
  139. // A ChannelEdit holds Channel Feild data for a channel edit.
  140. type ChannelEdit struct {
  141. Name string `json:"name,omitempty"`
  142. Topic string `json:"topic,omitempty"`
  143. NSFW bool `json:"nsfw,omitempty"`
  144. Position int `json:"position"`
  145. Bitrate int `json:"bitrate,omitempty"`
  146. UserLimit int `json:"user_limit,omitempty"`
  147. PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"`
  148. ParentID string `json:"parent_id,omitempty"`
  149. }
  150. // A PermissionOverwrite holds permission overwrite data for a Channel
  151. type PermissionOverwrite struct {
  152. ID string `json:"id"`
  153. Type string `json:"type"`
  154. Deny int `json:"deny"`
  155. Allow int `json:"allow"`
  156. }
  157. // Emoji struct holds data related to Emoji's
  158. type Emoji struct {
  159. ID string `json:"id"`
  160. Name string `json:"name"`
  161. Roles []string `json:"roles"`
  162. Managed bool `json:"managed"`
  163. RequireColons bool `json:"require_colons"`
  164. Animated bool `json:"animated"`
  165. }
  166. // APIName returns an correctly formatted API name for use in the MessageReactions endpoints.
  167. func (e *Emoji) APIName() string {
  168. if e.ID != "" && e.Name != "" {
  169. return e.Name + ":" + e.ID
  170. }
  171. if e.Name != "" {
  172. return e.Name
  173. }
  174. return e.ID
  175. }
  176. // VerificationLevel type definition
  177. type VerificationLevel int
  178. // Constants for VerificationLevel levels from 0 to 3 inclusive
  179. const (
  180. VerificationLevelNone VerificationLevel = iota
  181. VerificationLevelLow
  182. VerificationLevelMedium
  183. VerificationLevelHigh
  184. )
  185. // A Guild holds all data related to a specific Discord Guild. Guilds are also
  186. // sometimes referred to as Servers in the Discord client.
  187. type Guild struct {
  188. ID string `json:"id"`
  189. Name string `json:"name"`
  190. Icon string `json:"icon"`
  191. Region string `json:"region"`
  192. AfkChannelID string `json:"afk_channel_id"`
  193. EmbedChannelID string `json:"embed_channel_id"`
  194. OwnerID string `json:"owner_id"`
  195. JoinedAt Timestamp `json:"joined_at"`
  196. Splash string `json:"splash"`
  197. AfkTimeout int `json:"afk_timeout"`
  198. MemberCount int `json:"member_count"`
  199. VerificationLevel VerificationLevel `json:"verification_level"`
  200. EmbedEnabled bool `json:"embed_enabled"`
  201. Large bool `json:"large"` // ??
  202. DefaultMessageNotifications int `json:"default_message_notifications"`
  203. Roles []*Role `json:"roles"`
  204. Emojis []*Emoji `json:"emojis"`
  205. Members []*Member `json:"members"`
  206. Presences []*Presence `json:"presences"`
  207. Channels []*Channel `json:"channels"`
  208. VoiceStates []*VoiceState `json:"voice_states"`
  209. Unavailable bool `json:"unavailable"`
  210. }
  211. // A UserGuild holds a brief version of a Guild
  212. type UserGuild struct {
  213. ID string `json:"id"`
  214. Name string `json:"name"`
  215. Icon string `json:"icon"`
  216. Owner bool `json:"owner"`
  217. Permissions int `json:"permissions"`
  218. }
  219. // A GuildParams stores all the data needed to update discord guild settings
  220. type GuildParams struct {
  221. Name string `json:"name,omitempty"`
  222. Region string `json:"region,omitempty"`
  223. VerificationLevel *VerificationLevel `json:"verification_level,omitempty"`
  224. DefaultMessageNotifications int `json:"default_message_notifications,omitempty"` // TODO: Separate type?
  225. AfkChannelID string `json:"afk_channel_id,omitempty"`
  226. AfkTimeout int `json:"afk_timeout,omitempty"`
  227. Icon string `json:"icon,omitempty"`
  228. OwnerID string `json:"owner_id,omitempty"`
  229. Splash string `json:"splash,omitempty"`
  230. }
  231. // A Role stores information about Discord guild member roles.
  232. type Role struct {
  233. ID string `json:"id"`
  234. Name string `json:"name"`
  235. Managed bool `json:"managed"`
  236. Mentionable bool `json:"mentionable"`
  237. Hoist bool `json:"hoist"`
  238. Color int `json:"color"`
  239. Position int `json:"position"`
  240. Permissions int `json:"permissions"`
  241. }
  242. // Roles are a collection of Role
  243. type Roles []*Role
  244. func (r Roles) Len() int {
  245. return len(r)
  246. }
  247. func (r Roles) Less(i, j int) bool {
  248. return r[i].Position > r[j].Position
  249. }
  250. func (r Roles) Swap(i, j int) {
  251. r[i], r[j] = r[j], r[i]
  252. }
  253. // A VoiceState stores the voice states of Guilds
  254. type VoiceState struct {
  255. UserID string `json:"user_id"`
  256. SessionID string `json:"session_id"`
  257. ChannelID string `json:"channel_id"`
  258. GuildID string `json:"guild_id"`
  259. Suppress bool `json:"suppress"`
  260. SelfMute bool `json:"self_mute"`
  261. SelfDeaf bool `json:"self_deaf"`
  262. Mute bool `json:"mute"`
  263. Deaf bool `json:"deaf"`
  264. }
  265. // A Presence stores the online, offline, or idle and game status of Guild members.
  266. type Presence struct {
  267. User *User `json:"user"`
  268. Status Status `json:"status"`
  269. Game *Game `json:"game"`
  270. Nick string `json:"nick"`
  271. Roles []string `json:"roles"`
  272. Since *int `json:"since"`
  273. }
  274. // GameType is the type of "game" (see GameType* consts) in the Game struct
  275. type GameType int
  276. // Valid GameType values
  277. const (
  278. GameTypeGame GameType = iota
  279. GameTypeStreaming
  280. )
  281. // A Game struct holds the name of the "playing .." game for a user
  282. type Game struct {
  283. Name string `json:"name"`
  284. Type GameType `json:"type"`
  285. URL string `json:"url,omitempty"`
  286. Details string `json:"details,omitempty"`
  287. State string `json:"state,omitempty"`
  288. TimeStamps TimeStamps `json:"timestamps,omitempty"`
  289. Assets Assets `json:"assets,omitempty"`
  290. ApplicationID string `json:"application_id,omitempty"`
  291. Instance int8 `json:"instance,omitempty"`
  292. // TODO: Party and Secrets (unknown structure)
  293. }
  294. // A TimeStamps struct contains start and end times used in the rich presence "playing .." Game
  295. type TimeStamps struct {
  296. EndTimestamp int64 `json:"end,omitempty"`
  297. StartTimestamp int64 `json:"start,omitempty"`
  298. }
  299. // UnmarshalJSON unmarshals JSON into TimeStamps struct
  300. func (t *TimeStamps) UnmarshalJSON(b []byte) error {
  301. temp := struct {
  302. End float64 `json:"end,omitempty"`
  303. Start float64 `json:"start,omitempty"`
  304. }{}
  305. err := json.Unmarshal(b, &temp)
  306. if err != nil {
  307. return err
  308. }
  309. t.EndTimestamp = int64(temp.End)
  310. t.StartTimestamp = int64(temp.Start)
  311. return nil
  312. }
  313. // An Assets struct contains assets and labels used in the rich presence "playing .." Game
  314. type Assets struct {
  315. LargeImageID string `json:"large_image,omitempty"`
  316. SmallImageID string `json:"small_image,omitempty"`
  317. LargeText string `json:"large_text,omitempty"`
  318. SmallText string `json:"small_text,omitempty"`
  319. }
  320. // A Member stores user information for Guild members.
  321. type Member struct {
  322. GuildID string `json:"guild_id"`
  323. JoinedAt string `json:"joined_at"`
  324. Nick string `json:"nick"`
  325. Deaf bool `json:"deaf"`
  326. Mute bool `json:"mute"`
  327. User *User `json:"user"`
  328. Roles []string `json:"roles"`
  329. }
  330. // A Settings stores data for a specific users Discord client settings.
  331. type Settings struct {
  332. RenderEmbeds bool `json:"render_embeds"`
  333. InlineEmbedMedia bool `json:"inline_embed_media"`
  334. InlineAttachmentMedia bool `json:"inline_attachment_media"`
  335. EnableTtsCommand bool `json:"enable_tts_command"`
  336. MessageDisplayCompact bool `json:"message_display_compact"`
  337. ShowCurrentGame bool `json:"show_current_game"`
  338. ConvertEmoticons bool `json:"convert_emoticons"`
  339. Locale string `json:"locale"`
  340. Theme string `json:"theme"`
  341. GuildPositions []string `json:"guild_positions"`
  342. RestrictedGuilds []string `json:"restricted_guilds"`
  343. FriendSourceFlags *FriendSourceFlags `json:"friend_source_flags"`
  344. Status Status `json:"status"`
  345. DetectPlatformAccounts bool `json:"detect_platform_accounts"`
  346. DeveloperMode bool `json:"developer_mode"`
  347. }
  348. // Status type definition
  349. type Status string
  350. // Constants for Status with the different current available status
  351. const (
  352. StatusOnline Status = "online"
  353. StatusIdle Status = "idle"
  354. StatusDoNotDisturb Status = "dnd"
  355. StatusInvisible Status = "invisible"
  356. StatusOffline Status = "offline"
  357. )
  358. // FriendSourceFlags stores ... TODO :)
  359. type FriendSourceFlags struct {
  360. All bool `json:"all"`
  361. MutualGuilds bool `json:"mutual_guilds"`
  362. MutualFriends bool `json:"mutual_friends"`
  363. }
  364. // A Relationship between the logged in user and Relationship.User
  365. type Relationship struct {
  366. User *User `json:"user"`
  367. Type int `json:"type"` // 1 = friend, 2 = blocked, 3 = incoming friend req, 4 = sent friend req
  368. ID string `json:"id"`
  369. }
  370. // A TooManyRequests struct holds information received from Discord
  371. // when receiving a HTTP 429 response.
  372. type TooManyRequests struct {
  373. Bucket string `json:"bucket"`
  374. Message string `json:"message"`
  375. RetryAfter time.Duration `json:"retry_after"`
  376. }
  377. // A ReadState stores data on the read state of channels.
  378. type ReadState struct {
  379. MentionCount int `json:"mention_count"`
  380. LastMessageID string `json:"last_message_id"`
  381. ID string `json:"id"`
  382. }
  383. // An Ack is used to ack messages
  384. type Ack struct {
  385. Token string `json:"token"`
  386. }
  387. // A GuildRole stores data for guild roles.
  388. type GuildRole struct {
  389. Role *Role `json:"role"`
  390. GuildID string `json:"guild_id"`
  391. }
  392. // A GuildBan stores data for a guild ban.
  393. type GuildBan struct {
  394. Reason string `json:"reason"`
  395. User *User `json:"user"`
  396. }
  397. // A GuildIntegration stores data for a guild integration.
  398. type GuildIntegration struct {
  399. ID string `json:"id"`
  400. Name string `json:"name"`
  401. Type string `json:"type"`
  402. Enabled bool `json:"enabled"`
  403. Syncing bool `json:"syncing"`
  404. RoleID string `json:"role_id"`
  405. ExpireBehavior int `json:"expire_behavior"`
  406. ExpireGracePeriod int `json:"expire_grace_period"`
  407. User *User `json:"user"`
  408. Account *GuildIntegrationAccount `json:"account"`
  409. SyncedAt int `json:"synced_at"`
  410. }
  411. // A GuildIntegrationAccount stores data for a guild integration account.
  412. type GuildIntegrationAccount struct {
  413. ID string `json:"id"`
  414. Name string `json:"name"`
  415. }
  416. // A GuildEmbed stores data for a guild embed.
  417. type GuildEmbed struct {
  418. Enabled bool `json:"enabled"`
  419. ChannelID string `json:"channel_id"`
  420. }
  421. // A UserGuildSettingsChannelOverride stores data for a channel override for a users guild settings.
  422. type UserGuildSettingsChannelOverride struct {
  423. Muted bool `json:"muted"`
  424. MessageNotifications int `json:"message_notifications"`
  425. ChannelID string `json:"channel_id"`
  426. }
  427. // A UserGuildSettings stores data for a users guild settings.
  428. type UserGuildSettings struct {
  429. SupressEveryone bool `json:"suppress_everyone"`
  430. Muted bool `json:"muted"`
  431. MobilePush bool `json:"mobile_push"`
  432. MessageNotifications int `json:"message_notifications"`
  433. GuildID string `json:"guild_id"`
  434. ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"`
  435. }
  436. // A UserGuildSettingsEdit stores data for editing UserGuildSettings
  437. type UserGuildSettingsEdit struct {
  438. SupressEveryone bool `json:"suppress_everyone"`
  439. Muted bool `json:"muted"`
  440. MobilePush bool `json:"mobile_push"`
  441. MessageNotifications int `json:"message_notifications"`
  442. ChannelOverrides map[string]*UserGuildSettingsChannelOverride `json:"channel_overrides"`
  443. }
  444. // An APIErrorMessage is an api error message returned from discord
  445. type APIErrorMessage struct {
  446. Code int `json:"code"`
  447. Message string `json:"message"`
  448. }
  449. // Webhook stores the data for a webhook.
  450. type Webhook struct {
  451. ID string `json:"id"`
  452. GuildID string `json:"guild_id"`
  453. ChannelID string `json:"channel_id"`
  454. User *User `json:"user"`
  455. Name string `json:"name"`
  456. Avatar string `json:"avatar"`
  457. Token string `json:"token"`
  458. }
  459. // WebhookParams is a struct for webhook params, used in the WebhookExecute command.
  460. type WebhookParams struct {
  461. Content string `json:"content,omitempty"`
  462. Username string `json:"username,omitempty"`
  463. AvatarURL string `json:"avatar_url,omitempty"`
  464. TTS bool `json:"tts,omitempty"`
  465. File string `json:"file,omitempty"`
  466. Embeds []*MessageEmbed `json:"embeds,omitempty"`
  467. }
  468. // MessageReaction stores the data for a message reaction.
  469. type MessageReaction struct {
  470. UserID string `json:"user_id"`
  471. MessageID string `json:"message_id"`
  472. Emoji Emoji `json:"emoji"`
  473. ChannelID string `json:"channel_id"`
  474. }
  475. // GatewayBotResponse stores the data for the gateway/bot response
  476. type GatewayBotResponse struct {
  477. URL string `json:"url"`
  478. Shards int `json:"shards"`
  479. }
  480. // Constants for the different bit offsets of text channel permissions
  481. const (
  482. PermissionReadMessages = 1 << (iota + 10)
  483. PermissionSendMessages
  484. PermissionSendTTSMessages
  485. PermissionManageMessages
  486. PermissionEmbedLinks
  487. PermissionAttachFiles
  488. PermissionReadMessageHistory
  489. PermissionMentionEveryone
  490. PermissionUseExternalEmojis
  491. )
  492. // Constants for the different bit offsets of voice permissions
  493. const (
  494. PermissionVoiceConnect = 1 << (iota + 20)
  495. PermissionVoiceSpeak
  496. PermissionVoiceMuteMembers
  497. PermissionVoiceDeafenMembers
  498. PermissionVoiceMoveMembers
  499. PermissionVoiceUseVAD
  500. )
  501. // Constants for general management.
  502. const (
  503. PermissionChangeNickname = 1 << (iota + 26)
  504. PermissionManageNicknames
  505. PermissionManageRoles
  506. PermissionManageWebhooks
  507. PermissionManageEmojis
  508. )
  509. // Constants for the different bit offsets of general permissions
  510. const (
  511. PermissionCreateInstantInvite = 1 << iota
  512. PermissionKickMembers
  513. PermissionBanMembers
  514. PermissionAdministrator
  515. PermissionManageChannels
  516. PermissionManageServer
  517. PermissionAddReactions
  518. PermissionViewAuditLogs
  519. PermissionAllText = PermissionReadMessages |
  520. PermissionSendMessages |
  521. PermissionSendTTSMessages |
  522. PermissionManageMessages |
  523. PermissionEmbedLinks |
  524. PermissionAttachFiles |
  525. PermissionReadMessageHistory |
  526. PermissionMentionEveryone
  527. PermissionAllVoice = PermissionVoiceConnect |
  528. PermissionVoiceSpeak |
  529. PermissionVoiceMuteMembers |
  530. PermissionVoiceDeafenMembers |
  531. PermissionVoiceMoveMembers |
  532. PermissionVoiceUseVAD
  533. PermissionAllChannel = PermissionAllText |
  534. PermissionAllVoice |
  535. PermissionCreateInstantInvite |
  536. PermissionManageRoles |
  537. PermissionManageChannels |
  538. PermissionAddReactions |
  539. PermissionViewAuditLogs
  540. PermissionAll = PermissionAllChannel |
  541. PermissionKickMembers |
  542. PermissionBanMembers |
  543. PermissionManageServer |
  544. PermissionAdministrator
  545. )
  546. // Block contains Discord JSON Error Response codes
  547. const (
  548. ErrCodeUnknownAccount = 10001
  549. ErrCodeUnknownApplication = 10002
  550. ErrCodeUnknownChannel = 10003
  551. ErrCodeUnknownGuild = 10004
  552. ErrCodeUnknownIntegration = 10005
  553. ErrCodeUnknownInvite = 10006
  554. ErrCodeUnknownMember = 10007
  555. ErrCodeUnknownMessage = 10008
  556. ErrCodeUnknownOverwrite = 10009
  557. ErrCodeUnknownProvider = 10010
  558. ErrCodeUnknownRole = 10011
  559. ErrCodeUnknownToken = 10012
  560. ErrCodeUnknownUser = 10013
  561. ErrCodeUnknownEmoji = 10014
  562. ErrCodeBotsCannotUseEndpoint = 20001
  563. ErrCodeOnlyBotsCanUseEndpoint = 20002
  564. ErrCodeMaximumGuildsReached = 30001
  565. ErrCodeMaximumFriendsReached = 30002
  566. ErrCodeMaximumPinsReached = 30003
  567. ErrCodeMaximumGuildRolesReached = 30005
  568. ErrCodeTooManyReactions = 30010
  569. ErrCodeUnauthorized = 40001
  570. ErrCodeMissingAccess = 50001
  571. ErrCodeInvalidAccountType = 50002
  572. ErrCodeCannotExecuteActionOnDMChannel = 50003
  573. ErrCodeEmbedCisabled = 50004
  574. ErrCodeCannotEditFromAnotherUser = 50005
  575. ErrCodeCannotSendEmptyMessage = 50006
  576. ErrCodeCannotSendMessagesToThisUser = 50007
  577. ErrCodeCannotSendMessagesInVoiceChannel = 50008
  578. ErrCodeChannelVerificationLevelTooHigh = 50009
  579. ErrCodeOAuth2ApplicationDoesNotHaveBot = 50010
  580. ErrCodeOAuth2ApplicationLimitReached = 50011
  581. ErrCodeInvalidOAuthState = 50012
  582. ErrCodeMissingPermissions = 50013
  583. ErrCodeInvalidAuthenticationToken = 50014
  584. ErrCodeNoteTooLong = 50015
  585. ErrCodeTooFewOrTooManyMessagesToDelete = 50016
  586. ErrCodeCanOnlyPinMessageToOriginatingChannel = 50019
  587. ErrCodeCannotExecuteActionOnSystemMessage = 50021
  588. ErrCodeMessageProvidedTooOldForBulkDelete = 50034
  589. ErrCodeInvalidFormBody = 50035
  590. ErrCodeInviteAcceptedToGuildApplicationsBotNotIn = 50036
  591. ErrCodeReactionBlocked = 90001
  592. )