diff options
author | 2021-07-15 15:40:03 -0700 | |
---|---|---|
committer | 2021-07-15 15:40:03 -0700 | |
commit | fa797cea8d8b5e2115e80802c0b4f4ef2d51609f (patch) | |
tree | e601356bcb508d9469ff3c4c6a0bce57ba3be221 | |
parent | Add command to resend infraction embed (diff) |
Fix superstarify reason displaying the incorrect nickname
Because the edit was happening before the reason string was formatted,
the edit updated the state of the user object, causing the nickname
to be the superstarified one rather than the one the user was attempting
to use.
-rw-r--r-- | bot/exts/moderation/infraction/superstarify.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/bot/exts/moderation/infraction/superstarify.py b/bot/exts/moderation/infraction/superstarify.py index 6dd9924ad..160c1ad19 100644 --- a/bot/exts/moderation/infraction/superstarify.py +++ b/bot/exts/moderation/infraction/superstarify.py @@ -60,6 +60,12 @@ class Superstarify(InfractionScheduler, Cog): if after.display_name == forced_nick: return # Nick change was triggered by this event. Ignore. + reason = ( + "You have tried to change your nickname on the **Python Discord** server " + f"from **{before.display_name}** to **{after.display_name}**, but as you " + "are currently in superstar-prison, you do not have permission to do so." + ) + log.info( f"{after.display_name} ({after.id}) tried to escape superstar prison. " f"Changing the nick back to {before.display_name}." @@ -69,17 +75,7 @@ class Superstarify(InfractionScheduler, Cog): reason=f"Superstarified member tried to escape the prison: {infraction['id']}" ) - notified = await _utils.notify_infraction( - infraction=infraction, - user=after, - reason=( - "You have tried to change your nickname on the **Python Discord** server " - f"from **{before.display_name}** to **{after.display_name}**, but as you " - "are currently in superstar-prison, you do not have permission to do so." - ), - ) - - if not notified: + if not await _utils.notify_infraction(infraction, after, reason): log.info("Failed to DM user about why they cannot change their nickname.") @Cog.listener() |