mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 15:17:00 +01:00
23 lines
624 B
Python
23 lines
624 B
Python
#!/usr/bin/env python
|
|
|
|
|
|
class Update(object):
|
|
def __init__(self, **kwargs):
|
|
param_defaults = {
|
|
'update_id': None,
|
|
'message': None
|
|
}
|
|
|
|
for (param, default) in param_defaults.iteritems():
|
|
setattr(self, param, kwargs.get(param, default))
|
|
|
|
@staticmethod
|
|
def newFromJsonDict(data):
|
|
if 'message' in data:
|
|
from telegram import Message
|
|
message = Message.newFromJsonDict(data['message'])
|
|
else:
|
|
message = None
|
|
|
|
return Update(update_id=data.get('update_id', None),
|
|
message=message)
|