3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00

change spelling correction order in command ~

This commit is contained in:
Luke Slater 2012-03-06 14:44:38 +00:00
parent 23bd691927
commit dfb17dc107

20
run.js
View File

@ -114,6 +114,15 @@ DBot.prototype.reloadModules = function() {
} else { } else {
var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2); var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2);
if(q) { if(q) {
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 {
// See if it's similar to anything // See if it's similar to anything
var winnerDistance = Infinity; var winnerDistance = Infinity;
var winner = false; var winner = false;
@ -127,17 +136,6 @@ DBot.prototype.reloadModules = function() {
if(winnerDistance < 3) { if(winnerDistance < 3) {
this.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!'); 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.');
} 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]);
} }
} }
} }