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

Update update object.

This commit is contained in:
eternnoir 2016-01-04 22:29:04 +08:00
parent b5680a1c1f
commit 7eeda3bc4d

View File

@ -87,12 +87,21 @@ class Update(JsonDeserializable):
def de_json(cls, json_type): def de_json(cls, json_type):
obj = cls.check_json(json_type) obj = cls.check_json(json_type)
update_id = obj['update_id'] update_id = obj['update_id']
message = None
inline_query = None
# TODO chosen_inline_result
chosen_inline_result = None
if 'message' in obj:
message = Message.de_json(obj['message']) message = Message.de_json(obj['message'])
return cls(update_id, 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.update_id = update_id
self.message = message self.message = message
self.inline_query = inline_query
self.chosen_inline_result = chosen_inline_result
class User(JsonDeserializable): class User(JsonDeserializable):