From dfc2d0652f7654cc6221fee9d6a2401b32ca4ea4 Mon Sep 17 00:00:00 2001 From: Blue Date: Mon, 18 Feb 2019 21:37:16 +0000 Subject: [PATCH] Make fetchUnread and fetchUnseen include group chats (#394) * Correct fetchUnread and fetchUnseen to include 1:1 chats and group chats --- fbchat/client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fbchat/client.py b/fbchat/client.py index 9818907..d8817c2 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1180,7 +1180,9 @@ class Client(object): self.req_url.UNREAD_THREADS, form, fix_request=True, as_json=True ) - return j["payload"]["unread_thread_fbids"][0]["other_user_fbids"] + payload = j["payload"]["unread_thread_fbids"][0] + + return payload["thread_fbids"] + payload["other_user_fbids"] def fetchUnseen(self): """ @@ -1194,7 +1196,9 @@ class Client(object): self.req_url.UNSEEN_THREADS, None, fix_request=True, as_json=True ) - return j["payload"]["unseen_thread_fbids"][0]["other_user_fbids"] + payload = j["payload"]["unseen_thread_fbids"][0] + + return payload["thread_fbids"] + payload["other_user_fbids"] def fetchImageUrl(self, image_id): """Fetches the url to the original image from an image attachment ID