diff options
-rw-r--r-- | api/src/routes/gateway.ts | 14 | ||||
-rw-r--r-- | gateway/src/opcodes/Identify.ts | 5 | ||||
-rw-r--r-- | gateway/src/schema/Identify.ts | 1 |
3 files changed, 18 insertions, 2 deletions
diff --git a/api/src/routes/gateway.ts b/api/src/routes/gateway.ts index d4208341..88d9dfda 100644 --- a/api/src/routes/gateway.ts +++ b/api/src/routes/gateway.ts @@ -9,4 +9,18 @@ router.get("/", route({}), (req: Request, res: Response) => { res.json({ url: endpoint || process.env.GATEWAY || "ws://localhost:3002" }); }); +router.get("/bot", route({}), (req: Request, res: Response) => { + const { endpoint } = Config.get().gateway; + res.json({ + url: endpoint || process.env.GATEWAY || "ws://localhost:3002", + shards: 1, + session_start_limit: { + total: 1000, + remaining: 999, + reset_after: 14400000, + max_concurrency: 1 + } + }); +}); + export default router; diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts index 9eb4cd32..f6a4478f 100644 --- a/gateway/src/opcodes/Identify.ts +++ b/gateway/src/opcodes/Identify.ts @@ -50,12 +50,13 @@ export async function onIdentify(this: WebSocket, data: Payload) { this.shard_id = identify.shard[0]; this.shard_count = identify.shard[1]; if ( - !this.shard_count || - !this.shard_id || + this.shard_count == null || + this.shard_id == null || this.shard_id >= this.shard_count || this.shard_id < 0 || this.shard_count <= 0 ) { + console.log(identify.shard); return this.close(CLOSECODES.Invalid_shard); } } diff --git a/gateway/src/schema/Identify.ts b/gateway/src/schema/Identify.ts index 0835ddc7..6054f2e8 100644 --- a/gateway/src/schema/Identify.ts +++ b/gateway/src/schema/Identify.ts @@ -43,6 +43,7 @@ export const IdentifySchema = { $user_guild_settings_version: Number, }, $v: Number, + $version: Number, }; export interface IdentifySchema { |