Merge remote-tracking branch 'origin/master'

This commit is contained in:
Rykov7
2024-01-28 10:24:23 +03:00
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -6,7 +6,9 @@ from urllib.request import urlopen
from telebot import types 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] = {} WARNS: dict[int, int] = {}
@@ -145,4 +147,4 @@ def fetch_rule(index: int) -> str:
def has_links(body: str) -> bool: 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
+2
View File
@@ -186,6 +186,8 @@ class TestOthers(TestCase):
params = ( params = (
(True, 'My bot https://t.me/bot.some'), (True, 'My bot https://t.me/bot.some'),
(True, 'My bot http://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, 'My bot here'),
(False, 'I can use http'), (False, 'I can use http'),
) )