diff options
| author | 2020-09-13 08:44:49 +0300 | |
|---|---|---|
| committer | 2020-09-13 08:44:49 +0300 | |
| commit | c705d6d19506873ab6e21a7301963510833b2b07 (patch) | |
| tree | 1e22cd93f437f2950626bf0411deea46e41bdeeb | |
| parent | Restore newlines for `notify_infraction` embed description (diff) | |
Shorten infraction text when any other field than reason is too long
| -rw-r--r-- | bot/cogs/moderation/utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/cogs/moderation/utils.py b/bot/cogs/moderation/utils.py index 95820404a..4a3c14391 100644 --- a/bot/cogs/moderation/utils.py +++ b/bot/cogs/moderation/utils.py @@ -160,6 +160,10 @@ async def notify_infraction( reason=textwrap.shorten(reason, 1000, placeholder="...") if reason else "No reason provided." ) + # For case when other fields than reason is too long and this reach limit, then force-shorten string + if len(text) > 2048: + text = f"{text[:2045]}..." + embed = discord.Embed( description=text, colour=Colours.soft_red |