Created
July 27, 2020 08:29
-
-
Save varunngoyal/d5835aea6c80a4c83a6c7a8d2c362162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class df_rich_responses(): | |
def __init__(self): | |
self.abc = "abc" | |
def fulfillment_messages(self, message, responses): | |
return { | |
"fulfillmentMessages": [ | |
{ | |
"text": { | |
"text": [ | |
message | |
] | |
} | |
}, | |
{ | |
"payload": { | |
"richContent": responses | |
} | |
} | |
] | |
} | |
def list_response(self, country_list): | |
buttonsList = [] | |
for country in country_list[:-1]: | |
buttonsList.append({ | |
"type": "list", | |
"title": country, | |
"subtitle": country, | |
"event": { | |
"name": "country_click", | |
"languageCode": "", | |
"parameters": { | |
"geo-country": country | |
} | |
} | |
}) | |
buttonsList.append({ | |
"type": "divider" | |
}) | |
buttonsList.append({ | |
"type": "list", | |
"title": country_list[-1:][0], | |
"subtitle": country_list[-1:][0], | |
"event": { | |
"name": "view_more_after", | |
"languageCode": "", | |
"parameters": { | |
"geo-country": country | |
} | |
} | |
}) | |
return buttonsList | |
def image_response(self, name, url): | |
return [ | |
[ | |
{ | |
"type": "image", | |
"rawUrl": url, | |
"accessibilityText": name | |
} | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment