BUGFIX: fix is_mixed

- после сработки на русские кавычки - поменял логику, тепрь она такая: ЕСЛИ хоть одна буква русская И при этом есть хоть 1 английская буква -то смешение
This commit is contained in:
kotolex
2023-12-24 20:55:17 +05:00
parent cc1a37a86e
commit 2957edbeb0
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ from urllib.request import urlopen
from telebot import types
from .constants import SPAM, BAN_WORDS, NON_GRATA, ADMIN_ID, ONLY_RUS_LETTERS, RUS_LETTERS_AND_PUNCTUATION, RULES_TEXT
from .constants import SPAM, BAN_WORDS, NON_GRATA, ADMIN_ID, ONLY_RUS_LETTERS, ONLY_ENG_LETTERS, RULES_TEXT
def is_url_reachable(url: str) -> bool:
@@ -32,7 +32,7 @@ def is_mixed(text: str) -> bool:
"""
for word in text.split():
word = word.strip().lower()
if any(e in ONLY_RUS_LETTERS for e in word) and not all(e in RUS_LETTERS_AND_PUNCTUATION for e in word):
if any(e in ONLY_RUS_LETTERS for e in word) and any(e in ONLY_ENG_LETTERS for e in word):
return True
return False