From e0dee27658f2dd0506b3186149d4bd6675eb0100 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Mon, 31 Oct 2011 17:07:14 +0000 Subject: [PATCH] ** --- modules/getajob.js | 17 ----------------- modules/spelling.js | 4 +--- modules/youare.js | 2 -- run.js | 11 +++++++---- 4 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 modules/getajob.js diff --git a/modules/getajob.js b/modules/getajob.js deleted file mode 100644 index 7a6d052..0000000 --- a/modules/getajob.js +++ /dev/null @@ -1,17 +0,0 @@ -var getAJob = function(dbot) { - var dbot = dbot; - - return { - 'listener': function(data) { - if(Number.prototype.chanceIn(1, 50)) { - dbot.say(data.channel, data.user + ': Get a job!'); - } - }, - - 'on': 'PRIVMSG' - }; -}; - -exports.fetch = function(dbot) { - return getAJob(dbot); -}; diff --git a/modules/spelling.js b/modules/spelling.js index 1a96af7..94bfa90 100644 --- a/modules/spelling.js +++ b/modules/spelling.js @@ -4,7 +4,7 @@ var spelling = function(dbot) { return { 'listener': function(data, params) { - var q = data.message.valMatch(/^\*([\d\w\s]*)/, 2); + var q = data.message.valMatch(/^(\*|\*\*)([\d\w\s]*)/, 3); if(q) { var correction = q[1]; var candidates = last[data.channel][data.user].split(' '); @@ -19,8 +19,6 @@ var spelling = function(dbot) { } } - console.log(winner + ' ' + winnerDistance); - if(winnerDistance < 3) { if(winner !== correction) { var fix = last[data.channel][data.user].replace(winner, correction); diff --git a/modules/youare.js b/modules/youare.js index 7401a11..49b8d67 100644 --- a/modules/youare.js +++ b/modules/youare.js @@ -1,6 +1,4 @@ var youAre = function(dbot) { - var dbot = dbot; - return { 'listener': function(data) { var key = data.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5); diff --git a/run.js b/run.js index 4f67b7a..1ce9536 100644 --- a/run.js +++ b/run.js @@ -6,17 +6,20 @@ require('./snippets'); var modules = ['spelling', 'web', 'modehate', 'user', 'admin', 'puns', 'kick', 'karma', 'youare', 'quotes']; var DBot = function(dModules, timers) { - this.admin = 'reality'; - this.waitingForKarma = false; - this.name = 'depressionbot'; + this.config = fs.readFileSync('conf.json', 'utf-8'); + + this.admin = this.config.admin; + this.name = this.config.username; + this.db = JSON.parse(fs.readFileSync('db.json', 'utf-8')); this.timers = timers.create(); + this.waitingForKarma = false; + this.instance = jsbot.createJSBot(this.name, 'elara.ivixor.net', 6667, this, function() { this.instance.join('#42'); this.instance.join('#not42'); this.instance.join('#itonlygetsworse'); - }.bind(this)); this.moduleNames = dModules;