From a5cb159d7d1ca82d91738111e4dbf8f5f58eaec1 Mon Sep 17 00:00:00 2001 From: gitCommitWiL <43019766+gitCommitWiL@users.noreply.github.com> Date: Tue, 7 Apr 2020 06:52:09 -0400 Subject: [PATCH] Made change so that sendUri works properly with Facebook profile pages Facebook profiles pages are treated differently from other urls --- fbchat/_client.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fbchat/_client.py b/fbchat/_client.py index a7edab79..b63dc19c 100644 --- a/fbchat/_client.py +++ b/fbchat/_client.py @@ -1091,23 +1091,25 @@ def sendUri(self, uri, message=None, thread_id=None, thread_type=ThreadType.USER data["action_type"] = "ma-type:user-generated-message" data["shareable_attachment[share_type]"] = urlData["share_type"] # most uri params will come back as dict - if isinstance(urlData['share_params'], dict): + if isinstance(urlData["share_params"], dict): data["has_attachment"] = True for key in urlData["share_params"]: if isinstance(urlData["share_params"][key], dict): for key2 in urlData["share_params"][key]: data[ - "shareable_attachment[share_params][{}][{}]".format(key, key2) + "shareable_attachment[share_params][{}][{}]".format( + key, key2 + ) ] = urlData["share_params"][key][key2] else: - data["shareable_attachment[share_params][{}]".format(key)] = urlData[ - "share_params" - ][key] + data[ + "shareable_attachment[share_params][{}]".format(key) + ] = urlData["share_params"][key] # some (such as facebook profile pages) will just be a list else: data["has_attachment"] = False - for index, val in enumerate(urlData['share_params']): - data['shareable_attachment[share_params][{}]'.format(index)] = val + for index, val in enumerate(urlData["share_params"]): + data["shareable_attachment[share_params][{}]".format(index)] = val return self._doSendRequest(data) def sendEmoji(