Пример #1
0
def pybot(command, image=None):
    response = ''
    try:
        for key in bot_dict:
            if key in command:
                response = bot_dict[key]
                break

            if '平成' in command:
                response = heisei_command(command)
            if '長さ' in command:
                response = len_command(command)
            if '干支' in command:
                response = eto_command(command)
            if '選ぶ' in command:
                response = choice_command(command)
            if 'さいころ' in command:
                response = dice_command()
            if '今日' in command:
                response = today_command()
            if '現在' in command:
                response = now_command()
            if '曜日' in command:
                response = weekday_command(command)
            if '合計' in command:
                response = sum_command(command)
            if '書籍' in command:
                response = book_command(command)
            if 'マルコフ' in command:
                response = markov_command()

        if not response:
            response = '何ヲ言ッテルカ、ワカラナイ'
        return response

    except Exception as e:
        print('予期セヌ エラーガ 発生シマシタ')
        print('* 種類:', type(e))
        print('* 内容:', e)
Пример #2
0
while True:
    try:
        command = input('pybot> ')
        response = ""
        for key in bot_dict:
            if key in command:
                response = bot_dict[key]
                break

        if '平成' in command:
            response = heisei_command(command)
        if '長さ' in command:
            response = len_command(command)
        if '干支' in command:
            response = eto_command(command)
        if '選ぶ' in command:
            response = choice_command(command)
        if 'さいころ' in command:
            response = dice_command()
        if '今日' in command:
            response = today_command()
        if '現在' in command:
            response = now_command()
        if '曜日' in command:
            response = weekday_command(command)
        if '天気' in command:
            response = weather_command()
        if '事典' in command:
            response = wikipedia_command(command)
Пример #3
0
while True:
    command = input('pybot> ')
    responce = ""
    try:
        for key in bot_dict:
            if key in command:
                responce = bot_dict[key]
                break

        if '平成' in command:
            responce = heisei_command(command)
        if '長さ' in command:
            responce = len_command(command)
        if '干支' in command:
            responce = eto_command(command)
        if '選ぶ' in command:
            responce = choice_command(command)
        if 'さいころ' in command:
            responce = dice_command(command)
        if '今日' in command:
            responce = today_command()
        if '現在' in command:
            responce = now_command()

        if not responce:
            responce = '何ヲ言ッテルカ、ワカラナイ'
        print(responce)

        if 'さようなら' in command:
            break