diff --git a/src/types/codes/gatewayCloseEventCodes.ts b/src/types/codes/gatewayCloseEventCodes.ts index 94f4dfebf..65292cf0f 100644 --- a/src/types/codes/gatewayCloseEventCodes.ts +++ b/src/types/codes/gatewayCloseEventCodes.ts @@ -1,17 +1,31 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#opcodes-and-status-codes */ export enum GatewayCloseEventCodes { + /** We're not sure what went wrong. Try reconnecting? */ UnknownError = 4000, + /** You sent an invalid [Gateway opcode](https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) or an invalid payload for an opcode. Don't do that! */ UnknownOpcode, + /** You sent an invalid [payload](https://discord.com/developers/docs/topics/gateway#sending-payloads) to us. Don't do that! */ DecodeError, + /** You sent us a payload prior to [identifying](https://discord.com/developers/docs/topics/gateway#identify). */ NotAuthenticated, + /** The account token sent with your [identify payload](https://discord.com/developers/docs/topics/gateway#identify) is incorrect. */ AuthenticationFailed, + /** You sent more than one identify payload. Don't do that! */ AlreadyAuthenticated, + /** The sequence sent when [resuming](https://discord.com/developers/docs/topics/gateway#resume) the session was invalid. Reconnect and start a new session. */ InvalidSeq = 4007, + /** Woah nelly! You're sending payloads to us too quickly. Slow it down! You will be disconnected on receiving this. */ RateLimited, + /** Your session timed out. Reconnect and start a new one. */ SessionTimedOut, + /** You sent us an invalid [shard when identifying](https://discord.com/developers/docs/topics/gateway#sharding). */ InvalidShard, + /** The session would have handled too many guilds - you are required to [shard](https://discord.com/developers/docs/topics/gateway#sharding) your connection in order to connect. */ ShardingRequired, + /** You sent an invalid version for the gateway. */ InvalidApiVersion, + /** You sent an invalid intent for a [Gateway Intent](https://discord.com/developers/docs/topics/gateway#gateway-intents). You may have incorrectly calculated the bitwise value. */ InvalidIntents, + /** You sent a disallowed intent for a [Gateway Intent](https://discord.com/developers/docs/topics/gateway#gateway-intents). You may have tried to specify an intent that you [have not enabled or are not approved for](https://discord.com/developers/docs/topics/gateway#privileged-intents). */ DisallowedIntents, } diff --git a/src/types/codes/gatewayOpcodes.ts b/src/types/codes/gatewayOpcodes.ts index 55e933e67..ca575019e 100644 --- a/src/types/codes/gatewayOpcodes.ts +++ b/src/types/codes/gatewayOpcodes.ts @@ -1,14 +1,26 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes */ export enum GatewayOpcodes { + /** An event was dispatched. */ Dispatch, + /** Fired periodically by the client to keep the connection alive. */ Heartbeat, + /** Starts a new session during the initial handshake. */ Identify, + /** Update the client's presence. */ PresenceUpdate, + /** Used to join/leave or move between voice channels. */ + VoiceStateUpdate, + /** Resume a previous session that was disconnected. */ Resume = 6, + /** You should attempt to reconnect and resume immediately. */ Reconnect, + /** Request information about offline guild members in a large guild. */ RequestGuildMembers, + /** The session has been invalidated. You should reconnect and identify/resume accordingly. */ InvalidSession, + /** Sent immediately after connecting, contains the `heartbeat_interval` to use. */ Hello, + /** Sent in response to receiving a heartbeat to acknowledge that it has been received. */ HeartbeatACK, } diff --git a/src/types/codes/httpResponseCodes.ts b/src/types/codes/httpResponseCodes.ts index cc8242a0a..b6117460b 100644 --- a/src/types/codes/httpResponseCodes.ts +++ b/src/types/codes/httpResponseCodes.ts @@ -1,14 +1,25 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http */ export enum HTTPResponseCodes { + /** The request completed successfully. */ Ok = 200, + /** The entity was created successfully. */ Created, + /** The request completed successfully but returned no content. */ NoContent = 204, + /** The entity was not modified (no action was taken). */ NotModified = 304, + /** The request was improperly formatted, or the server couldn't understand it. */ BadRequest = 400, + /** The `Authorization` header was missing or invalid. */ Unauthorized, + /** The `Authorization` token you passed did not have permission to the resource. */ Forbidden = 403, + /** The resource at the location specified doesn't exist. */ NotFound, + /** The HTTP method used is not valid for the location specified. */ MethodNotAllowed, + /** You are being rate limited, see [Rate Limits](https://discord.com/developers/docs/topics/rate-limits). */ TooManyRequests = 429, + /** There was not a gateway available to process your request. Wait a bit and retry. */ GatewayUnavailable = 502, } diff --git a/src/types/codes/jsonErrorCodes.ts b/src/types/codes/jsonErrorCodes.ts index eadf39c6a..1243fe4c0 100644 --- a/src/types/codes/jsonErrorCodes.ts +++ b/src/types/codes/jsonErrorCodes.ts @@ -1,5 +1,6 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#json */ export enum JsonErrorCodes { + /** General error (such as a malformed request body, amongst other things) */ GeneralError, UnknownAccount = 10001, UnknownApplication, @@ -109,6 +110,7 @@ export enum JsonErrorCodes { InvalidRole, InvalidRecipients = 50033, AMessageProvidedWasTooOldToBulkDelete, + /** Invalid form body (returned for both `application/json` and `multipart/form-data` bodies), or invalid `Content-Type` provided */ InvalidFormBodyOrContentTypeProvided, AnInviteWasAcceptedToAGuildTheApplicationsBotIsNotIn, InvalidApiVersionProvided = 50041, diff --git a/src/types/codes/rpcCloseEventCodes.ts b/src/types/codes/rpcCloseEventCodes.ts index c7075f6d2..9f1c951c7 100644 --- a/src/types/codes/rpcCloseEventCodes.ts +++ b/src/types/codes/rpcCloseEventCodes.ts @@ -1,9 +1,15 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc */ export enum RpcCloseEventCodes { + /** You connected to the RPC server with an invalid client ID. */ InvalidClientId = 4000, + /** You connected to the RPC server with an invalid origin. */ InvalidOrigin, + /** You are being rate limited. */ RateLimited, + /** The OAuth2 token associated with a connection was revoked, get a new one! */ TokenRevoked, + /** The RPC Server version specified in the connection string was not valid. */ InvalidVersion, + /** The encoding specified in the connection string was not valid. */ InvalidEncoding, } diff --git a/src/types/codes/rpcErrorCodes.ts b/src/types/codes/rpcErrorCodes.ts index 76cdc38f0..414f15e36 100644 --- a/src/types/codes/rpcErrorCodes.ts +++ b/src/types/codes/rpcErrorCodes.ts @@ -1,19 +1,35 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc */ export enum RpcErrorCodes { + /** An unknown error occurred. */ UnknownError = 1000, + /** You sent an invalid payload. */ InvalidPayload = 4000, + /** Invalid command name specified. */ InvalidCommand = 4002, + /** Invalid guild ID specified. */ InvalidGuild, + /** Invalid event name specified. */ InvalidEvent, + /** Invalid channel ID specified. */ InvalidChannel, + /** You lack permissions to access the given resource. */ InvalidPermissions, + /** An invalid OAuth2 application ID was used to authorize or authenticate with. */ InvalidClientId, + /** An invalid OAuth2 application origin was used to authorize or authenticate with. */ InvalidOrigin, + /** An invalid OAuth2 token was used to authorize or authenticate with. */ InvalidToken, + /** The specified user ID was invalid. */ InvalidUser, + /** A standard OAuth2 error occurred; check the data object for the OAuth2 error details. */ OAuth2Error = 5000, + /** An asynchronous `SELECT_TEXT_CHANNEL`/`SELECT_VOICE_CHANNEL` command timed out. */ SelectChannelTimedOut, + /** An asynchronous `GET_GUILD` command timed out. */ GetGuildTimedOut, + /** You tried to join a user to a voice channel but the user was already in one. */ SelectVoiceForceRequired, + /** You tried to capture more than one shortcut key at once. */ CaptureShortcutAlreadyListening, } diff --git a/src/types/codes/voiceCloseEventCodes.ts b/src/types/codes/voiceCloseEventCodes.ts index 414a69e2d..c4027c39e 100644 --- a/src/types/codes/voiceCloseEventCodes.ts +++ b/src/types/codes/voiceCloseEventCodes.ts @@ -1,16 +1,27 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice */ export enum VoiceCloseEventCodes { + /** You sent an invalid [opcode](https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes). */ UnknownOpcode = 4001, + /** You sent a invalid payload in your [identifying](https://discord.com/developers/docs/topics/gateway#identify) to the Gateway. */ FailedToDecodePayload, + /** You sent a payload before [identifying](https://discord.com/developers/docs/topics/gateway#identify) with the Gateway. */ NotAuthenticated, + /** The token you sent in your [identify](https://discord.com/developers/docs/topics/gateway#identify) payload is incorrect. */ AuthenticationFailed, + /** You sent more than one [identify](https://discord.com/developers/docs/topics/gateway#identify) payload. Stahp. */ AlreadyAuthenticated, + /** Your session is no longer valid. */ SessionNoLongerValid, + /** Your session has timed out. */ SessionTimedOut = 4009, + /** We can't find the server you're trying to connect to. */ ServerNotFound = 4011, + /** We didn't recognize the [protocol](https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload) you sent. */ UnknownProtocol, /** Channel was deleted, you were kicked, voice server changed, or the main gateway session was dropped. Should not reconnect. */ Disconnect = 4014, + /** The server crashed. Our bad! Try [resuming](https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection). */ VoiceServerCrashed, + /** We didn't recognize your [encryption](https://discord.com/developers/docs/topics/voice-connections#encrypting-and-sending-voice). */ UnknownEncryptionMode, } diff --git a/src/types/codes/voiceOpcodes.ts b/src/types/codes/voiceOpcodes.ts index e1f15ddb8..8fb942428 100644 --- a/src/types/codes/voiceOpcodes.ts +++ b/src/types/codes/voiceOpcodes.ts @@ -1,14 +1,25 @@ /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice */ export enum VoiceOpcodes { + /** Begin a voice websocket connection. */ Identify, + /** Select the voice protocol. */ SelectProtocol, + /** Complete the websocket handshake. */ Ready, + /** Keep the websocket connection alive. */ Heartbeat, + /** Describe the session. */ SessionDescription, + /** Indicate which users are speaking. */ Speaking, + /** Sent to acknowledge a received client heartbeat. */ HeartbeatACK, + /** Resume a connection. */ Resume, + /** Time to wait between sending heartbeats in milliseconds. */ Hello, + /** Acknowledge a successful session resume. */ Resumed, + /** A client has disconnected from the voice channel */ ClientDisconnect = 13, }