Files
DRB-CnC/Client/discord-bot/utilities/configHandler.js
Logan Cusano c8c75e8b37 Allow the client to interact with the discord bot
- The client can now interact with the bot, this allows the client to offer bot controls via API
- The master server will now be able to instruct a specific client to join a specific channel via channel ID (master server function coming soon)
- Suppress some debug statements to make the output easier to read when mixed in with the client debug output
2022-12-18 20:31:54 -05:00

50 lines
1.2 KiB
JavaScript

// Debug
import ModuleDebugBuilder from "./moduleDebugBuilder.js";
const log = new ModuleDebugBuilder("bot", "configHandler");
// Modules
import { readFileSync } from 'fs';
import path from "path";
export function getConfig() {
return JSON.parse(readFileSync(path.resolve("discord-bot/config/botConfig.json")));
}
export function getTOKEN() {
const parsedJSON = getConfig();
const token = parsedJSON.TOKEN;
log.DEBUG("Discord API Token: ", token)
return token;
}
export function getGuildID() {
const parsedJSON = getConfig();
const guildID = parsedJSON.GuildID;
log.DEBUG("Guild ID: ", guildID);
return guildID;
}
export function getApplicationID() {
const parsedJSON = getConfig();
const appID = parsedJSON.ApplicationID;
log.DEBUG("Application ID: ", appID);
return appID;
}
export function getDeviceID(){
const parsedJSON = getConfig();
const deviceID = parseInt(parsedJSON.DeviceID);
log.DEBUG("Device ID: ", deviceID);
return deviceID;
}
export function getDeviceName(){
const parsedJSON = getConfig();
const deviceName = parsedJSON.DeviceName;
log.DEBUG("Device Name: ", deviceName);
return deviceName;
}