Sending new quick replies
This commit is contained in:
@@ -1048,13 +1048,15 @@ class Client(object):
|
|||||||
if message.quick_replies:
|
if message.quick_replies:
|
||||||
xmd = {"quick_replies": []}
|
xmd = {"quick_replies": []}
|
||||||
for quick_reply in message.quick_replies:
|
for quick_reply in message.quick_replies:
|
||||||
xmd["quick_replies"].append({
|
q = dict()
|
||||||
"content_type": "text",
|
q["content_type"] = quick_reply.type.value.lower()
|
||||||
"title": quick_reply.title,
|
q["payload"] = quick_reply.payload
|
||||||
"payload": quick_reply.payload,
|
q["data"] = quick_reply.data
|
||||||
"image_url": quick_reply.image_url,
|
if isinstance(quick_reply, QuickReplyText): q["title"] = quick_reply.title
|
||||||
"data": quick_reply.data,
|
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)
|
data['platform_xmd'] = json.dumps(xmd)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
@@ -482,7 +482,7 @@ class QuickReplyText(QuickReply):
|
|||||||
class QuickReplyLocation(QuickReply):
|
class QuickReplyLocation(QuickReply):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
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)
|
super(QuickReplyLocation, self).__init__(_type=QuickReplyType.LOCATION, **kwargs)
|
||||||
self.is_response = False
|
self.is_response = False
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ class QuickReplyPhoneNumber(QuickReply):
|
|||||||
image_url = None
|
image_url = None
|
||||||
|
|
||||||
def __init__(self, image_url=None, **kwargs):
|
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)
|
super(QuickReplyPhoneNumber, self).__init__(_type=QuickReplyType.PHONE_NUMBER, **kwargs)
|
||||||
self.image_url = image_url
|
self.image_url = image_url
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ class QuickReplyEmail(QuickReply):
|
|||||||
image_url = None
|
image_url = None
|
||||||
|
|
||||||
def __init__(self, image_url=None, **kwargs):
|
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)
|
super(QuickReplyEmail, self).__init__(_type=QuickReplyType.EMAIL, **kwargs)
|
||||||
self.image_url = image_url
|
self.image_url = image_url
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user