diff --git a/src/schema/Activity.ts b/src/schema/Activity.ts
new file mode 100644
index 00000000..62cf7ad6
--- /dev/null
+++ b/src/schema/Activity.ts
@@ -0,0 +1,49 @@
+import { ActivityBodySchema } from "@fosscord/server-util";
+import { EmojiSchema } from "./Emoji";
+
+export const ActivitySchema = {
+ afk: Boolean,
+ status: String,
+ $activities: [ActivityBodySchema],
+ $since: Number, // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
+};
+
+export interface ActivitySchema {
+ afk: boolean;
+ status: string;
+ activities?: [
+ {
+ name: string; // the activity's name
+ type: number; // activity type // TODO: check if its between range 0-5
+ url?: string; // stream url, is validated when type is 1
+ created_at?: number; // unix timestamp of when the activity was added to the user's session
+ timestamps?: {
+ // unix timestamps for start and/or end of the game
+ start: number;
+ end: number;
+ };
+ application_id?: string; // application id for the game
+ details?: string;
+ state?: string;
+ emoji?: EmojiSchema;
+ party?: {
+ id?: string;
+ size?: [number]; // used to show the party's current and maximum size // TODO: array length 2
+ };
+ assets?: {
+ large_image?: string; // the id for a large asset of the activity, usually a snowflake
+ large_text?: string; // text displayed when hovering over the large image of the activity
+ small_image?: string; // the id for a small asset of the activity, usually a snowflake
+ small_text?: string; // text displayed when hovering over the small image of the activity
+ };
+ secrets?: {
+ join?: string; // the secret for joining a party
+ spectate?: string; // the secret for spectating a game
+ match?: string; // the secret for a specific instanced match
+ };
+ instance?: boolean;
+ flags: bigint; // activity flags OR d together, describes what the payload includes
+ }
+ ];
+ since?: number; // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
+}
diff --git a/src/schema/Emoji.ts b/src/schema/Emoji.ts
new file mode 100644
index 00000000..413b8359
--- /dev/null
+++ b/src/schema/Emoji.ts
@@ -0,0 +1,11 @@
+export const EmojiSchema = {
+ name: String, // the name of the emoji
+ $id: String, // the id of the emoji
+ animated: Boolean, // whether this emoji is animated
+};
+
+export interface EmojiSchema {
+ name: string;
+ id?: string;
+ animated: Boolean;
+}
diff --git a/src/schema/Identify.ts b/src/schema/Identify.ts
new file mode 100644
index 00000000..646c5f05
--- /dev/null
+++ b/src/schema/Identify.ts
@@ -0,0 +1,83 @@
+import { ActivitySchema } from "./Activity";
+
+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: {
+ // 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,
+ $$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,
+ },
+ $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,
+ $read_state_version: Number,
+ $user_guild_settings_version: Number,
+ },
+ $v: 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;
+ shard?: [bigint, bigint];
+ guild_subscriptions?: boolean;
+ capabilities?: number;
+ client_state?: {
+ guild_hashes?: any;
+ highest_last_message_id?: string;
+ read_state_version?: number;
+ user_guild_settings_version?: number;
+ };
+ v?: number;
+}
diff --git a/src/schema/LazyRequest.ts b/src/schema/LazyRequest.ts
new file mode 100644
index 00000000..7c828ac6
--- /dev/null
+++ b/src/schema/LazyRequest.ts
@@ -0,0 +1,19 @@
+export interface LazyRequest {
+ guild_id: string;
+ channels?: Record<string, [number, number]>;
+ activities?: boolean;
+ threads?: boolean;
+ typing?: true;
+ members?: any[];
+ thread_member_lists?: any[];
+}
+
+export const LazyRequest = {
+ guild_id: String,
+ $activities: Boolean,
+ $channels: Object,
+ $typing: Boolean,
+ $threads: Boolean,
+ $members: [] as any[],
+ $thread_member_lists: [] as any[],
+};
diff --git a/src/schema/VoiceStateUpdate.ts.ts b/src/schema/VoiceStateUpdate.ts.ts
new file mode 100644
index 00000000..4345c2f6
--- /dev/null
+++ b/src/schema/VoiceStateUpdate.ts.ts
@@ -0,0 +1,15 @@
+export const VoiceStateUpdateSchema = {
+ $guild_id: String,
+ channel_id: String,
+ self_mute: Boolean,
+ self_deaf: Boolean,
+ self_video: Boolean,
+};
+
+export interface VoiceStateUpdateSchema {
+ guild_id?: string;
+ channel_id: string;
+ self_mute: boolean;
+ self_deaf: boolean;
+ self_video: boolean;
+}
|