def bot_process(term):
    out = None
    for sense in bot_senses():
        if sense in term:
            lines = [line.rstrip('\n') for line in open(bot_const.bot_sense_base+sense+'_keys.artha')]
            if g_func.clean_for_artha(term.replace(sense, "", 1)) in lines:
                ln = lines.index(g_func.clean_for_artha(term.replace(sense, "", 1)))
                lines_x = [line.rstrip('\n') for line in open(bot_const.bot_sense_base+sense+'_replies.artha')]
                out = lines_x[ln]
            elif g_func.clean_for_artha(term.replace(sense+" a", "", 1)) in lines:
                ln = lines.index(g_func.clean_for_artha(term.replace(sense+" a", "", 1)))
                lines_x = [line.rstrip('\n') for line in open(bot_const.bot_sense_base+sense+'_replies.artha')]
                out = lines_x[ln]
            else:
                out = bot_down()
    if out is None:
        out = bot_def_down()
    return out
def bot_action(x):
    react = ""
    bot_log(0, 1, x)
    x = g_func.clean_for_artha(x)

    if x == "":
        x = -1
    else:
        x.decode('utf-8')
        x = x.lower()

    for case in g_func.Switch(x):
        if case(-1):
            react = "Say something."
            break
        if case():  # default reply, omit possible 'if True'
            react = bot_intellect.bot_interpret(x)
    if react != -1:
        bot_output(react)
    else:
        return react
def bot_action(x):
    react = ""
    bot_log(0, 1, x)

    if '#artha' not in x:
        x = bot_intellect.bot_focus(g_func.clean_for_artha(x))

    if x == "":
        x = -1
    elif x == "debug:cc":
        x = 0.0
    else:
        x.decode('utf-8')
        x = x.lower()

    if x in bot_cache_in:
        react = bot_repeat_append(bot_cache_out[bot_cache_in.index(x)])
    else:
        for case in g_func.Switch(x):
            if case(-1):
                react = "Say something."
                break
            if case(0.0):
                react = "[admin]: "+str(global_consult.c_count)
                break
            if case():  # default reply, omit possible 'if True'
                react = bot_intellect.bot_interpret(x)
    if react != -1:
        if x not in bot_cache_in:
            bot_cache_in.append(x)
        if react not in bot_cache_out:
            bot_cache_out.append(g_func.parse_artha_vars(react))
        global_consult.c_count += 1
        return bot_output(react)
    else:
        return react