logs: Add do_nickcheck (unused rn)

This commit is contained in:
Ave Ozkal 2019-02-27 11:03:45 +03:00
parent 4a762bbafd
commit 62b57f4fdb
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B

View file

@ -14,6 +14,7 @@ class Logs:
self.bot = bot self.bot = bot
self.invite_re = re.compile(r"((discord\.gg|discordapp\.com/" self.invite_re = re.compile(r"((discord\.gg|discordapp\.com/"
r"+invite)/+[a-zA-Z0-9-]+)") r"+invite)/+[a-zA-Z0-9-]+)")
self.name_re = re.compile(r"[a-zA-Z0-9].*")
async def on_member_join(self, member): async def on_member_join(self, member):
await self.bot.wait_until_ready() await self.bot.wait_until_ready()
@ -85,6 +86,17 @@ class Logs:
spy_channel = self.bot.get_channel(config.spylog_channel) spy_channel = self.bot.get_channel(config.spylog_channel)
await spy_channel.send(msg) 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): async def on_message(self, message):
await self.bot.wait_until_ready() await self.bot.wait_until_ready()
if message.channel.id not in config.spy_channels: if message.channel.id not in config.spy_channels: