summary refs log tree commit diff
path: root/api/src/schema/Message.ts
blob: 2dd54f0c1bd5f4ad8f00e31b619a6a1a33381301 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { Embed, EmbedImage } from "@fosscord/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;
}