summary refs log tree commit diff
path: root/src/api/routes/guilds/index.ts
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-27 05:18:48 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:48:54 +0200
commit7d936efb2f37db42c3e57ee9a915ed4d5ab8e25f (patch)
tree69d68d640c4ac2946b118591f02de9d3c24fb29b /src/api/routes/guilds/index.ts
parentAdd sqlite migration for plugin settings (diff)
downloadserver-7d936efb2f37db42c3e57ee9a915ed4d5ab8e25f.tar.xz
Cleanup, reformat, fix some todos, git hook
fixup! Cleanup, reformat, fix some todos, git hook
Diffstat (limited to 'src/api/routes/guilds/index.ts')
-rw-r--r--src/api/routes/guilds/index.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api/routes/guilds/index.ts b/src/api/routes/guilds/index.ts

index 6946e2f7..3d433232 100644 --- a/src/api/routes/guilds/index.ts +++ b/src/api/routes/guilds/index.ts
@@ -7,9 +7,10 @@ const router: Router = Router(); //TODO: create default channel router.post("/", route({ body: "GuildCreateSchema", right: "CREATE_GUILDS" }), async (req: Request, res: Response) => { + let cfg = Config.get(); const body = req.body as GuildCreateSchema; - const { maxGuilds } = Config.get().limits.user; + const { maxGuilds } = cfg.limits.user; const guild_count = await Member.count({ where: { id: req.user_id } }); const rights = await getRights(req.user_id); if (guild_count >= maxGuilds && !rights.has("MANAGE_GUILDS")) { @@ -18,7 +19,7 @@ router.post("/", route({ body: "GuildCreateSchema", right: "CREATE_GUILDS" }), a const guild = await Guild.createGuild({ ...body, owner_id: req.user_id }); - const { autoJoin } = Config.get().guild; + const { autoJoin } = cfg.guild; if (autoJoin.enabled && !autoJoin.guilds?.length) { // @ts-ignore await Config.set({ guild: { autoJoin: { guilds: [guild.id] } } });