Project start
Co-Authored-By: Lee Hyun <ink0416@naver.com> Co-Authored-By: yky4589 <8479056+yky4589@users.noreply.github.com> Co-Authored-By: Choi Minseo <minseo0388@outlook.com> Co-Authored-By: Aki <akiacode@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									c21fab2aff
								
							
						
					
					
						commit
						4b9123f5f6
					
				
					 19 changed files with 472 additions and 1 deletions
				
			
		
							
								
								
									
										19
									
								
								.eslintrc.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								.eslintrc.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| module.exports = { | ||||
|   env: { | ||||
|     es2021: true, | ||||
|     node: true | ||||
|   }, | ||||
|   extends: [ | ||||
|     'standard-with-typescript', | ||||
|     'prettier', | ||||
|     'prettier/@typescript-eslint', | ||||
|     'prettier/standard' | ||||
|   ], | ||||
|   parser: '@typescript-eslint/parser', | ||||
|   parserOptions: { | ||||
|     ecmaVersion: 12, | ||||
|     sourceType: 'module' | ||||
|   }, | ||||
|   plugins: ['@typescript-eslint'], | ||||
|   rules: {} | ||||
| } | ||||
							
								
								
									
										4
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -102,3 +102,7 @@ dist | |||
| 
 | ||||
| # TernJS port file | ||||
| .tern-port | ||||
| 
 | ||||
| # Used ESLint for linting so block package-lock | ||||
| package-lock.json | ||||
| yarn.lock | ||||
|  |  | |||
							
								
								
									
										6
									
								
								.vscode/settings.json
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.vscode/settings.json
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| { | ||||
|   "deno.enable": true, | ||||
|   "deno.lint": false, | ||||
|   "deno.unstable": false, | ||||
|   "deepscan.enable": true | ||||
| } | ||||
|  | @ -1,2 +1,3 @@ | |||
| # discord.deno | ||||
| Discord Deno API that is easy to use | ||||
| 
 | ||||
| ## Feature | ||||
|  |  | |||
							
								
								
									
										22
									
								
								package.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								package.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| { | ||||
|   "name": "discord.deno", | ||||
|   "version": "1.0.0", | ||||
|   "description": "Discord Deno API that is easy to use.", | ||||
|   "main": "index.js", | ||||
|   "repository": "https://github.com/Helloyunho/discord.deno.git", | ||||
|   "author": "Helloyunho <yunho050840@gmail.com>", | ||||
|   "license": "MIT", | ||||
|   "devDependencies": { | ||||
|     "@typescript-eslint/eslint-plugin": "^4.5.0", | ||||
|     "@typescript-eslint/parser": "^4.5.0", | ||||
|     "eslint": "^7.11.0", | ||||
|     "eslint-config-prettier": "^6.13.0", | ||||
|     "eslint-config-standard": "^14.1.1", | ||||
|     "eslint-config-standard-with-typescript": "^19.0.1", | ||||
|     "eslint-plugin-import": "^2.22.1", | ||||
|     "eslint-plugin-node": "^11.1.0", | ||||
|     "eslint-plugin-promise": "^4.2.1", | ||||
|     "eslint-plugin-standard": "^4.0.1", | ||||
|     "typescript": "^4.0.3" | ||||
|   } | ||||
| } | ||||
							
								
								
									
										7
									
								
								src/consts/urlsAndVersions.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/consts/urlsAndVersions.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| export const DISCORD_API_URL = 'https://discord.com/api' //여기 v8 들어가야하는거 아닌가... <- gateway.ts 참조바람 왜 거기 endpoint에서 import에서 에러나지 왜??
 | ||||
| 
 | ||||
| export const DISCORD_GATEWAY_URL = 'wss://gateway.discord.com' | ||||
| 
 | ||||
| export const DISCORD_CDN_URL = 'https://cdn.discordapp.com' | ||||
| 
 | ||||
| export const DISCORD_API_VERSION = 8 | ||||
							
								
								
									
										114
									
								
								src/models/gateway.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								src/models/gateway.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,114 @@ | |||
