diff options
Diffstat (limited to 'external')
-rwxr-xr-x | external/messenger.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/external/messenger.py b/external/messenger.py index 3df1a5c..76ca90d 100755 --- a/external/messenger.py +++ b/external/messenger.py @@ -251,7 +251,7 @@ class MessengerBridge: self.my_user_id = self.getUserIdFromUid(self.client.uid) - threads = self.client.fetchThreadList() + threads = self.client.fetchThreadList(limit=10) # ensure we have a correct mapping for bridged user IDs to fb uids # (this should be fast) for thread in threads: @@ -478,7 +478,11 @@ class MessengerBridge: for at in message_object.attachments: if isinstance(at, ImageAttachment): - full_url = self.client.fetchImageUrl(at.uid) + try: + full_url = self.client.fetchImageUrl(at.uid) + except: + time.sleep(1) + full_url = self.client.fetchImageUrl(at.uid) event["attachments"].append({ "filename": full_url.split("?")[0].split("/")[-1], "url": full_url, @@ -499,6 +503,8 @@ class MessengerBridge: "filename": at.filename, "url": url, }) + elif isinstance(at, ShareAttachment): + event["text"] += "\n{}\n{}".format(at.description, at.url) else: event["text"] += "\nUnhandled attachment: {}".format(at) |