summary refs log tree commit diff
path: root/src/Schema
diff options
context:
space:
mode:
Diffstat (limited to 'src/Schema')
-rw-r--r--src/Schema/Activity.ts41
-rw-r--r--src/Schema/Emoji.ts5
-rw-r--r--src/Schema/Identify.ts17
3 files changed, 63 insertions, 0 deletions
diff --git a/src/Schema/Activity.ts b/src/Schema/Activity.ts
new file mode 100644

index 00000000..e502cebd --- /dev/null +++ b/src/Schema/Activity.ts
@@ -0,0 +1,41 @@ +import { EmojiSchema } from "./Emoji"; + +export const 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: BigInt, // 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..ebb9afdd --- /dev/null +++ b/src/Schema/Emoji.ts
@@ -0,0 +1,5 @@ +export const EmojiSchema = { + name: String, // the name of the emoji + id: BigInt, // the id of the emoji + animated: Boolean, // whether this emoji is animated +}; diff --git a/src/Schema/Identify.ts b/src/Schema/Identify.ts new file mode 100644
index 00000000..8775fac3 --- /dev/null +++ b/src/Schema/Identify.ts
@@ -0,0 +1,17 @@ +import { ActivitySchema } from "./Activity"; + +export const 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, + $$browser: String, + $$device: 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: [Number], + $guild_subscriptions: Boolean, +};