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