From 108e4264fc36a8b873fc0d6285b3c12070e78d95 Mon Sep 17 00:00:00 2001 From: Leandro Toledo Date: Mon, 23 May 2016 20:31:36 -0300 Subject: [PATCH] Add user to MessageEntity #302 --- telegram/messageentity.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/telegram/messageentity.py b/telegram/messageentity.py index cfa309a18..1eb87180b 100644 --- a/telegram/messageentity.py +++ b/telegram/messageentity.py @@ -18,7 +18,7 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains a object that represents a Telegram MessageEntity.""" -from telegram import TelegramObject +from telegram import User, TelegramObject class MessageEntity(TelegramObject): @@ -31,6 +31,7 @@ class MessageEntity(TelegramObject): offset (int): length (int): url (Optional[str]): + user (Optional[:class:`telegram.User`]): """ def __init__(self, type, offset, length, **kwargs): @@ -40,11 +41,14 @@ class MessageEntity(TelegramObject): self.length = length # Optionals self.url = kwargs.get('url') + self.user = kwargs.get('user') @staticmethod def de_json(data): data = super(MessageEntity, MessageEntity).de_json(data) + data['user'] = User.de_json(data.get('user')) + return MessageEntity(**data) @staticmethod