Пример #1
0
def pybot(command):
    #    command = input('pybot> ')
    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 = eto_command(command)
        if '選ぶ' in command:
            response = choice_command(command)
        if 'さいころ' in command:
            response = dice_command()
        if '曜日' in command:
            response = weekday_command(command)
        #仮想環境で外部パッケージ(requests)を使用
        if '天気' in command:
            response = weather_command()

        if not response:
            response = '何言ってるかわからない'
        return response

        #if "さようなら" in command:
        #    break
    except Exception as e:
        print('予期せぬエラーが発生しました')
        print('* 種類', type(e))
        print('* 内容', e)
Пример #2
0
def pybot(command):
    #command = input('pybot> ')
    reponse = ''
    try:
        """
        #print(command)
        if 'こんにちは' in command:
            print('コンニチハ')
        elif 'ありがとう' in command:
            print('どういたしまして')
        elif 'さようなら' in command:
            print('サヨウナラ')
            break
        else:
            print('何を言っているか、わかりません')
        """
        for key in bot_dict:
            if key in command:
                reponse = bot_dict[key]
                break

        if '平成' in command:
            reponse = heisei_command(command)
            """
            heisei, year_str = command.split()
            year = int(year_str)
            if year >= 1989:
                heisei_year = year - 1988
                reponse = '西暦{}年は平成{}年です'.format(year, heisei_year)
            else:
                reponse = '西暦{}年は、平成ではありません。'.format(year)
            """
        if '長さ' in command:
            reponse = length_command(command)
        if '選ぶ' in command:
            reponse = choice_command(command)
        if 'さいころ' in command:
            reponse = dice_command()
        if '今日' in command:
            reponse = today_command()
        if '現在' in command:
            reponse = now_command()
        if '曜日' in command:
            reponse = weekday_command(command)
        if '天気' in command:
            reponse = weather_command()
        if '辞典' in command:
            reponse = wikipedia_command(command)
        if not reponse:
            reponse = '何をいっているか、わからない'

        return reponse
        """    
        if 'さようなら' in command:
            break;
        """
    except Exception as e:
        print('予期せぬエラーが発生しました。')
        print('*種類:', type(e))
        print('内容:', e)
Пример #3
0
def pybot(command):
    # command = input('pybot >')
    response = ''
    try:
        for message in bot_dict:
            if message in command:
                response = bot_dict[message]
                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)

        if not response:
            response = '何を言っているか分からない'
        return response

        # if 'さようなら' in command:
        #     break
    except Exception as e:
        print('予期せぬエラーが発生しました')
        print('*種類:', type(e))
        print('*種類:', e)
Пример #4
0
def pybot(command):
    #command = input('pybot> ')
    response = ''
    try:
        for key in bot_dict:
            if key in command:
                response = bot_dict[key]
                break

            if '天気' in command:
                response = weather_command()
            if 'wikipedia' in command:
                response = wikipedia_command(command)
            if 'audience_mobilization_anaritics' in command:
                response = douin_csv_open(command)
            if 'What_is_the_bellmare_spectator_recruitment_number_forecast?' in command:
                response = about()
            if 'tell_me_the_analytical_method' in command:
                response = anaritics_method()
            if 'tell_me_about_other_functions' in command:
                response = other_functions()

            #サッカーのベルマーレとか打つと下のifの関数のみが適用されるのでいつか何かを考える

            if 'スタジアム' in command:
                response = about_stadium()

            if 'サッカー' in command:
                response = about_soccer()

            if 'ベルマーレ' in command:
                response = about_bellmare()

            if 'Jリーグ' in command:
                response = about_j_league()

        if not response:
            response = 'ごめんなさい。その言葉はまだ教わっていないから分からないの。'
        return response

        #if 'さようなら' in command:
        #    break
    except Exception as e:
        print('予期セヌ エラーガ 発生シマシタ')
        print('* 種類:', type(e))
        print('* 内容', e)
Пример #5
0
def pybot(command):
    # command = input('pybot> ');
    response = ''
    try:
        for message in bot_dict:
            if message in command:
                response = bot_dict[message]
                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 = wikiedia_command(command)

        if not response:
            response = 'ヨクワカリマセン'

        return response

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

    except Exception as e:
        print('予期セヌ エラーガ 発生シマシタ')
        print('* 種類:', type(e))
        print('* 内容:', e)
Пример #6
0
def pybot(command):
    # command = input('pybot> ')
    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 = weather_command()
        if '辞典' in command:
            response = wikipedia_command(command)

        if not response:
            response = 'ナニヲイッテイルノカワカラナイ'
        return response

        # if 'さようなら' in command:
        #     break
    except Exception as e:
        print('予期せぬエラーが発生しました')
        print('* 種類:', type(e))
        print('* 内容:', e)
Пример #7
0
def pybot(command):
    #command = input('pybot> ')
    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 = weather_command()
        if '辞典' in command:
            response = wikipedia_command(command)

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

        #if 'さようなら' in command:
        #    break
    except Exception as e:
        print('予期セヌ エラーガ 発生シマシタ')
        print('* 種類', type(e))
        print('* 内容', e)
Пример #8
0
            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)

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

        if 'さようなら' in command:
            break
    except Exception as e:
        print('予期セヌエラーが発生シマシタ')
        print('* 種類', type(e))
        print('* 内容', e)
Пример #9
0
def bot(command):
    #command = input("pybot> ")
    response = ""
    try:
        for key in bot_dict:
            if key in command:
                response = bot_dict[key]
                break

            if "意味" in command:
                response = wikipedia_command(command)
            if "長さ" in command:
                response = len_moji(command)

            if "干支" in command:
                response = eto_command(command)

            if "元号" in command:
                response = gengo_calculater(command)

            if "heisei" in command:
                response = heisei_calculater(command)
            if "平成" in command:
                response = heisei_calculater(command)

            if "reiwa" in command:
                response = reiwa_calculater(command)
            if "令和" in command:
                response = reiwa_calculater(command)

            if "昭和" in command:
                response = showa_calculater(command)
            if "showa" in command:
                response = showa_calculater(command)

            if "サイコロ" in command:
                response = dice_command()
            if "さいころ" in command:
                response = dice_command()
            if "dice" in command:
                response = dice_command()

            if "選ぶ" in command:
                response = choice_command(command)

            if "今日" in command:
                response = today_command()
            if "today" in command:
                response = today.command()

            if "現在" in command:
                response = now_command()
            if "now" in command:
                response = now_command()

            if "曜日" in command:
                response = weekday_command(command)
            if "weekday" in command:
                response = weekday_command(command)

            if "天気" in command:
                response = weather_command()
            if "weather" in command:
                response = weather_command()

            if '平均値' in command:
                response = heikin(command)

            if '中央値' in command:
                response = chuo_ti(command)

        if not response:
            response = "何言ってるかわからん\(^o^)/オワタ\nこれから勉強します(^^♪"
            output_file = open("new_word.txt", "a", encoding="utf-8")
            output_file.write("{}\n".format(command))
            output_file.close()
        return response

    except Exception as e:
        print("予期せぬエラーが発生しました。")
        print("* 種類:", type(e))
        print("* 内容:", e)
        error_file = open("error.txt", "a", encoding="utf-8")
        error_file.write("種類:{} 内容{}\n".format(type(e), e))
        error_file.close()