summary refs log tree commit diff
path: root/api/src/schema/Message.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 20:22:16 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 20:22:16 +0200
commitbdc0cc723c7d5974a4c4e3e8b0793917684ec85d (patch)
tree7123410553a6698d90ddaae69b05cde8402ded36 /api/src/schema/Message.ts
parent1.3.52 (diff)
parent:sparkles: gateway (diff)
downloadserver-bdc0cc723c7d5974a4c4e3e8b0793917684ec85d.tar.xz
Merge branch 'master' into util
Diffstat (limited to 'api/src/schema/Message.ts')
-rw-r--r--api/src/schema/Message.ts82
1 files changed, 82 insertions, 0 deletions
diff --git a/api/src/schema/Message.ts b/api/src/schema/Message.ts
new file mode 100644

index 00000000..8423d706 --- /dev/null +++ b/api/src/schema/Message.ts
@@ -0,0 +1,82 @@ +import { Embed, EmbedImage } from "@fosscord/server-util"; +import { Length } from "../util/instanceOf"; + +export const MessageCreateSchema = { + $content: new Length(String, 0, 2000), + $nonce: String, + $tts: Boolean, + $flags: BigInt, + $embed: { + $title: new Length(String, 0, 256), //title of embed + $type: String, // type of embed (always "rich" for webhook embeds) + $description: new Length(String, 0, 2048), // description of embed + $url: String, // url of embed + $timestamp: String, // ISO8601 timestamp + $color: Number, // color code of the embed + $footer: { + text: new Length(String, 0, 2048), + icon_url: String, + proxy_icon_url: String + }, // footer object footer information + $image: EmbedImage, // image object image information + $thumbnail: EmbedImage, // thumbnail object thumbnail information + $video: EmbedImage, // video object video information + $provider: { + name: String, + url: String + }, // provider object provider information + $author: { + name: new Length(String, 0, 256), + url: String, + icon_url: String, + proxy_icon_url: String + }, // author object author information + $fields: new Length( + [ + { + name: new Length(String, 0, 256), + value: new Length(String, 0, 1024), + $inline: Boolean + } + ], + 0, + 25 + ) + }, + $allowed_mentions: { + $parse: [String], + $roles: [String], + $users: [String], + $replied_user: Boolean + }, + $message_reference: { + message_id: String, + channel_id: String, + $guild_id: String, + $fail_if_not_exists: Boolean + }, + $payload_json: String, + $file: Object +}; + +export interface MessageCreateSchema { + content?: string; + nonce?: string; + tts?: boolean; + flags?: bigint; + embed?: Embed & { timestamp?: string }; + allowed_mentions?: { + parse?: string[]; + roles?: string[]; + users?: string[]; + replied_user?: boolean; + }; + message_reference?: { + message_id: string; + channel_id: string; + guild_id?: string; + fail_if_not_exists: boolean; + }; + payload_json?: string; + file?: any; +}