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

Fix video type class

This commit is contained in:
Sergio Gómez 2015-07-26 11:19:20 +02:00
parent 7b919852fa
commit 83ab8a39c9

View File

@ -162,6 +162,8 @@ class Message(JsonDeserializable):
if 'group_chat_created' in obj: if 'group_chat_created' in obj:
opts['group_chat_created'] = obj['group_chat_created'] opts['group_chat_created'] = obj['group_chat_created']
content_type = 'group_chat_created' content_type = 'group_chat_created'
if 'caption' in obj:
opts['caption'] = obj['caption']
return Message(message_id, from_user, date, chat, content_type, opts) return Message(message_id, from_user, date, chat, content_type, opts)
@classmethod @classmethod
@ -285,19 +287,18 @@ class Video(JsonDeserializable):
width = obj['width'] width = obj['width']
height = obj['height'] height = obj['height']
duration = obj['duration'] duration = obj['duration']
thumb = PhotoSize.de_json(obj['thumb']) thumb = None
caption = None
mime_type = None mime_type = None
file_size = None file_size = None
if 'caption' in obj: if 'thumb' in obj:
caption = obj['caption'] thumb = PhotoSize.de_json(obj['thumb'])
if 'mine_type' in obj: if 'mime_type' in obj:
mime_type = obj['mime_type'] mime_type = obj['mime_type']
if 'file_size' in obj: if 'file_size' in obj:
file_size = obj['file_size'] file_size = obj['file_size']
return Video(file_id, width, height, duration, thumb, mime_type, file_size, caption) return Video(file_id, width, height, duration, thumb, mime_type, file_size)
def __init__(self, file_id, width, height, duration, thumb, mime_type=None, file_size=None, caption=None): def __init__(self, file_id, width, height, duration, thumb=None, mime_type=None, file_size=None):
self.file_id = file_id self.file_id = file_id
self.width = width self.width = width
self.height = height self.height = height
@ -305,7 +306,6 @@ class Video(JsonDeserializable):
self.thumb = thumb self.thumb = thumb
self.mime_type = mime_type self.mime_type = mime_type
self.file_size = file_size self.file_size = file_size
self.caption = caption
class Contact(JsonDeserializable): class Contact(JsonDeserializable):