diff options
author | destruc7i0n <6181960+destruc7i0n@users.noreply.github.com> | 2021-12-24 17:51:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-24 17:51:26 -0500 |
commit | 328eec0cd4fff00f19e734cc7e9b54124ab44cf5 (patch) | |
tree | 3a36a0884f2d280ced7fedefffef4ad08574deed /src/Shulker.ts | |
parent | check if channel is valid on launch (diff) | |
download | shulker-328eec0cd4fff00f19e734cc7e9b54124ab44cf5.tar.gz shulker-328eec0cd4fff00f19e734cc7e9b54124ab44cf5.zip |
updated to discord.js v13 (#77)
* updated to discord.js v13 * update loading of config * updated debug lines * rcon cleanup * more code cleanup * bump version * message about node.js requirement Co-authored-by: destruc7i0n <destruc7i0n@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r-- | src/Shulker.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Shulker.ts b/src/Shulker.ts index 4c79c78..df635ad 100644 --- a/src/Shulker.ts +++ b/src/Shulker.ts @@ -1,3 +1,6 @@ +import path from 'path' +import fs from 'fs' + import DiscordClient from './Discord' import Handler, { LogLine } from './MinecraftHandler' @@ -12,10 +15,16 @@ class Shulker { } loadConfig () { - const configFile = (process.argv.length > 2) ? process.argv[2] : '../config.json' + const configFile = process.argv.length > 2 ? process.argv[2] : './config.json' + if (!fs.existsSync(configFile)) { + console.log('[ERROR] Could not find config file!') + return false + } console.log('[INFO] Using configuration file:', configFile) - this.config = require(configFile) - if (!this.config) { + + try { + this.config = JSON.parse(fs.readFileSync(configFile, 'utf8')) + } catch (e) { console.log('[ERROR] Could not load config file!') return false } |