From 4c5efae87e6ab9b6980bb9d3e03ced19c091b5a2 Mon Sep 17 00:00:00 2001 From: Casey Link Date: Thu, 8 Sep 2011 15:28:58 -0500 Subject: [PATCH] make chill meter channel specific --- modules/chillmeter.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/chillmeter.py b/modules/chillmeter.py index f9df0e0..1ad05c1 100644 --- a/modules/chillmeter.py +++ b/modules/chillmeter.py @@ -43,26 +43,31 @@ chill_things = [ # keeps a finger on the pulse of the chillness def measure(phenny, input): + chill = measure.channels.get(input.sender, 0) now = time.time() if now - measure.last_tick > 60: measure.last_tick = now - measure.chill -= chill_decay_rate - measure.chill = max(0, measure.chill) + chill -= chill_decay_rate + chill = max(0, chill) + measure.channels[input.sender] = chill if ".chill" in input: return # dont self count for w in chill_words: if w in input.lower(): - measure.chill += 1 + chill += 1 + + measure.channels[input.sender] = chill + measure.rule = r'.*' measure.priority = 'low' -measure.chill = 0 measure.last_tick = time.time() +measure.channels = {} def chill(phenny, input): - level = measure.chill + level = measure.channels.get(input.sender, 0) n = random.randint(1,2) items = []