Fix guild patch with channel ids

This commit is contained in:
Rory& committed 2026-10-29 13:08:31 +01:00
1 parent f8a51f6887
commit 09b71a1a52
1 file changed
+4 -5
+4 -5
View File
@@ -122,9 +122,6 @@ router.patch(
guild.features = body.features;
}
// TODO: check if body ids are valid
guild.assign(body);
if (body.public_updates_channel_id == "1") {
// create an updates channel for them
const channel = await Channel.createChannel(
@@ -149,7 +146,7 @@ router.patch(
await Guild.insertChannelInOrder(guild.id, channel.id, 0, guild);
guild.public_updates_channel_id = channel.id;
body.public_updates_channel_id = channel.id;
} else if (body.public_updates_channel_id != undefined) {
// ensure channel exists in this guild
await Channel.findOneOrFail({
@@ -182,7 +179,7 @@ router.patch(
await Guild.insertChannelInOrder(guild.id, channel.id, 0, guild);
guild.rules_channel_id = channel.id;
body.rules_channel_id = channel.id;
} else if (body.rules_channel_id != undefined) {
// ensure channel exists in this guild
await Channel.findOneOrFail({
@@ -191,6 +188,8 @@ router.patch(
});
}
guild.assign(body);
const data = guild.toJSON();
// TODO: guild hashes
// TODO: fix vanity_url_code, template_id