fix(forums): fixed 400 bad request error if the forum post already has the resolved tag
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
Seaswimmer 2023-09-07 19:44:25 -04:00
parent 698ba7645a
commit 0c9dcba375
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -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)