Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-fetch help threads before closing #3228

Merged
merged 2 commits into from
Jan 5, 2025
Merged

Re-fetch help threads before closing #3228

merged 2 commits into from
Jan 5, 2025

Conversation

swfarnsworth
Copy link
Member

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.

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.
@swfarnsworth swfarnsworth added the a: help channels Related to the help channel system label Jan 4, 2025
@swfarnsworth
Copy link
Member Author

image

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Looks like get_or_fetch_channel is already imported in this file, so we can drop the import pydis_core entirely

Copy link
Member

@vivekashok1221 vivekashok1221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ChrisLovering ChrisLovering merged commit 41d15cc into main Jan 5, 2025
2 of 3 checks passed
@ChrisLovering ChrisLovering deleted the fix-thread-close branch January 5, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: help channels Related to the help channel system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants