Changing method of exporting to use functions locally

This commit is contained in:
Logan Cusano
2023-03-26 20:26:09 -04:00
parent 6c294fe803
commit 030953f692

View File

@@ -5,38 +5,43 @@ const log = new DebugBuilder("client-bot", "configController");
const { readFileSync } = require('fs');
const path = require("path");
exports.getConfig = function getConfig() {
function getConfig() {
return JSON.parse(readFileSync(path.resolve("discord-bot/config/botConfig.json")));
}
exports.getConfig = getConfig;
exports.getGuildID = function getGuildID() {
const parsedJSON = this.getConfig();
function getGuildID() {
const parsedJSON = getConfig();
const guildID = parsedJSON.GuildID;
log.DEBUG("Guild ID: ", guildID);
return guildID;
}
exports.getGuildID = getGuildID;
exports.getApplicationID = function getApplicationID() {
const parsedJSON = this.getConfig();
function getApplicationID() {
const parsedJSON = getConfig();
const appID = parsedJSON.ApplicationID;
log.DEBUG("Application ID: ", appID);
return appID;
}
exports.getApplicationID = getApplicationID;
exports.getDeviceID = function getDeviceID(){
const parsedJSON = this.getConfig();
function getDeviceID(){
const parsedJSON = getConfig();
const deviceID = parseInt(parsedJSON.DeviceID);
log.DEBUG("Device ID: ", deviceID);
return deviceID;
}
exports.getDeviceID = getDeviceID;
exports.getDeviceName = function getDeviceName(){
const parsedJSON = this.getConfig();
function getDeviceName(){
const parsedJSON = getConfig();
const deviceName = parsedJSON.DeviceName;
log.DEBUG("Device Name: ", deviceName);
return deviceName;
}
}
exports.getDeviceName = getDeviceID;