forked from GitHub/dbot
not in all messages..
This commit is contained in:
parent
e1047362a2
commit
f3e31925af
28
run.js
28
run.js
@ -108,22 +108,22 @@ DBot.prototype.reloadModules = function() {
|
||||
this.save();
|
||||
}
|
||||
} else {
|
||||
// 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;
|
||||
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
|
||||
var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2);
|
||||
if(q) {
|
||||
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.');
|
||||
|
Loading…
Reference in New Issue
Block a user