summary refs log tree commit diff
path: root/src/util/schemas/IdentifySchema.ts
blob: 0e44af38c7ef531b3d4a9dabd424d2df7b5aae70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { ActivitySchema } from "@fosscord/util";

export const IdentifySchema = {
	token: String,
	$intents: BigInt, // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
	$properties: Object,
	// {
	// 	// discord 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,
	// 	$$browser: String,
	// 	$$device: String,
	// 	$browser_user_agent: String,
	// 	$browser_version: String,
	// 	$os_version: String,
	// 	$referrer: String,
	// 	$$referrer: String,
	// 	$referring_domain: String,
	// 	$$referring_domain: String,
	// 	$referrer_current: String,
	// 	$referring_domain_current: String,
	// 	$release_channel: String,
	// 	$client_build_number: Number,
	// 	$client_event_source: String,
	// 	$client_version: String,
	// 	$system_locale: String,
	// 	$window_manager: String,
	// 	$distro: String,
	// },
	$presence: ActivitySchema,
	$compress: Boolean,
	$large_threshold: Number,
	$shard: [BigInt, BigInt],
	$guild_subscriptions: Boolean,
	$capabilities: Number,
	$client_state: {
		$guild_hashes: Object,
		$highest_last_message_id: String || Number,
		$read_state_version: Number,
		$user_guild_settings_version: Number,
		$user_settings_version: undefined,
		$useruser_guild_settings_version: undefined,
		$private_channels_version: Number,
		$guild_versions: Object,
		$api_code_version: Number,
	},
	$clientState: {
		$guildHashes: Object,
		$highestLastMessageId: String || Number,
		$readStateVersion: Number,
		$useruserGuildSettingsVersion: undefined,
		$userGuildSettingsVersion: undefined,
		$guildVersions: Object,
		$apiCodeVersion: Number,
	},
	$v: Number,
	$version: Number,
};

export interface IdentifySchema {
	token: string;
	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;
		$browser?: string;
		$device?: string;
		browser_user_agent?: string;
		browser_version?: string;
		os_version?: string;
		referrer?: string;
		referring_domain?: string;
		referrer_current?: string;
		referring_domain_current?: string;
		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;
	compress?: boolean;
	large_threshold?: number;
	largeThreshold?: number;
	shard?: [bigint, bigint];
	guild_subscriptions?: boolean;
	capabilities?: number;
	client_state?: {
		guild_hashes?: any;
		highest_last_message_id?: string | number;
		read_state_version?: number;
		user_guild_settings_version?: number;
		user_settings_version?: number;
		useruser_guild_settings_version?: number;
		private_channels_version?: number;
		guild_versions?: any;
		api_code_version?: number;
	};
	clientState?: {
		guildHashes?: any;
		highestLastMessageId?: string | number;
		readStateVersion?: number;
		userGuildSettingsVersion?: number;
		useruserGuildSettingsVersion?: number;
		guildVersions?: any;
		apiCodeVersion?: number;
	};
	v?: number;
}