aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/moderation/infractions.py10
-rw-r--r--bot/cogs/moderation/scheduler.py3
2 files changed, 8 insertions, 5 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py
index 5bfaad796..f685f6991 100644
--- a/bot/cogs/moderation/infractions.py
+++ b/bot/cogs/moderation/infractions.py
@@ -226,7 +226,10 @@ class Infractions(InfractionScheduler, commands.Cog):
self.mod_log.ignore(Event.member_remove, user.id)
- action = user.kick(reason=textwrap.shorten(reason, width=512, placeholder="..."))
+ if reason:
+ reason = textwrap.shorten(reason, width=512, placeholder="...")
+
+ action = user.kick(reason=reason)
await self.apply_infraction(ctx, infraction, user, action)
@respect_role_hierarchy()
@@ -259,9 +262,10 @@ class Infractions(InfractionScheduler, commands.Cog):
self.mod_log.ignore(Event.member_remove, user.id)
- truncated_reason = textwrap.shorten(reason, width=512, placeholder="...")
+ if reason:
+ reason = textwrap.shorten(reason, width=512, placeholder="...")
- action = ctx.guild.ban(user, reason=truncated_reason, delete_message_days=0)
+ action = ctx.guild.ban(user, reason=reason, delete_message_days=0)
await self.apply_infraction(ctx, infraction, user, action)
if infraction.get('expires_at') is not None:
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py
index b03d89537..beb201b8c 100644
--- a/bot/cogs/moderation/scheduler.py
+++ b/bot/cogs/moderation/scheduler.py
@@ -127,11 +127,10 @@ class InfractionScheduler(Scheduler):
dm_result = ":incoming_envelope: "
dm_log_text = "\nDM: Sent"
- if infraction["actor"] == self.bot.user.id:
+ if reason and infraction["actor"] == self.bot.user.id:
log.trace(
f"Infraction #{id_} actor is bot; including the reason in the confirmation message."
)
-
end_msg = f" (reason: {textwrap.shorten(reason, width=1500, placeholder='...')})"
elif ctx.channel.id not in STAFF_CHANNELS:
log.trace(