summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-06 15:35:02 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-06 15:35:02 +0100
commit84d714324ad65de94cfb3076daa8f6622a54e438 (patch)
tree563a0686d87db0bba3d6e1ce3aa2f561dfe58998
parentupdate missing-native-js-functions version (diff)
downloadserver-84d714324ad65de94cfb3076daa8f6622a54e438.tar.xz
:sparkles: Schema interfaces
-rw-r--r--dist/Schema/Activity.d.ts41
-rw-r--r--dist/Schema/Emoji.d.ts7
-rw-r--r--dist/Schema/Emoji.js2
-rw-r--r--dist/Schema/Emoji.js.map2
-rw-r--r--dist/Schema/Identify.d.ts17
-rw-r--r--dist/models/Guild.d.ts67
-rw-r--r--src/Schema/Activity.ts40
-rw-r--r--src/Schema/Emoji.ts8
-rw-r--r--src/Schema/Identify.ts16
-rw-r--r--src/models/Guild.ts71
-rw-r--r--src/models/Guild.ts.OLD1
11 files changed, 195 insertions, 77 deletions
diff --git a/dist/Schema/Activity.d.ts b/dist/Schema/Activity.d.ts

index 420471a8..e5f276d6 100644 --- a/dist/Schema/Activity.d.ts +++ b/dist/Schema/Activity.d.ts
@@ -1,3 +1,4 @@ +import { EmojiSchema } from "./Emoji"; export declare const ActivitySchema: { afk: BooleanConstructor; status: StringConstructor; @@ -15,7 +16,7 @@ export declare const ActivitySchema: { $State: StringConstructor; $emoji: { name: StringConstructor; - id: BigIntConstructor; + $id: BigIntConstructor; animated: BooleanConstructor; }; $party: { @@ -38,3 +39,41 @@ export declare const ActivitySchema: { }[]; $since: NumberConstructor; }; +export interface ActivitySchema { + afk: boolean; + status: string; + activities?: [ + { + name: string; + type: number; + url?: string; + created_at?: number; + timestamps?: { + start: number; + end: number; + }; + application_id?: bigint; + details?: string; + State?: string; + emoji?: EmojiSchema; + party?: { + id?: string; + size?: [number]; + }; + assets?: { + large_image?: string; + large_text?: string; + small_image?: string; + small_text?: string; + }; + secrets?: { + join?: string; + spectate?: string; + match?: string; + }; + instance?: boolean; + flags: bigint; + } + ]; + since?: number; +} diff --git a/dist/Schema/Emoji.d.ts b/dist/Schema/Emoji.d.ts
index 81570e17..da4770e9 100644 --- a/dist/Schema/Emoji.d.ts +++ b/dist/Schema/Emoji.d.ts
@@ -1,5 +1,10 @@ export declare const EmojiSchema: { name: StringConstructor; - id: BigIntConstructor; + $id: BigIntConstructor; animated: BooleanConstructor; }; +export interface EmojiSchema { + name: string; + id?: bigint; + animated: Boolean; +} diff --git a/dist/Schema/Emoji.js b/dist/Schema/Emoji.js
index fe999d4e..79213bce 100644 --- a/dist/Schema/Emoji.js +++ b/dist/Schema/Emoji.js
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.EmojiSchema = void 0; exports.EmojiSchema = { name: String, - id: BigInt, + $id: BigInt, animated: Boolean, }; //# sourceMappingURL=Emoji.js.map \ No newline at end of file diff --git a/dist/Schema/Emoji.js.map b/dist/Schema/Emoji.js.map
index 0d776e6d..ccf29c51 100644 --- a/dist/Schema/Emoji.js.map +++ b/dist/Schema/Emoji.js.map
@@ -1 +1 @@ -{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/Schema/Emoji.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,OAAO;CACjB,CAAC"} \ No newline at end of file +{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/Schema/Emoji.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,QAAQ,EAAE,OAAO;CACjB,CAAC"} \ No newline at end of file diff --git a/dist/Schema/Identify.d.ts b/dist/Schema/Identify.d.ts
index be586093..a7fa5b23 100644 --- a/dist/Schema/Identify.d.ts +++ b/dist/Schema/Identify.d.ts
@@ -1,3 +1,4 @@ +import { ActivitySchema } from "./Activity"; export declare const IdentifySchema: { token: StringConstructor; properties: { @@ -23,7 +24,7 @@ export declare const IdentifySchema: { $State: StringConstructor; $emoji: { name: StringConstructor; - id: BigIntConstructor; + $id: BigIntConstructor; animated: BooleanConstructor; }; $party: { @@ -51,3 +52,17 @@ export declare const IdentifySchema: { $shard: NumberConstructor[]; $guild_subscriptions: BooleanConstructor; }; +export interface IdentifySchema { + token: string; + properties: { + $$os: string; + $$browser: string; + $$device: string; + }; + intents: bigint; + presence?: ActivitySchema; + compress?: boolean; + large_threshold?: number; + shard?: [number]; + guild_subscriptions?: boolean; +} diff --git a/dist/models/Guild.d.ts b/dist/models/Guild.d.ts
index ea212c92..a4451c85 100644 --- a/dist/models/Guild.d.ts +++ b/dist/models/Guild.d.ts
@@ -3,50 +3,49 @@ import { Emoji } from "./Emoji"; import { Member } from "./Member"; import { Role } from "./Role"; export interface Guild { - id: bigint; - name: string; - icon: string; - icon_hash: string; - splash: string; - discovery_splash: string; - owner: boolean; - owner_id: bigint; - permissions: string; - region: string; afk_channel_id: bigint; afk_timeout: number; - widget_enabled: boolean; - widget_channel_id: bigint; - verification_level: number; + application_id: bigint; + approximate_member_count: number; + approximate_presence_count: number; + banner: string; + channels: Channel[]; default_message_notifications: number; - explicit_content_filter: number; - roles: Role[]; + description: string; + discovery_splash: string; emojis: Emoji[]; + explicit_content_filter: number; features: []; - mfa_level: number; - application_id: bigint; - system_channel_id: bigint; - system_channel_flags: number; - rules_channel_id: bigint; + icon: string; + id: bigint; joined_at: number; large: boolean; - unavailable: boolean; + max_members: number; + max_presences: number; + max_video_channel_users: number; member_count: number; - voice_states: []; members: Member[]; - channels: Channel[]; - presences: []; - max_presences: number; - max_members: number; - vanity_url_code: string; - description: string; - banner: string; - premium_tier: number; - premium_subscription_count: number; + mfa_level: number; + name: string; + owner_id: bigint; + owner: boolean; + permissions: string; preferred_locale: string; + premium_subscription_count: number; + premium_tier: number; + presences: []; public_updates_channel_id: bigint; - max_video_channel_users: number; - approximate_member_count: number; - approximate_presence_count: number; + region: string; + roles: Role[]; + rules_channel_id: bigint; + splash: string; + system_channel_flags: number; + system_channel_id: bigint; + unavailable: boolean; + vanity_url_code: string; + verification_level: number; + voice_states: []; welcome_screen: []; + widget_channel_id: bigint; + widget_enabled: boolean; } diff --git a/src/Schema/Activity.ts b/src/Schema/Activity.ts
index e502cebd..00772743 100644 --- a/src/Schema/Activity.ts +++ b/src/Schema/Activity.ts
@@ -39,3 +39,43 @@ export const ActivitySchema = { ], $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?: 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
index ebb9afdd..09f3ebb1 100644 --- a/src/Schema/Emoji.ts +++ b/src/Schema/Emoji.ts
@@ -1,5 +1,11 @@ export const EmojiSchema = { name: String, // the name of the emoji - id: BigInt, // the id of the emoji + $id: BigInt, // the id of the emoji animated: Boolean, // whether this emoji is animated }; + +export interface EmojiSchema { + name: string; + id?: bigint; + animated: Boolean; +} diff --git a/src/Schema/Identify.ts b/src/Schema/Identify.ts
index 8775fac3..3a7182db 100644 --- a/src/Schema/Identify.ts +++ b/src/Schema/Identify.ts
@@ -15,3 +15,19 @@ export const IdentifySchema = { $shard: [Number], $guild_subscriptions: Boolean, }; + +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; + $$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; +} diff --git a/src/models/Guild.ts b/src/models/Guild.ts
index 3d84a9c8..5140c610 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts
@@ -4,50 +4,49 @@ import { Member } from "./Member"; import { Role } from "./Role"; export interface Guild { - id: bigint; - name: string; - icon: string; - icon_hash: string; - splash: string; - discovery_splash: string; - owner: boolean; - owner_id: bigint; - permissions: string; - region: string; afk_channel_id: bigint; afk_timeout: number; - widget_enabled: boolean; - widget_channel_id: bigint; - verification_level: number; + application_id: bigint; + approximate_member_count: number; + approximate_presence_count: number; + banner: string; + channels: Channel[]; default_message_notifications: number; - explicit_content_filter: number; - roles: Role[]; + description: string; + discovery_splash: string; emojis: Emoji[]; + explicit_content_filter: number; features: []; - mfa_level: number; - application_id: bigint; - system_channel_id: bigint; - system_channel_flags: number; - rules_channel_id: bigint; - joined_at: number; + icon: string; + id: bigint; + joined_at: number; // ! member specific should be removed large: boolean; - unavailable: boolean; + max_members: number; // e.g. default 100.000 + max_presences: number; + max_video_channel_users: number; // ? default: 25, is this max 25 streaming or watching member_count: number; - voice_states: []; // ! tf is this members: Member[]; - channels: Channel[]; - presences: []; // TODO: add model - max_presences: number; - max_members: number; - vanity_url_code: string; - description: string; - banner: string; - premium_tier: number; + mfa_level: number; + name: string; + owner_id: bigint; + owner: boolean; + permissions: string; + preferred_locale: string; // only community guilds can choose this premium_subscription_count: number; - preferred_locale: string; + premium_tier: number; // nitro boost level + presences: []; // TODO: add model public_updates_channel_id: bigint; - max_video_channel_users: number; - approximate_member_count: number; - approximate_presence_count: number; - welcome_screen: []; // ! what is this + region: string; + roles: Role[]; + rules_channel_id: bigint; + splash: string; + system_channel_flags: number; + system_channel_id: bigint; + unavailable: boolean; + vanity_url_code: string; + verification_level: number; + voice_states: []; // connected users + welcome_screen: []; // welcome splash screen if a user joins guild + widget_channel_id: bigint; + widget_enabled: boolean; } diff --git a/src/models/Guild.ts.OLD b/src/models/Guild.ts.OLD
index a4e7460f..7f65ed17 100644 --- a/src/models/Guild.ts.OLD +++ b/src/models/Guild.ts.OLD
@@ -2,7 +2,6 @@ export interface Guild { id: bigint; name: string; icon: string; // e.g. "28776e7ad42922582be25bb06cdc5b53" - icon_hash: string; afk_channel_id: bigint; afk_timeout: number; application_id: bigint;