From 3df806ef67f2a2f8c021145186571cbca46b4ac1 Mon Sep 17 00:00:00 2001 From: Steele Farnsworth Date: Sat, 4 Jan 2025 16:04:56 -0500 Subject: [PATCH 1/2] Re-fetch help threads before closing. This ensures that the thread title is up-to-date. Previously, even if someone changed the title of the thread, the bot might prepend the lock emoji to an older version of the title. --- bot/exts/help_channels/_channel.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py index cf3cdbaf67..9cf95e254d 100644 --- a/bot/exts/help_channels/_channel.py +++ b/bot/exts/help_channels/_channel.py @@ -3,6 +3,7 @@ import arrow import discord +import pydis_core from pydis_core.utils import scheduling from pydis_core.utils.channel import get_or_fetch_channel @@ -44,6 +45,9 @@ def is_help_forum_post(channel: discord.abc.GuildChannel) -> bool: async def _close_help_post(closed_post: discord.Thread, closing_reason: _stats.ClosingReason) -> None: """Close the help post and record stats.""" + # Get Thread with updated metadata (such as the title) + closed_post = await pydis_core.utils.channel.get_or_fetch_channel(bot.instance, closed_post.id) + embed = discord.Embed(description=CLOSED_POST_MSG) embed.set_author(name=f"{POST_TITLE} closed", icon_url=CLOSED_POST_ICON_URL) message = "" From 41d15ccff810695724006db7f315a3fd8dedcbc6 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sun, 5 Jan 2025 13:22:32 +0000 Subject: [PATCH 2/2] Remove unneeded import --- bot/exts/help_channels/_channel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py index 9cf95e254d..9d76adf656 100644 --- a/bot/exts/help_channels/_channel.py +++ b/bot/exts/help_channels/_channel.py @@ -3,7 +3,6 @@ import arrow import discord -import pydis_core from pydis_core.utils import scheduling from pydis_core.utils.channel import get_or_fetch_channel @@ -46,7 +45,7 @@ def is_help_forum_post(channel: discord.abc.GuildChannel) -> bool: async def _close_help_post(closed_post: discord.Thread, closing_reason: _stats.ClosingReason) -> None: """Close the help post and record stats.""" # Get Thread with updated metadata (such as the title) - closed_post = await pydis_core.utils.channel.get_or_fetch_channel(bot.instance, closed_post.id) + closed_post = await get_or_fetch_channel(bot.instance, closed_post.id) embed = discord.Embed(description=CLOSED_POST_MSG) embed.set_author(name=f"{POST_TITLE} closed", icon_url=CLOSED_POST_ICON_URL)