From 1ca3ad6237576e4f7daf32a0482c2d0e78749476 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Tue, 31 Jul 2018 11:56:43 +0200 Subject: [PATCH] Forgot about thread_type in new methods. Added it! --- fbchat/client.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fbchat/client.py b/fbchat/client.py index 9ddcf63..e033dae 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1781,7 +1781,8 @@ class Client(object): if fetch_data.get("__typename") == "ThreadImageMessage": # Thread image change image_id = fetch_data["image_with_metadata"]["legacy_attachment_id"] - self.onImageChange(mid=mid, author_id=author_id, new_image=image_id, thread_id=thread_id, ts=ts) + self.onImageChange(mid=mid, author_id=author_id, new_image=image_id, thread_id=thread_id, + thread_type=ThreadType.GROUP, ts=ts) # Nickname change elif delta_type == "change_thread_nickname": @@ -1794,24 +1795,24 @@ class Client(object): # Admin added to group thread elif delta.get("class") == "AdminAddedToGroupThread": - thread_id = str(metadata['threadKey']['threadFbId']) + thread_id, thread_type = getThreadIdAndThreadType(metadata) added_ids = [str(x['userFbId']) for x in delta['addedAdmins']] self.onAdminsAdded(mid=mid, added_ids=added_ids, author_id=author_id, thread_id=thread_id, - ts=ts, msg=m) + thread_type=thread_type, ts=ts, msg=m) # Admin removed from group thread elif delta.get("class") == "AdminRemovedFromGroupThread": - thread_id = str(metadata['threadKey']['threadFbId']) + thread_id, thread_type = getThreadIdAndThreadType(metadata) removed_ids = delta['removedAdminFbIds'] self.onAdminsRemoved(mid=mid, removed_ids=removed_ids, author_id=author_id, thread_id=thread_id, - ts=ts, msg=m) + thread_type=thread_type, ts=ts, msg=m) # Group approval mode change elif delta_type == "change_thread_approval_mode": - thread_id = str(metadata['threadKey']['threadFbId']) + thread_id, thread_type = getThreadIdAndThreadType(metadata) approval_mode = bool(int(delta['untypedData']['APPROVAL_MODE'])) self.onApprovalModeChange(mid=mid, approval_mode=approval_mode, author_id=author_id, thread_id=thread_id, - ts=ts, msg=m) + thread_type=thread_type, ts=ts, msg=m) # Message delivered elif delta.get("class") == "DeliveryReceipt":