fix models + move schemas in api and gateway
This commit is contained in:
@@ -1,81 +0,0 @@
|
||||
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
|
||||
};
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
export const EmojiSchema = {
|
||||
name: String, // the name 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;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
export const GuildSchema = {
|
||||
name: String, // ! 2-100 chars
|
||||
$region: String, // ? voice region ?
|
||||
// $icon: String, // TODO: add icon data (base64 128x128)
|
||||
|
||||
// * --- useless for us due to templates being a thing --- * //
|
||||
// $verification_level: Number, // ! https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
||||
// $default_message_notifications: Number, // ! https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
||||
// $explicit_content_filter: Number,
|
||||
// $roles: array of role objects,
|
||||
// $channels: array of partial channel objects,
|
||||
// $afk_channel_id: snowflake,
|
||||
// * --- useless for us --- * //
|
||||
|
||||
// $afk_timeout: Number,
|
||||
// $system_channel_id: snowflake,
|
||||
};
|
||||
|
||||
export interface GuildSchema {
|
||||
name: string; // ! 2-100 chars
|
||||
region?: string; // ? voice region ?
|
||||
// icon?: string; // TODO: add icon data (base64 128x128)
|
||||
|
||||
// * --- useless for us due to templates being a thing --- * //
|
||||
// verification_level?: number; // ! https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
||||
// default_message_notifications?: number; // ! https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
||||
// explicit_content_filter?: number;
|
||||
// $roles: array of role objects,
|
||||
// $channels: array of partial channel objects,
|
||||
// $afk_channel_id: snowflake,
|
||||
// * --- useless for us --- * //
|
||||
|
||||
// afk_timeout?: number;
|
||||
// system_channel_id?: snowflake,
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key
|
||||
$$os: String,
|
||||
$$browser: String,
|
||||
$$device: String,
|
||||
},
|
||||
$presence: ActivitySchema,
|
||||
$compress: Boolean,
|
||||
$large_threshold: Number,
|
||||
$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;
|
||||
}
|
||||
@@ -12,12 +12,6 @@ import { Member } from "./models/Member";
|
||||
import { Role } from "./models/Role";
|
||||
import { User } from "./models/User";
|
||||
|
||||
//* schema
|
||||
import { EmojiSchema } from "./Schema/Emoji";
|
||||
import { ActivitySchema } from "./Schema/Activity";
|
||||
import { IdentifySchema } from "./Schema/Identify";
|
||||
import { GuildSchema } from "./Schema/Guild";
|
||||
|
||||
import { trimSpecial } from "./util/String";
|
||||
import { BitField } from "./util/BitField";
|
||||
import { Intents } from "./util/Intents";
|
||||
@@ -47,8 +41,4 @@ export {
|
||||
Member,
|
||||
Role,
|
||||
User,
|
||||
EmojiSchema,
|
||||
ActivitySchema,
|
||||
IdentifySchema,
|
||||
GuildSchema,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export interface Event {
|
||||
guild_id?: bigint;
|
||||
user_id?: bigint;
|
||||
channel_id?: bigint;
|
||||
created_at: number;
|
||||
data: any;
|
||||
event: string;
|
||||
|
||||
+1
-3
@@ -7,8 +7,6 @@ export interface Guild {
|
||||
afk_channel_id?: bigint;
|
||||
afk_timeout?: number;
|
||||
application_id?: bigint;
|
||||
approximate_member_count?: number;
|
||||
approximate_presence_count?: number;
|
||||
banner?: string;
|
||||
channels: Channel[];
|
||||
default_message_notifications?: number;
|
||||
@@ -25,11 +23,11 @@ export interface Guild {
|
||||
max_presences?: number;
|
||||
max_video_channel_users?: number; // ? default: 25, is this max 25 streaming or watching
|
||||
member_count?: number;
|
||||
presence_count?: number; // users online
|
||||
members?: Member[];
|
||||
mfa_level?: number;
|
||||
name: string;
|
||||
owner_id: bigint;
|
||||
permissions?: string;
|
||||
preferred_locale?: string; // only community guilds can choose this
|
||||
premium_subscription_count?: number;
|
||||
premium_tier?: number; // nitro boost level
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export interface Role {
|
||||
id: bigint;
|
||||
color: number;
|
||||
hoist: boolean;
|
||||
managed: boolean;
|
||||
@@ -6,4 +7,7 @@ export interface Role {
|
||||
name: string;
|
||||
permissions: bigint;
|
||||
position: number;
|
||||
tags?: {
|
||||
bot_id?: bigint;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user