logs: ok, but add ok words too

This commit is contained in:
Ave Ozkal 2019-02-27 11:19:12 +03:00
parent 7840c16172
commit e4bfd7daf9
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B

View file

@ -17,8 +17,9 @@ class Logs:
self.name_re = re.compile(r"[a-zA-Z0-9].*") self.name_re = re.compile(r"[a-zA-Z0-9].*")
self.clean_re = re.compile(r'[\W_]+', re.UNICODE) self.clean_re = re.compile(r'[\W_]+', re.UNICODE)
# All lower case, no spaces, nothing non-alphanumeric # All lower case, no spaces, nothing non-alphanumeric
self.susp_words = ["sxos", "reinx", "tinfoil", "dz", "goldleaf", self.susp_words = ["sx", "tx", "reinx", "tinfoil", "dz", "goldleaf",
"nsp", "xci"] "nsp", "xci", "nut", "doge", "cdnsp"]
self.ok_words = ["nspwn", "hblnsp"]
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()
@ -89,7 +90,8 @@ class Logs:
alert = True alert = True
for susp_word in self.susp_words: for susp_word in self.susp_words:
if susp_word in cleancont: if susp_word in cleancont and\
not any(ok_word in cleancont for ok_word in self.ok_words):
msg += f"\n- Contains suspicious word: `{susp_word}`" msg += f"\n- Contains suspicious word: `{susp_word}`"
alert = True alert = True