This commit is contained in:
Steve Nian
2018-01-30 20:17:09 +08:00
parent a94fa5fbe3
commit 315242e069
2 changed files with 9 additions and 8 deletions

View File

@@ -112,8 +112,9 @@ def graphql_to_attachment(a):
elif _type == 'MessageAudio': elif _type == 'MessageAudio':
return AudioAttachment( return AudioAttachment(
filename=a.get('filename'), filename=a.get('filename'),
playable_url=a.get('playable_url'), url=a.get('playable_url'),
duration=a.get('playable_duration_in_ms') duration=a.get('playable_duration_in_ms'),
audio_type=a.get('audio_type')
) )
elif _type == 'MessageFile': elif _type == 'MessageFile':
return FileAttachment( return FileAttachment(

View File

@@ -268,18 +268,18 @@ class FileAttachment(Attachment):
self.is_malicious = is_malicious self.is_malicious = is_malicious
class AudioAttachment(Attachment): class AudioAttachment(Attachment):
# Name of the file #: Name of the file
filename = None filename = None
# playable_url #: playable_url
playable_url = None url = None
# duration #: Duration of the audioclip in milliseconds
duration = None duration = None
def __init__(self, filename=None, playable_url=None, duration=None, **kwargs): def __init__(self, filename=None, url=None, duration=None, **kwargs):
"""Represents an audio file that has been sent as a Facebook attachment""" """Represents an audio file that has been sent as a Facebook attachment"""
super(AudioAttachment, self).__init__(**kwargs) super(AudioAttachment, self).__init__(**kwargs)
self.filename = filename self.filename = filename
self.playable_url = playable_url self.url = url
self.duration = duration self.duration = duration
class ImageAttachment(Attachment): class ImageAttachment(Attachment):