diff --git a/.gitignore b/.gitignore index 1a7610d..a49c313 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Ignore the user config files -config.json +./config.json # Ignore the user database db.json diff --git a/modules/admin/config.json b/modules/admin/config.json new file mode 100644 index 0000000..e1a07bb --- /dev/null +++ b/modules/admin/config.json @@ -0,0 +1,3 @@ +{ + "dbKeys": [ "bans", "locks" ] +} diff --git a/modules/kick/config.json b/modules/kick/config.json new file mode 100644 index 0000000..10e1e76 --- /dev/null +++ b/modules/kick/config.json @@ -0,0 +1,3 @@ +{ + "dbKeys": [ "kicks", "kickers" ] +} diff --git a/modules/quotes/config.json b/modules/quotes/config.json new file mode 100644 index 0000000..32c3324 --- /dev/null +++ b/modules/quotes/config.json @@ -0,0 +1,3 @@ +{ + "dbKeys": [ "quoteArrs" ] +} diff --git a/modules/web/config.json b/modules/web/config.json new file mode 100644 index 0000000..981e0f7 --- /dev/null +++ b/modules/web/config.json @@ -0,0 +1,4 @@ +{ + "webHost": "localhost", + "webPort": 8080 +} diff --git a/run.js b/run.js index e1b5f6e..661e3d7 100644 --- a/run.js +++ b/run.js @@ -23,35 +23,6 @@ var DBot = function(timers) { this.db = {}; } - // Repair any deficiencies in the DB; if this is a new DB, that's everything - if(!this.db.hasOwnProperty("bans")) { - this.db.bans = {}; - } - if(!this.db.bans.hasOwnProperty("*")) { - this.db.bans["*"] = []; - } - if(!this.db.hasOwnProperty("quoteArrs")) { - this.db.quoteArrs = {}; - } - if(!this.db.hasOwnProperty("kicks")) { - this.db.kicks = {}; - } - if(!this.db.hasOwnProperty("kickers")) { - this.db.kickers = {}; - } - if(!this.db.hasOwnProperty("modehate")) { - this.db.modehate = []; - } - if(!this.db.hasOwnProperty("locks")) { - this.db.locks = []; - } - if(!this.db.hasOwnProperty("ignores")) { - this.db.ignores = {}; - } - if(!this.db.hasOwnProperty('polls')) { - this.db.polls = {}; - } - // Load Strings file try { this.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8')); @@ -236,6 +207,19 @@ DBot.prototype.reloadModules = function() { // Invalid or no string info } + // Load the module config data + try { + var config = JSON.parse(fs.readFileSync(moduleDir + 'config.json', 'utf-8')) + this.config[name] = config; + for(var i=0;i