From ab10879c06a46019644a69883fd4e652caa67069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=A5=D1=80?= =?UTF-8?q?=D0=B0=D0=BC=D0=BE=D0=B2?= Date: Mon, 13 Oct 2025 14:05:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= =?UTF-8?q?=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=BE=D0=B2=20=D1=81=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/action_reporter.py | 2 +- src/bad_words.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/action_reporter.py b/src/action_reporter.py index f737847..1614223 100644 --- a/src/action_reporter.py +++ b/src/action_reporter.py @@ -48,7 +48,7 @@ class ActionReporter: 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: # Получаем информацию о пользователе и администраторе diff --git a/src/bad_words.py b/src/bad_words.py index 6c2f739..b718e38 100644 --- a/src/bad_words.py +++ b/src/bad_words.py @@ -112,13 +112,17 @@ def contains_bad_word(text: str) -> bool: # Приводим к нижнему регистру для проверки 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: text_lower = text_lower.replace(exception, '') # Проверяем бранные слова - for bad_word in BAD_WORDS: + for bad_word in bad_words: if bad_word in text_lower: return True @@ -140,13 +144,17 @@ def get_bad_words_from_text(text: str) -> list: text_lower = text.lower() found_words = [] + # Получаем актуальные списки из кэша + bad_words = get_bad_words() + exceptions = get_exceptions() + # Проверяем исключения - for exception in EXCEPTIONS: + for exception in exceptions: if exception in text_lower: text_lower = text_lower.replace(exception, '') # Ищем бранные слова - for bad_word in BAD_WORDS: + for bad_word in bad_words: if bad_word in text_lower: found_words.append(bad_word)