diff --git a/post_parser.py b/post_parser.py index 9d3f2b0..1b53324 100644 --- a/post_parser.py +++ b/post_parser.py @@ -318,6 +318,10 @@ class PostParser: if re.search(r'(?i)\bдонат\w*\b', message_text): flags.append("donat") + # Check for t.me/boost links and add donat flag + if re.search(r'https?://(?:www\.)?t\.me/boost/', message_text): + flags.append("donat") + # Check if the post's reactions contain more clown emojis (🤡). if getattr(message, "reactions", None): for reaction in message.reactions.reactions: diff --git a/tests/test_post_parser_flags.py b/tests/test_post_parser_flags.py index 5d0edf7..a3aef7e 100644 --- a/tests/test_post_parser_flags.py +++ b/tests/test_post_parser_flags.py @@ -207,6 +207,11 @@ class TestPostParserExtractFlags(unittest.TestCase): message = self._create_mock_message(text="Support us via ДОНАТ.") self.assertIn("donat", self.parser._extract_flags(message)) + def test_flag_donat_with_boost_link(self): + """Test that t.me/boost/ links add donat flag.""" + message = self._create_mock_message(text="Support the channel: https://t.me/boost/channel_name") + self.assertIn("donat", self.parser._extract_flags(message)) + def test_flag_clown_reaction(self): message = self._create_mock_message(reactions_data=[("🤡", 35), ("👍", 10)]) self.assertIn("clown", self.parser._extract_flags(message))