From 0af926928a292212ddad67704a008870716039d7 Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 Date: Thu, 22 Aug 2024 13:50:44 -0400 Subject: [PATCH] Copy settings if they are not present --- index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 99f4061..b0e3503 100755 --- a/index.js +++ b/index.js @@ -1,9 +1,19 @@ -const m = require('minecraft-protocol') -const settings = require('./settings.json') -const generateUser = require('./util/usergen.js') -const EventEmitter = require('node:events') const fs = require('fs') +if (!fs.readdirSync('.').includes('settings.json')) { + console.log("Settings file is missing, using defaults.") + fs.copyFileSync("settings_example.json", "settings.json") +} + +if (!fs.readdirSync('.').includes('secret.json')) { + console.log("Secrets file is missing, using defaults.") + fs.copyFileSync("secret_example.json", "secret.json") +} + +const m = require('minecraft-protocol') +const generateUser = require('./util/usergen.js') +const EventEmitter = require('node:events') +const settings = require('./settings.json') module.exports.bot = [] const botplug = []