diff --git a/CHANGES/1782.bugfix.rst b/CHANGES/1782.bugfix.rst new file mode 100644 index 00000000..20ea6d5b --- /dev/null +++ b/CHANGES/1782.bugfix.rst @@ -0,0 +1 @@ +Fixed ``HtmlDecoration.custom_emoji()`` to use the correct ``emoji-id`` attribute name instead of ``emoji_id`` in the ```` tag, matching the Telegram Bot API specification. diff --git a/aiogram/utils/text_decorations.py b/aiogram/utils/text_decorations.py index b8edead2..c835c27b 100644 --- a/aiogram/utils/text_decorations.py +++ b/aiogram/utils/text_decorations.py @@ -265,7 +265,7 @@ class HtmlDecoration(TextDecoration): return html.escape(value, quote=False) def custom_emoji(self, value: str, custom_emoji_id: str) -> str: - return self._tag(self.EMOJI_TAG, value, attrs={"emoji_id": custom_emoji_id}) + return self._tag(self.EMOJI_TAG, value, attrs={"emoji-id": custom_emoji_id}) def blockquote(self, value: str) -> str: return self._tag(self.BLOCKQUOTE_TAG, value) diff --git a/tests/test_utils/test_formatting.py b/tests/test_utils/test_formatting.py index 8efc1598..25a81ba2 100644 --- a/tests/test_utils/test_formatting.py +++ b/tests/test_utils/test_formatting.py @@ -108,7 +108,7 @@ class TestNode: ], [ CustomEmoji("test", custom_emoji_id="42"), - 'test', + 'test', ], [ BlockQuote("test"), diff --git a/tests/test_utils/test_text_decorations.py b/tests/test_utils/test_text_decorations.py index 6325edb8..4ebd5f3a 100644 --- a/tests/test_utils/test_text_decorations.py +++ b/tests/test_utils/test_text_decorations.py @@ -59,7 +59,7 @@ class TestTextDecoration: [ html_decoration, MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"), - 'test', + 'test', ], [ html_decoration,