This commit is contained in:
Flam3rboy
2021-08-12 20:09:35 +02:00
parent a1c85f0b16
commit 08e837bf55
233 changed files with 0 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
export const BanCreateSchema = {
$delete_message_days: String,
$reason: String,
};
export interface BanCreateSchema {
delete_message_days?: string;
reason?: string;
}
+62
View File
@@ -0,0 +1,62 @@
import { ChannelType } from "@fosscord/server-util";
import { Length } from "../util/instanceOf";
export const ChannelModifySchema = {
name: new Length(String, 2, 100),
type: new Length(Number, 0, 13),
$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: String,
type: new Length(Number, 0, 1), // either 0 (role) or 1 (member)
allow: BigInt,
deny: BigInt
}
],
$parent_id: String,
$nsfw: Boolean
};
export const DmChannelCreateSchema = {
$name: String,
recipients: new Length([String], 1, 10)
};
export interface DmChannelCreateSchema {
name?: string;
recipients: string[];
}
export interface ChannelModifySchema {
name: string;
type: number;
topic?: string;
bitrate?: number;
user_limit?: number;
rate_limit_per_user?: number;
position?: number;
permission_overwrites?: {
id: string;
type: number;
allow: bigint;
deny: bigint;
}[];
parent_id?: string;
nsfw?: boolean;
}
export const ChannelGuildPositionUpdateSchema = [
{
id: String,
$position: Number
}
];
export type ChannelGuildPositionUpdateSchema = {
id: string;
position?: number;
}[];
+131
View File
@@ -0,0 +1,131 @@
import { ChannelSchema, GuildChannel } from "@fosscord/server-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;
}
+22
View File
@@ -0,0 +1,22 @@
export const InviteCreateSchema = {
$target_user_id: String,
$target_type: String,
$validate: String, //? wtf is this
$max_age: Number,
$max_uses: Number,
$temporary: Boolean,
$unique: Boolean,
$target_user: String,
$target_user_type: Number
};
export interface InviteCreateSchema {
target_user_id?: String;
target_type?: String;
validate?: String; //? wtf is this
max_age?: Number;
max_uses?: Number;
temporary?: Boolean;
unique?: Boolean;
target_user?: String;
target_user_type?: Number;
}
+29
View File
@@ -0,0 +1,29 @@
export const MemberCreateSchema = {
id: String,
nick: String,
guild_id: String,
joined_at: Date
};
export interface MemberCreateSchema {
id: string;
nick: string;
guild_id: string;
joined_at: Date;
}
export const MemberNickChangeSchema = {
nick: String
};
export interface MemberNickChangeSchema {
nick: string;
}
export const MemberChangeSchema = {
$roles: [String]
};
export interface MemberChangeSchema {
roles?: string[];
}
+82
View File
@@ -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;
}
+17
View File
@@ -0,0 +1,17 @@
export const RoleModifySchema = {
$name: String,
$permissions: BigInt,
$color: Number,
$hoist: Boolean, // whether the role should be displayed separately in the sidebar
$mentionable: Boolean, // whether the role should be mentionable
$position: Number
};
export interface RoleModifySchema {
name?: string;
permissions?: BigInt;
color?: number;
hoist?: boolean; // whether the role should be displayed separately in the sidebar
mentionable?: boolean; // whether the role should be mentionable
position?: number;
}
+19
View File
@@ -0,0 +1,19 @@
export const TemplateCreateSchema = {
name: String,
$description: String,
};
export interface TemplateCreateSchema {
name: string;
description?: string;
}
export const TemplateModifySchema = {
name: String,
$description: String,
};
export interface TemplateModifySchema {
name: string;
description?: string;
}
+23
View File
@@ -0,0 +1,23 @@
import { Length } from "../util/instanceOf";
export const UserModifySchema = {
$username: new Length(String, 2, 32),
$avatar: String,
$bio: new Length(String, 0, 190),
$accent_color: Number,
$banner: String,
$password: String,
$new_password: String,
$code: String // 2fa code
};
export interface UserModifySchema {
username?: string;
avatar?: string | null;
bio?: string;
accent_color?: number | null;
banner?: string | null;
password?: string;
new_password?: string;
code?: string;
}
+10
View File
@@ -0,0 +1,10 @@
// https://discord.com/developers/docs/resources/guild#guild-widget-object
export const WidgetModifySchema = {
enabled: Boolean, // whether the widget is enabled
channel_id: String // the widget channel id
};
export interface WidgetModifySchema {
enabled: boolean; // whether the widget is enabled
channel_id: string; // the widget channel id
}