structs.go 22 KB

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