summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-01 13:53:26 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-01 13:53:26 +0200
commit5f56ca2ef38f1ada57cbfb470670ad15587af8b2 (patch)
treee46918c27c8b08aa2f5c9360344614b3207eb3b5
parent:zap: add dev script (diff)
downloadserver-5f56ca2ef38f1ada57cbfb470670ad15587af8b2.tar.xz
:bug: fix identify schema
-rw-r--r--src/events/Message.ts2
-rw-r--r--src/opcodes/Identify.ts2
-rw-r--r--src/schema/Identify.ts6
3 files changed, 8 insertions, 2 deletions
diff --git a/src/events/Message.ts b/src/events/Message.ts

index 37328b07..2c3305cb 100644 --- a/src/events/Message.ts +++ b/src/events/Message.ts
@@ -39,6 +39,6 @@ export async function Message(this: WebSocket, buffer: Data) { return await OPCodeHandler.call(this, data); } catch (error) { console.error(error); - return this.close(CLOSECODES.Unknown_error); + if (!this.CLOSED && this.CLOSING) return this.close(CLOSECODES.Unknown_error); } } diff --git a/src/opcodes/Identify.ts b/src/opcodes/Identify.ts
index 75e00b28..0f0ca470 100644 --- a/src/opcodes/Identify.ts +++ b/src/opcodes/Identify.ts
@@ -25,7 +25,7 @@ import { check } from "./instanceOf"; export async function onIdentify(this: WebSocket, data: Payload) { clearTimeout(this.readyTimeout); - check.call(this, IdentifySchema, data.d); + if (!check.call(this, IdentifySchema, data.d)) return; const identify: IdentifySchema = data.d; diff --git a/src/schema/Identify.ts b/src/schema/Identify.ts
index dac5d9cc..65ef9c89 100644 --- a/src/schema/Identify.ts +++ b/src/schema/Identify.ts
@@ -6,6 +6,7 @@ export const IdentifySchema = { $properties: { // bruh discord really uses $ in the property key for bots, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key $os: String, + $os_arch: String, $browser: String, $device: String, $$os: String, @@ -21,6 +22,8 @@ export const IdentifySchema = { $release_channel: String, $client_build_number: Number, $client_event_source: String, + $client_version: String, + $system_locale: String, }, $presence: ActivitySchema, $compress: Boolean, @@ -41,6 +44,7 @@ export interface IdentifySchema { properties: { // bruh discord really uses $ in the property key, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key os?: string; + os_atch?: string; browser?: string; device?: string; $os?: string; @@ -56,6 +60,8 @@ export interface IdentifySchema { release_channel?: "stable" | "dev" | "ptb" | "canary"; client_build_number?: number; client_event_source?: any; + client_version?: string; + system_locale?: string; }; intents?: bigint; // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt presence?: ActivitySchema;