python-telegram-bot/telegram/audio.py
2015-07-07 21:12:51 -03:00

21 lines
642 B
Python

#!/usr/bin/env python
class Audio(object):
def __init__(self, **kwargs):
param_defaults = {
'file_id': None,
'duration': None,
'mime_type': None,
'file_size': None
}
for (param, default) in param_defaults.iteritems():
setattr(self, param, kwargs.get(param, default))
@staticmethod
def newFromJsonDict(data):
return Audio(file_id=data.get('file_id', None),
duration=data.get('duration', None),
mime_type=data.get('mime_type', None),
file_size=data.get('file_size', None))