summary refs log tree commit diff
path: root/api/src/schema/Guild.ts
blob: ce40b49f5ad460d775ab2738b999a1337a42b08f (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { ChannelSchema, GuildChannel } from "@fosscord/util";
import { Length } from "../util/instanceOf";

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

export interface GuildCreateSchema {
	name: string;
	region?: string;
	icon?: string;
	channels?: GuildChannel[];
	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: Number,
	$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 GuildGetSchema = {
	id: true,
	name: true,
	icon: true,
	splash: true,
	discovery_splash: true,
	owner: true,
	owner_id: true,
	permissions: true,
	region: true,
	afk_channel_id: true,
	afk_timeout: true,
	widget_enabled: true,
	widget_channel_id: true,
	verification_level: true,
	default_message_notifications: true,
	explicit_content_filter: true,
	roles: true,
	emojis: true,
	features: true,
	mfa_level: true,
	application_id: true,
	system_channel_id: true,
	system_channel_flags: true,
	rules_channel_id: true,
	joined_at: true,
	// large: true,
	// unavailable: true,
	member_count: true,
	// voice_states: true,
	// members: true,
	// channels: true,
	// presences: true,
	max_presences: true,
	max_members: true,
	vanity_url_code: true,
	description: true,
	banner: true,
	premium_tier: true,
	premium_subscription_count: true,
	preferred_locale: true,
	public_updates_channel_id: true,
	max_video_channel_users: true,
	approximate_member_count: true,
	approximate_presence_count: true
	// welcome_screen: true,
};

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

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

export const GuildAddChannelToWelcomeScreenSchema = {
	channel_id: String,
	description: String,
	$emoji_id: String,
	emoji_name: String
};

export interface GuildAddChannelToWelcomeScreenSchema {
	channel_id: string;
	description: string;
	emoji_id?: string;
	emoji_name: string;
}