python-telegram-bot/telegram/contact.py
2015-07-08 10:20:43 -03:00

21 lines
667 B
Python

#!/usr/bin/env python
class Contact(object):
def __init__(self, **kwargs):
param_defaults = {
'phone_number': None,
'first_name': None,
'last_name': None,
'user_id': None
}
for (param, default) in param_defaults.iteritems():
setattr(self, param, kwargs.get(param, default))
@staticmethod
def newFromJsonDict(data):
return Contact(phone_number=data.get('phone_number', None),
first_name=data.get('first_name', None),
last_name=data.get('last_name', None),
user_id=data.get('user_id', None))