From 0c9dcba375c36b1c63d6404b8b19c64c363f347b Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 7 Sep 2023 19:44:25 -0400 Subject: [PATCH] fix(forums): fixed 400 bad request error if the forum post already has the resolved tag --- forums/forums.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/forums/forums.py b/forums/forums.py index 0c5bc55..9940b87 100644 --- a/forums/forums.py +++ b/forums/forums.py @@ -60,7 +60,11 @@ class Forums(commands.Cog): reason = f"Thread closed by {interaction.user.name} ({interaction.user.id})" await self.msg.edit(content=response_reason, view=None) await self.ctx.message.add_reaction("✅") - await interaction.channel.edit(locked=True, archived=True, applied_tags=interaction.channel.applied_tags + [interaction.channel.parent.get_tag(await self.config.guild(interaction.guild).forum_tag())], reason=reason) + tag = interaction.channel.parent.get_tag(await self.config.guild(interaction.guild).forum_tag()) + if tag in interaction.channel.applied_tags: + await interaction.channel.edit(locked=True, archived=True, reason=reason) + else: + await interaction.channel.edit(locked=True, archived=True, applied_tags=interaction.channel.applied_tags + [tag], reason=reason) else: await interaction.response.send_message(content="You cannot close this thread!", ephemeral=True)