mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-29 03:32:49 +01:00
25 lines
739 B
Python
25 lines
739 B
Python
#!/usr/bin/env python
|
|
|
|
|
|
class UserProfilePhotos(object):
|
|
def __init__(self, **kwargs):
|
|
param_defaults = {
|
|
'total_count': None,
|
|
'photos': None
|
|
}
|
|
|
|
for (param, default) in param_defaults.iteritems():
|
|
setattr(self, param, kwargs.get(param, default))
|
|
|
|
@staticmethod
|
|
def newFromJsonDict(data):
|
|
if 'photos' in data:
|
|
from telegram import PhotoSize
|
|
photos = []
|
|
for photo in data['photos']:
|
|
photos.append([PhotoSize.newFromJsonDict(x) for x in photo])
|
|
else:
|
|
photos = None
|
|
|
|
return UserProfilePhotos(total_count=data.get('total_count', None),
|
|
photos=photos)
|