update import to fosscord-server-util

This commit is contained in:
Flam3rboy
2021-02-10 14:37:16 +01:00
parent 49b3426858
commit 38757c60e1
7 changed files with 60 additions and 50 deletions
+12 -9
View File
@@ -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;
const identify: IdentifySchema = data.d;
try {
var { id } = await checkToken(identify.token);
clearTimeout(this.readyTimeout);
instanceOf(IdentifySchema, data.d);
const identify: IdentifySchema = data.d;
var decoded = await checkToken(identify.token);
this.userid = decoded.id;
await setupListener.call(this);
} catch (error) {
return this.close(CLOSECODES.Authentication_failed);
}