forked from Muzifs/LGBot
исправление работы списков слов
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user