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)