1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

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.
This commit is contained in:
Kondra007 2016-05-07 20:24:16 +03:00
parent 769bb55bbe
commit fb1052824c

View File

@ -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