From cbafdc289fd33f5da1d5fe1ac621ed91bc8dd1ed Mon Sep 17 00:00:00 2001 From: Jacob Bom Date: Sat, 24 Jun 2017 00:12:55 +0200 Subject: [PATCH] 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) --- telegram/message.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telegram/message.py b/telegram/message.py index 86e895d14..d63b636d7 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -673,6 +673,8 @@ class Message(TelegramObject): if entity.type == MessageEntity.TEXT_LINK: insert = '{}'.format(entity.url, text) + elif entity.type == MessageEntity.URL: + insert = '{0}'.format(text) elif entity.type == MessageEntity.BOLD: insert = '' + text + '' 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: