From 83ab8a39c990cb2095393e07ae22b1cca7583c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Go=CC=81mez?= Date: Sun, 26 Jul 2015 11:19:20 +0200 Subject: [PATCH] Fix video type class --- telebot/types.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 34c61f7..0157901 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -162,6 +162,8 @@ class Message(JsonDeserializable): if 'group_chat_created' in obj: opts['group_chat_created'] = obj['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) @classmethod @@ -285,19 +287,18 @@ class Video(JsonDeserializable): width = obj['width'] height = obj['height'] duration = obj['duration'] - thumb = PhotoSize.de_json(obj['thumb']) - caption = None + thumb = None mime_type = None file_size = None - if 'caption' in obj: - caption = obj['caption'] - if 'mine_type' in obj: + if 'thumb' in obj: + thumb = PhotoSize.de_json(obj['thumb']) + if 'mime_type' in obj: mime_type = obj['mime_type'] if 'file_size' in obj: 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.width = width self.height = height @@ -305,7 +306,6 @@ class Video(JsonDeserializable): self.thumb = thumb self.mime_type = mime_type self.file_size = file_size - self.caption = caption class Contact(JsonDeserializable):