diff options
author | 2021-11-10 06:17:23 +0530 | |
---|---|---|
committer | 2021-11-10 06:17:23 +0530 | |
commit | cd3db5f9e51c79a9fe8f621cdafdc9052ef22033 (patch) | |
tree | c0246af65a2c17098c58c69e49960e3db5e48a53 | |
parent | Explicitly show there is no message content (diff) |
Check if log entry has embeds before indexing them
-rw-r--r-- | bot/exts/moderation/incidents.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/exts/moderation/incidents.py b/bot/exts/moderation/incidents.py index bdbce4acb..77dfad255 100644 --- a/bot/exts/moderation/incidents.py +++ b/bot/exts/moderation/incidents.py @@ -151,7 +151,7 @@ def shorten_text(text: str) -> str: text = text[:300] # Limit to a maximum of three lines - text = "\n".join(line for line in text.split("\n", maxsplit=3)[:3]) + text = "\n".join(text.split("\n", maxsplit=3)[:3]) # If it is a single word, then truncate it to 50 characters if text.find(" ") == -1: @@ -186,6 +186,9 @@ async def make_message_link_embed(ctx: Context, message_link: str) -> Optional[d last_100_logs: list[discord.Message] = await mod_logs_channel.history(limit=100).flatten() for log_entry in last_100_logs: + if not log_entry.embeds: + continue + log_embed: discord.Embed = log_entry.embeds[0] if ( log_embed.author.name == "Message deleted" |