Beispiel #1
0
def sort_query(msg_text, sender_id):
    message_pack = None

    if msg_text in NEUTRAL_WORDS:
        return None

    msg_list = msg_text.split()

    if "hello" in msg_list:
        name = get_name(sender_id)
        message_pack = say_hello(name)

    for meal in ["lunch", "dinner", "breakfast"]:
        if meal in msg_list:
            if 'tomorrow' in msg_list:
                message_pack = get_text(get_meal(meal, tomorrow=True))
            else:
                message_pack = get_text(get_meal(meal))

    if not message_pack:
        message_pack = sort(msg_list)

    return pack_details(message_pack, sender_id)
def say_sorry():
    """ sorry message with randomized words. """
    return get_text(random.choice(sorry_msgs))
def say_hello(name):
    """ Hello message with randomized words along with name. """
    hello_msg = random.choice(hello_msgs)
    hello_msg[0] = hello_msg[0].replace('<USERNAME>', name)
    return get_text(hello_msg)
    ["ashok", AK_SUPRI, AK_CHOWKI, AK_WARDEN],
    ["meera", MB_SUPRI, MB_CHOWKI, MB_WARDEN],
    ["malviya", MAL_SUPRI, MAL_CHOWKI, MAL_WARDEN],
    ["sr", SR_SUPRI, SR_CHOWKI, SR_WARDEN],
    ["cvr", CVR_SUPRI, CVR_CHOWKI, CVR_WARDEN],
    ["shankar", SK_SUPRI, SK_CHOWKI, SK_WARDEN],
    ["gandhi", GN_SUPRI, GN_CHOWKI, GN_WARDEN],
    ["ram", RM_SUPRI, RM_CHOWKI, RM_WARDEN],
    ["budh", BD_SUPRI, BD_CHOWKI, BD_WARDEN],
    ["vyas", VY_SUPRI, VY_CHOWKI, VY_WARDEN],
    ["ranapratap", RP_SUPRI, RP_CHOWKI, RP_WARDEN]]


db = {
    "swd": {
        "timings": get_text(SWD_TIME, "SWD"),
        "number": get_text(SWD_NUM, "SWD"),
        "email": get_text(SWD_EMAIL, "SWD")
    },
    "arcd": {
        "timings": get_text(ARCD_TIME, "ARCD"),
        "number": get_text(BK_ROUT_NUM, "BK Rout Assoc Dean"),
        "email": get_text(ARCD_EMAIL, "ARCD")
    },
    "pizzeria": {
        "timings": get_text(PIZZ_TIME, "Pizzeria"),
        "number": get_text(PIZZ_NUM, "Pizzeria"),
        "menu": get_file(PIZZ_MENU, "image"),
        "address": get_text(PIZZ_ADD, "Pizzeria")
    },
    "ic": {