From a3514c3f9aeedb4baa65b0d47097ea6abbaab664 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Sun, 3 Mar 2019 22:39:06 +0300 Subject: [PATCH] logs: highlight bad words --- cogs/logs.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cogs/logs.py b/cogs/logs.py index 73b00a1..d121c79 100644 --- a/cogs/logs.py +++ b/cogs/logs.py @@ -23,6 +23,10 @@ class Logs(Cog): "goldleaf", "lithium", # title managers "nsp", "xci", # "backup" formats "nut", "doge", "cdnsp"] # cdn dlers/dumpers + susp_hellgex = "|".join([r"\W*".join(list(word)) for + word in self.susp_words]) + self.susp_hellgex = re.compile(susp_hellgex) + self.ok_words = ["nspwn", "hblnsp", "exefs"] @Cog.listener() @@ -158,8 +162,13 @@ class Logs(Cog): msg += f"\n\nJump: <{message.jump_url}>" spy_channel = self.bot.get_channel(config.spylog_channel) + # Bad Code :tm:, blame retr0id + message_clean = message.content.replace("*", "").replace("_", "") + regd = self.susp_hellgex.sub(lambda w: "**{}**".format(w.group(0)), + message_clean) + # Show a message embed - embed = discord.Embed(description=message.content) + embed = discord.Embed(description=regd) embed.set_author(name=message.author.display_name, icon_url=message.author.avatar_url)