mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 14:39:54 -05:00
stderr some counts
This commit is contained in:
parent
8bbddf2bf3
commit
213610cea8
@ -7,12 +7,15 @@ This is the SpiceBot AI system. Based On Chatty cathy
|
|||||||
import os
|
import os
|
||||||
import aiml
|
import aiml
|
||||||
|
|
||||||
BOT_PREFIX = (".", '?', '!')
|
from .Logs import logs
|
||||||
|
|
||||||
|
|
||||||
class SpiceBot_AI():
|
class SpiceBot_AI():
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.dict = {
|
||||||
|
"counts": 0,
|
||||||
|
}
|
||||||
# Load AIML kernel
|
# Load AIML kernel
|
||||||
self.aiml_kernel = aiml.Kernel()
|
self.aiml_kernel = aiml.Kernel()
|
||||||
# Learn responses
|
# Learn responses
|
||||||
@ -22,7 +25,12 @@ class SpiceBot_AI():
|
|||||||
aimldir = os.path.join(configsdir, "aiml")
|
aimldir = os.path.join(configsdir, "aiml")
|
||||||
for aimlfile in os.listdir(aimldir):
|
for aimlfile in os.listdir(aimldir):
|
||||||
aiml_filename = os.path.join(aimldir, aimlfile)
|
aiml_filename = os.path.join(aimldir, aimlfile)
|
||||||
self.aiml_kernel.learn(aiml_filename)
|
try:
|
||||||
|
self.aiml_kernel.learn(aiml_filename)
|
||||||
|
self.dict['counts'] += 1
|
||||||
|
except Exception as e:
|
||||||
|
logs.log('SpiceBot_AI', "Error loading %s: %s (%s)" % ('aiml', e, aiml_filename))
|
||||||
|
logs.log('SpiceBot_AI', "Found " + str(self.dict['counts']) + " " + 'aiml' + " commands.", True)
|
||||||
|
|
||||||
def on_message(self, message):
|
def on_message(self, message):
|
||||||
return self.aiml_kernel.respond(message.content)
|
return self.aiml_kernel.respond(message.content)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user