|
|
@ -41,6 +41,8 @@ bot = telebot.TeleBot(db['token'])
|
|
|
|
|
|
|
|
|
|
|
|
from re import search, match, sub, compile
|
|
|
|
from re import search, match, sub, compile
|
|
|
|
def is_bad(word, bad, excepts):
|
|
|
|
def is_bad(word, bad, excepts):
|
|
|
|
|
|
|
|
#Replace spec.symbols
|
|
|
|
|
|
|
|
|
|
|
|
# Excepts
|
|
|
|
# Excepts
|
|
|
|
if word in excepts:
|
|
|
|
if word in excepts:
|
|
|
|
return False
|
|
|
|
return False
|
|
|
@ -53,14 +55,30 @@ def is_bad(word, bad, excepts):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### TRANSLIT an OTHER ######
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def rep(word):
|
|
|
|
|
|
|
|
rep = [['e','е'], ['a','а'], ['i','и'], ['t','т'], ['y','у'], ['u','у'], ['o','о'], ['d','д'], ['x','х'], ['t','т'], ['p','п'],
|
|
|
|
|
|
|
|
['r','р'], ['h','х'], ['b','б'], ['n','н'],
|
|
|
|
|
|
|
|
['🇽','х'], ['🇾','у'], ['🇹','т'], ['🇪','е'],
|
|
|
|
|
|
|
|
['❌','х'], ['✖','х'], ['❎','х'] ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in rep:
|
|
|
|
|
|
|
|
word = word.replace(i[0], i[1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(word)
|
|
|
|
|
|
|
|
return word
|
|
|
|
|
|
|
|
|
|
|
|
####### CATCH BAD WORDS ####
|
|
|
|
####### CATCH BAD WORDS ####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def catch(message):
|
|
|
|
def catch(message):
|
|
|
|
bad_list = ['х.+й', 'xуи', 'xyи', 'хyи', 'xyй', 'xуй', 'ху.', '.+хуё', 'xyu', 'xui', 'хyй', 'хй', 'поху',
|
|
|
|
bad_list = ['х.+й', 'xуи', 'xyи', 'хyи', 'xyй', 'xуй', 'ху.', '.+хуё', 'xyu', 'xui', 'хyй', 'поху', '.уй', 'ах.ен', 'а.уе',
|
|
|
|
'бл.+ть', 'бля', 'блят',
|
|
|
|
'бл.+ть', 'бля', 'бл.+т',
|
|
|
|
'бл+.дь',
|
|
|
|
'бл+.дь',
|
|
|
|
'трах', 'еб.+ть', 'ебу', 'ебал', '..ебен', 'ебан', 'ёбан', 'ебть', 'eby', '..ебись', 'уеб', 'уёб', 'ебей',
|
|
|
|
'трах', 'еб.+ть', 'ебу', 'ебал', '..ебен', 'ебан', 'ёбан', 'ебть', 'eby', '..ебись', 'уеб', 'уёб', 'ебей', 'ебу', 'ебл', 'еба',
|
|
|
|
|
|
|
|
'еб.+утые', 'е.+б.+утые', 'ебан', 'еб.+н', 'ебн', 'ёбн',
|
|
|
|
|
|
|
|
'пр..ба', '.б.л', 'у.б', '.блан',
|
|
|
|
'п.+зда', 'пиз.+ец', 'пизд', 'пизец', 'пздец', 'п.+здец', 'пизд',
|
|
|
|
'п.+зда', 'пиз.+ец', 'пизд', 'пизец', 'пздец', 'п.+здец', 'пизд',
|
|
|
|
'пид.+р', 'пидр',
|
|
|
|
'пид.+р', 'пидр',
|
|
|
|
'д.лб.+б',
|
|
|
|
'д.лб.+б',
|
|
|
@ -72,6 +90,8 @@ def catch(message):
|
|
|
|
|
|
|
|
|
|
|
|
bad_found = False
|
|
|
|
bad_found = False
|
|
|
|
for check in words:
|
|
|
|
for check in words:
|
|
|
|
|
|
|
|
# Mat -> Мат
|
|
|
|
|
|
|
|
check = rep(check)
|
|
|
|
# -М#ат$ => Мат
|
|
|
|
# -М#ат$ => Мат
|
|
|
|
regex = compile('[^a-zA-Zа-яА-ЯЁё]')
|
|
|
|
regex = compile('[^a-zA-Zа-яА-ЯЁё]')
|
|
|
|
check = regex.sub('', check)
|
|
|
|
check = regex.sub('', check)
|
|
|
@ -79,10 +99,23 @@ def catch(message):
|
|
|
|
break
|
|
|
|
break
|
|
|
|
for bad in bad_list:
|
|
|
|
for bad in bad_list:
|
|
|
|
if is_bad(check.lower(), bad, excepts) == True:
|
|
|
|
if is_bad(check.lower(), bad, excepts) == True:
|
|
|
|
print(bad)
|
|
|
|
#print(bad)
|
|
|
|
|
|
|
|
bad_found = True
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
if not bad_found:
|
|
|
|
|
|
|
|
for check in words:
|
|
|
|
|
|
|
|
check = rep(check)
|
|
|
|
|
|
|
|
regex = compile('[^a-zA-Zа-яА-ЯЁё]')
|
|
|
|
|
|
|
|
check = regex.sub('.', check)
|
|
|
|
|
|
|
|
if bad_found:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
for bad in bad_list:
|
|
|
|
|
|
|
|
if is_bad(check.lower(), bad, excepts) == True:
|
|
|
|
|
|
|
|
#print(bad)
|
|
|
|
bad_found = True
|
|
|
|
bad_found = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if bad_found:
|
|
|
|
if bad_found:
|
|
|
|
bot.delete_message(message.chat.id, message.id)
|
|
|
|
bot.delete_message(message.chat.id, message.id)
|
|
|
|
bot.send_message(message.chat.id, f'Пользователь {telebot.util.user_link(message.from_user)} использовал непечатное выражение.', parse_mode='HTML')
|
|
|
|
bot.send_message(message.chat.id, f'Пользователь {telebot.util.user_link(message.from_user)} использовал непечатное выражение.', parse_mode='HTML')
|
|
|
@ -96,7 +129,7 @@ def catch_edited_messages(message):
|
|
|
|
catch(message)
|
|
|
|
catch(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#'''
|
|
|
|
'''
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
bot.polling()
|
|
|
|
bot.polling()
|
|
|
@ -106,4 +139,4 @@ while True:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
bot.polling()
|
|
|
|
bot.polling()
|
|
|
|
'''
|
|
|
|
#'''
|
|
|
|