From 2607ce1e9307062708528aabfa811b3eb502c212 Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 20 Jan 2013 15:49:31 +0000 Subject: [PATCH] create getcurrentconfigpath for use by other commands --- modules/admin/commands.js | 64 +++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/modules/admin/commands.js b/modules/admin/commands.js index 5ab67f9..51e371e 100644 --- a/modules/admin/commands.js +++ b/modules/admin/commands.js @@ -4,6 +4,29 @@ var fs = require('fs'), exec = require('child_process').exec; var commands = function(dbot) { + var getCurrentConfigPath = function(configKey) { + var configKey = configKey.split('.'); + + defaultConfigPath = dbot.config; + userConfigPath = dbot.db.config; + for(var i=0;i " + newOption); - userConfigPath[configItem] = newOption; + event.reply(configPathString + ": " + currentOption + " -> " + newOption); + userConfigPath[configKey] = newOption; dbot.reloadModules(); } }; @@ -196,6 +213,7 @@ var commands = function(dbot) { commands['reload'].access = 'admin'; commands['unload'].access = 'admin'; commands['load'].access = 'admin'; + commands['setconfig'].access = 'admin'; commands['join'].access = 'moderator'; commands['part'].access = 'moderator'; commands['opme'].access = 'moderator';