aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar TizzySaurus <[email protected]>2021-10-11 11:50:31 +0100
committerGravatar GitHub <[email protected]>2021-10-11 11:50:31 +0100
commit371869ad39628df306270ba16a76e96c6ccd3dad (patch)
treeb2e10289bcd4aec9f0d343cb7c00ee11748bbba8
parentRemove redundant `else` clauses (diff)
Only send DM before applying infraction for ban/kick
-rw-r--r--bot/exts/moderation/infraction/_scheduler.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py
index f6fa5a3c3..1bdfbb943 100644
--- a/bot/exts/moderation/infraction/_scheduler.py
+++ b/bot/exts/moderation/infraction/_scheduler.py
@@ -161,7 +161,7 @@ class InfractionScheduler:
# 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"]:
+ if not infraction["hidden"] and infr_type in {"ban", "kick"}:
dm_result = f"{constants.Emojis.failmail} "
dm_log_text = "\nDM: **Failed**"
@@ -229,7 +229,7 @@ class InfractionScheduler:
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
- if not infraction["hidden"] and infr_type not in ("ban", "kick"):
+ if not infraction["hidden"] and infr_type not in {"ban", "kick"}:
dm_result = f"{constants.Emojis.failmail} "
dm_log_text = "\nDM: **Failed**"