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

Merge pull request #673 from TahaPY/master

Added Animation and is_animated for stickers
This commit is contained in:
Badiboy 2020-01-03 17:51:53 +03:00 committed by GitHub
commit 7adec8bd90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,6 +287,9 @@ class Message(JsonDeserializable):
if 'audio' in obj: if 'audio' in obj:
opts['audio'] = Audio.de_json(obj['audio']) opts['audio'] = Audio.de_json(obj['audio'])
content_type = 'audio' content_type = 'audio'
if 'animation' in obj:
opts['animation'] = Animation.de_json(obj['animation'])
content_type = 'animation'
if 'document' in obj: if 'document' in obj:
opts['document'] = Document.de_json(obj['document']) opts['document'] = Document.de_json(obj['document'])
content_type = 'document' content_type = 'document'
@ -425,6 +428,7 @@ class Message(JsonDeserializable):
self.contact = None self.contact = None
self.location = None self.location = None
self.venue = None self.venue = None
self.animation = None
self.new_chat_member = None self.new_chat_member = None
self.new_chat_members = None self.new_chat_members = None
self.left_chat_member = None self.left_chat_member = None
@ -2040,6 +2044,7 @@ class Sticker(JsonDeserializable):
file_id = obj['file_id'] file_id = obj['file_id']
width = obj['width'] width = obj['width']
height = obj['height'] height = obj['height']
is_animated = obj['is_animated']
thumb = None thumb = None
if 'thumb' in obj: if 'thumb' in obj:
thumb = PhotoSize.de_json(obj['thumb']) thumb = PhotoSize.de_json(obj['thumb'])
@ -2049,9 +2054,9 @@ class Sticker(JsonDeserializable):
if 'mask_position' in obj: if 'mask_position' in obj:
mask_position = MaskPosition.de_json(obj['mask_position']) mask_position = MaskPosition.de_json(obj['mask_position'])
file_size = obj.get('file_size') file_size = obj.get('file_size')
return cls(file_id, width, height, thumb, emoji, set_name, mask_position, file_size) return cls(file_id, width, height, thumb, emoji, set_name, mask_position, file_size, is_animated)
def __init__(self, file_id, width, height, thumb, emoji, set_name, mask_position, file_size): def __init__(self, file_id, width, height, thumb, emoji, set_name, mask_position, file_size, is_animated):
self.file_id = file_id self.file_id = file_id
self.width = width self.width = width
self.height = height self.height = height
@ -2060,7 +2065,7 @@ class Sticker(JsonDeserializable):
self.set_name = set_name self.set_name = set_name
self.mask_position = mask_position self.mask_position = mask_position
self.file_size = file_size self.file_size = file_size
self.is_animated = is_animated
class MaskPosition(JsonDeserializable, JsonSerializable): class MaskPosition(JsonDeserializable, JsonSerializable):
@classmethod @classmethod