diff options
| author | 2019-12-11 00:51:28 -0800 | |
|---|---|---|
| committer | 2019-12-11 01:06:39 -0800 | |
| commit | 571608271a8d6198d11fdd7e79fb52243795e1b6 (patch) | |
| tree | 59d35d6f9d8f45d3b7c4d23c461fc1dabe0f5c3f | |
| parent | ModLog: make voice state event respect ignored channels (diff) | |
ModLog: exclude most channel attributes from voice state diff
| -rw-r--r-- | bot/cogs/moderation/modlog.py | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py index 00aba9872..3f42388b1 100644 --- a/bot/cogs/moderation/modlog.py +++ b/bot/cogs/moderation/modlog.py @@ -25,7 +25,7 @@ CHANNEL_CHANGES_SUPPRESSED = ("_overwrites", "position")  MEMBER_CHANGES_SUPPRESSED = ("status", "activities", "_client_status", "nick")  ROLE_CHANGES_UNSUPPORTED = ("colour", "permissions") -VOICE_STATE_ATTRIBUTES = {"self_video": "Broadcasting", "afk": "AFK"} +VOICE_STATE_ATTRIBUTES = {"self_video": "Broadcasting", "afk": "AFK", "channel.name": "Channel"}  class ModLog(Cog, name="ModLog"): @@ -769,7 +769,13 @@ class ModLog(Cog, name="ModLog"):              self._ignored[Event.voice_state_update].remove(member.id)              return -        diff = DeepDiff(before, after, exclude_paths="root.session_id") +        # Exclude all channel attributes except the name. +        diff = DeepDiff( +            before, +            after, +            exclude_paths="root.session_id", +            exclude_regex_paths=r"root\.channel\.(?!name)", +        )          # A type change seems to always take precedent over a value change. Furthermore, it will          # include the value change along with the type change anyway. Therefore, it's OK to | 
