diff --git a/sopel_modules/SpiceBot/AI.py b/sopel_modules/SpiceBot/AI.py index b3c8197..c184098 100644 --- a/sopel_modules/SpiceBot/AI.py +++ b/sopel_modules/SpiceBot/AI.py @@ -5,6 +5,7 @@ This is the SpiceBot AI system. Based On Chatty cathy """ import os +import tempfile import aiml @@ -16,15 +17,29 @@ class SpiceBot_AI(): } # Load AIML kernel self.aiml_kernel = aiml.Kernel() + # self.aiml_kernel._verboseMode = False # Learn responses import sopel_modules for plugin_dir in set(sopel_modules.__path__): configsdir = os.path.join(plugin_dir, "SpiceBot_Configs") aimldir = os.path.join(configsdir, "aiml") - aimlstarter = os.path.join(aimldir, "std-startup.xml") + aimlstarter = tempfile.mkstemp()[1] + with open(aimlstarter, 'w') as fileo: + fileo.write( + "" + " \n" + " \n" + " LOAD AIML B\n" + " \n" + " \n" + "".format(os.path.join(aimldir, "*")) + ) self.aiml_kernel.learn(aimlstarter) self.aiml_kernel.respond("LOAD AIML B") + os.remove(aimlstarter) def on_message(self, message): aiml_response = self.aiml_kernel.respond(message) diff --git a/sopel_modules/SpiceBot_Configs/aiml/aiml/dog.aiml b/sopel_modules/SpiceBot_Configs/aiml/dog.aiml similarity index 100% rename from sopel_modules/SpiceBot_Configs/aiml/aiml/dog.aiml rename to sopel_modules/SpiceBot_Configs/aiml/dog.aiml diff --git a/sopel_modules/SpiceBot_Configs/aiml/std-startup.xml b/sopel_modules/SpiceBot_Configs/aiml/std-startup.xml deleted file mode 100644 index ed108be..0000000 --- a/sopel_modules/SpiceBot_Configs/aiml/std-startup.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - LOAD AIML B - - - - - - - -