structs.go 22 KB

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