|
|
|
@ -40,14 +40,13 @@ bot = telebot.TeleBot(db['token'])
|
|
|
|
|
########## ALANYS WORD #####
|
|
|
|
|
|
|
|
|
|
from re import search, match, sub, compile
|
|
|
|
|
def is_bad(word, bad):
|
|
|
|
|
def is_bad(word, bad, excepts):
|
|
|
|
|
# Excepts
|
|
|
|
|
if word in excepts:
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
# Agressive mode, causes false positives
|
|
|
|
|
#res = search(bad, word)
|
|
|
|
|
|
|
|
|
|
# -М#ат$ => Мат
|
|
|
|
|
regex = compile('[^a-zA-Zа-яА-Я]')
|
|
|
|
|
word = regex.sub('', word)
|
|
|
|
|
|
|
|
|
|
res = match(bad, word)
|
|
|
|
|
if res is not None:
|
|
|
|
|
return True
|
|
|
|
@ -64,16 +63,22 @@ def catch(message):
|
|
|
|
|
'трах', 'еб.+ть', 'ебу', 'ебал', '..ебен', 'ебан', 'ёбан', 'ебть', 'eby', '..ебись', 'уеб', 'уёб', 'ебей',
|
|
|
|
|
'п.+зда', 'пиз.+ец', 'пизд', 'пизец', 'пздец', 'п.+здец', 'пизд',
|
|
|
|
|
'пид.+р', 'пидр',
|
|
|
|
|
'д.лб.+б',
|
|
|
|
|
'f.+ck', 's.+ck', 'fck', 'sck']
|
|
|
|
|
|
|
|
|
|
excepts = ['хороший']
|
|
|
|
|
|
|
|
|
|
words = message.text.split()
|
|
|
|
|
|
|
|
|
|
bad_found = False
|
|
|
|
|
for check in words:
|
|
|
|
|
# -М#ат$ => Мат
|
|
|
|
|
regex = compile('[^a-zA-Zа-яА-ЯЁё]')
|
|
|
|
|
check = regex.sub('', check)
|
|
|
|
|
if bad_found:
|
|
|
|
|
break
|
|
|
|
|
for bad in bad_list:
|
|
|
|
|
if is_bad(check.lower(), bad) == True:
|
|
|
|
|
if is_bad(check.lower(), bad, excepts) == True:
|
|
|
|
|
print(bad)
|
|
|
|
|
bad_found = True
|
|
|
|
|
break
|
|
|
|
|