summary refs log tree commit diff
path: root/src/api/routes/guilds/#guild_id/index.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-08-12 00:01:00 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-08-12 00:01:00 +1000
commitd06fbcebb8ffbe90ba2f2514b68c93072d49fe04 (patch)
tree24b2b9a03e005e163fe606da4161800a27e9d0a0 /src/api/routes/guilds/#guild_id/index.ts
parentMerge pull request #1045 from erkinalp/patch-2 (diff)
downloadserver-d06fbcebb8ffbe90ba2f2514b68c93072d49fe04.tar.xz
set rules/updates in guild if we created them
Diffstat (limited to '')
-rw-r--r--src/api/routes/guilds/#guild_id/index.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/routes/guilds/#guild_id/index.ts b/src/api/routes/guilds/#guild_id/index.ts
index 6feb0a83..adcd585c 100644
--- a/src/api/routes/guilds/#guild_id/index.ts
+++ b/src/api/routes/guilds/#guild_id/index.ts
@@ -165,7 +165,7 @@ router.patch(
 				.execute();
 
 			// create an updates channel for them
-			await Channel.createChannel(
+			const channel = await Channel.createChannel(
 				{
 					name: "moderator-only",
 					guild_id: guild.id,
@@ -184,6 +184,8 @@ router.patch(
 				undefined,
 				{ skipPermissionCheck: true },
 			);
+
+			guild.rules_channel_id = channel.id;
 		} else if (body.public_updates_channel_id != undefined) {
 			// ensure channel exists in this guild
 			await Channel.findOneOrFail({
@@ -200,7 +202,7 @@ router.patch(
 				.execute();
 
 			// create a rules for them
-			await Channel.createChannel(
+			const channel = await Channel.createChannel(
 				{
 					name: "rules",
 					guild_id: guild.id,
@@ -219,6 +221,8 @@ router.patch(
 				undefined,
 				{ skipPermissionCheck: true },
 			);
+
+			guild.rules_channel_id = channel.id;
 		} else if (body.rules_channel_id != undefined) {
 			// ensure channel exists in this guild
 			await Channel.findOneOrFail({