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 not response: response = '何ヲ言ッテルカ、ワカラナイ' return response except Exception as e: print('予期セヌ エラーガ 発生シマシタ') print('* 種類:', type(e)) print('* 内容:', e)
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)
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)
def pybot(command): # command = input("pybot> ") response = "" try: for messege in bot_dict: if messege in command: response = bot_dict[messege] break if "和暦" in command: response = wareki_command(command) if "干支" in command: response = eto_command(command) if "選ぶ" in command: response = choice_command(command) if "さいころ" in command: response = dice_command(command) if "今日" in command: response = today_command() if "現在" in command: response = now_command() if "曜日" in command: response = weekday_command(command) if "平方根" in command: response = sqrt_command(command) if "イベント" in command: response = event_command(command) if "辞典" in command: response = wikipedia_command(command) if not response: response = "ナニヲイッテイルカワカラナイ" return response # if "さようなら" in command: # break except Exception as e: print("予期せぬエラーが発生しました")
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)
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)
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)
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 = wareki_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 = event_command(command) if '事典' in command: response = wikipedia_command(command) if not response: response = '何ヲ言ッテルカ、ワカラナイ' return response # if 'さようなら' in command: # break except Exception as e: print('予期セヌ エラーガ 発生シマシタ') print(f'* 種類: {type(e)}') print(f'* 内容: {e}')
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 = '何ヲ言ッテルカ、ワカラナイ' print(response) if 'さようなら' in command: break except Exception as e: print('予期セヌエラーが発生シマシタ')
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 except Exception as e: print('予期セヌ エラーガ 発生シマシタ') print('* 種類:', type(e)) print('* 内容:', e)