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':
return AudioAttachment(
filename=a.get('filename'),
playable_url=a.get('playable_url'),
duration=a.get('playable_duration_in_ms')
url=a.get('playable_url'),
duration=a.get('playable_duration_in_ms'),
audio_type=a.get('audio_type')
)
elif _type == 'MessageFile':
return FileAttachment(

View File

@@ -268,18 +268,18 @@ class FileAttachment(Attachment):
self.is_malicious = is_malicious
class AudioAttachment(Attachment):
# Name of the file
#: Name of the file
filename = None
# playable_url
playable_url = None
# duration
#: playable_url
url = None
#: Duration of the audioclip in milliseconds
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"""
super(AudioAttachment, self).__init__(**kwargs)
self.filename = filename
self.playable_url = playable_url
self.url = url
self.duration = duration
class ImageAttachment(Attachment):