summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsand <daniel@spatof.org>2013-05-16 14:11:42 (GMT)
committer sand <daniel@spatof.org>2013-05-16 14:11:42 (GMT)
commit7db377d82f326537ac812cd9fd53c6c63551c75a (patch)
tree61564de7d9685cf22c54034444d9ff1ee2e3b9d0
parentbd7867465137cfc3a3ee396fb5037eeadef79f7f (diff)
markov verbosity configurabile
-rw-r--r--pinolo/plugins/markov.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pinolo/plugins/markov.py b/pinolo/plugins/markov.py
index 5f16e91..2dae7ee 100644
--- a/pinolo/plugins/markov.py
+++ b/pinolo/plugins/markov.py
@@ -163,13 +163,13 @@ class MarkovBrain(object):
class MarkovPlugin(Plugin):
- SAVE_EVERY = 50
-
def __init__(self, bot):
super(MarkovPlugin, self).__init__(bot)
self.db_file = os.path.join(self.bot.config['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()
@@ -193,11 +193,11 @@ class MarkovPlugin(Plugin):
else:
self.markov.learn(event.text)
self._counter += 1
- if self._counter >= self.SAVE_EVERY:
+ if self._counter >= self.save_every:
self._counter = 0
self.markov.save()
- if random.randint(0, 100) >= 92:
+ if random.randint(0, 100) >= self.verbosity:
reply = self.markov.say(event.text)
if reply:
event.reply(reply, prefix=False)