aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-10-19 01:01:05 +0100
committerGravatar GitHub <[email protected]>2020-10-19 01:01:05 +0100
commitf0ba0c263e9c1114afbe03cd6d3758160018a2a8 (patch)
treece0ca8bab5ab38943f720c6e74b6912b38aa3e97
parentMerge pull request #1246 from python-discord/voice-gate-dm-failed (diff)
parentInstruct to reconnect to voice channel if connected on verification. (diff)
Merge pull request #1247 from python-discord/voice-gate-delay-grant
Ensure verified users can see verified message.
-rw-r--r--bot/exts/moderation/voice_gate.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py
index 8b68b8e2d..c2743e136 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
@@ -21,7 +22,7 @@ FAILED_MESSAGE = (
)
MESSAGE_FIELD_MAP = {
- "verified_at": f"have been verified for less {GateConf.minimum_days_verified} days",
+ "verified_at": f"have been verified for less than {GateConf.minimum_days_verified} days",
"voice_banned": "have an active voice ban infraction",
"total_messages": f"have sent less than {GateConf.minimum_messages} messages",
}
@@ -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,21 +102,31 @@ 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.",
color=Colour.green()
)
+
+ if ctx.author.voice:
+ embed.description += "\n\nPlease reconnect to your voice channel to be granted your new permissions."
+
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()