diff options
| author | 2020-04-04 14:53:11 +0300 | |
|---|---|---|
| committer | 2020-04-04 14:53:11 +0300 | |
| commit | 6ad86ace9f34245180aefeed9553c407602602e8 (patch) | |
| tree | cec2bcbd2540346ea4d80213e3cb69cca3663529 | |
| parent | (Banning): Added logging and truncating to correct length for Discord Audit L... (diff) | |
(Kick Command): Added logging and truncating to correct length for Discord Audit Log when kick reason length is more than 512 characters.
| -rw-r--r-- | bot/cogs/moderation/infractions.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index f41484711..f8c3e8da3 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -225,7 +225,10 @@ class Infractions(InfractionScheduler, commands.Cog): self.mod_log.ignore(Event.member_remove, user.id) - action = user.kick(reason=reason) + if len(reason) > 512: + log.info("Kick reason is longer than 512 characters. Reason will be truncated for Audit Log.") + + action = user.kick(reason=f"{reason[:509]}..." if len(reason) > 512 else reason) await self.apply_infraction(ctx, infraction, user, action) @respect_role_hierarchy() |