forked from GitHub/dbot
Merge git://github.com/reality/depressionbot
This commit is contained in:
commit
fbab79c567
@ -59,7 +59,21 @@ var drama = function(dbot) {
|
||||
|
||||
'listener': function(data) {
|
||||
var category = bayes.classify(data.message, function(category) {
|
||||
console.log(category + '!');
|
||||
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));
|
||||
|
||||
if(last.hasOwnProperty(data.channel)) {
|
||||
|
44
run.js
44
run.js
@ -140,30 +140,28 @@ DBot.prototype.reloadModules = function() {
|
||||
} else {
|
||||
var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2);
|
||||
if(q) {
|
||||
// See if it's similar to anything
|
||||
var winnerDistance = Infinity;
|
||||
var winner = false;
|
||||
for(var commandName in this.commands) {
|
||||
var distance = String.prototype.distance(params[0], commandName);
|
||||
if(distance < winnerDistance) {
|
||||
winner = commandName;
|
||||
winnerDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
if(winnerDistance < 3) {
|
||||
this.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!');
|
||||
} else { // See if there's anything in quotes
|
||||
if(this.db.bans['*'].include(data.user)) {
|
||||
this.say(data.channel, data.user +
|
||||
' is banned from using this command. Commence incineration.');
|
||||
if(this.db.bans['*'].include(data.user)) {
|
||||
this.say(data.channel, data.user +
|
||||
' is banned from using this command. Commence incineration.');
|
||||
} else {
|
||||
q[1] = q[1].trim();
|
||||
key = this.cleanNick(q[1])
|
||||
if(this.db.quoteArrs.hasOwnProperty(key)) {
|
||||
this.say(data.channel, q[1] + ': ' + this.db.quoteArrs[key].random());
|
||||
} else {
|
||||
q[1] = q[1].trim();
|
||||
key = this.cleanNick(q[1])
|
||||
if(this.db.quoteArrs.hasOwnProperty(key)) {
|
||||
this.say(data.channel, q[1] + ': ' + this.db.quoteArrs[key].random());
|
||||
} else {
|
||||
this.say(data.channel, 'Nobody loves ' + q[1]);
|
||||
// See if it's similar to anything
|
||||
var winnerDistance = Infinity;
|
||||
var winner = false;
|
||||
for(var commandName in this.commands) {
|
||||
var distance = String.prototype.distance(params[0], commandName);
|
||||
if(distance < winnerDistance) {
|
||||
winner = commandName;
|
||||
winnerDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
if(winnerDistance < 3) {
|
||||
this.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user