mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 15:22:43 +00:00
🚧 typeorm
This commit is contained in:
1 parent
954700b2d5
commit
4abc758991
10 files changed
+67
-76
No files matched your search
@@ -40,7 +40,7 @@ router.post("/", check(RoleModifySchema), async (req: Request, res: Response) =>
|
||||
managed: false,
|
||||
position: 0,
|
||||
tags: null,
|
||||
permissions: perms.bitfield & (body.permissions || 0n)
|
||||
permissions: String(perms.bitfield & (body.permissions || 0n))
|
||||
}).save();
|
||||
|
||||
await emitEvent({
|
||||
|
||||
@@ -17,7 +17,7 @@ const TemplateGuildProjection: (keyof Guild)[] = [
|
||||
"preferred_locale",
|
||||
"afk_timeout",
|
||||
"roles",
|
||||
"channels",
|
||||
// "channels",
|
||||
"afk_channel_id",
|
||||
"system_channel_id",
|
||||
"system_channel_flags",
|
||||
|
||||
@@ -19,63 +19,55 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) =
|
||||
}
|
||||
|
||||
const guild_id = Snowflake.generate();
|
||||
const guild = new Guild({
|
||||
name: body.name,
|
||||
region: Config.get().regions.default,
|
||||
owner_id: req.user_id,
|
||||
icon: undefined,
|
||||
afk_channel_id: undefined,
|
||||
afk_timeout: 300,
|
||||
application_id: undefined,
|
||||
banner: undefined,
|
||||
default_message_notifications: 0,
|
||||
description: undefined,
|
||||
splash: undefined,
|
||||
discovery_splash: undefined,
|
||||
explicit_content_filter: 0,
|
||||
features: [],
|
||||
id: guild_id,
|
||||
large: undefined,
|
||||
max_members: 250000,
|
||||
max_presences: 250000,
|
||||
max_video_channel_users: 25,
|
||||
presence_count: 0,
|
||||
member_count: 0, // will automatically be increased by addMember()
|
||||
mfa_level: 0,
|
||||
preferred_locale: "en-US",
|
||||
premium_subscription_count: 0,
|
||||
premium_tier: 0,
|
||||
public_updates_channel_id: undefined,
|
||||
rules_channel_id: undefined,
|
||||
system_channel_flags: "0",
|
||||
system_channel_id: undefined,
|
||||
unavailable: false,
|
||||
vanity_url_code: undefined,
|
||||
verification_level: 0,
|
||||
welcome_screen: {
|
||||
enabled: false,
|
||||
description: "No description",
|
||||
welcome_channels: []
|
||||
},
|
||||
widget_channel_id: undefined,
|
||||
widget_enabled: false
|
||||
});
|
||||
|
||||
const [guild_doc, role] = await Promise.all([
|
||||
new Guild(guild).save(),
|
||||
new Role({
|
||||
const guild = new Guild(
|
||||
{
|
||||
name: body.name,
|
||||
region: Config.get().regions.default,
|
||||
owner_id: req.user_id,
|
||||
afk_timeout: 300,
|
||||
default_message_notifications: 0,
|
||||
explicit_content_filter: 0,
|
||||
features: [],
|
||||
id: guild_id,
|
||||
max_members: 250000,
|
||||
max_presences: 250000,
|
||||
max_video_channel_users: 25,
|
||||
presence_count: 0,
|
||||
member_count: 0, // will automatically be increased by addMember()
|
||||
mfa_level: 0,
|
||||
preferred_locale: "en-US",
|
||||
premium_subscription_count: 0,
|
||||
premium_tier: 0,
|
||||
system_channel_flags: "0",
|
||||
unavailable: false,
|
||||
verification_level: 0,
|
||||
welcome_screen: {
|
||||
enabled: false,
|
||||
description: "No description",
|
||||
welcome_channels: []
|
||||
},
|
||||
widget_enabled: false
|
||||
},
|
||||
{ id: guild_id }
|
||||
);
|
||||
const role = new Role(
|
||||
{
|
||||
guild_id: guild_id,
|
||||
color: 0,
|
||||
hoist: false,
|
||||
managed: false,
|
||||
mentionable: false,
|
||||
name: "@everyone",
|
||||
permissions: 2251804225n,
|
||||
permissions: String("2251804225"),
|
||||
position: 0,
|
||||
tags: null
|
||||
}).save()
|
||||
]);
|
||||
},
|
||||
{
|
||||
id: guild_id
|
||||
}
|
||||
);
|
||||
|
||||
await Promise.all([guild.save(), role.save()]);
|
||||
|
||||
if (!body.channels || !body.channels.length) body.channels = [{ id: "01", type: 0, name: "general" }];
|
||||
|
||||
|
||||
Reference in new issue
Block a user