1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Added nested entities from Bot API 4.5

This commit is contained in:
EskiSlav 2020-07-17 13:43:45 +03:00
parent 40e19e5af1
commit b50eb1bafb

View File

@ -479,8 +479,11 @@ class Message(JsonDeserializable):
"pre" : "<pre>{text}</pre>", "pre" : "<pre>{text}</pre>",
"code" : "<code>{text}</code>", "code" : "<code>{text}</code>",
#"url" : "<a href=\"{url}\">{text}</a>", # @badiboy plain URLs have no text and do not need tags #"url" : "<a href=\"{url}\">{text}</a>", # @badiboy plain URLs have no text and do not need tags
"text_link": "<a href=\"{url}\">{text}</a>" "text_link": "<a href=\"{url}\">{text}</a>",
"strikethrough": "<s>{text}</s>",
"underline": "<u>{text}</u>"
} }
if hasattr(self, "custom_subs"): if hasattr(self, "custom_subs"):
for key, value in self.custom_subs.items(): for key, value in self.custom_subs.items():
_subs[key] = value _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) html_text += func(utf16_text[offset * 2 : (offset + entity.length) * 2], entity.type, entity.url, entity.user)
offset += entity.length offset += entity.length
else: else:
# TODO: process nested entities from Bot API 4.5 # For future entities
# Now ignoring them
pass pass
if offset * 2 < len(utf16_text): if offset * 2 < len(utf16_text):
html_text += func(utf16_text[offset * 2:]) html_text += func(utf16_text[offset * 2:])