Exemple #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)
Exemple #2
0
def send(account_id, __, ___):
    """
    This function processes the content of the user confirmation message

    :param account_id: user account.
    """
    status, __, type, message = get_user_status(account_id)
    if status != "done" or message is None:
        # todo add error prompt
        raise HTTPError(500, "user status error. status error")

    content = make_text(
        "Your question has been sent to the person in charge. \n\n"
        "The staff will answer your question as soon as possible.")

    content1 = make_text("If you have any additional questions, "
                        "please select the task from below. "
                        "If you want to go back to the initial stage, "
                        "select [Go to Initial Menu] from the menu below.")

    content1["quickReply"] = create_quick_replay()

    title = "{type} inquiry details".format(type=type)
    prompt_message = yield create_articles(title, message, account_id)
    if prompt_message is not None:
        yield push_messages(account_id, [prompt_message])
        return

    clean_user_status(account_id)
    yield push_messages(account_id, [content, content1])
Exemple #3
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)
def send(account_id, __, ___):
    """
    This function processes the content of the user confirmation message

    :param account_id: user account.
    """
    status, __, type, message = get_user_status(account_id)
    if status != "done" or message is None:
        # todo add error prompt
        raise HTTPError(500, "user status error. status error")

    fmt = _("Your question has been sent to the person in charge. \n\n"
            "The staff will answer your question as soon as possible.")
    content = make_i18n_text(
        "Your question has been sent to the person in charge. \n\n"
        "The staff will answer your question as soon as possible.", "send",
        fmt)

    fmt = _("If you have any additional questions, "
            "please select the task from below. "
            "If you want to go back to the initial stage, "
            "select [Go to Initial Menu] from the menu below.")
    content1 = make_i18n_text(
        "If you have any additional questions, "
        "please select the task from below. "
        "If you want to go back to the initial stage, "
        "select [Go to Initial Menu] from the menu below.", "send", fmt)

    content1["quickReply"] = create_quick_replay()
    name, department = yield get_account_info(account_id)
    fmt = _("{department} {name} made an inquiry.")
    title = get_i18n_content_by_lang(fmt,
                                     "send",
                                     DEFAULT_LANG,
                                     department=department,
                                     name=name)
    prompt_message = yield create_articles(title, type, message, account_id)
    if prompt_message is not None:
        yield push_messages(account_id, [prompt_message])
        return

    clean_user_status(account_id)
    yield push_messages(account_id, [content, content1])