aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2022-11-27 15:17:33 +0000
committerGravatar GitHub <[email protected]>2022-11-27 15:17:33 +0000
commit5cf3fb3fc2a1ea03a71670d71519dbab91bbf41c (patch)
tree56d8efd3f764dc08ef341bddeda2f718be088e9d
parentMerge pull request #2333 from erlend-aasland/patch-1 (diff)
parentDon't close already closed posts (diff)
Merge pull request #2342 from python-discord/don't-close-already-closed-posts
Don't close already closed posts
-rw-r--r--bot/exts/help_channels/_channel.py4
-rw-r--r--bot/exts/help_channels/_cog.py2
2 files changed, 6 insertions, 0 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py
index 25a1bf4d2..0cee24817 100644
--- a/bot/exts/help_channels/_channel.py
+++ b/bot/exts/help_channels/_channel.py
@@ -204,6 +204,10 @@ async def maybe_archive_idle_post(post: discord.Thread, scheduler: scheduling.Sc
If `has_task` is True and rescheduling is required, the extant task to make the post
dormant will first be cancelled.
"""
+ if post.locked:
+ log.trace(f"Not closing already closed post #{post} ({post.id}).")
+ return
+
log.trace(f"Handling open post #{post} ({post.id}).")
closing_time, closing_reason = await get_closing_time(post)
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index 146391dcf..31f30b7aa 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -91,6 +91,8 @@ class HelpForum(commands.Cog):
if await self.close_check(ctx):
log.info(f"Close command invoked by {ctx.author} in #{ctx.channel}.")
await _channel.help_post_closed(ctx.channel)
+ if ctx.channel.id in self.scheduler:
+ self.scheduler.cancel(ctx.channel.id)
@help_forum_group.command(name="dm", root_aliases=("helpdm",))
async def help_dm_command(