fix: uncaught exception

This commit is contained in:
2026-01-19 11:00:38 +01:00
parent bf3b5bd6e4
commit 1d84d26008

View File

@@ -335,6 +335,7 @@ async def handle_message_delete(message, bot):
inline=False, inline=False,
) # noqa ) # noqa
try:
if message.reference is not None: if message.reference is not None:
original_message = await message.channel.fetch_message( original_message = await message.channel.fetch_message(
message.reference.message_id message.reference.message_id
@@ -345,6 +346,12 @@ async def handle_message_delete(message, bot):
value=original_message.author.mention, value=original_message.author.mention,
inline=False, # noqa inline=False, # noqa
) # noqa ) # noqa
except discord.NotFound:
logger.warning("Referenced message not found")
except discord.Forbidden:
logger.error("No permission to access the referenced message")
except discord.HTTPException as e:
logger.error(f"Error fetching message: {e}")
embed.set_footer( embed.set_footer(
text=f"Message ID: {message.id} | Author ID: {message.author.id}" # noqa text=f"Message ID: {message.id} | Author ID: {message.author.id}" # noqa