summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-05 20:47:47 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-05 20:47:47 +1000
commitdf696d362a135d483d72f05697d41322bd974ad0 (patch)
treeca6ad2b12edbd78d07990fbe8768045b9a66071c
parentprettier whoops (diff)
downloadserver-df696d362a135d483d72f05697d41322bd974ad0.tar.xz
Close if already identified
-rw-r--r--src/gateway/opcodes/Identify.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts

index 2e661a14..5816c308 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts
@@ -59,7 +59,6 @@ import { check } from "./instanceOf"; // TODO: user sharding // TODO: check privileged intents, if defined in the config -// TODO: check if already identified const getUserFromToken = async (token: string): Promise<string | null> => { try { @@ -73,6 +72,11 @@ const getUserFromToken = async (token: string): Promise<string | null> => { }; export async function onIdentify(this: WebSocket, data: Payload) { + if (this.user_id) { + // we've already identified + return this.close(CLOSECODES.Already_authenticated); + } + clearTimeout(this.readyTimeout); // Check payload matches schema @@ -106,7 +110,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { this.shard_id < 0 || this.shard_count <= 0 ) { - // TODO: why do we even care about this? + // TODO: why do we even care about this right now? console.log( `[Gateway] Invalid sharding from ${user_id}: ${identify.shard}`, );