blob: ebb5ca705e398ce422eed4270630135094d98bb3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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";
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);
} catch (error) {
return this.close(CLOSECODES.Authentication_failed);
}
}
|