diff --git a/src/helpers.py b/src/helpers.py index 72d8ced..8ebfedf 100644 --- a/src/helpers.py +++ b/src/helpers.py @@ -6,7 +6,9 @@ from urllib.request import urlopen from telebot import types -from .constants import SPAM, BAN_WORDS, NON_GRATA, ADMIN_ID, ONLY_RUS_LETTERS, ONLY_ENG_LETTERS, RULES_TEXT, SYMBOLS +from .constants import ( + SPAM, BAN_WORDS, NON_GRATA, ADMIN_ID, ONLY_RUS_LETTERS, ONLY_ENG_LETTERS, RULES_TEXT, SYMBOLS, URL_RX +) WARNS: dict[int, int] = {} @@ -145,4 +147,4 @@ def fetch_rule(index: int) -> str: def has_links(body: str) -> bool: - return "https://" in body or "http://" in body + return "https://" in body or "http://" in body or "t.me/" in body diff --git a/tests/test_helpers.py b/tests/test_helpers.py index cf45605..4d5eccb 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -186,6 +186,8 @@ class TestOthers(TestCase): params = ( (True, 'My bot https://t.me/bot.some'), (True, 'My bot http://t.me/bot.some'), + (True, 'My bot here https://t.me/bot.some '), + (True, 'My bot here t.me/+hENFI22TCQdkN2E'), (False, 'My bot here'), (False, 'I can use http'), )