From c33fbe7a5b9e3158fd880012eb1db9b7834c7482 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 4 Jun 2019 08:22:50 -0400 Subject: [PATCH] hmmmm --- sopel_modules/SpiceBot/AI.py | 46 ++++++++++-------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/sopel_modules/SpiceBot/AI.py b/sopel_modules/SpiceBot/AI.py index d1507d6..3165188 100644 --- a/sopel_modules/SpiceBot/AI.py +++ b/sopel_modules/SpiceBot/AI.py @@ -22,7 +22,6 @@ class SpiceBot_AI_MainSection(StaticSection): class SpiceBot_AI(): def __init__(self): - self.load_commands = {0: None} self.braindirs = [] self.dict = { "counts": 0, @@ -63,40 +62,21 @@ class SpiceBot_AI(): for braindir in braindirs: if braindir not in self.braindirs: self.braindirs.append(braindir) - dirnumber = max(self.load_commands.keys()) + 1 - self.load_commands[dirnumber] = braindir tempbrain = tempfile.mkstemp()[1] - # with open(tempbrain, 'w') as fileo: - # fileo.write( - # "" - # " \n" - # " \n" - # " LOAD AIML B\n" - # # " LOAD AIML {}\n" - # " \n" - # " \n" - # # "".format(str(dirnumber), os.path.join(braindir, "*")) - # "".format(os.path.join(braindir, "*.aiml")) - # ) - brainfile = open(tempbrain, 'a') - brainfile.write("") - brainfile.write(" \n") - brainfile.write(" \n") - brainfile.write(" LOAD AIML {}\n".format(str(dirnumber))) - brainfile.write(" \n") - brainfile.write(" \n") - brainfile.write("") - brainfile.close() + with open(tempbrain, 'w') as fileo: + fileo.write( + "" + " \n" + " \n" + " LOAD AIML B\n" + " \n" + " \n" + "".format(os.path.join(braindir, "*.aiml")) + ) self.aiml_kernel.learn(tempbrain) - # self.aiml_kernel.respond("LOAD AIML B") - for number in self.load_commands.keys(): - if number != 0: - self.aiml_kernel.respond("LOAD AIML {}").format(str(dirnumber)) - os.remove(tempbrain) + self.aiml_kernel.respond("LOAD AIML B") def on_message(self, bot, trigger, message): nick = Identifier(trigger.nick)