forked from Muzifs/LGBot
исправление работы списков слов
This commit is contained in:
@@ -48,7 +48,7 @@ class ActionReporter:
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
# Отправляет лог действия в админ-чат
|
# Отправляет лог действия в админ-чат
|
||||||
async def log_action(self, action: str, user_id: int, admin_id: int, reason: str, duration: str, photo_path: str):
|
async def log_action(self, action: str, user_id: int, admin_id: int, reason: str, duration: str, photo_path: str = None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# Получаем информацию о пользователе и администраторе
|
# Получаем информацию о пользователе и администраторе
|
||||||
|
@@ -112,13 +112,17 @@ def contains_bad_word(text: str) -> bool:
|
|||||||
# Приводим к нижнему регистру для проверки
|
# Приводим к нижнему регистру для проверки
|
||||||
text_lower = text.lower()
|
text_lower = text.lower()
|
||||||
|
|
||||||
|
# Получаем актуальные списки из кэша
|
||||||
|
bad_words = get_bad_words()
|
||||||
|
exceptions = get_exceptions()
|
||||||
|
|
||||||
# Проверяем исключения
|
# Проверяем исключения
|
||||||
for exception in EXCEPTIONS:
|
for exception in exceptions:
|
||||||
if exception in text_lower:
|
if exception in text_lower:
|
||||||
text_lower = text_lower.replace(exception, '')
|
text_lower = text_lower.replace(exception, '')
|
||||||
|
|
||||||
# Проверяем бранные слова
|
# Проверяем бранные слова
|
||||||
for bad_word in BAD_WORDS:
|
for bad_word in bad_words:
|
||||||
if bad_word in text_lower:
|
if bad_word in text_lower:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -140,13 +144,17 @@ def get_bad_words_from_text(text: str) -> list:
|
|||||||
text_lower = text.lower()
|
text_lower = text.lower()
|
||||||
found_words = []
|
found_words = []
|
||||||
|
|
||||||
|
# Получаем актуальные списки из кэша
|
||||||
|
bad_words = get_bad_words()
|
||||||
|
exceptions = get_exceptions()
|
||||||
|
|
||||||
# Проверяем исключения
|
# Проверяем исключения
|
||||||
for exception in EXCEPTIONS:
|
for exception in exceptions:
|
||||||
if exception in text_lower:
|
if exception in text_lower:
|
||||||
text_lower = text_lower.replace(exception, '')
|
text_lower = text_lower.replace(exception, '')
|
||||||
|
|
||||||
# Ищем бранные слова
|
# Ищем бранные слова
|
||||||
for bad_word in BAD_WORDS:
|
for bad_word in bad_words:
|
||||||
if bad_word in text_lower:
|
if bad_word in text_lower:
|
||||||
found_words.append(bad_word)
|
found_words.append(bad_word)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user