update import to fosscord-server-util
This commit is contained in:
+12
-9
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user