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"
- # " \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".format(os.path.join(braindir, "*.aiml")))
- 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"
+ " \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)