aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2024-02-09 07:00:23 +0000
committerGravatar GitHub <[email protected]>2024-02-09 07:00:23 +0000
commit138314348e5dae85cd49e7e9a9da5a540ac57c9b (patch)
treeffb2105b6d7cf3517e4afe7427b6c7428d077abe
parentBump sentry-sdk from 1.40.1 to 1.40.2 (#2917) (diff)
Fix modlog event being in a non-cached channel (#2911)
-rw-r--r--bot/exts/moderation/modlog.py5
1 files 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):