diff options
| author | 2020-06-14 22:41:09 -0700 | |
|---|---|---|
| committer | 2020-06-14 22:41:09 -0700 | |
| commit | 08c96f9eb07a2a86e68fb0e0837b9d07c40dab5e (patch) | |
| tree | 371c2abb4b11fee3b0f95ff36760a079217e1227 | |
| parent | Check infraction reason isn't None before shortening it (diff) | |
Fix check for bot actor in infractions
The reason None check should be nested to avoid affecting the else/elif
statements that follow.
| -rw-r--r-- | bot/cogs/moderation/scheduler.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py index beb201b8c..d75a72ddb 100644 --- a/bot/cogs/moderation/scheduler.py +++ b/bot/cogs/moderation/scheduler.py @@ -127,17 +127,17 @@ class InfractionScheduler(Scheduler): dm_result = ":incoming_envelope: " dm_log_text = "\nDM: Sent" - if reason and infraction["actor"] == self.bot.user.id: + end_msg = "" + if 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='...')})" + if reason: + end_msg = f" (reason: {textwrap.shorten(reason, width=1500, placeholder='...')})" elif ctx.channel.id not in STAFF_CHANNELS: log.trace( f"Infraction #{id_} context is not in a staff channel; omitting infraction count." ) - - end_msg = "" else: log.trace(f"Fetching total infraction count for {user}.") |