From fb1052824ce999e2cba72125c52916793f1e460a Mon Sep 17 00:00:00 2001 From: Kondra007 Date: Sat, 7 May 2016 20:24:16 +0300 Subject: [PATCH] Added 06.05.16 updates * Added the field emoji to the Sticker object. Your bot can now know the emoji a sticker corresponds to. * Added the field forwarded_from_chat to the Message object for messages forwarded from channels. --- telebot/types.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 665326f..2ef11b5 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -170,6 +170,8 @@ class Message(JsonDeserializable): opts = {} if 'forward_from' in obj: opts['forward_from'] = User.de_json(obj['forward_from']) + if 'forward_from_chat' in obj: + opts['forward_from_chat'] = Chat.de_json(obj['forward_from_chat']) if 'forward_date' in obj: opts['forward_date'] = obj['forward_date'] if 'reply_to_message' in obj: @@ -261,6 +263,7 @@ class Message(JsonDeserializable): self.from_user = from_user self.date = date self.chat = chat + self.forward_from_chat = None self.forward_from = None self.forward_date = None self.reply_to_message = None @@ -394,14 +397,16 @@ class Sticker(JsonDeserializable): thumb = None if 'thumb' in obj: thumb = PhotoSize.de_json(obj['thumb']) + emoji = obj.get('emoji') file_size = obj.get('file_size') - return cls(file_id, width, height, thumb, file_size) + return cls(file_id, width, height, thumb, emoji, file_size) - def __init__(self, file_id, width, height, thumb, file_size=None): + def __init__(self, file_id, width, height, thumb, emoji=None, file_size=None): self.file_id = file_id self.width = width self.height = height self.thumb = thumb + self.emoji = emoji self.file_size = file_size