diff --git a/tsconfig.json b/tsconfig.json index 1853cc842..19db3c704 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -40,8 +40,8 @@ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // Hack to stop VSCode from suggesting imports without ./ or ../ as a prefix. + "baseUrl": "../../", /* Base directory to resolve non-absolute module names. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ diff --git a/types/discord.ts b/types/discord.ts index a80e58e94..a2a85a4ab 100644 --- a/types/discord.ts +++ b/types/discord.ts @@ -28,3 +28,129 @@ export interface DiscordBotGateway { export interface DiscordHeartbeatPayload { heartbeat_interval: number } + +export enum GatewayOpcode { + Dispatch = 0, + Heartbeat, + Identify, + StatusUpdate, + VoiceStateUpdate, + Resume, + Reconnect, + RequestGuildMembers, + InvalidSession, + Hello, + HeartbeatACK +} + +export enum GatewayCloseEventCode { + UnknownError = 4000, + UnknownOpcode, + DecodeError, + NotAuthenticated, + AuthenticationFailed, + AlreadyAuthenticated, + InvalidSeq = 4007, + RateLimited, + SessionTimeout, + InvalidShard, + ShardingRequired +} + +export enum VoiceOpcode { + Identify, + SelectProtocol, + Ready, + Heartbeat, + SessionDescription, + Speaking, + HeartbeatACK, + Resume, + Hello, + Resumed, + ClientDisconnect = 13 +} + +export enum VoiceCloseEventCode { + UnknownOpcode = 4001, + NotAuthenticated = 4003, + AuthenticationFailed, + AlreadyAuthenticated, + SessionNoLongerValid, + SessionTimeout = 4009, + ServerNotFound = 4011, + UnknownProtocol, + Disconnected = 4014, + VoiceServerCrashed, + UnknownEncryptionMode +} + +export enum HttpResponseCode { + Ok = 200, + Created, + NoContent = 204, + NotModified = 304, + BadRequest = 400, + Unauthorized = 401, + Forbidden = 403, + NotFound, + MethodNotAllowed, + TooManyRequests = 429, + GatewayUnavailable = 502, + // ServerError left untyped because it's 5xx. +} + +export enum JSONErrorCode { + UnknownAccount = 10001, + UnknownApplication, + UnknownChannel, + UnknownGuild, + UnknownIntegration, + UnknownInvite, + UnknownMember, + UnknownMessge, + UnknownOverwrite, + UnknownProvider, + UnknownRole, + UnknownToken = 10012, + UnknownUser, + UnknownEmoji, + UnknownWebhook, + BotsCannotUse = 20001, + OnlyBotsCanUse, + MaxGuildsReached = 30001, + MaxFriendsReached, + MaxPinsReached, + MaxGuildRolesReached = 30005, + MaxReactionsReached = 30010, + MaxGuildChannelsReached = 30013, + MaxInvitesReached = 30016, + Unathorized = 40001, + UserIsBannedFromGuild = 40007, + MissingAccess = 50001, + InvalidAccountType = 50002, + CannotExecuteOnDMChannel, + WidgetDisabled, + CannotEditMessageByAnotherUser, + CannotSendEmptyMessage, + CannotSendMessageToUser, + CannotSendMessageInVoiceChannel, + ChannelVerificationTooHigh, + OAuth2ApplicationNoBot, + OAuth2ApplicationLimitReached, + InvalidOAuthState, + MissingPermissions, + InvalidAuthenticationToken, + NoteIsTooLong, + TooFewOrTooManyMessagesToDelete, + MessageCanOnlyBePinnedInParentChannel = 50019, + InviteCodeTakenOrInvalid, + CannotExecuteOnSystemMessage, + InvalidOAuth2AccessToken, + MessageProvidedTooOldToBulkDelet = 50034, + InvalidFormBody, + InviteAcceptedToGuildApplicationBotNotIn, + InvalidAPIVersion = 50041, + ReactionBlocked = 90001, + ResourceOverloaded = 130000 +}