From 8c20f6302294ccf0601e9f0f7ea1477fdd7f4003 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Mon, 23 May 2016 11:12:20 +0800 Subject: [PATCH] Add user to MessageEntity. --- telebot/types.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index d837cbd..d0b9b4e 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -311,13 +311,17 @@ class MessageEntity(JsonDeserializable): offset = obj['offset'] length = obj['length'] url = obj.get('url') - return cls(type, offset, length, url) + user = None + if 'user' in obj: + user = User.de_json(obj['user']) + return cls(type, offset, length, url, user) - def __init__(self, type, offset, length, url=None): + def __init__(self, type, offset, length, url=None, user=None): self.type = type self.offset = offset self.length = length self.url = url + self.user = user class PhotoSize(JsonDeserializable):