diff options
-rw-r--r-- | bot/exts/moderation/infraction/infractions.py | 2 | ||||
-rw-r--r-- | bot/exts/moderation/voice_gate.py | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py index 71d873667..746d4e154 100644 --- a/bot/exts/moderation/infraction/infractions.py +++ b/bot/exts/moderation/infraction/infractions.py @@ -371,6 +371,8 @@ class Infractions(InfractionScheduler, commands.Cog): if reason: reason = textwrap.shorten(reason, width=512, placeholder="...") + await user.move_to(None, reason="Disconnected from voice to apply voiceban.") + action = user.remove_roles(self._voice_verified_role, reason=reason) await self.apply_infraction(ctx, infraction, user, action) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index 7cadca153..8b68b8e2d 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -102,7 +102,10 @@ class VoiceGate(Cog): description=FAILED_MESSAGE.format(reasons="\n".join(f'• You {reason}.' for reason in failed_reasons)), color=Colour.red() ) - await ctx.author.send(embed=embed) + try: + await ctx.author.send(embed=embed) + except discord.Forbidden: + await ctx.channel.send(ctx.author.mention, embed=embed) return self.mod_log.ignore(Event.member_update, ctx.author.id) @@ -112,7 +115,10 @@ class VoiceGate(Cog): description="You have been granted permission to use voice channels in Python Discord.", color=Colour.green() ) - await ctx.author.send(embed=embed) + try: + await ctx.author.send(embed=embed) + except discord.Forbidden: + await ctx.channel.send(ctx.author.mention, embed=embed) self.bot.stats.incr("voice_gate.passed") @Cog.listener() |