Fix Message.text_*

Didn't work with URL type MessageEntities
(when you type a url in a tg client and tg converts it to a link for you)
This commit is contained in:
Jacob Bom 2017-06-24 00:12:55 +02:00 committed by Noam Meltzer
parent ebb2556176
commit cbafdc289f

View file

@ -673,6 +673,8 @@ class Message(TelegramObject):
if entity.type == MessageEntity.TEXT_LINK:
insert = '<a href="{}">{}</a>'.format(entity.url, text)
elif entity.type == MessageEntity.URL:
insert = '<a href="{0}">{0}</a>'.format(text)
elif entity.type == MessageEntity.BOLD:
insert = '<b>' + text + '</b>'
elif entity.type == MessageEntity.ITALIC:
@ -723,6 +725,8 @@ class Message(TelegramObject):
if entity.type == MessageEntity.TEXT_LINK:
insert = '[{}]({})'.format(text, entity.url)
elif entity.type == MessageEntity.URL:
insert = '[{0}]({0})'.format(text)
elif entity.type == MessageEntity.BOLD:
insert = '*' + text + '*'
elif entity.type == MessageEntity.ITALIC: