diff options
author | 2024-07-06 21:46:24 +0530 | |
---|---|---|
committer | 2024-07-06 21:46:24 +0530 | |
commit | 9946b0a70553235de5b082fa4568ef99aecc6a21 (patch) | |
tree | 833b66042495a96623add68667238b03a96c1f26 | |
parent | Update bot/exts/moderation/modlog.py (diff) |
"Jump to message" changed and added handling for Reference deleted messages
- [x] Changed "Jump to message" to "Jump to referenced message" as it already exists in the embed, thus can create confusion
- [x] if the Reference message is deleted messages it will now give reference line as **In reply to:** Deleted Message
-rw-r--r-- | bot/exts/moderation/modlog.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bot/exts/moderation/modlog.py b/bot/exts/moderation/modlog.py index 601da50f4..15b8f6a3a 100644 --- a/bot/exts/moderation/modlog.py +++ b/bot/exts/moderation/modlog.py @@ -489,6 +489,7 @@ class ModLog(Cog, name="ModLog"): return True return channel.id in GuildConstant.modlog_blacklist + async def log_cached_deleted_message(self, message: discord.Message) -> None: """ Log the message's details to message change log. @@ -526,12 +527,17 @@ class ModLog(Cog, name="ModLog"): if message.reference is not None and message.reference.resolved is not None: resolved_message = message.reference.resolved - if isinstance(resolved_message, discord.Message): + if isinstance(resolved_message, discord.DeletedReferencedMessage): + # Reference is a deleted message + reference_line = "**In reply to:** Deleted Message" + response = reference_line + response + + elif isinstance(resolved_message, discord.Message): jump_url = resolved_message.jump_url author = resolved_message.author.mention reference_line = ( - f"**In reply to:** {author} [Jump to message]({jump_url})\n" + f"**In reply to:** {author} [Jump to referenced message]({jump_url})\n" ) response = reference_line + response |