forked from GitHub/dbot
fix the quote/command correct order thing
This commit is contained in:
parent
52d38aa1e7
commit
6fb7c8e91f
@ -16,7 +16,12 @@ var command = function(dbot) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!_.has(dbot.commands, commandName)) {
|
if(!_.has(dbot.commands, commandName)) {
|
||||||
if(_.has(dbot.modules, 'spelling')) {
|
if(_.has(dbot.modules, 'quotes')) {
|
||||||
|
var key = event.message.substring(1);
|
||||||
|
dbot.api.quotes.getInterpolatedQuote(event.server, event.channel.name, key, function(quote) {
|
||||||
|
if(quote) {
|
||||||
|
event.reply(key + ': ' + quote);
|
||||||
|
} else if(_.has(dbot.modules, 'spelling')) {
|
||||||
var commands = _.keys(dbot.commands)
|
var commands = _.keys(dbot.commands)
|
||||||
winner = false,
|
winner = false,
|
||||||
closestMatch = Infinity;
|
closestMatch = Infinity;
|
||||||
@ -33,11 +38,22 @@ var command = function(dbot) {
|
|||||||
event.reply(commandName + ' not found. Did you mean ' + winner + '?');
|
event.reply(commandName + ' not found. Did you mean ' + winner + '?');
|
||||||
return;
|
return;
|
||||||
} else if(_.has(dbot.modules, 'quotes')) {
|
} else if(_.has(dbot.modules, 'quotes')) {
|
||||||
commandName = '~';
|
dbot.api.link.udLookup(key, function(word, definition) {
|
||||||
|
if(word) {
|
||||||
|
event.reply(key + '[UD]: ' + definition);
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t('category_not_found', { 'category': key }));
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if(_.has(dbot.modules, 'quotes')) {
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(_.has(dbot.modules, 'quotes')) {
|
||||||
commandName = '~';
|
commandName = '~';
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
@ -37,19 +37,9 @@ var commands = function(dbot) {
|
|||||||
this.api.getInterpolatedQuote(event.server, event.channel, key, function(quote) {
|
this.api.getInterpolatedQuote(event.server, event.channel, key, function(quote) {
|
||||||
if(quote) {
|
if(quote) {
|
||||||
event.reply(key + ': ' + quote);
|
event.reply(key + ': ' + quote);
|
||||||
} else {
|
|
||||||
if(this.config.udFallback === true && _.has(dbot.modules, 'link')) {
|
|
||||||
dbot.api.link.udLookup(key, function(word, definition) {
|
|
||||||
if(word) {
|
|
||||||
event.reply(key + '[UD]: ' + definition);
|
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('category_not_found', { 'category': key }));
|
event.reply(dbot.t('category_not_found', { 'category': key }));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} else {
|
|
||||||
event.reply(dbot.t('category_not_found', { 'category': key }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3,6 +3,5 @@
|
|||||||
"dependencies": [ "users", "event" ],
|
"dependencies": [ "users", "event" ],
|
||||||
"rmLimit": 10,
|
"rmLimit": 10,
|
||||||
"ignorable": true,
|
"ignorable": true,
|
||||||
"quotesOnJoin": false,
|
"quotesOnJoin": false
|
||||||
"udFallback": false
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user