1 files changed, 11 insertions, 8 deletions
diff --git a/src/opcodes/Identify.ts b/src/opcodes/Identify.ts
index ebb5ca70..f0546a41 100644
--- a/src/opcodes/Identify.ts
+++ b/src/opcodes/Identify.ts
@@ -1,17 +1,20 @@
import { CLOSECODES, Payload } from "../util/Constants";
-import Config from "../util/Config";
import WebSocket from "../util/WebSocket";
-import { checkToken, IdentifySchema } from "discord-server-util";
-import { check } from "./instanceOf";
+import { checkToken, IdentifySchema } from "fosscord-server-util";
+import { setupListener } from "../listener/listener";
+import { instanceOf } from "lambert-server";
export async function onIdentify(this: WebSocket, data: Payload) {
- clearTimeout(this.readyTimeout);
- if (check.call(this, IdentifySchema, data.d)) return;
+ try {
+ clearTimeout(this.readyTimeout);
+ instanceOf(IdentifySchema, data.d);
- const identify: IdentifySchema = data.d;
+ const identify: IdentifySchema = data.d;
- try {
- var { id } = await checkToken(identify.token);
+ var decoded = await checkToken(identify.token);
+ this.userid = decoded.id;
+
+ await setupListener.call(this);
} catch (error) {
return this.close(CLOSECODES.Authentication_failed);
}
|