コード例 #1
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])
コード例 #2
0
def transfer_message(account_id, callback, __):
    """
    This function prompts the user to go to ask someone.

    :param account_id: user account id.
    :param callback: Business type.
    """
    fmt = _("Your question will be directly delivered to the person "
            "in charge of {type} to answer your question directly.")
    content1 = make_i18n_text(
        "Your question will be directly delivered to "
        "the person in charge of {type} "
        "to answer your question directly.".format(type=TYPES[callback]),
        "transfer_message",
        fmt,
        type=callback)

    fmt1 = _(
        "Please tell me your question.\n\nOnly one message can be delivered. "
        "Please write your question at one go.")
    content2 = make_i18n_text(
        "Please tell me your question.\n\n"
        "Only one message can be delivered. "
        "Please write your question at one go.", "transfer_message", fmt1)

    yield asyncio.sleep(0.5)
    set_replace_user_info(account_id, 'wait_in', 'doing', callback)

    yield push_messages(account_id, [content1, content2])
コード例 #3
0
def enquire_message(account_id, callback, __):
    """
    This function prompts the user for a message.

    :param account_id: user account id.
    :param callback: Callback corresponding to business type.
    """

    fmt = _("You have selected {type}. Please tell me your question.")
    content1 = make_i18n_text(
        "You have selected {type}. "
        "Please tell me your question.".format(type=TYPES[callback]),
        "enquire_message",
        fmt,
        type=callback)

    fmt = _("Only one message can be delivered. "
            "Please write your question at one go.")
    content2 = make_i18n_text(
        "Only one message can be delivered. "
        "Please write your question at one go.", "enquire_message", fmt)

    yield asyncio.sleep(0.5)

    set_replace_user_info(account_id, 'wait_in', 'doing', callback)

    yield push_messages(account_id, [content1, content2])
コード例 #4
0
def query_security(account_id, __, ___):
    """
    This function deals with user query security related problems.

    :param account_id: user account id.
    """
    status, __, type, message = get_user_status(account_id)
    if status == "wait_in":
        set_user_status(account_id, status="none")

    fmt = _("Here are FAQs about security.")
    text = make_i18n_text("Here are FAQs about security.", "query_security", fmt)

    fmt = _("Send a question")
    replay = create_quick_replay_item("transfer_security", "query_security",
                                      "Send a question", fmt)

    labels = ["See more", "See more", "See more", "See more"]

    fmt = _("See more")
    i18n_label_fmts = [fmt, fmt, fmt, fmt]

    titles = [
        "I lost my access card.",
        "My access card has been damaged.",
        "Can visitors enter the office?",
        "I can’t remember my computer password."
    ]
    
    i18n_title_fmts = [
        _("I lost my access card."),
        _("My access card has been damaged."),
        _("Can visitors enter the office?"),
        _("I con’t remember my computer password.")
    ]
    texts = [
        "Contact the Security Team to reissue your access card.",
        "Contact the Security Team to reissue your access card.",
        "Contact the Security Team in advance to gain access.",
        "Contact the Security Team to change your computer password."
    ]

    fmt = _("Contact the Security Team to reissue your access card.")
    i18n_text_fmts = [
        fmt,
        fmt,
        _("Contact the Security Team in advance to gain access."),
        _("Contact the Security Team to change your computer password.")
    ]

    carousel = create_carousel("query_security", labels,
                               POST_BACK_URLS["security"], texts, titles,
                               CAROUSEL["security"],
                               fmt_labels=i18n_label_fmts,
                               fmt_texts=i18n_text_fmts,
                               fmt_titles=i18n_title_fmts)

    carousel["quickReply"] = replay

    yield push_messages(account_id, [text, carousel])
