python-telegram-bot/telegram/audio.py

22 lines
642 B
Python
Raw Normal View History

2015-07-08 01:52:57 +02:00
#!/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),
2015-07-08 02:12:51 +02:00
duration=data.get('duration', None),
mime_type=data.get('mime_type', None),
file_size=data.get('file_size', None))