make chill meter channel specific

master
Casey Link 2011-09-08 15:28:58 -05:00
parent af4d5e37b4
commit 4c5efae87e
1 changed files with 10 additions and 5 deletions

View File

@ -43,26 +43,31 @@ chill_things = [
# keeps a finger on the pulse of the chillness # keeps a finger on the pulse of the chillness
def measure(phenny, input): def measure(phenny, input):
chill = measure.channels.get(input.sender, 0)
now = time.time() now = time.time()
if now - measure.last_tick > 60: if now - measure.last_tick > 60:
measure.last_tick = now measure.last_tick = now
measure.chill -= chill_decay_rate chill -= chill_decay_rate
measure.chill = max(0, measure.chill) chill = max(0, chill)
measure.channels[input.sender] = chill
if ".chill" in input: if ".chill" in input:
return # dont self count return # dont self count
for w in chill_words: for w in chill_words:
if w in input.lower(): if w in input.lower():
measure.chill += 1 chill += 1
measure.channels[input.sender] = chill
measure.rule = r'.*' measure.rule = r'.*'
measure.priority = 'low' measure.priority = 'low'
measure.chill = 0
measure.last_tick = time.time() measure.last_tick = time.time()
measure.channels = {}
def chill(phenny, input): def chill(phenny, input):
level = measure.chill level = measure.channels.get(input.sender, 0)
n = random.randint(1,2) n = random.randint(1,2)
items = [] items = []