summary refs log tree commit diff
path: root/util/src/entities/Guild.ts
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-08 04:27:28 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-09 23:28:27 +0200
commitd52d9c62fc30e31e2c01bf6b63f9aedebdde216f (patch)
treee0f7fd130aeeecb9964e1f359eea6b4e124de7da /util/src/entities/Guild.ts
parentClean dependencies (diff)
downloadserver-d52d9c62fc30e31e2c01bf6b63f9aedebdde216f.tar.xz
Bunch of fixes and improvements, everything appears to work now
Diffstat (limited to 'util/src/entities/Guild.ts')
-rw-r--r--util/src/entities/Guild.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts

index 328c586e..058033e8 100644 --- a/util/src/entities/Guild.ts +++ b/util/src/entities/Guild.ts
@@ -285,7 +285,7 @@ export class Guild extends BaseClass { }) { const guild_id = Snowflake.generate(); - const guild = await new Guild({ + const guild: Guild = Object.assign(new Guild(),{ name: body.name || "Fosscord", icon: await handleFile(`/icons/${guild_id}`, body.icon as string), region: Config.get().regions.default, @@ -316,11 +316,12 @@ export class Guild extends BaseClass { welcome_channels: [], }, widget_enabled: true, // NB: don't set it as false to prevent artificial restrictions - }).save(); + }); + await guild.save(); // we have to create the role _after_ the guild because else we would get a "SQLITE_CONSTRAINT: FOREIGN KEY constraint failed" error // TODO: make the @everyone a pseudorole that is dynamically generated at runtime so we can save storage - await new Role({ + let role: Role = Object.assign(new Role(), { id: guild_id, guild_id: guild_id, color: 0, @@ -333,7 +334,8 @@ export class Guild extends BaseClass { position: 0, icon: null, unicode_emoji: null - }).save(); + }); + await role.save(); if (!body.channels || !body.channels.length) body.channels = [{ id: "01", type: 0, name: "general" }];