Exemple #1
0
def create_quick_replay():
    """
    Building a quick reply floating window for messages.

        reference
        - `Common Message Property <https://developers.worksmobile.com/jp/document/100500807?lang=en>`_

    Check also: faq_bot/model/data.py
    :return: quick replay item
    """
    fmt0 = _("HR/Leave")
    action0 = make_i18n_postback_action("enquire_leave", "message", "HR/Leave",
                                        fmt0, "HR/Leave", fmt0)
    item0 = make_quick_reply_item(action0)

    fmt1 = _("Welfare/Work support")
    action1 = make_i18n_postback_action("enquire_welfare", "message",
                                        "Welfare/Work support", fmt1,
                                        "Welfare/Work support", fmt1)
    item1 = make_quick_reply_item(action1)

    fmt2 = _("Security")
    action2 = make_i18n_postback_action("enquire_security", "message",
                                        "Security", fmt2, "Security", fmt2)
    item2 = make_quick_reply_item(action2)

    return make_quick_reply([item0, item1, item2])
Exemple #2
0
def echo_display(message):
    """
    Generate messages that require user confirmation.

        reference
        - `Common Message Property <https://developers.worksmobile.com/jp/document/100500807?lang=en>`_

    Check also: faq_bot/model/data.py
    :param message: User input message.
    :return: Message to prompt users.
    """
    text = "Do you want to send the following as your question? \n\n" \
           "===\n{message}\n===".format(message=message)
    content = make_text(text)

    action0 = make_postback_action("send", label="Send", display_text="Send")
    item0 = make_quick_reply_item(action0)

    action1 = make_postback_action("modify",
                                   label="Modify",
                                   display_text="Modify")
    item1 = make_quick_reply_item(action1)

    action2 = make_postback_action("cancel",
                                   label="Cancel",
                                   display_text="Cancel")
    item2 = make_quick_reply_item(action2)

    quick_reply = make_quick_reply([item0, item1, item2])

    content["quickReply"] = quick_reply

    return content
Exemple #3
0
def create_quick_replay_item(callback,
                             locale,
                             label,
                             fmt_label=None,
                             text=None,
                             fmt_text=None):
    """
    Building a quick reply floating window for messages.
    Check also: faq_bot/model/data.py

        reference
        - `Common Message Property <https://developers.worksmobile.com/jp/document/100500807?lang=en>`_

    :param callback: callback string for the button.
    :return: quick replay item
    """

    if text is None:
        text = label
        if fmt_text is None and fmt_label is not None:
            fmt_text = fmt_label

    action = make_i18n_postback_action(callback, locale, label, fmt_label,
                                       text, fmt_text)

    item = make_quick_reply_item(action)
    return make_quick_reply([item])