From b50eb1bafb31aeee6cff6e7781ba5e7c7bfbbf1a Mon Sep 17 00:00:00 2001 From: EskiSlav Date: Fri, 17 Jul 2020 13:43:45 +0300 Subject: [PATCH 1/2] Added nested entities from Bot API 4.5 --- telebot/types.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index cb98b9f..7660b80 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -479,8 +479,11 @@ class Message(JsonDeserializable): "pre" : "
{text}
", "code" : "{text}", #"url" : "{text}", # @badiboy plain URLs have no text and do not need tags - "text_link": "{text}" - } + "text_link": "{text}", + "strikethrough": "{text}", + "underline": "{text}" + } + if hasattr(self, "custom_subs"): for key, value in self.custom_subs.items(): _subs[key] = value @@ -511,8 +514,7 @@ class Message(JsonDeserializable): html_text += func(utf16_text[offset * 2 : (offset + entity.length) * 2], entity.type, entity.url, entity.user) offset += entity.length else: - # TODO: process nested entities from Bot API 4.5 - # Now ignoring them + # For future entities pass if offset * 2 < len(utf16_text): html_text += func(utf16_text[offset * 2:]) From c533a52e39d1efd1cfd1752bec0d297e49dd17d3 Mon Sep 17 00:00:00 2001 From: EskiSlav Date: Sat, 18 Jul 2020 00:25:00 +0300 Subject: [PATCH 2/2] Restored necessary comment --- telebot/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index 7660b80..a622d29 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -514,7 +514,8 @@ class Message(JsonDeserializable): html_text += func(utf16_text[offset * 2 : (offset + entity.length) * 2], entity.type, entity.url, entity.user) offset += entity.length else: - # For future entities + # TODO: process nested entities from Bot API 4.5 + # Now ignoring them pass if offset * 2 < len(utf16_text): html_text += func(utf16_text[offset * 2:])