summary refs log tree commit diff
path: root/src/schema
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-03-04 22:01:45 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-03-04 22:01:45 +0100
commit56c9e4377712e1a13e4d4f391ac0cf34cfb6e91d (patch)
tree35e7e6b28314ab209295164a910cbe72a5573126 /src/schema
parent[Users] @me self + guilds (diff)
downloadserver-56c9e4377712e1a13e4d4f391ac0cf34cfb6e91d.tar.xz
:sparkles: Schema
Diffstat (limited to 'src/schema')
-rw-r--r--src/schema/Channel.ts51
-rw-r--r--src/schema/Message.ts27
2 files changed, 78 insertions, 0 deletions
diff --git a/src/schema/Channel.ts b/src/schema/Channel.ts
new file mode 100644

index 00000000..2e7d1214 --- /dev/null +++ b/src/schema/Channel.ts
@@ -0,0 +1,51 @@ +import { Length } from "../util/instanceOf"; + +export const ChannelModifySchema = { + name: new Length(String, 2, 100), + type: Number, + $topic: new Length(String, 0, 1024), + $bitrate: Number, + $user_limit: Number, + $rate_limit_per_user: new Length(Number, 0, 21600), + $position: Number, + $permission_overwrites: [ + { + id: BigInt, + type: new Length(Number, 0, 1), // either 0 (role) or 1 (member) + allow: BigInt, + deny: BigInt, + }, + ], + $parent_id: BigInt, + $nsfw: Boolean, +}; + +export interface ChannelModifySchema { + name: string; + type: number; + topic?: string; + bitrate?: number; + user_limit?: number; + rate_limit_per_user?: Number; + position?: number; + permission_overwrites?: { + id: bigint; + type: number; + allow: bigint; + deny: bigint; + }[]; + parent_id?: bigint; + nsfw?: boolean; +} + +export const ChannelGuildPositionUpdateSchema = [ + { + id: BigInt, + $position: Number, + }, +]; + +export type ChannelGuildPositionUpdateSchema = { + id: bigint; + position?: number; +}[]; diff --git a/src/schema/Message.ts b/src/schema/Message.ts new file mode 100644
index 00000000..80897f9d --- /dev/null +++ b/src/schema/Message.ts
@@ -0,0 +1,27 @@ +export const MessageCreateSchema = { + content: String, + nonce: Number, + tts: Boolean, + embed: {}, + allowed_mentions: [], + message_reference: { + message_id: BigInt, + channel_id: BigInt, + guild_id: BigInt, + fail_if_not_exists: Boolean, + }, +}; + +export interface MessageCreateSchema { + content: string; + nonce: number; + tts: boolean; + embed: {}; + allowed_mentions: []; + message_reference: { + message_id: bigint; + channel_id: bigint; + guild_id: bigint; + fail_if_not_exists: boolean; + }; +}