summary refs log tree commit diff
path: root/api/src/schema/Guild.ts
blob: 0f9fd8846aadc551024c5109d6585f128a46525b (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
83
84
85
86
87
88
89
90
91
92
93
94
import { Channel } from "@fosscord/util";
import { Length } from "../util/instanceOf";
import { ChannelModifySchema } from "./Channel";

export const GuildCreateSchema = {
	name: new Length(String, 2, 100),
	$region: String, // auto complete voice region of the user
	$icon: String,
	$channels: [ChannelModifySchema],
	$guild_template_code: String,
	$system_channel_id: String,
	$rules_channel_id: String
};

export interface GuildCreateSchema {
	name: string;
	region?: string;
	icon?: string;
	channels?: ChannelModifySchema[];
	guild_template_code?: string;
	system_channel_id?: string;
	rules_channel_id?: string;
}

export const GuildUpdateSchema = {
	...GuildCreateSchema,
	name: undefined,
	$name: new Length(String, 2, 100),
	$banner: String,
	$splash: String,
	$description: String,
	$features: [String],
	$icon: String,
	$verification_level: Number,
	$default_message_notifications: Number,
	$system_channel_flags: String,
	$system_channel_id: String,
	$explicit_content_filter: Number,
	$public_updates_channel_id: String,
	$afk_timeout: Number,
	$afk_channel_id: String,
	$preferred_locale: String
};
// @ts-ignore
delete GuildUpdateSchema.$channels;

export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> {
	banner?: string;
	splash?: string;
	description?: string;
	features?: string[];
	verification_level?: number;
	default_message_notifications?: number;
	system_channel_flags?: number;
	explicit_content_filter?: number;
	public_updates_channel_id?: string;
	afk_timeout?: number;
	afk_channel_id?: string;
	preferred_locale?: string;
}

export const GuildTemplateCreateSchema = {
	name: String,
	$avatar: String
};

export interface GuildTemplateCreateSchema {
	name: string;
	avatar?: string;
}

export const GuildUpdateWelcomeScreenSchema = {
	$welcome_channels: [
		{
			channel_id: String,
			description: String,
			$emoji_id: String,
			emoji_name: String
		}
	],
	$enabled: Boolean,
	$description: new Length(String, 0, 140)
};

export interface GuildUpdateWelcomeScreenSchema {
	welcome_channels?: {
		channel_id: string;
		description: string;
		emoji_id?: string;
		emoji_name: string;
	}[];
	enabled?: boolean;
	description?: string;
}