diff options
| author | 2020-08-15 12:23:26 -0700 | |
|---|---|---|
| committer | 2020-08-15 12:25:04 -0700 | |
| commit | f26deafbebf1d3f6790a165d403e0fb664117939 (patch) | |
| tree | 26bb42f87d8c463ca8d9585729eb33b1117fc330 | |
| parent | Don't patch ctx.message.author in antispam (diff) | |
Truncate mod log content
Discord has a limit of 2000 characters for messages.
| -rw-r--r-- | bot/cogs/moderation/modlog.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py index 0a63f57b8..5f30d3744 100644 --- a/bot/cogs/moderation/modlog.py +++ b/bot/cogs/moderation/modlog.py @@ -120,6 +120,10 @@ class ModLog(Cog, name="ModLog"): else: content = "@everyone" + # Truncate content to 2000 characters and append an ellipsis. + if content and len(content) > 2000: + content = content[:2000 - 3] + "..." + channel = self.bot.get_channel(channel_id) log_message = await channel.send( content=content, |