Added DeletedMessage attachment
This commit is contained in:
@@ -131,7 +131,9 @@ def graphql_to_attachment(a):
|
||||
def graphql_to_extensible_attachment(a):
|
||||
story = a.get('story_attachment')
|
||||
if story:
|
||||
_type = story['target']['__typename']
|
||||
target = story.get('target')
|
||||
if target:
|
||||
_type = target['__typename']
|
||||
if _type == 'MessageLocation':
|
||||
latitude, longitude = get_url_parameter(get_url_parameter(story['url'], 'u'), 'where1').split(", ")
|
||||
rtn = LocationAttachment(
|
||||
@@ -171,7 +173,11 @@ def graphql_to_extensible_attachment(a):
|
||||
original_image_url=(get_url_parameter(story['media']['image']['uri'], 'url') if "/safe_image.php" in story['media']['image']['uri'] else story['media']['image']['uri']) if story.get('media') else None,
|
||||
image_width=story['media']['image']['width'] if story.get('media') else None,
|
||||
image_height=story['media']['image']['height'] if story.get('media') else None,
|
||||
attachments=[graphql_to_subattachment(attachment) for attachment in story.get('subattachments')]
|
||||
attachments=[graphql_to_subattachment(attachment) for attachment in story.get('subattachments')],
|
||||
)
|
||||
else:
|
||||
return DeletedMessage(
|
||||
uid=a.get('legacy_attachment_id'),
|
||||
)
|
||||
|
||||
|
||||
|
@@ -216,6 +216,12 @@ class Attachment(object):
|
||||
"""Represents a Facebook attachment"""
|
||||
self.uid = uid
|
||||
|
||||
class DeletedMessage(Attachment):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Represents a deleted message"""
|
||||
super(DeletedMessage, self).__init__(*args, **kwargs)
|
||||
|
||||
class Sticker(Attachment):
|
||||
#: The sticker-pack's ID
|
||||
pack = None
|
||||
|
Reference in New Issue
Block a user