mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
config setup
This commit is contained in:
parent
dfe1007609
commit
aba9c3380f
@ -31,11 +31,17 @@ class SpiceBot_AI():
|
|||||||
|
|
||||||
def load_brain(self):
|
def load_brain(self):
|
||||||
import sopel_modules
|
import sopel_modules
|
||||||
|
braindirs = []
|
||||||
for plugin_dir in set(sopel_modules.__path__):
|
for plugin_dir in set(sopel_modules.__path__):
|
||||||
configsdir = os.path.join(plugin_dir, "SpiceBot_Configs")
|
configsdir = os.path.join(plugin_dir, "SpiceBot_Configs")
|
||||||
aimldir = os.path.join(configsdir, "aiml")
|
aimldir = os.path.join(configsdir, "aiml")
|
||||||
aimlstarter = tempfile.mkstemp()[1]
|
braindirs.append(aimldir)
|
||||||
with open(aimlstarter, 'w') as fileo:
|
|
||||||
|
# TODO add extra config
|
||||||
|
|
||||||
|
for braindir in braindirs:
|
||||||
|
tempbrain = tempfile.mkstemp()[1]
|
||||||
|
with open(tempbrain, 'w') as fileo:
|
||||||
fileo.write(
|
fileo.write(
|
||||||
"<aiml version='1.0.1' encoding='UTF-8'>"
|
"<aiml version='1.0.1' encoding='UTF-8'>"
|
||||||
" <!-- std-startup.xml -->\n"
|
" <!-- std-startup.xml -->\n"
|
||||||
@ -45,11 +51,11 @@ class SpiceBot_AI():
|
|||||||
" <learn>{}</learn>\n"
|
" <learn>{}</learn>\n"
|
||||||
" </template>\n"
|
" </template>\n"
|
||||||
" </category>\n"
|
" </category>\n"
|
||||||
"</aiml>".format(os.path.join(aimldir, "*"))
|
"</aiml>".format(os.path.join(braindir, "*"))
|
||||||
)
|
)
|
||||||
self.aiml_kernel.learn(aimlstarter)
|
self.aiml_kernel.learn(tempbrain)
|
||||||
self.aiml_kernel.respond("LOAD AIML B")
|
self.aiml_kernel.respond("LOAD AIML B")
|
||||||
os.remove(aimlstarter)
|
os.remove(tempbrain)
|
||||||
|
|
||||||
def on_message(self, bot, trigger, message):
|
def on_message(self, bot, trigger, message):
|
||||||
nick = Identifier(trigger.nick)
|
nick = Identifier(trigger.nick)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user