diff options
author | 2021-10-12 06:45:30 +0530 | |
---|---|---|
committer | 2021-10-12 06:45:30 +0530 | |
commit | 5e6e361ce5f08425d84e53fab611a3b8b685fcc0 (patch) | |
tree | 8db14fd512202c1d5a3af6fa33e1162b185874bc | |
parent | Correct discord message link regex (diff) |
Add error handling on modlog channel fetch
-rw-r--r-- | bot/exts/moderation/incidents.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/exts/moderation/incidents.py b/bot/exts/moderation/incidents.py index 5d2c66d6c..14bec3877 100644 --- a/bot/exts/moderation/incidents.py +++ b/bot/exts/moderation/incidents.py @@ -175,7 +175,12 @@ async def make_message_link_embed(ctx: Context, message_link: str) -> t.Optional try: message: discord.Message = await MessageConverter().convert(ctx, message_link) except MessageNotFound: - mod_logs_channel = ctx.bot.get_channel(Channels.mod_log) + try: + mod_logs_channel = ctx.bot.get_channel(Channels.mod_log) + except discord.NotFound: + log.exception(f"Mod-logs (<#{Channels.mod_log}> channel not found.") + return + last_100_logs: list[discord.Message] = await mod_logs_channel.history(limit=100).flatten() for log_entry in last_100_logs: |