From 5a75c63672da6b2d0b5df408cfadb041b58edf02 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Tue, 11 Dec 2012 16:26:59 +0000 Subject: [PATCH] removed drama because why bother --- modules/drama/drama.js | 96 ------------------------------------------ 1 file changed, 96 deletions(-) delete mode 100644 modules/drama/drama.js diff --git a/modules/drama/drama.js b/modules/drama/drama.js deleted file mode 100644 index fc9aa3a..0000000 --- a/modules/drama/drama.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Module Name: Drama - * Description: Experimental, you probably don't want it. - */ -var brain = require('brain'); - -var drama = function(dbot) { - var dbot = dbot; - var last = {}; - var options = { - 'backend': { - 'type': 'Redis', - 'options': { - 'hostname': 'localhost', - 'port': 6379, - 'name': 'dbotdrama' - } - }, - - 'thresholds': { - 'drama': 3, - 'beinganasshole': 3, - 'sd': 3, // self depracating - 'normal': 1 - }, - - 'def': 'normal' - }; - var bayes = new brain.BayesianClassifier(options); - - var commands = { - '~train': function(event) { - if(dbot.admin.include(event.user)) { - bayes.train(last[event.params[1]][event.params[2]], event.params[3]); - event.reply('Last thing ' + event.params[2] + ' said in ' + - event.params[1] + ' (' + last[event.params[1]][event.params[2]] + ') classified as \'' + event.params[3] + '\''); - } - }, - - '~rtrain': function(event) { - if(dbot.admin.include(event.user)) { - var category = event.params[1]; - event.params.splice(0, 2); - var msg = event.params.join(' '); - bayes.train(msg, category); - event.reply('\'' + msg + '\' classified as \'' + category + '\''); - } - }, - - '~classify': function(event) { - event.params.splice(0, 1); - var msg = event.params.join(' '); - bayes.classify(msg, function(category) { - event.reply('Classified as: ' + category + '!'); - }.bind(this)); - } - } - - return { - 'name': 'drama', - 'ignorable': false, - 'commands': commands, - - 'listener': function(data) { - var category = bayes.classify(data.message, function(category) { - if(category !== 'normal') { - if(category === 'beinganasshole') { - if(dbot.db.drama.beinganasshole.hasOwnProperty(event.user)) { - dbot.db.drama.beinganasshole[event.user]++; - } else { - dbot.db.drama.beinganasshole[event.user] = 1; - } - } else if(category === 'sd') { - if(dbot.db.drama.sd.hasOwnProperty(event.user)) { - dbot.db.drama.sd[event.user]++; - } else { - dbot.db.drama.sd[event.user] = 1; - } - } - } - }.bind(this)); - - if(last.hasOwnProperty(event.channel)) { - last[event.channel][event.user] = data.message; - } else { - last[event.channel] = { }; - last[event.channel][event.user] = data.message; - } - }, - 'on': 'PRIVMSG' - }; -} - -exports.fetch = function(dbot) { - return drama(dbot); -};