From 7faa73a5610d98719a008bc1364ed8bf1d1f910c Mon Sep 17 00:00:00 2001 From: Sugden <28943913+NotSugden@users.noreply.github.com> Date: Fri, 20 Nov 2020 15:18:13 +0000 Subject: [PATCH] feat: add missing error codes (#5008) Co-authored-by: SpaceEEC --- src/util/Constants.js | 18 +++++ typings/index.d.ts | 161 +++++++++++++++++------------------------- 2 files changed, 81 insertions(+), 98 deletions(-) diff --git a/src/util/Constants.js b/src/util/Constants.js index 2d9ab42db420..61a03ccb8e6e 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -519,17 +519,25 @@ exports.VerificationLevels = ['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_HIGH']; * * UNKNOWN_USER * * UNKNOWN_EMOJI * * UNKNOWN_WEBHOOK + * * UNKNOWN_BAN * * BOT_PROHIBITED_ENDPOINT * * BOT_ONLY_ENDPOINT + * * CHANNEL_HIT_WRITE_RATELIMIT * * MAXIMUM_GUILDS * * MAXIMUM_FRIENDS * * MAXIMUM_PINS * * MAXIMUM_ROLES + * * MAXIMUM_WEBHOOKS * * MAXIMUM_REACTIONS * * MAXIMUM_CHANNELS + * * MAXIMUM_ATTACHMENTS * * MAXIMUM_INVITES * * UNAUTHORIZED + * * ACCOUNT_VERIFICATION_REQUIRED + * * REQUEST_ENTITY_TOO_LARGE + * * FEATURE_TEMPORARILY_DISABLED * * USER_BANNED + * * ALREADY_CROSSPOSTED * * MISSING_ACCESS * * INVALID_ACCOUNT_TYPE * * CANNOT_EXECUTE_ON_DM @@ -554,6 +562,7 @@ exports.VerificationLevels = ['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_HIGH']; * * INVALID_FORM_BODY * * INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT * * INVALID_API_VERSION + * * CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL * * REACTION_BLOCKED * * RESOURCE_OVERLOADED * @typedef {string} APIError @@ -574,17 +583,25 @@ exports.APIErrors = { UNKNOWN_USER: 10013, UNKNOWN_EMOJI: 10014, UNKNOWN_WEBHOOK: 10015, + UNKNOWN_BAN: 10026, BOT_PROHIBITED_ENDPOINT: 20001, BOT_ONLY_ENDPOINT: 20002, + CHANNEL_HIT_WRITE_RATELIMIT: 20028, MAXIMUM_GUILDS: 30001, MAXIMUM_FRIENDS: 30002, MAXIMUM_PINS: 30003, MAXIMUM_ROLES: 30005, + MAXIMUM_WEBHOOKS: 30007, MAXIMUM_REACTIONS: 30010, MAXIMUM_CHANNELS: 30013, + MAXIMUM_ATTACHMENTS: 30015, MAXIMUM_INVITES: 30016, UNAUTHORIZED: 40001, + ACCOUNT_VERIFICATION_REQUIRED: 40002, + REQUEST_ENTITY_TOO_LARGE: 40005, + FEATURE_TEMPORARILY_DISABLED: 40006, USER_BANNED: 40007, + ALREADY_CROSSPOSTED: 40033, MISSING_ACCESS: 50001, INVALID_ACCOUNT_TYPE: 50002, CANNOT_EXECUTE_ON_DM: 50003, @@ -609,6 +626,7 @@ exports.APIErrors = { INVALID_FORM_BODY: 50035, INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: 50036, INVALID_API_VERSION: 50041, + CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL: 50074, REACTION_BLOCKED: 90001, RESOURCE_OVERLOADED: 130000, }; diff --git a/typings/index.d.ts b/typings/index.d.ts index 8cc90bb5f439..056c628b778f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -482,59 +482,7 @@ declare module 'discord.js' { HELLO: 10; HEARTBEAT_ACK: 11; }; - APIErrors: { - UNKNOWN_ACCOUNT: 10001; - UNKNOWN_APPLICATION: 10002; - UNKNOWN_CHANNEL: 10003; - UNKNOWN_GUILD: 10004; - UNKNOWN_INTEGRATION: 10005; - UNKNOWN_INVITE: 10006; - UNKNOWN_MEMBER: 10007; - UNKNOWN_MESSAGE: 10008; - UNKNOWN_OVERWRITE: 10009; - UNKNOWN_PROVIDER: 10010; - UNKNOWN_ROLE: 10011; - UNKNOWN_TOKEN: 10012; - UNKNOWN_USER: 10013; - UNKNOWN_EMOJI: 10014; - UNKNOWN_WEBHOOK: 10015; - BOT_PROHIBITED_ENDPOINT: 20001; - BOT_ONLY_ENDPOINT: 20002; - MAXIMUM_GUILDS: 30001; - MAXIMUM_FRIENDS: 30002; - MAXIMUM_PINS: 30003; - MAXIMUM_ROLES: 30005; - MAXIMUM_REACTIONS: 30010; - MAXIMUM_CHANNELS: 30013; - MAXIMUM_INVITES: 30016; - UNAUTHORIZED: 40001; - USER_BANNED: 40007; - MISSING_ACCESS: 50001; - INVALID_ACCOUNT_TYPE: 50002; - CANNOT_EXECUTE_ON_DM: 50003; - EMBED_DISABLED: 50004; - CANNOT_EDIT_MESSAGE_BY_OTHER: 50005; - CANNOT_SEND_EMPTY_MESSAGE: 50006; - CANNOT_MESSAGE_USER: 50007; - CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: 50008; - CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: 50009; - OAUTH2_APPLICATION_BOT_ABSENT: 50010; - MAXIMUM_OAUTH2_APPLICATIONS: 50011; - INVALID_OAUTH_STATE: 50012; - MISSING_PERMISSIONS: 50013; - INVALID_AUTHENTICATION_TOKEN: 50014; - NOTE_TOO_LONG: 50015; - INVALID_BULK_DELETE_QUANTITY: 50016; - CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019; - CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021; - INVALID_OAUTH_TOKEN: 50025; - BULK_DELETE_MESSAGE_TOO_OLD: 50034; - INVALID_FORM_BODY: 50035; - INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: 50036; - INVALID_API_VERSION: 50041; - REACTION_BLOCKED: 90001; - RESOURCE_OVERLOADED: 130000; - }; + APIErrors: APIErrors; VoiceStatus: { CONNECTED: 0; CONNECTING: 1; @@ -2136,51 +2084,68 @@ declare module 'discord.js' { deaf?: boolean; } - interface APIError { - UNKNOWN_ACCOUNT: number; - UNKNOWN_APPLICATION: number; - UNKNOWN_CHANNEL: number; - UNKNOWN_GUILD: number; - UNKNOWN_INTEGRATION: number; - UNKNOWN_INVITE: number; - UNKNOWN_MEMBER: number; - UNKNOWN_MESSAGE: number; - UNKNOWN_OVERWRITE: number; - UNKNOWN_PROVIDER: number; - UNKNOWN_ROLE: number; - UNKNOWN_TOKEN: number; - UNKNOWN_USER: number; - UNKNOWN_EMOJI: number; - UNKNOWN_WEBHOOK: number; - BOT_PROHIBITED_ENDPOINT: number; - BOT_ONLY_ENDPOINT: number; - MAXIMUM_GUILDS: number; - MAXIMUM_FRIENDS: number; - MAXIMUM_PINS: number; - MAXIMUM_ROLES: number; - MAXIMUM_REACTIONS: number; - UNAUTHORIZED: number; - MISSING_ACCESS: number; - INVALID_ACCOUNT_TYPE: number; - CANNOT_EXECUTE_ON_DM: number; - EMBED_DISABLED: number; - CANNOT_EDIT_MESSAGE_BY_OTHER: number; - CANNOT_SEND_EMPTY_MESSAGE: number; - CANNOT_MESSAGE_USER: number; - CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: number; - CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: number; - OAUTH2_APPLICATION_BOT_ABSENT: number; - MAXIMUM_OAUTH2_APPLICATIONS: number; - INVALID_OAUTH_STATE: number; - MISSING_PERMISSIONS: number; - INVALID_AUTHENTICATION_TOKEN: number; - NOTE_TOO_LONG: number; - INVALID_BULK_DELETE_QUANTITY: number; - CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: number; - CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: number; - BULK_DELETE_MESSAGE_TOO_OLD: number; - INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: number; - REACTION_BLOCKED: number; + interface APIErrors { + UNKNOWN_ACCOUNT: 10001; + UNKNOWN_APPLICATION: 10002; + UNKNOWN_CHANNEL: 10003; + UNKNOWN_GUILD: 10004; + UNKNOWN_INTEGRATION: 10005; + UNKNOWN_INVITE: 10006; + UNKNOWN_MEMBER: 10007; + UNKNOWN_MESSAGE: 10008; + UNKNOWN_OVERWRITE: 10009; + UNKNOWN_PROVIDER: 10010; + UNKNOWN_ROLE: 10011; + UNKNOWN_TOKEN: 10012; + UNKNOWN_USER: 10013; + UNKNOWN_EMOJI: 10014; + UNKNOWN_WEBHOOK: 10015; + UNKNOWN_BAN: 10026; + BOT_PROHIBITED_ENDPOINT: 20001; + BOT_ONLY_ENDPOINT: 20002; + CHANNEL_HIT_WRITE_RATELIMIT: 20028; + MAXIMUM_GUILDS: 30001; + MAXIMUM_FRIENDS: 30002; + MAXIMUM_PINS: 30003; + MAXIMUM_ROLES: 30005; + MAXIMUM_WEBHOOKS: 30007; + MAXIMUM_REACTIONS: 30010; + MAXIMUM_CHANNELS: 30013; + MAXIMUM_ATTACHMENTS: 30015; + MAXIMUM_INVITES: 30016; + UNAUTHORIZED: 40001; + ACCOUNT_VERIFICATION_REQUIRED: 40002; + REQUEST_ENTITY_TOO_LARGE: 40005; + FEATURE_TEMPORARILY_DISABLED: 40006; + USER_BANNED: 40007; + ALREADY_CROSSPOSTED: 40033; + MISSING_ACCESS: 50001; + INVALID_ACCOUNT_TYPE: 50002; + CANNOT_EXECUTE_ON_DM: 50003; + EMBED_DISABLED: 50004; + CANNOT_EDIT_MESSAGE_BY_OTHER: 50005; + CANNOT_SEND_EMPTY_MESSAGE: 50006; + CANNOT_MESSAGE_USER: 50007; + CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: 50008; + CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: 50009; + OAUTH2_APPLICATION_BOT_ABSENT: 50010; + MAXIMUM_OAUTH2_APPLICATIONS: 50011; + INVALID_OAUTH_STATE: 50012; + MISSING_PERMISSIONS: 50013; + INVALID_AUTHENTICATION_TOKEN: 50014; + NOTE_TOO_LONG: 50015; + INVALID_BULK_DELETE_QUANTITY: 50016; + CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019; + INVALID_OR_TAKEN_INVITE_CODE: 50020; + CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021; + INVALID_OAUTH_TOKEN: 50025; + BULK_DELETE_MESSAGE_TOO_OLD: 50034; + INVALID_FORM_BODY: 50035; + INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: 50036; + INVALID_API_VERSION: 50041; + CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL: 50074; + REACTION_BLOCKED: 90001; + RESOURCE_OVERLOADED: 130000; } type APIMessageContentResolvable = string | number | boolean | bigint | symbol | readonly StringResolvable[];