mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
set some config options not allowed to be changes [#145]
This commit is contained in:
parent
0a2b81c0d6
commit
2f05cba960
@ -4,6 +4,8 @@ var fs = require('fs'),
|
||||
exec = require('child_process').exec;
|
||||
|
||||
var commands = function(dbot) {
|
||||
var noChangeConfig = [ 'servers', 'name', 'moduleNames' ];
|
||||
|
||||
var getCurrentConfigPath = function(configKey) {
|
||||
var defaultConfigPath = dbot.config;
|
||||
var userConfigPath = dbot.db.config;
|
||||
@ -183,6 +185,7 @@ var commands = function(dbot) {
|
||||
var configKey = _.last(configPathString.split('.'));
|
||||
var newOption = event.params[2];
|
||||
|
||||
if(!_.include(noChangeConfig, configKey)) {
|
||||
var configPath = getCurrentConfigPath(configPathString);
|
||||
var currentOption;
|
||||
if(_.has(configPath['user'], configKey)) {
|
||||
@ -208,6 +211,9 @@ var commands = function(dbot) {
|
||||
event.reply(configPathString + ": " + currentOption + " -> " + newOption);
|
||||
configPath['user'][configKey] = newOption;
|
||||
dbot.reloadModules();
|
||||
} else {
|
||||
event.reply("This config option cannot be altered while the bot is running.");
|
||||
}
|
||||
},
|
||||
|
||||
'showconfig': function(event) {
|
||||
|
Loading…
Reference in New Issue
Block a user