diff options
author | 2020-10-11 12:52:12 +0300 | |
---|---|---|
committer | 2020-10-11 12:52:12 +0300 | |
commit | 002c53cb922f826c33c58fe35afccee24d5b2689 (patch) | |
tree | 6ee03d21ecad80744a8f3051c8f95510c04f4feb | |
parent | Suppress Voice Gate cog InWhiteListCheckFailure (diff) |
Improve voice gate messages deletion
-rw-r--r-- | bot/exts/moderation/voice_gate.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index 101db90b8..bd2afb464 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -105,6 +105,9 @@ class VoiceGate(Cog): if message.channel.id != Channels.voice_gate: return + ctx = await self.bot.get_context(message) + is_verify_command = ctx.command is not None and ctx.command.name == "voice_verify" + # When it's bot sent message, delete it after some time if message.author.bot: with suppress(discord.NotFound): @@ -112,11 +115,14 @@ class VoiceGate(Cog): return # Then check is member moderator+, because we don't want to delete their messages. - if any(role.id in MODERATION_ROLES for role in message.author.roles): + if any(role.id in MODERATION_ROLES for role in message.author.roles) and is_verify_command == False: log.trace(f"Excluding moderator message {message.id} from deletion in #{message.channel}.") return - self.mod_log.ignore(Event.message_delete, message.id) + # Ignore deleted voice verification messages + if ctx.command is not None and ctx.command.name == "voice_verify": + self.mod_log.ignore(Event.message_delete, message.id) + with suppress(discord.NotFound): await message.delete() |