aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-10-08 21:43:55 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-10-08 21:43:55 +0200
commitaee8e1455395919a235195194d2a459e1d96ce71 (patch)
treed3bb4a61fb9884772c902149528f3f18d67ecb9f
parentMerge pull request #462 from python-discord/moderation-cleanup (diff)
Ensure display name changes are logged
https://github.com/python-discord/bot/issues/489 Recently, we discovered that not all display name changes were logged to the #user-log channel. This problem was caused by the `old_value` or the `new_value` showing up as `None` when a user sets or removes a guild-specific nickname. Since we ignore changes where one of the two values is `None`, we did not log these `None->nick` or `nick->None` events. Since we are mainly interested in the display name of the user, and the display name is equal to the user's guild-specific nickname if they have set one and otherwise their username, I made the following changes: - Add logging of changes in the display names of members. - Ignore nick-specific changes completely, since these changes are already captured by the changes in the display name we now log. This closes #489
-rw-r--r--bot/cogs/moderation/modlog.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py
index 86eab55de..92e9b0ef1 100644
--- a/bot/cogs/moderation/modlog.py
+++ b/bot/cogs/moderation/modlog.py
@@ -20,7 +20,7 @@ GUILD_CHANNEL = t.Union[discord.CategoryChannel, discord.TextChannel, discord.Vo
CHANNEL_CHANGES_UNSUPPORTED = ("permissions",)
CHANNEL_CHANGES_SUPPRESSED = ("_overwrites", "position")
-MEMBER_CHANGES_SUPPRESSED = ("status", "activities", "_client_status")
+MEMBER_CHANGES_SUPPRESSED = ("status", "activities", "_client_status", "nick")
ROLE_CHANGES_UNSUPPORTED = ("colour", "permissions")
@@ -498,6 +498,11 @@ class ModLog(Cog, name="ModLog"):
f"**Discriminator:** `{before.discriminator}` **->** `{after.discriminator}`"
)
+ if before.display_name != after.display_name:
+ changes.append(
+ f"**Display name:** `{before.display_name}` **->** `{after.display_name}`"
+ )
+
if not changes:
return