| import { inflate } from 'https://deno.land/x/denoflate/mod.ts' | ||||
| import { | ||||
|   DISCORD_GATEWAY_URL, | ||||
|   DISCORD_API_VERSION | ||||
| } from '../consts/urlsAndVersions.ts' | ||||
| import { GatewayResponse } from '../types/gatewayResponse.ts' | ||||
| import { GatewayOpcodes, GatewayIntents } from '../types/gatewayTypes.ts' | ||||
| 
 | ||||
| /** | ||||
|  * Handles Discord gateway connection. | ||||
|  * You should not use this and rather use Client class. | ||||
|  * | ||||
|  * @beta | ||||
|  */ | ||||
| class Gateway { | ||||
|   websocket: WebSocket | ||||
|   token: string | ||||
|   intents: [GatewayIntents] | ||||
|   connected = false | ||||
|   initialized = false | ||||
|   heartbeatInterval = 0 | ||||
|   heartbeatIntervalID?: number | ||||
|   sequenceID?: number | ||||
|   heartbeatServerResponded = false | ||||
| 
 | ||||
|   constructor (token: string, intents: [GatewayIntents]) { | ||||
|     this.websocket = new WebSocket( | ||||
|       `${DISCORD_GATEWAY_URL}/?v=${DISCORD_API_VERSION}&encoding=json` | ||||
|     ) | ||||
|     this.token = token | ||||
|     this.intents = intents | ||||
|   } | ||||
| 
 | ||||
|   onopen () { | ||||
|     this.connected = true | ||||
|   } | ||||
| 
 | ||||
|   onmessage (event: MessageEvent) { | ||||
|     let data = event.data | ||||
|     if (data instanceof ArrayBuffer) { | ||||
|       data = new Uint8Array(data) | ||||
|     } | ||||
|     if (data instanceof Uint8Array) { | ||||
|       const dataSuffix = data.slice(-4) | ||||
| 
 | ||||
|       if ( | ||||
|         dataSuffix[0] === 0 && | ||||
|         dataSuffix[1] === 0 && | ||||
|         dataSuffix[2] === 0xff && | ||||
|         dataSuffix[3] === 0xff | ||||
|       ) { | ||||
|         data = inflate(data) | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     const { op, d, s, t }: GatewayResponse = JSON.parse(data) | ||||
| 
 | ||||
|     switch (op) { | ||||
|       case GatewayOpcodes.HELLO: | ||||
|         this.heartbeatInterval = d.heartbeat_interval | ||||
|         this.heartbeatIntervalID = setInterval(() => { | ||||
|           this.websocket.send( | ||||
|             JSON.stringify({ | ||||
|               op: GatewayOpcodes.HEARTBEAT, | ||||
|               d: this.sequenceID ?? null | ||||
|             }) | ||||
|           ) | ||||
| 
 | ||||
|           if (this.heartbeatServerResponded) { | ||||
|             this.heartbeatServerResponded = false | ||||
|           } else { | ||||
|             // TODO: Add heartbeat failed error
 | ||||
|           } | ||||
|         }, this.heartbeatInterval) | ||||
| 
 | ||||
|         this.websocket.send( | ||||
|           JSON.stringify({ | ||||
|             token: this.token, | ||||
|             properties: { | ||||
|               $os: Deno.build.os, | ||||
|               $browser: 'discord.deno', | ||||
|               $device: 'discord.deno' | ||||
|             }, | ||||
|             compress: true, | ||||
|             shard: [0, 1], // TODO: Make sharding possible
 | ||||
|             intents: this.intents.reduce( | ||||
|               (previous, current) => previous | current, | ||||
|               0 | ||||
|             ), | ||||
|             presence: { | ||||
|               // TODO: User should can customize this
 | ||||
|               status: 'online', | ||||
|               since: null, | ||||
|               afk: false | ||||
|             } | ||||
|           }) | ||||
|         ) | ||||
|         break | ||||
| 
 | ||||
|       case GatewayOpcodes.HEARTBEAT_ACK: | ||||
|         this.heartbeatServerResponded = true | ||||
|         break | ||||
| 
 | ||||
|       case GatewayOpcodes.DISPATCH: | ||||
|         switch (t) { | ||||
|         } | ||||
| 
 | ||||
|       default: | ||||
|         return | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export { Gateway } | ||||
							
								
								
									
										10
									
								
								src/structures/base.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/structures/base.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| // 일단 대충 여러 봇 라이브러리에서 본 구조 가져오는 중..
 | ||||
| 
 | ||||
| class Base { | ||||
|   id?: string | ||||
|   constructor (id: string | undefined) { | ||||
|     if (id) { | ||||
|       this.id = id | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										0
									
								
								src/structures/channel.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/structures/channel.ts
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/structures/embed.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/structures/embed.ts
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/structures/guild.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/structures/guild.ts
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										1
									
								
								src/structures/message.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/structures/message.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| // 여긴가
 | ||||
							
								
								
									
										0
									
								
								src/structures/textChannel.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/structures/textChannel.ts
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										66
									
								
								src/types/endpoint.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								src/types/endpoint.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,66 @@ | |||
| //Being Written by Choi Donghan, Catry
 | ||||
| 
 | ||||
| import { | ||||
|   DISCORD_API_URL, | ||||
|   DISCORD_API_VERSION, | ||||
|   DISCORD_CDN_URL | ||||
| } from '../consts/urlsAndVersions.ts' | ||||
| 
 | ||||
| //Guild Endpoints
 | ||||
| const GUILDS = `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds` | ||||
| const GUILD = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}` | ||||
| const GUILD_ICON = (guildID: string, iconID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/${iconID}` | ||||
| const GUILD_BANNER = (guildID: string, iconID: string) => | ||||
|   `${DISCORD_CDN_URL}/${guildID}/${iconID}` | ||||
| const GUILD_AUDIT_LOGS = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/audit-logs` | ||||
| const GUILD_WIDGET = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/widget` | ||||
| const GUILD_EMOJI = (guildID: string, emoji_id: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis/${emoji_id}` | ||||
| const GUILD_EMOJIS = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/emojis` | ||||
| const GUILD_REGIONS = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/regions` | ||||
| const GUILD_ROLE = (guildID: string, roleID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/roles/${roleID}` | ||||
| const GUILD_ROLES = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/roles` | ||||
| const GUILD_MEMBER_ROLE = (guildID: string, memberID: string, roleID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/members/${memberID}/roles/${roleID}` | ||||
| const GUILD_INTEGRATION = (guildID: string, integrationID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations/${integrationID}` | ||||
| const GUILD_INTEGRATIONS = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations` | ||||
| const GUILD_INTEGARTION_SYNC = (guildID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations?include_appilications=true` | ||||
| 
 | ||||
| //Channel Endpoints
 | ||||
| const CHANNEL = (channelID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}` | ||||
| const CHANNELS = (channelID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${channelID}/channels` | ||||
| const CHANNEL_MESSAGES = (channelID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages` | ||||
| const CHANNEL_MESSAGE = (channelID: string, messageID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}` | ||||
| const CHANNEL_CROSSPOST = (channelID: string, messageID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/crosspost` | ||||
| const MESSAGE_REACTION = ( | ||||
|   channelID: string, | ||||
|   messageID: string, | ||||
|   emoji: string | ||||
| ) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` | ||||
| 
 | ||||
| //User Endpoints
 | ||||
| const USER = (userID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/${userID}` | ||||
| const USER_AVATAR_DEFAULT = (iconID: number) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/embed/avatars${iconID}.png` | ||||
| const USER_AVATAR = (userID: string, iconID: string) => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/avatars/${userID}/${iconID}.png` | ||||
| const USER_CREATE_DM = () => | ||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/users/@me/channels` | ||||
							
								
								
									
										14
									
								
								src/types/gatewayResponse.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/types/gatewayResponse.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | |||
| import { GatewayOpcodes } from '../types/gatewayTypes.ts' | ||||
| 
 | ||||
| /** | ||||
|  * Gateway response from Discord. | ||||
|  * | ||||
|  */ | ||||
| interface GatewayResponse { | ||||
|   op: GatewayOpcodes | ||||
|   d: any | ||||
|   s?: number | ||||
|   t?: string | ||||
| } | ||||
| 
 | ||||
| export { GatewayResponse } | ||||
							
								
								
									
										58
									
								
								src/types/gatewayTypes.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/types/gatewayTypes.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,58 @@ | |||
| // https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway
 | ||||
| 
 | ||||
| /** | ||||
|  * Gateway OPcodes from Discord docs. | ||||
|  */ | ||||
| enum GatewayOpcodes { // 문서를 확인해본 결과 Opcode 5번은 비어있다. - UnderC -
 | ||||
|   DISPATCH = 0, | ||||
|   HEARTBEAT = 1, | ||||
|   IDENTIFY = 2, | ||||
|   PRESENCE_UPDATE = 3, | ||||
|   VOICE_STATE_UPDATE = 4, | ||||
|   RESUME = 6, | ||||
|   RECONNECT = 7, | ||||
|   REQUEST_GUILD_MEMBERS = 8, | ||||
|   INVALID_SESSION = 9, | ||||
|   HELLO = 10, | ||||
|   HEARTBEAT_ACK = 11 | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Gateway Close Codes from Discord docs. | ||||
|  */ | ||||
| enum GatewayCloseCodes { | ||||
|   UNKNOWN_ERROR = 4000, | ||||
|   UNKNOWN_OPCODE = 4001, | ||||
|   DECODE_ERROR = 4002, | ||||
|   NOT_AUTHENTICATED = 4003, | ||||
|   AUTHENTICATION_FAILED = 4004, | ||||
|   ALREADY_AUTHENTICATED = 4005, | ||||
|   INVALID_SEQ = 4007, | ||||
|   RATE_LIMITED = 4008, | ||||
|   SESSION_TIMED_OUT = 4009, | ||||
|   INVALID_SHARD = 4010, | ||||
|   SHARDING_REQUIRED = 4011, | ||||
|   INVALID_API_VERSION = 4012, | ||||
|   INVALID_INTENTS = 4013, | ||||
|   DISALLOWED_INTENTS = 4014 | ||||
| } | ||||
| 
 | ||||
| enum GatewayIntents { | ||||
|   GUILDS = 1 << 0, | ||||
|   GUILD_MEMBERS = 1 << 1, | ||||
|   GUILD_BANS = 1 << 2, | ||||
|   GUILD_EMOJIS = 1 << 3, | ||||
|   GUILD_INTEGRATIONS = 1 << 4, | ||||
|   GUILD_WEBHOOKS = 1 << 5, | ||||
|   GUILD_INVITES = 1 << 6, | ||||
|   GUILD_VOICE_STATES = 1 << 7, | ||||
|   GUILD_PRESENCES = 1 << 8, | ||||
|   GUILD_MESSAGES = 1 << 9, | ||||
|   GUILD_MESSAGE_REACTIONS = 1 << 10, | ||||
|   GUILD_MESSAGE_TYPING = 1 << 11, | ||||
|   DIRECT_MESSAGES = 1 << 12, | ||||
|   DIRECT_MESSAGE_REACTIONS = 1 << 13, | ||||
|   DIRECT_MESSAGE_TYPING = 1 << 13 | ||||
| } | ||||
| 
 | ||||
| export { GatewayCloseCodes, GatewayOpcodes, GatewayIntents } | ||||
							
								
								
									
										45
									
								
								src/types/permissionFlags.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/types/permissionFlags.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| // https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
 | ||||
| // 귀하는 해갈
 | ||||
| // 그렇습니다
 | ||||
| 
 | ||||
| //이거 필요한건가 -와갈드- -UnderC-
 | ||||
| 
 | ||||
| enum PermissionFlags { | ||||
|   CREATE_INSTANT_INVITE = 0x00000001, | ||||
| 
 | ||||
|   KICK_MEMBERS = 0x00000002, | ||||
|   BAN_MEMBERS = 0x00000004, | ||||
|   ADMINISTRATOR = 0x00000008, | ||||
|   MANAGE_CHANNELS = 0x00000010, | ||||
|   MANAGE_GUILD = 0x00000020, | ||||
| 
 | ||||
|   ADD_REACTIONS = 0x00000040, | ||||
|   VIEW_AUDIT_LOG = 0x00000080, | ||||
|   PRIORITY_SPEAKER = 0x00000100, | ||||
|   STREAM = 0x00000200, | ||||
| 
 | ||||
|   VIEW_CHANNEL = 0x00000400, | ||||
|   SEND_MESSAGES = 0x00000800, | ||||
|   SEND_TTS_MESSAGES = 0x00001000, | ||||
|   MANAGE_MESSAGES = 0x00002000, | ||||
| 
 | ||||
|   EMBED_LINKS = 0x00004000, | ||||
|   ATTACH_FILES = 0x00008000, | ||||
|   READ_MESSAGE_HISTORY = 0x00010000, | ||||
|   MENTION_EVERYONE = 0x00020000, | ||||
|   USE_EXTERNAL_EMOJIS = 0x00040000, | ||||
|   VIEW_GUILD_INSIGHTS = 0x00080000, | ||||
| 
 | ||||
|   CONNECT = 0x00100000, | ||||
|   SPEAK = 0x00200000, | ||||
|   MUTE_MEMBERS = 0x00400000, | ||||
|   DEAFEN_MEMBERS = 0x00800000, | ||||
|   MOVE_MEMBERS = 0x01000000, | ||||
|   USE_VAD = 0x02000000, | ||||
| 
 | ||||
|   CHANGE_NICKNAME = 0x04000000, | ||||
|   MANAGE_NICKNAMES = 0x08000000, | ||||
|   MANAGE_ROLES = 0x10000000, | ||||
|   MANAGE_WEBHOOKS = 0x20000000, | ||||
|   MANAGE_EMOJIS = 0x40000000 | ||||
| } | ||||
							
								
								
									
										29
									
								
								src/types/voiceTypes.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/types/voiceTypes.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| // https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice
 | ||||
| 
 | ||||
| enum VoiceOpcodes { // VoiceOpcodes 추가 - UnderC -
 | ||||
|   IDENTIFY = 0, | ||||
|   SELECT_PROTOCOL = 1, | ||||
|   READY = 2, | ||||
|   HEARTBEAT = 3, | ||||
|   SESSION_DESCRIPTION = 4, | ||||
|   SPEAKING = 6, | ||||
|   HEARTBEAT_ACK = 6, | ||||
|   RESUME = 7, | ||||
|   HELLO = 8, | ||||
|   RESUMED = 9, | ||||
|   CLIENT_DISCONNECT = 13 | ||||
| } | ||||
| 
 | ||||
| enum VoiceCloseCodes { | ||||
|   UNKNOWN_OPCODE = 4001, | ||||
|   NOT_AUTHENTICATED = 4003, | ||||
|   AUTHENTICATION_FAILED = 4004, | ||||
|   ALREADY_AUTHENTICATED = 4005, | ||||
|   SESSION_NO_LONGER_VALID = 4006, | ||||
|   SESSION_TIMEOUT = 4009, | ||||
|   SERVER_NOT_FOUNT = 4011, | ||||
|   UNKNOWN_PROTOCOL = 4012, | ||||
|   DISCONNECTED = 4014, | ||||
|   VOICE_SERVER_CRASHED = 4015, | ||||
|   UNKNOWN_ENCRYPTION_MODE = 4016 | ||||
| } | ||||
							
								
								
									
										75
									
								
								tsconfig.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								tsconfig.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,75 @@ | |||
| { | ||||
|   "compilerOptions": { | ||||
|     /* Visit https://aka.ms/tsconfig.json to read more about this file */ | ||||
| 
 | ||||
|     /* Basic Options */ | ||||
|     // "incremental": true,                   /* Enable incremental compilation */ | ||||
|     "target": "ESNEXT", | ||||
|     /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ | ||||
|     "module": "ESNext", | ||||
|     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ | ||||
|     // "lib": [],                             /* Specify library files to be included in the compilation. */ | ||||
|     // "allowJs": true,                       /* Allow javascript files to be compiled. */ | ||||
|     // "checkJs": true,                       /* Report errors in .js files. */ | ||||
|     // "jsx": "preserve",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ | ||||
|     // "declaration": true,                   /* Generates corresponding '.d.ts' file. */ | ||||
|     // "declarationMap": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */ | ||||
|     // "sourceMap": true,                     /* Generates corresponding '.map' file. */ | ||||
|     // "outFile": "./",                       /* Concatenate and emit output to single file. */ | ||||
|     // "outDir": "./",                        /* Redirect output structure to the directory. */ | ||||
|     // "rootDir": "./",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ | ||||
|     // "composite": true,                     /* Enable project compilation */ | ||||
|     // "tsBuildInfoFile": "./",               /* Specify file to store incremental compilation information */ | ||||
|     // "removeComments": true,                /* Do not emit comments to output. */ | ||||
|     // "noEmit": true,                        /* Do not emit outputs. */ | ||||
|     // "importHelpers": true,                 /* Import emit helpers from 'tslib'. */ | ||||
|     // "downlevelIteration": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ | ||||
|     // "isolatedModules": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ | ||||
| 
 | ||||
|     /* Strict Type-Checking Options */ | ||||
|     "strict": true, | ||||
|     /* Enable all strict type-checking options. */ | ||||
|     // "noImplicitAny": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */ | ||||
|     // "strictNullChecks": true,              /* Enable strict null checks. */ | ||||
|     // "strictFunctionTypes": true,           /* Enable strict checking of function types. */ | ||||
|     // "strictBindCallApply": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ | ||||
|     // "strictPropertyInitialization": true,  /* Enable strict checking of property initialization in classes. */ | ||||
|     // "noImplicitThis": true,                /* Raise error on 'this' expressions with an implied 'any' type. */ | ||||
|     // "alwaysStrict": true,                  /* Parse in strict mode and emit "use strict" for each source file. */ | ||||
| 
 | ||||
|     /* Additional Checks */ | ||||
|     // "noUnusedLocals": true,                /* Report errors on unused locals. */ | ||||
|     // "noUnusedParameters": true,            /* Report errors on unused parameters. */ | ||||
|     // "noImplicitReturns": true,             /* Report error when not all code paths in function return a value. */ | ||||
|     // "noFallthroughCasesInSwitch": true,    /* Report errors for fallthrough cases in switch statement. */ | ||||
| 
 | ||||
|     /* 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'. */ | ||||
|     // "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. */ | ||||
|     // "allowSyntheticDefaultImports": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ | ||||
|     "esModuleInterop": true, | ||||
|     /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ | ||||
|     // "preserveSymlinks": true,              /* Do not resolve the real path of symlinks. */ | ||||
|     // "allowUmdGlobalAccess": true,          /* Allow accessing UMD globals from modules. */ | ||||
| 
 | ||||
|     /* Source Map Options */ | ||||
|     // "sourceRoot": "",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */ | ||||
|     // "mapRoot": "",                         /* Specify the location where debugger should locate map files instead of generated locations. */ | ||||
|     // "inlineSourceMap": true,               /* Emit a single file with source maps instead of having a separate file. */ | ||||
|     // "inlineSources": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ | ||||
| 
 | ||||
|     /* Experimental Options */ | ||||
|     // "experimentalDecorators": true,        /* Enables experimental support for ES7 decorators. */ | ||||
|     // "emitDecoratorMetadata": true,         /* Enables experimental support for emitting type metadata for decorators. */ | ||||
| 
 | ||||
|     /* Advanced Options */ | ||||
|     "skipLibCheck": true, | ||||
|     /* Skip type checking of declaration files. */ | ||||
|     "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ | ||||
|   } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue