From 514af801d21ba6ffc7147923ec9b4159c4f28bba Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Tue, 6 Mar 2012 19:55:35 +0000 Subject: [PATCH] drama stats recorded per user --- modules/drama.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/drama.js b/modules/drama.js index 2334a6d..c7d3daa 100644 --- a/modules/drama.js +++ b/modules/drama.js @@ -59,9 +59,20 @@ var drama = function(dbot) { 'listener': function(data) { var category = bayes.classify(data.message, function(category) { - console.log(category + '!'); - if(category === 'beinganasshole') { - dbot.say(data.channel, data.user + ': Quit being an asshole') + if(category !== 'normal') { + if(category === 'beinganasshole') { + if(dbot.db.drama.beinganasshole.hasOwnProperty(data.user)) { + dbot.db.drama.beinganasshole[data.user]++; + } else { + dbot.db.drama.beinganasshole[data.user] = 1; + } + } else if(category === 'sd') { + if(dbot.db.drama.sd.hasOwnProperty(data.user)) { + dbot.db.drama.sd[data.user]++; + } else { + dbot.db.drama.sd[data.user] = 1; + } + } } }.bind(this));