fix: uncaught exception

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

View File

@@ -335,16 +335,23 @@ async def handle_message_delete(message, bot):
inline=False, inline=False,
) # noqa ) # noqa
if message.reference is not None: try:
original_message = await message.channel.fetch_message( if message.reference is not None:
message.reference.message_id original_message = await message.channel.fetch_message(
) message.reference.message_id
)
embed.add_field( embed.add_field(
name="Replied", name="Replied",
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