def send_pref_prompt(id): message = TextTemplate( text= "Whom do you want to chat with? We will notify when someone of the selected gender is waiting to chat." ).get_message() replies = [{ "title": "Men", "payload": json.dumps({ "keyword": "subscribe", "ans": "male" }) }, { "title": "Women", "payload": json.dumps({ "keyword": "subscribe", "ans": "female" }) }] message = add_quick_reply(message, title=replies[0]["title"], payload=replies[0]["payload"]) message = add_quick_reply(message, title=replies[1]["title"], payload=replies[1]["payload"]) send_message(message, id)
def send_newchat_prompt(id): payload = {"keyword": "newchat"} payload["ans"] = "y" message = TextTemplate(text="Are you ready to start a new chat").get_message() message = add_quick_reply(message=message, title="Oh! Yes!", payload=json.dumps(payload)) payload["ans"] = "n" message = add_quick_reply(message=message, title="No. Later", payload=json.dumps(payload)) payload["ans"] = "p" message = add_quick_reply(message=message, title="Edit Profile", payload=json.dumps(payload)) send_message(message, id)
def send_interest_menu(sender): out = {"keyword":"interest"} message = TextTemplate(text="Whom do you want to chat with?").get_message() out["interest"] = "male" message = add_quick_reply(message=message, title="Men", payload=json.dumps(out)) out["interest"] = "female" message = add_quick_reply(message=message, title="Women", payload=json.dumps(out)) out["interest"] = "random" message = add_quick_reply(message=message, title="Random", payload=json.dumps(out)) send_message(message, sender)
def send_subscription_prompt(id): message = TextTemplate( text="Subscribe to our notifications? We'll send out a message to you " + "when someone of your choice is looking for a partner to chat with. Sounds good?" ).get_message() replies = [{ "title": "Yes. Subscribe", "payload": json.dumps({ "keyword": "subscribe", "ans": "y" }) }, { "title": "No, thanks", "payload": json.dumps({ "keyword": "subscribe", "ans": "n" }) }, { "title": "Don't show this", "payload": json.dumps({ "keyword": "subscribe", "ans": "x" }) }] message = add_quick_reply(message, title=replies[0]["title"], payload=replies[0]["payload"]) message = add_quick_reply(message, title=replies[1]["title"], payload=replies[1]["payload"]) message = add_quick_reply(message, title=replies[2]["title"], payload=replies[2]["payload"]) send_message(message, id)