usage info in command

This commit is contained in:
Luke Slater 2012-12-11 20:31:11 +00:00
parent f72e29398f
commit b641dcd34a

View File

@ -56,10 +56,9 @@ var command = function(dbot) {
'commands': { 'commands': {
'~usage': function(event) { '~usage': function(event) {
var commandName = event.params[1]; var commandName = event.params[1];
console.log(commandName); if(dbot.usage.hasOwnProperty(commandName)) {
if(dbot.commands.hasOwnProperty(commandName)) {
event.reply('Usage for ' + commandName + ': ' + event.reply('Usage for ' + commandName + ': ' +
dbot.commands[commandName].usage); dbot.usage[commandName]);
} else { } else {
event.reply('No usage information for ' + commandName); event.reply('No usage information for ' + commandName);
} }
@ -84,8 +83,8 @@ var command = function(dbot) {
dbot.save(); dbot.save();
} else { } else {
if(commandName !== '~') { if(commandName !== '~') {
if(dbot.commands[commandName].hasOwnProperty('usage')){ if(dbot.usage.hasOwnProperty(commandName)){
event.reply('Usage: ' + dbot.commands[commandName].usage); event.reply('Usage: ' + dbot.usage[commandName]);
} else { } else {
event.reply(dbot.t('syntax_error')); event.reply(dbot.t('syntax_error'));
} }