Initial update to try and fix #1
This commit is contained in:
42
Client/utilities/configHandler.js
Normal file
42
Client/utilities/configHandler.js
Normal file
@@ -0,0 +1,42 @@
|
||||
// Debug
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder.js");
|
||||
const log = new DebugBuilder("client-bot", "configController");
|
||||
// Modules
|
||||
const { readFileSync } = require('fs');
|
||||
const path = require("path");
|
||||
|
||||
exports.getConfig = function getConfig() {
|
||||
return JSON.parse(readFileSync(path.resolve("discord-bot/config/botConfig.json")));
|
||||
}
|
||||
|
||||
exports.getGuildID = function getGuildID() {
|
||||
const parsedJSON = getConfig();
|
||||
const guildID = parsedJSON.GuildID;
|
||||
|
||||
log.DEBUG("Guild ID: ", guildID);
|
||||
return guildID;
|
||||
}
|
||||
|
||||
exports.getApplicationID = function getApplicationID() {
|
||||
const parsedJSON = getConfig();
|
||||
const appID = parsedJSON.ApplicationID;
|
||||
|
||||
log.DEBUG("Application ID: ", appID);
|
||||
return appID;
|
||||
}
|
||||
|
||||
exports.getDeviceID = function getDeviceID(){
|
||||
const parsedJSON = getConfig();
|
||||
const deviceID = parseInt(parsedJSON.DeviceID);
|
||||
|
||||
log.DEBUG("Device ID: ", deviceID);
|
||||
return deviceID;
|
||||
}
|
||||
|
||||
exports.getDeviceName = function getDeviceName(){
|
||||
const parsedJSON = getConfig();
|
||||
const deviceName = parsedJSON.DeviceName;
|
||||
|
||||
log.DEBUG("Device Name: ", deviceName);
|
||||
return deviceName;
|
||||
}
|
||||
Reference in New Issue
Block a user