From d3ab4fa8cafa0aeedb626d2067659d75c88a1b4f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 4 Oct 2020 19:19:58 +0200 Subject: Update go packages; remove db cache --- external/messenger.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'external') 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) -- cgit v1.2.3