aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-04-05 18:17:16 +0300
committerGravatar ks129 <[email protected]>2020-04-05 18:17:16 +0300
commitaad67373d3ac6d3d3a236d6734a6c22019dce120 (patch)
tree695757f75fa1ff2bf347e27bea3c6cd9127eebcc
parent(Ban and Kick): Applied simplification to reason truncating. (diff)
(Mod Scheduler): Added reason truncations to Scheduler's `apply_infraction`
-rw-r--r--bot/cogs/moderation/scheduler.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py
index 917697be9..45e9d58ad 100644
--- a/bot/cogs/moderation/scheduler.py
+++ b/bot/cogs/moderation/scheduler.py
@@ -84,7 +84,8 @@ class InfractionScheduler(Scheduler):
"""Apply an infraction to the user, log the infraction, and optionally notify the user."""
infr_type = infraction["type"]
icon = utils.INFRACTION_ICONS[infr_type][0]
- reason = infraction["reason"]
+ # Truncate reason when it's too long to avoid raising error on sending ModLog entry
+ reason = textwrap.shorten(infraction["reason"], width=1900, placeholder="...")
expiry = time.format_infraction_with_duration(infraction["expires_at"])
id_ = infraction['id']