diff options
| -rw-r--r-- | bot/exts/moderation/voice_gate.py | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index 8b68b8e2d..f158c2906 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -1,3 +1,4 @@ +import asyncio  import logging  from contextlib import suppress  from datetime import datetime, timedelta @@ -50,9 +51,6 @@ class VoiceGate(Cog):          - You must have accepted our rules over a certain number of days ago          - You must not be actively banned from using our voice channels          """ -        # Send this as first thing in order to return after sending DM -        await ctx.send(f"{ctx.author.mention}, check your DMs.") -          try:              data = await self.bot.api_client.get(f"bot/users/{ctx.author.id}/metricity_data")          except ResponseCodeError as e: @@ -104,12 +102,12 @@ class VoiceGate(Cog):              )              try:                  await ctx.author.send(embed=embed) +                await ctx.send(f"{ctx.author}, please check your DMs.")              except discord.Forbidden:                  await ctx.channel.send(ctx.author.mention, embed=embed)              return          self.mod_log.ignore(Event.member_update, ctx.author.id) -        await ctx.author.add_roles(discord.Object(Roles.voice_verified), reason="Voice Gate passed")          embed = discord.Embed(              title="Voice gate passed",              description="You have been granted permission to use voice channels in Python Discord.", @@ -117,8 +115,14 @@ class VoiceGate(Cog):          )          try:              await ctx.author.send(embed=embed) +            await ctx.send(f"{ctx.author}, please check your DMs.")          except discord.Forbidden:              await ctx.channel.send(ctx.author.mention, embed=embed) + +        # wait a little bit so those who don't get DMs see the response in-channel before losing perms to see it. +        await asyncio.sleep(3) +        await ctx.author.add_roles(discord.Object(Roles.voice_verified), reason="Voice Gate passed") +          self.bot.stats.incr("voice_gate.passed")      @Cog.listener() | 
