From 2d5cb4fd75563556f6e57cc43dbdddae3a00e95a Mon Sep 17 00:00:00 2001 From: eternnoir Date: Sat, 5 Sep 2015 17:58:53 +0800 Subject: [PATCH] Add Update class. --- telebot/types.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/telebot/types.py b/telebot/types.py index 4c57034..37d84ea 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -78,6 +78,17 @@ class JsonDeserializable: return unicode(d) +class Update(JsonDeserializable): + @classmethod + def de_json(cls, json_type): + obj = cls.check_json(json_type) + update_id = obj['update_id'] + message = Message.de_json(obj['message']) + return Update(update_id, message) + + def __init__(self, update_id, message): + self.update_id = update_id + self.message = message class User(JsonDeserializable): @classmethod