summaryrefslogtreecommitdiffstats
path: root/pinolo/plugins/markov.py
diff options
context:
space:
mode:
Diffstat (limited to 'pinolo/plugins/markov.py')
-rw-r--r--pinolo/plugins/markov.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/pinolo/plugins/markov.py b/pinolo/plugins/markov.py
index d7c8d88..07871b2 100644
--- a/pinolo/plugins/markov.py
+++ b/pinolo/plugins/markov.py
@@ -164,16 +164,11 @@ class MarkovBrain(object):
class MarkovPlugin(Plugin):
-
- def __init__(self, bot):
- super(MarkovPlugin, self).__init__(bot)
- self.db_file = os.path.join(self.bot.config['datadir'], "markov.pickle")
+ def activate(self):
+ self.db_file = os.path.join(self.config.get("@root.datadir"),
+ "markov.pickle")
self.markov = MarkovBrain(self.db_file)
self._counter = 0
- self.verbosity = self.bot.config.get("markov_verbosity", 97)
- self.save_every = self.bot.config.get("markov_save_every", 50)
-
- def activate(self):
self.markov.load()
def deactivate(self):
@@ -195,11 +190,11 @@ class MarkovPlugin(Plugin):
else:
self.markov.learn(event.text)
self._counter += 1
- if self._counter >= self.save_every:
+ if self._counter >= self.config.get("save_every", 50):
self._counter = 0
self.markov.save()
- if random.randint(0, 100) >= self.verbosity:
+ if random.randint(0, 100) >= self.config.get("verbosity", 95):
reply = self.markov.say(event.text)
if reply:
event.reply(reply, prefix=False)