Sending new quick replies
This commit is contained in:
@@ -1048,13 +1048,15 @@ class Client(object):
|
||||
if message.quick_replies:
|
||||
xmd = {"quick_replies": []}
|
||||
for quick_reply in message.quick_replies:
|
||||
xmd["quick_replies"].append({
|
||||
"content_type": "text",
|
||||
"title": quick_reply.title,
|
||||
"payload": quick_reply.payload,
|
||||
"image_url": quick_reply.image_url,
|
||||
"data": quick_reply.data,
|
||||
})
|
||||
q = dict()
|
||||
q["content_type"] = quick_reply.type.value.lower()
|
||||
q["payload"] = quick_reply.payload
|
||||
q["data"] = quick_reply.data
|
||||
if isinstance(quick_reply, QuickReplyText): q["title"] = quick_reply.title
|
||||
if not isinstance(quick_reply, QuickReplyLocation): q["image_url"] = quick_reply.image_url
|
||||
xmd["quick_replies"].append(q)
|
||||
if len(message.quick_replies) == 1 and message.quick_replies[0].is_response:
|
||||
xmd["quick_replies"] = xmd["quick_replies"][0]
|
||||
data['platform_xmd'] = json.dumps(xmd)
|
||||
|
||||
return data
|
||||
|
@@ -482,7 +482,7 @@ class QuickReplyText(QuickReply):
|
||||
class QuickReplyLocation(QuickReply):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""Represents a location quick reply"""
|
||||
"""Represents a location quick reply (Doesn't work on mobile)"""
|
||||
super(QuickReplyLocation, self).__init__(_type=QuickReplyType.LOCATION, **kwargs)
|
||||
self.is_response = False
|
||||
|
||||
@@ -491,7 +491,7 @@ class QuickReplyPhoneNumber(QuickReply):
|
||||
image_url = None
|
||||
|
||||
def __init__(self, image_url=None, **kwargs):
|
||||
"""Represents a phone number quick reply"""
|
||||
"""Represents a phone number quick reply (Doesn't work on mobile)"""
|
||||
super(QuickReplyPhoneNumber, self).__init__(_type=QuickReplyType.PHONE_NUMBER, **kwargs)
|
||||
self.image_url = image_url
|
||||
|
||||
@@ -500,7 +500,7 @@ class QuickReplyEmail(QuickReply):
|
||||
image_url = None
|
||||
|
||||
def __init__(self, image_url=None, **kwargs):
|
||||
"""Represents an email quick reply"""
|
||||
"""Represents an email quick reply (Doesn't work on mobile)"""
|
||||
super(QuickReplyEmail, self).__init__(_type=QuickReplyType.EMAIL, **kwargs)
|
||||
self.image_url = image_url
|
||||
|
||||
|
Reference in New Issue
Block a user