diff options
author | 2024-03-25 19:28:25 +0000 | |
---|---|---|
committer | 2024-03-26 12:24:43 +0000 | |
commit | 0f0cf9b0256804e4a6c9b005561292c463c1de92 (patch) | |
tree | 99fbf57cdbaf636e2c0fd742e2640e67c376b057 | |
parent | Always try to close help posts, even when closing message couldn't be sent (diff) |
Attempt to fetch help post from cache before making an API request
-rw-r--r-- | bot/exts/help_channels/_channel.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py index 76076bb4e..ed9f5c346 100644 --- a/bot/exts/help_channels/_channel.py +++ b/bot/exts/help_channels/_channel.py @@ -5,6 +5,7 @@ from datetime import timedelta import arrow import discord from pydis_core.utils import scheduling +from pydis_core.utils.channel import get_or_fetch_channel import bot from bot import constants @@ -212,7 +213,7 @@ 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 post.guild.fetch_channel(post.id) + await get_or_fetch_channel(bot.instance, post.id) except discord.HTTPException: log.trace(f"Not closing missing post #{post} ({post.id}).") return |