structs.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  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. }
  165. // APIName returns an correctly formatted API name for use in the MessageReactions endpoints.
  166. func (e *Emoji) APIName() string {
  167. if e.ID != "" && e.Name != "" {
  168. return e.Name + ":" + e.ID
  169. }
  170. if e.Name != "" {
  171. return e.Name
  172. }
  173. return e.ID
  174. }
  175. // VerificationLevel type definition
  176. type VerificationLevel int
  177. // Constants for VerificationLevel levels from 0 to 3 inclusive
  178. const (
  179. VerificationLevelNone VerificationLevel = iota
  180. VerificationLevelLow
  181. VerificationLevelMedium
  182. VerificationLevelHigh
  183. )
  184. // A Guild holds all data related to a specific Discord Guild. Guilds are also
  185. // sometimes referred to as Servers in the Discord client.
  186. type Guild struct {
  187. ID string `json:"id"`
  188. Name string `json:"name"`
  189. Icon string `json:"icon"`
  190. Region string `json:"region"`
  191. AfkChannelID string `json:"afk_channel_id"`
  192. EmbedChannelID string `json:"embed_channel_id"`
  193. OwnerID string `json:"owner_id"`
  194. JoinedAt Timestamp `json:"joined_at"`
  195. Splash string `json:"splash"`
  196. AfkTimeout int `json:"afk_timeout"`
  197. MemberCount int `json:"member_count"`
  198. VerificationLevel VerificationLevel `json:"verification_level"`
  199. EmbedEnabled bool `json:"embed_enabled"`
  200. Large bool `json:"large"` // ??
  201. DefaultMessageNotifications int `json:"default_message_notifications"`
  202. Roles []*Role `json:"roles"`
  203. Emojis []*Emoji `json:"emojis"`
  204. Members []*Member `json:"members"`
  205. Presences []*Presence `json:"presences"`
  206. Channels []*Channel `json:"channels"`
  207. VoiceStates []*VoiceState `json:"voice_states"`
  208. Unavailable bool `json:"unavailable"`
  209. }
  210. // A UserGuild holds a brief version of a Guild
  211. type UserGuild struct {
  212. ID string `json:"id"`
  213. Name string `json:"name"`
  214. Icon string `json:"icon"`
  215. Owner bool `json:"owner"`
  216. Permissions int `json:"permissions"`
  217. }
  218. // A GuildParams stores all the data needed to update discord guild settings
  219. type GuildParams struct {
  220. Name string `json:"name,omitempty"`
  221. Region string `json:"region,omitempty"`
  222. VerificationLevel *VerificationLevel `json:"verification_level,omitempty"`
  223. DefaultMessageNotifications int `json:"default_message_notifications,omitempty"` // TODO: Separate type?
  224. AfkChannelID string `json:"afk_channel_id,omitempty"`
  225. AfkTimeout int `json:"afk_timeout,omitempty"`
  226. Icon string `json:"icon,omitempty"`
  227. OwnerID string `json:"owner_id,omitempty"`
  228. Splash string `json:"splash,omitempty"`
  229. }
  230. // A Role stores information about Discord guild member roles.
  231. type Role struct {
  232. ID string `json:"id"`
  233. Name string `json:"name"`
  234. Managed bool `json:"managed"`
  235. Mentionable bool `json:"mentionable"`
  236. Hoist bool `json:"hoist"`
  237. Color int `json:"color"`
  238. Position int `json:"position"`
  239. Permissions int `json:"permissions"`
  240. }
  241. // Roles are a collection of Role
  242. type Roles []*Role
  243. func (r Roles) Len() int {
  244. return len(r)
  245. }
  246. func (r Roles) Less(i, j int) bool {
  247. return r[i].Position > r[j].Position
  248. }
  249. func (r Roles) Swap(i, j int) {
  250. r[i], r[j] = r[j], r[i]
  251. }
  252. // A VoiceState stores the voice states of Guilds
  253. type VoiceState struct {
  254. UserID string `json:"user_id"`
  255. SessionID string `json:"session_id"`
  256. ChannelID string `json:"channel_id"`
  257. GuildID string `json:"guild_id"`
  258. Suppress bool `json:"suppress"`
  259. SelfMute bool `json:"self_mute"`
  260. SelfDeaf bool `json:"self_deaf"`
  261. Mute bool `json:"mute"`
  262. Deaf bool `json:"deaf"`
  263. }
  264. // A Presence stores the online, offline, or idle and game status of Guild members.
  265. type Presence struct {
  266. User *User `json:"user"`
  267. Status Status `json:"status"`
  268. Game *Game `json:"game"`
  269. Nick string `json:"nick"`
  270. Roles []string `json:"roles"`
  271. Since *int `json:"since"`
  272. }
  273. // GameType is the type of "game" (see GameType* consts) in the Game struct
  274. type GameType int
  275. // Valid GameType values
  276. const (
  277. GameTypeGame GameType = iota
  278. GameTypeStreaming
  279. )
  280. // A Game struct holds the name of the "playing .." game for a user
  281. type Game struct {
  282. Name string `json:"name"`
  283. Type GameType `json:"type"`
  284. URL string `json:"url,omitempty"`
  285. Details string `json:"details,omitempty"`
  286. State string `json:"state,omitempty"`
  287. TimeStamps TimeStamps `json:"timestamps,omitempty"`
  288. Assets Assets `json:"assets,omitempty"`
  289. ApplicationID string `json:"application_id,omitempty"`
  290. Instance int8 `json:"instance,omitempty"`
  291. // TODO: Party and Secrets (unknown structure)
  292. }
  293. // A TimeStamps struct contains start and end times used in the rich presence "playing .." Game
  294. type TimeStamps struct {
  295. EndTimestamp int64 `json:"end,omitempty"`
  296. StartTimestamp int64 `json:"start,omitempty"`
  297. }
  298. // UnmarshalJSON unmarshals JSON into TimeStamps struct
  299. func (t *TimeStamps) UnmarshalJSON(b []byte) error {
  300. temp := struct {
  301. End float64 `json:"end,omitempty"`
  302. Start float64 `json:"start,omitempty"`
  303. }{}
  304. err := json.Unmarshal(b, &temp)
  305. if err != nil {
  306. return err
  307. }
  308. t.EndTimestamp = int64(temp.End)
  309. t.StartTimestamp = int64(temp.Start)
  310. return nil
  311. }
  312. // An Assets struct contains assets and labels used in the rich presence "playing .." Game
  313. type Assets struct {
  314. LargeImageID string `json:"large_image,omitempty"`
  315. SmallImageID string `json:"small_image,omitempty"`
  316. LargeText string `json:"large_text,omitempty"`
  317. SmallText string `json:"small_text,omitempty"`
  318. }
  319. // A Member stores user information for Guild members.
  320. type Member struct {
  321. GuildID string `json:"guild_id"`
  322. JoinedAt string `json:"joined_at"`
  323. Nick string `json:"nick"`
  324. Deaf bool `json:"deaf"`
  325. Mute bool `json:"mute"`
  326. User *User `json:"user"`
  327. Roles []string `json:"roles"`
  328. }
  329. // A Settings stores data for a specific users Discord client settings.
  330. type Settings struct {
  331. RenderEmbeds bool `json:"render_embeds"`
  332. InlineEmbedMedia bool `json:"inline_embed_media"`
  333. InlineAttachmentMedia bool `json:"inline_attachment_media"`
  334. EnableTtsCommand bool `json:"enable_tts_command"`
  335. MessageDisplayCompact bool `json:"message_display_compact"`
  336. ShowCurrentGame bool `json:"show_current_game"`
  337. ConvertEmoticons bool `json:"convert_emoticons"`
  338. Locale string `json:"locale"`
  339. Theme string `json:"theme"`
  340. GuildPositions []string `json:"guild_positions"`
  341. RestrictedGuilds []string `json:"restricted_guilds"`
  342. FriendSourceFlags *FriendSourceFlags `json:"friend_source_flags"`
  343. Status Status `json:"status"`
  344. DetectPlatformAccounts bool `json:"detect_platform_accounts"`
  345. DeveloperMode bool `json:"developer_mode"`
  346. }
  347. // Status type definition
  348. type Status string
  349. // Constants for Status with the different current available status
  350. const (
  351. StatusOnline Status = "online"
  352. StatusIdle Status = "idle"
  353. StatusDoNotDisturb Status = "dnd"
  354. StatusInvisible Status = "invisible"
  355. StatusOffline Status = "offline"
  356. )
  357. // FriendSourceFlags stores ... TODO :)
  358. type FriendSourceFlags struct {
  359. All bool `json:"all"`
  360. MutualGuilds bool `json:"mutual_guilds"`
  361. MutualFriends bool `json:"mutual_friends"`
  362. }
  363. // A Relationship between the logged in user and Relationship.User
  364. type Relationship struct {
  365. User *User `json:"user"`
  366. Type int `json:"type"` // 1 = friend, 2 = blocked, 3 = incoming friend req, 4 = sent friend req
  367. ID string `json:"id"`
  368. }
  369. // A TooManyRequests struct holds information received from Discord
  370. // when receiving a HTTP 429 response.
  371. type TooManyRequests struct {
  372. Bucket string `json:"bucket"`
  373. Message string `json:"message"`
  374. RetryAfter time.Duration `json:"retry_after"`
  375. }
  376. // A ReadState stores data on the read state of channels.
  377. type ReadState struct {
  378. MentionCount int `json:"mention_count"`
  379. LastMessageID string `json:"last_message_id"`
  380. ID string `json:"id"`
  381. }
  382. // An Ack is used to ack messages
  383. type Ack struct {
  384. Token string `json:"token"`
  385. }
  386. // A GuildRole stores data for guild roles.
  387. type GuildRole struct {
  388. Role *Role `json:"role"`
  389. GuildID string `json:"guild_id"`
  390. }
  391. // A GuildBan stores data for a guild ban.
  392. type GuildBan struct {
  393. Reason string `json:"reason"`
  394. User *User `json:"user"`
  395. }
  396. // A GuildIntegration stores data for a guild integration.
  397. type GuildIntegration struct {
  398. ID string `json:"id"`
  399. Name string `json:"name"`
  400. Type string `json:"type"`
  401. Enabled bool `json:"enabled"`
  402. Syncing bool `json:"syncing"`
  403. RoleID string `json:"role_id"`
  404. ExpireBehavior int `json:"expire_behavior"`
  405. ExpireGracePeriod int `json:"expire_grace_period"`
  406. User *User `json:"user"`
  407. Account *GuildIntegrationAccount `json:"account"`
  408. SyncedAt int `json:"synced_at"`
  409. }
  410. // A GuildIntegrationAccount stores data for a guild integration account.
  411. type GuildIntegrationAccount struct {
  412. ID string `json:"id"`
  413. Name string `json:"name"`
  414. }
  415. // A GuildEmbed stores data for a guild embed.
  416. type GuildEmbed struct {
  417. Enabled bool `json:"enabled"`
  418. ChannelID string `json:"channel_id"`
  419. }
  420. // A UserGuildSettingsChannelOverride stores data for a channel override for a users guild settings.
  421. type UserGuildSettingsChannelOverride struct {
  422. Muted bool `json:"muted"`
  423. MessageNotifications int `json:"message_notifications"`
  424. ChannelID string `json:"channel_id"`
  425. }
  426. // A UserGuildSettings stores data for a users guild settings.
  427. type UserGuildSettings struct {
  428. SupressEveryone bool `json:"suppress_everyone"`
  429. Muted bool `json:"muted"`
  430. MobilePush bool `json:"mobile_push"`
  431. MessageNotifications int `json:"message_notifications"`
  432. GuildID string `json:"guild_id"`
  433. ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"`
  434. }
  435. // A UserGuildSettingsEdit stores data for editing UserGuildSettings
  436. type UserGuildSettingsEdit struct {
  437. SupressEveryone bool `json:"suppress_everyone"`
  438. Muted bool `json:"muted"`
  439. MobilePush bool `json:"mobile_push"`
  440. MessageNotifications int `json:"message_notifications"`
  441. ChannelOverrides map[string]*UserGuildSettingsChannelOverride `json:"channel_overrides"`
  442. }
  443. // An APIErrorMessage is an api error message returned from discord
  444. type APIErrorMessage struct {
  445. Code int `json:"code"`
  446. Message string `json:"message"`
  447. }
  448. // Webhook stores the data for a webhook.
  449. type Webhook struct {
  450. ID string `json:"id"`
  451. GuildID string `json:"guild_id"`
  452. ChannelID string `json:"channel_id"`
  453. User *User `json:"user"`
  454. Name string `json:"name"`
  455. Avatar string `json:"avatar"`
  456. Token string `json:"token"`
  457. }
  458. // WebhookParams is a struct for webhook params, used in the WebhookExecute command.
  459. type WebhookParams struct {
  460. Content string `json:"content,omitempty"`
  461. Username string `json:"username,omitempty"`
  462. AvatarURL string `json:"avatar_url,omitempty"`
  463. TTS bool `json:"tts,omitempty"`
  464. File string `json:"file,omitempty"`
  465. Embeds []*MessageEmbed `json:"embeds,omitempty"`
  466. }
  467. // MessageReaction stores the data for a message reaction.
  468. type MessageReaction struct {
  469. UserID string `json:"user_id"`
  470. MessageID string `json:"message_id"`
  471. Emoji Emoji `json:"emoji"`
  472. ChannelID string `json:"channel_id"`
  473. }
  474. // GatewayBotResponse stores the data for the gateway/bot response
  475. type GatewayBotResponse struct {
  476. URL string `json:"url"`
  477. Shards int `json:"shards"`
  478. }
  479. // Constants for the different bit offsets of text channel permissions
  480. const (
  481. PermissionReadMessages = 1 << (iota + 10)
  482. PermissionSendMessages
  483. PermissionSendTTSMessages
  484. PermissionManageMessages
  485. PermissionEmbedLinks
  486. PermissionAttachFiles
  487. PermissionReadMessageHistory
  488. PermissionMentionEveryone
  489. PermissionUseExternalEmojis
  490. )
  491. // Constants for the different bit offsets of voice permissions
  492. const (
  493. PermissionVoiceConnect = 1 << (iota + 20)
  494. PermissionVoiceSpeak
  495. PermissionVoiceMuteMembers
  496. PermissionVoiceDeafenMembers
  497. PermissionVoiceMoveMembers
  498. PermissionVoiceUseVAD
  499. )
  500. // Constants for general management.
  501. const (
  502. PermissionChangeNickname = 1 << (iota + 26)
  503. PermissionManageNicknames
  504. PermissionManageRoles
  505. PermissionManageWebhooks
  506. PermissionManageEmojis
  507. )
  508. // Constants for the different bit offsets of general permissions
  509. const (
  510. PermissionCreateInstantInvite = 1 << iota
  511. PermissionKickMembers
  512. PermissionBanMembers
  513. PermissionAdministrator
  514. PermissionManageChannels
  515. PermissionManageServer
  516. PermissionAddReactions
  517. PermissionViewAuditLogs
  518. PermissionAllText = PermissionReadMessages |
  519. PermissionSendMessages |
  520. PermissionSendTTSMessages |
  521. PermissionManageMessages |
  522. PermissionEmbedLinks |
  523. PermissionAttachFiles |
  524. PermissionReadMessageHistory |
  525. PermissionMentionEveryone
  526. PermissionAllVoice = PermissionVoiceConnect |
  527. PermissionVoiceSpeak |
  528. PermissionVoiceMuteMembers |
  529. PermissionVoiceDeafenMembers |
  530. PermissionVoiceMoveMembers |
  531. PermissionVoiceUseVAD
  532. PermissionAllChannel = PermissionAllText |
  533. PermissionAllVoice |
  534. PermissionCreateInstantInvite |
  535. PermissionManageRoles |
  536. PermissionManageChannels |
  537. PermissionAddReactions |
  538. PermissionViewAuditLogs
  539. PermissionAll = PermissionAllChannel |
  540. PermissionKickMembers |
  541. PermissionBanMembers |
  542. PermissionManageServer |
  543. PermissionAdministrator
  544. )
  545. // Block contains Discord JSON Error Response codes
  546. const (
  547. ErrCodeUnknownAccount = 10001
  548. ErrCodeUnknownApplication = 10002
  549. ErrCodeUnknownChannel = 10003
  550. ErrCodeUnknownGuild = 10004
  551. ErrCodeUnknownIntegration = 10005
  552. ErrCodeUnknownInvite = 10006
  553. ErrCodeUnknownMember = 10007
  554. ErrCodeUnknownMessage = 10008
  555. ErrCodeUnknownOverwrite = 10009
  556. ErrCodeUnknownProvider = 10010
  557. ErrCodeUnknownRole = 10011
  558. ErrCodeUnknownToken = 10012
  559. ErrCodeUnknownUser = 10013
  560. ErrCodeUnknownEmoji = 10014
  561. ErrCodeBotsCannotUseEndpoint = 20001
  562. ErrCodeOnlyBotsCanUseEndpoint = 20002
  563. ErrCodeMaximumGuildsReached = 30001
  564. ErrCodeMaximumFriendsReached = 30002
  565. ErrCodeMaximumPinsReached = 30003
  566. ErrCodeMaximumGuildRolesReached = 30005
  567. ErrCodeTooManyReactions = 30010
  568. ErrCodeUnauthorized = 40001
  569. ErrCodeMissingAccess = 50001
  570. ErrCodeInvalidAccountType = 50002
  571. ErrCodeCannotExecuteActionOnDMChannel = 50003
  572. ErrCodeEmbedCisabled = 50004
  573. ErrCodeCannotEditFromAnotherUser = 50005
  574. ErrCodeCannotSendEmptyMessage = 50006
  575. ErrCodeCannotSendMessagesToThisUser = 50007
  576. ErrCodeCannotSendMessagesInVoiceChannel = 50008
  577. ErrCodeChannelVerificationLevelTooHigh = 50009
  578. ErrCodeOAuth2ApplicationDoesNotHaveBot = 50010
  579. ErrCodeOAuth2ApplicationLimitReached = 50011
  580. ErrCodeInvalidOAuthState = 50012
  581. ErrCodeMissingPermissions = 50013
  582. ErrCodeInvalidAuthenticationToken = 50014
  583. ErrCodeNoteTooLong = 50015
  584. ErrCodeTooFewOrTooManyMessagesToDelete = 50016
  585. ErrCodeCanOnlyPinMessageToOriginatingChannel = 50019
  586. ErrCodeCannotExecuteActionOnSystemMessage = 50021
  587. ErrCodeMessageProvidedTooOldForBulkDelete = 50034
  588. ErrCodeInvalidFormBody = 50035
  589. ErrCodeInviteAcceptedToGuildApplicationsBotNotIn = 50036
  590. ErrCodeReactionBlocked = 90001
  591. )