diff options
-rw-r--r-- | bot/exts/moderation/infraction/_scheduler.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py index 73403f10b..6f1af86d3 100644 --- a/bot/exts/moderation/infraction/_scheduler.py +++ b/bot/exts/moderation/infraction/_scheduler.py @@ -156,12 +156,15 @@ class InfractionScheduler: log_content = None failed = False - # DM the user about the infraction if it's a ban/kick and not a shadow/hidden infraction. + # DM the user about the infraction if it's not a shadow/hidden infraction. # This needs to happen before we apply the infraction, as the bot cannot # send DMs to user that it doesn't share a guild with. If we were to # apply kick/ban infractions first, this would mean that we'd make it # impossible for us to deliver a DM. See python-discord/bot#982. - if not infraction["hidden"] and infr_type in ("ban", "kick"): + if not infraction["hidden"]: + dm_result = f"{constants.Emojis.failmail} " + dm_log_text = "\nDM: **Failed**" + # Accordingly display whether the user was successfully notified via DM. if await _utils.notify_infraction(user, infr_type.replace("_", " ").title(), expiry, user_reason, icon): dm_result = ":incoming_envelope: " @@ -226,7 +229,6 @@ class InfractionScheduler: log.error(f"Deletion of {infr_type} infraction #{id_} failed with error code {e.status}.") infr_message = "" else: - log.info(f"Applied {purge}{infr_type} infraction #{id_} to {user}.") infr_message = f" **{purge}{' '.join(infr_type.split('_'))}** to {user.mention}{expiry_msg}{end_msg}" # If we need to DM and haven't already tried to @@ -261,6 +263,7 @@ class InfractionScheduler: footer=f"ID {infraction['id']}" ) + log.info(f"Applied {purge}{infr_type} infraction #{id_} to {user}.") return not failed async def pardon_infraction( |