🐛 fix identify schema
This commit is contained in:
parent
6c62d72737
commit
5f56ca2ef3
@ -39,6 +39,6 @@ export async function Message(this: WebSocket, buffer: Data) {
|
|||||||
return await OPCodeHandler.call(this, data);
|
return await OPCodeHandler.call(this, data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return this.close(CLOSECODES.Unknown_error);
|
if (!this.CLOSED && this.CLOSING) return this.close(CLOSECODES.Unknown_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import { check } from "./instanceOf";
|
|||||||
|
|
||||||
export async function onIdentify(this: WebSocket, data: Payload) {
|
export async function onIdentify(this: WebSocket, data: Payload) {
|
||||||
clearTimeout(this.readyTimeout);
|
clearTimeout(this.readyTimeout);
|
||||||
check.call(this, IdentifySchema, data.d);
|
if (!check.call(this, IdentifySchema, data.d)) return;
|
||||||
|
|
||||||
const identify: IdentifySchema = data.d;
|
const identify: IdentifySchema = data.d;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ export const IdentifySchema = {
|
|||||||
$properties: {
|
$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
|
// 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: String,
|
||||||
|
$os_arch: String,
|
||||||
$browser: String,
|
$browser: String,
|
||||||
$device: String,
|
$device: String,
|
||||||
$$os: String,
|
$$os: String,
|
||||||
@ -21,6 +22,8 @@ export const IdentifySchema = {
|
|||||||
$release_channel: String,
|
$release_channel: String,
|
||||||
$client_build_number: Number,
|
$client_build_number: Number,
|
||||||
$client_event_source: String,
|
$client_event_source: String,
|
||||||
|
$client_version: String,
|
||||||
|
$system_locale: String,
|
||||||
},
|
},
|
||||||
$presence: ActivitySchema,
|
$presence: ActivitySchema,
|
||||||
$compress: Boolean,
|
$compress: Boolean,
|
||||||
@ -41,6 +44,7 @@ export interface IdentifySchema {
|
|||||||
properties: {
|
properties: {
|
||||||
// bruh discord really uses $ in the property key, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key
|
// 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?: string;
|
||||||
|
os_atch?: string;
|
||||||
browser?: string;
|
browser?: string;
|
||||||
device?: string;
|
device?: string;
|
||||||
$os?: string;
|
$os?: string;
|
||||||
@ -56,6 +60,8 @@ export interface IdentifySchema {
|
|||||||
release_channel?: "stable" | "dev" | "ptb" | "canary";
|
release_channel?: "stable" | "dev" | "ptb" | "canary";
|
||||||
client_build_number?: number;
|
client_build_number?: number;
|
||||||
client_event_source?: any;
|
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
|
intents?: bigint; // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
|
||||||
presence?: ActivitySchema;
|
presence?: ActivitySchema;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user