From 62b57f4fdb35f80422a864c81777a3593e997749 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Wed, 27 Feb 2019 11:03:45 +0300 Subject: [PATCH] logs: Add do_nickcheck (unused rn) --- cogs/logs.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cogs/logs.py b/cogs/logs.py index b1f2a6c..d2af0b0 100644 --- a/cogs/logs.py +++ b/cogs/logs.py @@ -14,6 +14,7 @@ class Logs: self.bot = bot self.invite_re = re.compile(r"((discord\.gg|discordapp\.com/" r"+invite)/+[a-zA-Z0-9-]+)") + self.name_re = re.compile(r"[a-zA-Z0-9].*") async def on_member_join(self, member): await self.bot.wait_until_ready() @@ -85,6 +86,17 @@ class Logs: spy_channel = self.bot.get_channel(config.spylog_channel) await spy_channel.send(msg) + async def do_nickcheck(self, message): + compliant = self.name_re.fullmatch(message.author.display_name) + if compliant: + return + + msg = f"R11 violating name by {message.author.mention} "\ + f"({message.author.id})." + + spy_channel = self.bot.get_channel(config.spylog_channel) + await spy_channel.send(msg) + async def on_message(self, message): await self.bot.wait_until_ready() if message.channel.id not in config.spy_channels: