aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-10-18 10:04:36 +0300
committerGravatar ks129 <[email protected]>2020-10-18 10:04:36 +0300
commitb72963930a6d8d28c794c5973efbb83def39a281 (patch)
tree3c4b3513394cf404e058d599c4dba77c785a953e
parentUpdate tests to not automatically adding back verified after vban expire (diff)
Use embeds instead of normal messages and send to DM instead
Diffstat (limited to '')
-rw-r--r--bot/exts/moderation/voice_gate.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py
index bdf7857f0..4a7c66278 100644
--- a/bot/exts/moderation/voice_gate.py
+++ b/bot/exts/moderation/voice_gate.py
@@ -4,6 +4,7 @@ from datetime import datetime, timedelta
import discord
from dateutil import parser
+from discord import Colour
from discord.ext.commands import Cog, Context, command
from bot.api import ResponseCodeError
@@ -46,15 +47,28 @@ 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("Check your DMs for result.")
+
try:
data = await self.bot.api_client.get(f"bot/users/{ctx.author.id}/metricity_data")
except ResponseCodeError as e:
if e.status == 404:
- await ctx.send(f":x: {ctx.author.mention} Unable to find Metricity data about you.")
+ embed = discord.Embed(
+ title="Not found",
+ description=f"{ctx.author.mention} Unable to find Metricity data about you.",
+ color=Colour.red()
+ )
log.info(f"Unable to find Metricity data about {ctx.author} ({ctx.author.id})")
else:
- log.warning(f"Got response code {e.status} while trying to get {ctx.author.id} metricity data.")
- await ctx.send(":x: Got unexpected response from site. Please let us know about this.")
+ embed = discord.Embed(
+ title="Unexpected response",
+ description="Got unexpected response from site. Please let us know about this.",
+ color=Colour.red()
+ )
+ log.warning(f"Got response code {e.status} while trying to get {ctx.author.id} Metricity data.")
+
+ await ctx.author.send(embed=embed)
return
# Pre-parse this for better code style
@@ -85,19 +99,22 @@ class VoiceGate(Cog):
else:
reasons = failed_reasons[0]
- await ctx.send(
- FAILED_MESSAGE.format(
- user=ctx.author.mention,
- reasons=reasons
- )
+ embed = discord.Embed(
+ title="Voice Gate not passed",
+ description=FAILED_MESSAGE.format(user=ctx.author.mention, reasons=reasons),
+ color=Colour.red()
)
+ await ctx.author.send(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")
- await ctx.author.send(
- ":tada: Congratulations! You have been granted permission to use voice channels in Python Discord."
+ embed = discord.Embed(
+ title="Congratulations",
+ description="You have been granted permission to use voice channels in Python Discord.",
+ color=Colour.green()
)
+ await ctx.author.send(embed=embed)
self.bot.stats.incr("voice_gate.passed")
@Cog.listener()