Individaul server config set up
This commit is contained in:
23
config.js
23
config.js
@@ -1,7 +1,7 @@
|
||||
const fs = require("fs");
|
||||
|
||||
var config = {};
|
||||
var rules = {};
|
||||
var servers = {};
|
||||
|
||||
module.exports.getconfig = function() {
|
||||
return config;
|
||||
@@ -11,6 +11,21 @@ module.exports.setconfig = function(con) {
|
||||
config = con;
|
||||
};
|
||||
|
||||
module.exports.getservers = function() {
|
||||
return servers;
|
||||
};
|
||||
|
||||
module.exports.setservers = function(con) {
|
||||
servers = con;
|
||||
};
|
||||
|
||||
module.exports.addServer = function(guild) {
|
||||
servers[guild.id] = {
|
||||
name: guild.name,
|
||||
rules: []
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.loadDefaults = function() {
|
||||
config = {
|
||||
Token: "DISCORD_TOKEN",
|
||||
@@ -19,12 +34,18 @@ module.exports.loadDefaults = function() {
|
||||
Version: "2.0.1",
|
||||
};
|
||||
|
||||
servers['SERVER ID'] = {
|
||||
name: 'SERVER NAME',
|
||||
rules: ['RULE 0', 'RULE 1']
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.loadFromFile = function() {
|
||||
config = JSON.parse(fs.readFileSync("resources/config.json"));
|
||||
servers = JSON.parse(fs.readFileSync("resources/servers.json"));
|
||||
}
|
||||
|
||||
module.exports.writeToFile = function() {
|
||||
fs.writeFileSync("resources/config.json", JSON.stringify(config, null, 4));
|
||||
fs.writeFileSync("resources/servers.json", JSON.stringify(servers, null, 4));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user