Fixed graphql and added method for replying on quick replies
This commit is contained in:
@@ -1130,6 +1130,19 @@ class Client(object):
|
|||||||
data['specific_to_list[0]'] = "fbid:{}".format(thread_id)
|
data['specific_to_list[0]'] = "fbid:{}".format(thread_id)
|
||||||
return self._doSendRequest(data)
|
return self._doSendRequest(data)
|
||||||
|
|
||||||
|
def quickReply(self, quick_reply, thread_id=None, thread_type=None):
|
||||||
|
"""
|
||||||
|
Replies to a chosen quick reply
|
||||||
|
|
||||||
|
:param thread_id: User/Group ID to send to. See :ref:`intro_threads`
|
||||||
|
:param thread_type: See :ref:`intro_threads`
|
||||||
|
:type thread_type: models.ThreadType
|
||||||
|
:return: :ref:`Message ID <intro_message_ids>` of the sent message
|
||||||
|
:raises: FBchatException if request failed
|
||||||
|
"""
|
||||||
|
quick_reply.is_response = True
|
||||||
|
return self.send(Message(text=quick_reply.title, quick_replies=[quick_reply]))
|
||||||
|
|
||||||
def _upload(self, files):
|
def _upload(self, files):
|
||||||
"""
|
"""
|
||||||
Uploads files to Facebook
|
Uploads files to Facebook
|
||||||
|
@@ -194,13 +194,21 @@ def graphql_to_plan(a):
|
|||||||
return rtn
|
return rtn
|
||||||
|
|
||||||
def graphql_to_quick_reply(q, is_response=False):
|
def graphql_to_quick_reply(q, is_response=False):
|
||||||
rtn = QuickReply(
|
data = dict()
|
||||||
title=q.get('title'),
|
if q.get('title') is not None: data["title"] = q["title"]
|
||||||
image_url=q.get('image_url'),
|
if q.get('image_url') is not None: data["image_url"] = q["image_url"]
|
||||||
payload=q.get('payload'),
|
if q.get('payload') is not None: data["payload"] = q["payload"]
|
||||||
data=q.get('data'),
|
if q.get('data') is not None: data["data"] = q["data"]
|
||||||
is_response=is_response,
|
data["is_response"] = is_response
|
||||||
)
|
_type = QuickReplyType(q.get('content_type').upper())
|
||||||
|
if _type == QuickReplyType.TEXT:
|
||||||
|
rtn = QuickReplyText(**data)
|
||||||
|
elif _type == QuickReplyType.LOCATION:
|
||||||
|
rtn = QuickReplyLocation(**data)
|
||||||
|
elif _type == QuickReplyType.PHONE_NUMBER:
|
||||||
|
rtn = QuickReplyPhoneNumber(**data)
|
||||||
|
elif _type == QuickReplyType.EMAIL:
|
||||||
|
rtn = QuickReplyEmail(**data)
|
||||||
return rtn
|
return rtn
|
||||||
|
|
||||||
def graphql_to_message(message):
|
def graphql_to_message(message):
|
||||||
|
Reference in New Issue
Block a user