3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-18 00:22:35 +01:00

Add int handling for setconfig, add debugLevel [#307]

This commit is contained in:
reality 2013-04-30 16:44:39 +00:00
parent 856d106f8b
commit 2afb1c6ba3
5 changed files with 15 additions and 4 deletions

View File

@ -16,5 +16,6 @@
"moduleNames": [ "ignore", "admin", "command", "dice", "js", "kick", "quotes", "spelling", "youare", "timers", "stats", "users", "link" ], "moduleNames": [ "ignore", "admin", "command", "dice", "js", "kick", "quotes", "spelling", "youare", "timers", "stats", "users", "link" ],
"language": "en", "language": "en",
"debugMode": false, "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)." "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)."
} }

View File

@ -115,7 +115,6 @@ var commands = function(dbot) {
}.bind(this)); }.bind(this));
}, },
'status': function(event) { 'status': function(event) {
var moduleName = event.params[1]; var moduleName = event.params[1];
if(_.has(dbot.status, moduleName)) { if(_.has(dbot.status, moduleName)) {
@ -207,6 +206,11 @@ var commands = function(dbot) {
newOption = (newOption == "true"); newOption = (newOption == "true");
} }
// Convert to integer type is config item integer
if(_.isNumber(currentOption)) {
newOption = parseInt(newOption);
}
if(_.isArray(currentOption)) { if(_.isArray(currentOption)) {
event.reply(dbot.t("config_array",{"alternate": "pushconfig"})); event.reply(dbot.t("config_array",{"alternate": "pushconfig"}));
} }

View File

@ -40,9 +40,15 @@ var command = function(dbot) {
} }
} catch(err) { } catch(err) {
if(dbot.config.debugMode == true) { if(dbot.config.debugMode == true) {
var stack = err.stack.split('\n').slice(1, dbot.config.debugLevel + 1);
event.reply('- Error in ' + commandName + ':'); event.reply('- Error in ' + commandName + ':');
event.reply('- Message: ' + err); 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(); dbot.save();

@ -1 +1 @@
Subproject commit e5519f353abf00e4ec25702f8e02231c9b1f5258 Subproject commit 500a21d78b8882eb206598011ab3a5f30e7113b6