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;
|