From 138314348e5dae85cd49e7e9a9da5a540ac57c9b Mon Sep 17 00:00:00 2001 From: ChrisJL Date: Fri, 9 Feb 2024 07:00:23 +0000 Subject: Fix modlog event being in a non-cached channel (#2911) --- bot/exts/moderation/modlog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot/exts/moderation/modlog.py b/bot/exts/moderation/modlog.py index 3c256396a..74bdc9db9 100644 --- a/bot/exts/moderation/modlog.py +++ b/bot/exts/moderation/modlog.py @@ -10,6 +10,7 @@ from discord import Colour, Message, Thread from discord.abc import GuildChannel from discord.ext.commands import Cog from discord.utils import escape_markdown, format_dt, snowflake_time +from pydis_core.utils.channel import get_or_fetch_channel from bot.bot import Bot from bot.constants import Channels, Colours, Emojis, Event, Guild as GuildConstant, Icons, Roles @@ -685,9 +686,9 @@ class ModLog(Cog, name="ModLog"): await self.bot.wait_until_guild_available() try: - channel = self.bot.get_channel(int(event.data["channel_id"])) + channel = await get_or_fetch_channel(self.bot, int(event.data["channel_id"])) message = await channel.fetch_message(event.message_id) - except discord.NotFound: # Was deleted before we got the event + except discord.NotFound: # Channel/message was deleted before we got the event return if self.is_message_blacklisted(message): -- cgit v1.2.3