diff --git a/config.json.sample b/config.json.sample index e982e5e..bd5e443 100644 --- a/config.json.sample +++ b/config.json.sample @@ -16,5 +16,6 @@ "moduleNames": [ "ignore", "admin", "command", "dice", "js", "kick", "quotes", "spelling", "youare", "timers", "stats", "users", "link" ], "language": "en", "debugMode": false, + "debugLevel": 1, "version": "Depressionbot IRC bot 0.4-dev - Lovingly crafted by The DepressionBot Foundation (a charity arm of the Official Aberystwyth Open Source International Development League)." } diff --git a/modules/admin/commands.js b/modules/admin/commands.js index 8657957..2680b40 100644 --- a/modules/admin/commands.js +++ b/modules/admin/commands.js @@ -115,7 +115,6 @@ var commands = function(dbot) { }.bind(this)); }, - 'status': function(event) { var moduleName = event.params[1]; if(_.has(dbot.status, moduleName)) { @@ -207,6 +206,11 @@ var commands = function(dbot) { newOption = (newOption == "true"); } + // Convert to integer type is config item integer + if(_.isNumber(currentOption)) { + newOption = parseInt(newOption); + } + if(_.isArray(currentOption)) { event.reply(dbot.t("config_array",{"alternate": "pushconfig"})); } diff --git a/modules/command/command.js b/modules/command/command.js index 670f5e3..776299c 100644 --- a/modules/command/command.js +++ b/modules/command/command.js @@ -40,9 +40,15 @@ var command = function(dbot) { } } 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); - event.reply('- Top of stack: ' + err.stack.split('\n')[1].trim()); + + _.each(stack, function(stackLine, index) { + event.reply('- Stack[' + index + ']: ' + + stackLine.trim()); + }); } } dbot.save(); diff --git a/modules/stats b/modules/stats index e5519f3..500a21d 160000 --- a/modules/stats +++ b/modules/stats @@ -1 +1 @@ -Subproject commit e5519f353abf00e4ec25702f8e02231c9b1f5258 +Subproject commit 500a21d78b8882eb206598011ab3a5f30e7113b6 diff --git a/run.js b/run.js index fa584e7..b42e4e6 100644 --- a/run.js +++ b/run.js @@ -279,7 +279,7 @@ DBot.prototype.reloadModules = function() { this.modules[module.name] = module; } catch(err) { - console.log(this.t('module_load_error', {'moduleName': name})); + console.log(this.t('module_load_error', { 'moduleName': name })); this.status[name] = err + ' - ' + err.stack.split('\n')[1].trim(); if(this.config.debugMode) { console.log('MODULE ERROR (' + name + '): ' + err.stack );