aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2025-02-07 16:41:24 +0000
committerGravatar Chris Lovering <[email protected]>2025-02-07 16:41:24 +0000
commitfdbffd1e8251b37439eb00fa34fdae3f1be816a8 (patch)
treec13937aba64c6e6a24433ef272e9a5cfb499e598
parentMerge pull request #3246 from python-discord/revert-3241-pastebin-auto-upload (diff)
Fetch latest help post further up the call stack when looking to archive
This ensures that the logic prior to closing also has the updated thread info
-rw-r--r--bot/exts/help_channels/_channel.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py
index 6a0c3264c..43b9a858d 100644
--- a/bot/exts/help_channels/_channel.py
+++ b/bot/exts/help_channels/_channel.py
@@ -47,9 +47,6 @@ async def _close_help_post(
scheduler: scheduling.Scheduler,
) -> None:
"""Close the help post and record stats."""
- # Get Thread with updated metadata (such as the title)
- closed_post = await get_or_fetch_channel(bot.instance, closed_post.id)
-
embed = discord.Embed(description=CLOSED_POST_MSG)
close_title = "Python help channel closed"
if closing_reason == _stats.ClosingReason.CLEANUP:
@@ -195,7 +192,8 @@ async def get_closing_time(post: discord.Thread) -> tuple[arrow.Arrow, _stats.Cl
async def maybe_archive_idle_post(post: discord.Thread, scheduler: scheduling.Scheduler) -> None:
"""Archive the `post` if idle, or schedule the archive for later if still active."""
try:
- await get_or_fetch_channel(bot.instance, post.id)
+ # Fetch the post again, to ensure we have the latest info
+ post = await get_or_fetch_channel(bot.instance, post.id)
except discord.HTTPException:
log.trace(f"Not closing missing post #{post} ({post.id}).")
return