mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 22:49:53 -05:00
database is better than brn file
This commit is contained in:
parent
b0272d014e
commit
8eebebe7b4
@ -10,7 +10,6 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
import aiml
|
import aiml
|
||||||
|
|
||||||
from .Config import config as botconfig
|
|
||||||
from .Database import db as botdb
|
from .Database import db as botdb
|
||||||
|
|
||||||
|
|
||||||
@ -31,11 +30,6 @@ class SpiceBot_AI():
|
|||||||
self.load_brain()
|
self.load_brain()
|
||||||
|
|
||||||
def load_brain(self):
|
def load_brain(self):
|
||||||
if os.path.isfile(botconfig.config.aibrain):
|
|
||||||
self.aiml_kernel.bootstrap(brainFile=botconfig.config.aibrain)
|
|
||||||
self.aiml_kernel.respond("LOAD AIML B")
|
|
||||||
self.save_brain()
|
|
||||||
else:
|
|
||||||
import sopel_modules
|
import sopel_modules
|
||||||
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")
|
||||||
@ -56,10 +50,6 @@ class SpiceBot_AI():
|
|||||||
self.aiml_kernel.learn(aimlstarter)
|
self.aiml_kernel.learn(aimlstarter)
|
||||||
self.aiml_kernel.respond("LOAD AIML B")
|
self.aiml_kernel.respond("LOAD AIML B")
|
||||||
os.remove(aimlstarter)
|
os.remove(aimlstarter)
|
||||||
self.save_brain()
|
|
||||||
|
|
||||||
def save_brain(self):
|
|
||||||
self.aiml_kernel.saveBrain(botconfig.config.aibrain)
|
|
||||||
|
|
||||||
def on_message(self, bot, trigger, message):
|
def on_message(self, bot, trigger, message):
|
||||||
nick = Identifier(trigger.nick)
|
nick = Identifier(trigger.nick)
|
||||||
|
|||||||
@ -32,8 +32,6 @@ class BotConfig():
|
|||||||
self.config.core.logs_raw = os.path.join(self.config.core.logdir, 'raw.log')
|
self.config.core.logs_raw = os.path.join(self.config.core.logdir, 'raw.log')
|
||||||
# self.config.core.logs_raw = os.path.os.path.join(self.config.core.logdir, self.config.basename + '.raw.log')
|
# self.config.core.logs_raw = os.path.os.path.join(self.config.core.logdir, self.config.basename + '.raw.log')
|
||||||
|
|
||||||
self.config.aibrain = os.path.join(self.config.homedir, self.config.basename + '.aibrain.brn')
|
|
||||||
|
|
||||||
# load as dict
|
# load as dict
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(self.config.filename)
|
config.read(self.config.filename)
|
||||||
|
|||||||
@ -55,8 +55,6 @@ def setup(bot):
|
|||||||
bot.config.core.logs_raw = os.path.join(bot.config.core.logdir, 'raw.log')
|
bot.config.core.logs_raw = os.path.join(bot.config.core.logdir, 'raw.log')
|
||||||
# bot.config.core.logs_raw = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.raw.log')
|
# bot.config.core.logs_raw = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.raw.log')
|
||||||
|
|
||||||
bot.config.aibrain = os.path.join(bot.config.homedir, bot.config.basename + '.aibrain.brn')
|
|
||||||
|
|
||||||
logs.log('SpiceBot_Channels', "Setting Up Configuration")
|
logs.log('SpiceBot_Channels', "Setting Up Configuration")
|
||||||
events.startup_add([events.BOT_CHANNELS])
|
events.startup_add([events.BOT_CHANNELS])
|
||||||
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
||||||
|
|||||||
@ -6,5 +6,4 @@ from .AI import botai
|
|||||||
|
|
||||||
|
|
||||||
def shutdown(bot):
|
def shutdown(bot):
|
||||||
botai.save_brain()
|
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user