This commit is contained in:
Luke Slater 2011-10-31 17:07:14 +00:00
parent 8a959a62b8
commit e0dee27658
4 changed files with 8 additions and 26 deletions

View File

@ -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);
};

View File

@ -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);

View File

@ -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);

11
run.js
View File

@ -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;