From 7eeda3bc4dfafbc2de2ed0995183aa5dced2fbb0 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Mon, 4 Jan 2016 22:29:04 +0800 Subject: [PATCH] Update update object. --- telebot/types.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 08d23a7..b076c79 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -87,12 +87,21 @@ class Update(JsonDeserializable): def de_json(cls, json_type): obj = cls.check_json(json_type) update_id = obj['update_id'] - message = Message.de_json(obj['message']) - return cls(update_id, message) + message = None + inline_query = None + # TODO chosen_inline_result + chosen_inline_result = None + if 'message' in obj: + message = Message.de_json(obj['message']) + if 'inline_query' in obj: + inline_query = InlineQuery.de_json(obj['inline_query']) + return cls(update_id, message, inline_query, chosen_inline_result) - def __init__(self, update_id, message): + def __init__(self, update_id, message, inline_query, chosen_inline_result): self.update_id = update_id self.message = message + self.inline_query = inline_query + self.chosen_inline_result = chosen_inline_result class User(JsonDeserializable):