コード例 #5
0
def query_welfare(account_id, __, ___):
    """
    This function deals with user query welfare related problems.

    :param account_id: user account id.
    """
    fmt = _("Here are FAQs about welfare and work support.")
    text = make_i18n_text("Here are FAQs about welfare and work support.",
                          "query_welfare", fmt)

    fmt = _("Send a question")
    replay = create_quick_replay_item("transfer_welfare", "query_welfare",
                                      "Send a question", fmt)

    labels = ["See more", "See more", "See more", "See more"]

    fmt = _("See more")
    i18n_label_fmts = [fmt, fmt, fmt, fmt]

    titles = [
        "The types of in-house welfare.",
        "What kinds of in-house clubs are there?", "Can I use a company car?",
        "How can I receive office supplies?"
    ]

    i18n_title_fmts = [
        _("The types of in-house welfare."),
        _("What kinds of in-house clubs are there?"),
        _("Can I use a company car?"),
        _("How can I receive office supplies?")
    ]

    texts = [
        "Welfare includes the four main insurances, checkup, etc.",
        "A variety of club activities such as sports are supported.",
        "Contact the Work Support Team to request a company car.",
        "Visit the Work Support Team to receive office supplies."
    ]

    i18n_text_fmts = [
        _("Welfare includes the four main insurances, checkup, etc."),
        _("A variety of club activities such as sports are supported."),
        _("Contact the Work Support Team to request a company car."),
        _("Visit the Work Support Team to receive office supplies.")
    ]

    carousel = create_carousel("query_welfare",
                               labels,
                               POST_BACK_URLS["welfare"],
                               texts,
                               titles,
                               CAROUSEL["welfare"],
                               fmt_labels=i18n_label_fmts,
                               fmt_texts=i18n_text_fmts,
                               fmt_titles=i18n_title_fmts)

    carousel["quickReply"] = replay

    yield push_messages(account_id, [text, carousel])
コード例 #6
0
ファイル: query_leave.py プロジェクト: wonsokoh1019/faqbot04
def query_leave(account_id, __, ___):
    """
    This function deals with the problems related to leave query.

    :param account_id: user account id.
    """
    fmt = _("Here are FAQs about HR and leave.")
    text = make_i18n_text("Here are FAQs about HR and leave.", "query_leave",
                          fmt)

    fmt = _("Send a question")
    replay = create_quick_replay_item("transfer_leave", "query_leave",
                                      "Send a question", fmt)

    labels = ["See more", "See more", "See more", "See more"]

    fmt = _("See more")
    i18n_label_fmts = [fmt, fmt, fmt, fmt]

    titles = [
        "The types of leave.", "How many days of leave I have?",
        "To request a leave.", "To cancel my leave."
    ]

    i18n_title_fmts = [
        _("The types of leave."),
        _("How many days of leave I have?"),
        _("To request a leave."),
        _("To cancel my leave.")
    ]

    texts = [
        "Types of leave are classified in the Labor Standards Act.",
        "The remaining days of your leave are on in-house browser.",
        "You can request a leave via the in-house browser.",
        "You can cancel your leave request via the in-house browser."
    ]

    i18n_text_fmts = [
        _("Types of leave are classified in the Labor Standards Act."),
        _("The remaining days of your leave are on in-house browser."),
        _("You can request a leave via the in-house browser."),
        _("You can cancel your leave request via the in-house browser.")
    ]

    carousel = create_carousel("query_leave",
                               labels,
                               POST_BACK_URLS["leave"],
                               texts,
                               titles,
                               CAROUSEL["leave"],
                               fmt_labels=i18n_label_fmts,
                               fmt_texts=i18n_text_fmts,
                               fmt_titles=i18n_title_fmts)

    carousel["quickReply"] = replay

    yield push_messages(account_id, [text, carousel])
コード例 #7
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")

    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])
コード例 #8
0
def query(account_id, __, ___):
    # todo
    # 此处查询用户的咨询状态,如果用户在

    content1 = make_text("Please select an work-related item "
                         "that you would like to know.")

    content2 = image_introduce()

    yield push_messages(account_id, [content1, content2])
コード例 #9
0
def start(account_id, _, __):
    """
    Handle the user start using robots.
    Send the robot's self introduction information,
    and the chat room is bound with rich menu.

    :param account_id: user account id.
    """
    contents = yield start_content(account_id)

    yield push_messages(account_id, contents)
