Skip to content

Commit 3df806e

Browse files
committed
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.
1 parent 3972006 commit 3df806e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bot/exts/help_channels/_channel.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import arrow
55
import discord
6+
import pydis_core
67
from pydis_core.utils import scheduling
78
from pydis_core.utils.channel import get_or_fetch_channel
89

@@ -44,6 +45,9 @@ def is_help_forum_post(channel: discord.abc.GuildChannel) -> bool:
4445

4546
async def _close_help_post(closed_post: discord.Thread, closing_reason: _stats.ClosingReason) -> None:
4647
"""Close the help post and record stats."""
48+
# Get Thread with updated metadata (such as the title)
49+
closed_post = await pydis_core.utils.channel.get_or_fetch_channel(bot.instance, closed_post.id)
50+
4751
embed = discord.Embed(description=CLOSED_POST_MSG)
4852
embed.set_author(name=f"{POST_TITLE} closed", icon_url=CLOSED_POST_ICON_URL)
4953
message = ""

0 commit comments

Comments
 (0)