diff --git a/sopel_modules/SpiceBot_AI/AI.py b/sopel_modules/SpiceBot_AI/AI.py index 4ee3cd2..6381c9a 100644 --- a/sopel_modules/SpiceBot_AI/AI.py +++ b/sopel_modules/SpiceBot_AI/AI.py @@ -26,43 +26,6 @@ def bot_command_nick(bot, trigger): fulltrigger = spicemanip.main(trigger.sb['args'], 0).lower() - if fulltrigger.lower().startswith("what is"): - searchterm = spicemanip.main(trigger.sb['args'], "3+") or None - if searchterm: - searchreturn = SpiceBot.googlesearch(searchterm) - if not searchreturn: - bot.osd('I cannot find anything about that') - else: - bot.osd(str(searchreturn)) - else: - bot.osd("Do you think this is Jeopardy?") - return - - elif fulltrigger.lower().startswith("where is"): - searchterm = spicemanip.main(trigger.sb['args'], "3+") or None - if searchterm: - - if searchterm.lower() in ['waldo', 'wally']: - bot.osd("He is hiding for a reason?") - searchreturn = SpiceBot.googlesearch("wimmelbilderbuch") - if searchreturn: - bot.osd(str(searchreturn)) - return - - elif searchterm.lower() == 'carmen sandiego': - carmenlocale = ['ACME Headquarters', "Villains' International League of Evil"] - bot.osd("Currently she is located at " + spicemanip.main(carmenlocale, 'random')) - return - searchreturn = SpiceBot.googlesearch(searchterm, 'maps') - - if not searchreturn: - bot.osd('I cannot find anything about that') - else: - bot.osd(str(searchreturn)) - else: - bot.osd("Not sure what you want me to look for.") - return - # if fulltrigger.lower().startswith("what time is it"): # TODO @@ -73,7 +36,7 @@ def bot_command_nick(bot, trigger): # return # TODO - elif fulltrigger.lower().startswith(tuple(["make me a", "beam me a"])): + if fulltrigger.lower().startswith(tuple(["make me a", "beam me a"])): makemea = spicemanip.main(trigger.sb['args'], "4+") or None if makemea: bot.osd("beams " + trigger.nick + " a " + makemea, trigger.sender, 'action') diff --git a/sopel_modules/SpiceBot_AI/AI_aiml.py b/sopel_modules/SpiceBot_AI/AI_aiml.py index 3ac2b3b..006b19e 100644 --- a/sopel_modules/SpiceBot_AI/AI_aiml.py +++ b/sopel_modules/SpiceBot_AI/AI_aiml.py @@ -44,12 +44,12 @@ def bot_command_rule(bot, trigger): bot.osd(invalid_display, trigger.nick, 'notice') return + fulltrigger = spicemanip.main(trigger_args, 0) if str(message).lower().startswith(str(bot.nick).lower()): command_type = 'nickname' trigger_args, trigger_command = SpiceBot.prerun.trigger_args(message, 'nickname') if str(trigger_command).startswith("?"): return - fulltrigger = spicemanip.main(trigger_args, 0) if fulltrigger in SpiceBot.commands.dict['nickrules']: return if trigger_command in SpiceBot.commands.dict['commands']["nickname"].keys(): @@ -63,6 +63,20 @@ def bot_command_rule(bot, trigger): bot.osd(str(returnmessage)) else: if command_type == 'nickname': + + if fulltrigger.lower().startswith(tuple(["what is", "where is"])): + searchterm = spicemanip.main(trigger_args, "3+") or None + if searchterm: + if trigger_args[0].lower() == "where": + searchreturn = SpiceBot.googlesearch(searchterm, 'maps') + else: + searchreturn = SpiceBot.googlesearch(searchterm) + if not searchreturn: + bot.osd('I cannot find anything about that') + else: + bot.osd(str(searchreturn)) + return + closestmatches = SpiceBot.similar_list(trigger_command, SpiceBot.commands.dict['commands']["nickname"].keys(), 3, 'reverse') if len(closestmatches): closestmatches = spicemanip.main(closestmatches, "andlist") diff --git a/sopel_modules/SpiceBot_Configs/aiml/nickname_whatis.aiml b/sopel_modules/SpiceBot_Configs/aiml/nickname_whatis.aiml new file mode 100644 index 0000000..eca6503 --- /dev/null +++ b/sopel_modules/SpiceBot_Configs/aiml/nickname_whatis.aiml @@ -0,0 +1,9 @@ + + + + + BOTNICK what is + + + + diff --git a/sopel_modules/SpiceBot_Configs/aiml/nickname_whereis.aiml b/sopel_modules/SpiceBot_Configs/aiml/nickname_whereis.aiml new file mode 100644 index 0000000..6b41ce9 --- /dev/null +++ b/sopel_modules/SpiceBot_Configs/aiml/nickname_whereis.aiml @@ -0,0 +1,29 @@ + + + + + BOTNICK where is waldo + + + + + BOTNICK where is wally + + + + + BOTNICK where is carmen sandiego + + + + + BOTNICK where is + + + +