Beispiel #1
0
def to_first(account_id, __, ___):
    process_flag = True
    status, __, type, message = get_user_status(account_id)
    if status is not None:
        clean_user_status(account_id)
        process_flag = False

    if process_flag:
        fmt = _(
            "Cannot be selected since you are currently in Initial Menu. \n\n"
            "Select it if you want to find FAQ or go back to Initial Menu "
            "while the person in charge is checking your question.")
        content = make_i18n_text(
            "Cannot be selected since you are currently "
            "in Initial Menu. \n\n"
            "Select it if you want to find FAQ or go back to "
            "Initial Menu while the person in charge is "
            "checking your question.", "to_first", fmt)
    else:
        fmt = _(
            "Moved to FAQ Initial Menu.\n\nPlease select an item from the menu below."
        )
        content = make_i18n_text(
            "Moved to FAQ Initial Menu.\n\nPlease select an item from the menu below.",
            "to_first", fmt)

    yield push_message(account_id, content)
Beispiel #2
0
def enquire(account_id, __, ___):
    """
    This function handles the user's selection of ask a person

    :param account_id: user account id.
    """
    content = make_text("Select a task related to your question.")

    content["quickReply"] = create_quick_replay()

    yield push_message(account_id, content)
Beispiel #3
0
def to_first(account_id, __, ___):
    process_flag = False
    if process_flag:
        content = make_text("Cannot be selected since you are currently "
                            "in Initial Menu. \n\n"
                            "Select it if you want to find FAQ or go back to "
                            "Initial Menu while the person in charge is "
                            "checking your question.")
    else:
        content = make_text("Moved to FAQ Initial Menu.")

    yield push_message(account_id, content)
Beispiel #4
0
def enquire(account_id, __, ___):
    """
    This function handles the user's selection of ask a person

    :param account_id: user account id.
    """
    set_replace_user_info(account_id, "none", "doing", "none")
    fmt = _("Select a task related to your question.")
    content = make_i18n_text("Select a task related to your question.",
                             "enquire", fmt)

    content["quickReply"] = create_quick_replay()

    yield push_message(account_id, content)
Beispiel #5
0
def deal_message(account_id, __, message):
    """
    Process messages manually entered by the user.

    :param account_id: user account id.
    :param message: user input message.
    """
    status, _, __, ___  = get_user_status(account_id)
    if status != "wait_in":
        raise HTTPError(403, "Messages not need to be processed")

    content = echo_display(message)
    set_user_status(account_id, status="done", message=message)

    yield push_message(account_id, content)
Beispiel #6
0
def cancel(account_id, __, ___):
    """
    This function handles user cancellation inquiry.

    :param account_id: user account id.
    """
    status, _, __, ___ = get_user_status(account_id)
    if status != "done":
        # todo add error prompt
        raise HTTPError(500, "user status error. status error")

    content = make_text("You have canceled your question. "
                        "Please re-select the task from the menu below.")
    clean_user_status(account_id)
    yield push_message(account_id, content)
Beispiel #7
0
def modify(account_id, __, ___):
    """
    This function handles the user's modification of the question

    :param account_id: user account id.
    """
    status, __, ___, ____ = get_user_status(account_id)
    if status != "done":
        raise HTTPError(500, "user status error. status error")

    fmt = _("I’ll help you modify your question. "
            "Please write your question again.")
    content = make_i18n_text(
        "I’ll help you modify your question. Please write"
        " your question again.", "modify", fmt)

    yield asyncio.sleep(0.5)

    set_user_status(account_id, status='wait_in')

    yield push_message(account_id, content)