3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-26 12:42:51 +01:00

fix indentation and stuff

This commit is contained in:
reality 2017-07-18 14:56:01 +00:00
parent 07156b2eb3
commit ec86b6e1a8

View File

@ -18,7 +18,6 @@ var command = function(dbot) {
} }
commandName = commandName.substring(1); commandName = commandName.substring(1);
this.api.hasAccess(event, commandName, function(hasAccess) { this.api.hasAccess(event, commandName, function(hasAccess) {
dbot.api.ignore.isUserIgnoring(event.rUser, commandName, function(isIgnoring) { dbot.api.ignore.isUserIgnoring(event.rUser, commandName, function(isIgnoring) {
dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) { dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) {
@ -73,47 +72,48 @@ var command = function(dbot) {
return; return;
} }
} }
if(this.api.applyRegex(commandName, event)) {
try {
cDomain.run(function() {
var command = dbot.commands[commandName],
results;
if(_.has(command, 'resolver')) {
event.res = [];
command.resolver(event, function(err) {
if(!err) {
results = command.apply(dbot.modules[command.module], [event]);
}
});
} else {
results = command.apply(dbot.modules[command.module], [event]);
}
});
} catch(err) {
if(dbot.config.debugMode == true) {
var stack = err.stack.split('\n').slice(1, dbot.config.debugLevel + 1);
event.reply('- Error in ' + commandName + ':'); if(this.api.applyRegex(commandName, event)) {
event.reply('- Message: ' + err); try {
cDomain.run(function() {
_.each(stack, function(stackLine, index) { var command = dbot.commands[commandName],
event.reply('- Stack[' + index + ']: ' + results;
stackLine.trim()); if(_.has(command, 'resolver')) {
event.res = [];
command.resolver(event, function(err) {
if(!err) {
results = command.apply(dbot.modules[command.module], [event]);
}
}); });
}
}
if(!_.include(['reload', 'load', 'unload', 'setconfig'], commandName)) dbot.api.event.emit('command', [ event ]);
} else {
if(commandName !== this.config.commandPrefix) {
if(_.has(dbot.usage, commandName)) {
event.reply('Usage: ' + dbot.usage[commandName]);
} else { } else {
event.reply(dbot.t('syntax_error')); results = command.apply(dbot.modules[command.module], [event]);
} }
});
} catch(err) {
if(dbot.config.debugMode == true) {
var stack = err.stack.split('\n').slice(1, dbot.config.debugLevel + 1);
event.reply('- Error in ' + commandName + ':');
event.reply('- Message: ' + err);
_.each(stack, function(stackLine, index) {
event.reply('- Stack[' + index + ']: ' +
stackLine.trim());
});
}
}
if(!_.include(['reload', 'load', 'unload', 'setconfig'], commandName)) dbot.api.event.emit('command', [ event ]);
} else {
if(commandName !== this.config.commandPrefix) {
if(_.has(dbot.usage, commandName)) {
event.reply('Usage: ' + dbot.usage[commandName]);
} else {
event.reply(dbot.t('syntax_error'));
} }
} }
} }
}.bind(this)); }
}.bind(this));
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
}.bind(this); }.bind(this);