コード例 #10
0
ファイル: query_leave.py プロジェクト: wonsokoh1019/faqbot02
def query_leave(account_id, __, ___):
    """
    This function deals with the problems related to leave query.

    :param account_id: user account id.
    """
    text = make_text("Here are FAQs about HR and leave.")

    replay = create_quick_replay_item("transfer_leave",
                                      "Ask a charge")

    labels = ["more", "more", "more", "more"]

    """
    replay = create_quick_replay_item("transfer_leave",
                                      "Ask a person in charge")
    labels = ["See more", "See more", "See more", "See more"]
    titles = [
        "I would like to know the types of leave.",
        "I would like to know how many days of leave I have.",
        "I would like to request a leave.",
        "I would like to cancel my leave request."
    ]
    """
    titles = [
        "I would  of leave.",
        "I would leave I have.",
        "I would a leave.",
        "I would leave request."
    ]
    """
    texts = [
        "Leave including annual leave, paid leave, etc. "
        "is granted according to the Labor Standards Act.",
        "You can check the remaining days of your leave via "
        "the in-house browser.",
        "You can request a leave via the in-house browser.",
        "You can cancel your leave request via the in-house browser."
    ]
    """
    texts = [
        "Leave including to the Labor Standards Act.",
        "You can check the remain browser.",
        "You can request a leave via the in-house browser.",
        "You can cancel your leave in-house browser."
    ]

    carousel = create_carousel(labels, POST_BACK_URLS["leave"],
                    texts, CAROUSEL["leave"], titles)

    carousel["quickReply"] = replay

    yield push_messages(account_id, [text, carousel])
コード例 #11
0
def query(account_id, __, ___):
    """
    This Function to deal "find FAQ" by task.
    :param account_id: user account id.
    """
    set_replace_user_info(account_id, "none", "doing", "none")
    fmt = _("Please select an work-related item that you would like to know.")
    content1 = make_i18n_text(
        "Please select an work-related item "
        "that you would like to know.", "query", fmt)

    content2 = template_introduce()

    yield push_messages(account_id, [content1, content2])
コード例 #12
0
def query(account_id, __, ___):
    """
    This Function to deal "find FAQ" by task.
    :param account_id: user account id.
    """
    # todo
    # 此处查询用户的咨询状态,如果用户在
    fmt = _("Please select an work-related item that you would like to know.")
    content1 = make_i18n_text("Please select an work-related item "
                         "that you would like to know.", "query", fmt)

    content2 = template_introduce()

    yield push_messages(account_id, [content1, content2])
コード例 #13
0
def query_welfare(account_id, __, ___):
    """
    This function deals with user query welfare related problems.

    :param account_id: user account id.
    """
    text = make_text("Here are FAQs about welfare and work support.")

    replay = create_quick_replay_item("transfer_welfare", "Ask a charge")
    labels = ["more", "more", "more", "more"]
    """
    labels = ["See more", "See more", "See more", "See more"]
    replay = create_quick_replay_item("transfer_welfare",
                                      "Ask a person in charge")
    titles = [
        "I would like to know the types of in-house welfare.",
        "What kinds of in-house clubs are there?",
        "Can I use a company car?",
        "How can I receive office supplies?"
    ]
    """

    titles = [
        "I would welfare.", "What clubs are there?", "Can I company car?",
        "How can office supplies?"
    ]
    """
    texts = [
        "In-house welfare includes the four main insurances, "
        "medical checkup, in-house clubs, etc.",
        "The company is supporting a variety of club activities "
        "such as sports, self-development, etc.",
        "Contact the Work Support Team to request a company car.",
        "Visit the Work Support Team to receive office supplies."
    ]
    """
    texts = [
        "In-house welfare in-house clubs, etc.",
        "The company is self-development, etc.",
        "Contact the to request a company car.",
        "Visit the  to receive office supplies."
    ]

    carousel = create_carousel(labels, POST_BACK_URLS["welfare"], texts,
                               CAROUSEL["welfare"], titles)

    carousel["quickReply"] = replay

    yield push_messages(account_id, [text, carousel])