diff --git a/CHANGES/1176.bugfix.rst b/CHANGES/1176.bugfix.rst new file mode 100644 index 00000000..57f67202 --- /dev/null +++ b/CHANGES/1176.bugfix.rst @@ -0,0 +1 @@ +Fixed the markdown spoiler parser. diff --git a/aiogram/utils/text_decorations.py b/aiogram/utils/text_decorations.py index 70f96388..97430a32 100644 --- a/aiogram/utils/text_decorations.py +++ b/aiogram/utils/text_decorations.py @@ -233,7 +233,7 @@ class MarkdownDecoration(TextDecoration): return f"~{value}~" def spoiler(self, value: str) -> str: - return f"|{value}|" + return f"||{value}||" def quote(self, value: str) -> str: return re.sub(pattern=self.MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=value) diff --git a/tests/test_utils/test_text_decorations.py b/tests/test_utils/test_text_decorations.py index 01fbabb6..056bd1cb 100644 --- a/tests/test_utils/test_text_decorations.py +++ b/tests/test_utils/test_text_decorations.py @@ -90,7 +90,7 @@ class TestTextDecoration: [markdown_decoration, MessageEntity(type="bot_command", offset=0, length=5), "test"], [markdown_decoration, MessageEntity(type="email", offset=0, length=5), "test"], [markdown_decoration, MessageEntity(type="phone_number", offset=0, length=5), "test"], - [markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "|test|"], + [markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "||test||"], [ markdown_decoration, MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"),