From e3ef3f48dc7f2c5c6923f04ea05bfaf663223f69 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Fri, 21 Oct 2011 16:59:57 -0500 Subject: [PATCH] Markov: add support for temporarily disabling chatter by supplying a negative chance --- modules/Markov.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/Markov.py b/modules/Markov.py index 8827c3c..8ba284e 100644 --- a/modules/Markov.py +++ b/modules/Markov.py @@ -349,9 +349,10 @@ class Markov(Module): targets = self._get_chatter_targets() for t in targets: - a = random.randint(1, t['chance']) - if a == 1: - self.sendmsg(self.connection, t['target'], self._generate_line(t['target'])) + if t['chance'] > 0: + a = random.randint(1, t['chance']) + if a == 1: + self.sendmsg(self.connection, t['target'], self._generate_line(t['target'])) def _do_shut_up_checks(self): """Check to see if we've been talking too much, and shut up if so."""