Made it clearer how to run the bot yourself, and changed some formatting in the json
diff --git a/src/config/format.js b/src/config/format.js
new file mode 100644
index 0000000..f87c9f7
--- /dev/null
+++ b/src/config/format.js
@@ -0,0 +1,96 @@
+import fs from 'fs';
+import * as readLine from 'node:readline/promises';
+import { exec } from 'node:child_process';
+
+const defaultDict = {
+ "token": "Your bot token",
+ "developmentToken": "Your development bot token",
+ "managementGuildID": "Your management guild ID",
+ "developmentGuildID": "Your development guild ID",
+ "enableDevelopment": true,
+ "owners": [],
+ "verifySecret": "If using verify, enter a code here which matches your website if needed",
+ "mongoUrl": "Your Mongo connection string, e.g. mongodb://127.0.0.1:27017",
+ "baseUrl": "Your website where buttons such as Verify will link to, e.g. https://example.com",
+ "pastebinApiKey": "An API key for pastebin (optional)",
+ "pastebinUsername": "Your pastebin username (optional)",
+ "pastebinPassword": "Your pastebin password (optional)",
+}
+
+const readline = readLine.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+});
+
+async function getInput(prompt) {
+ process.stdout.write(prompt);
+
+ const answer = await readline.question(prompt);
+ return answer.toString();
+}
+
+
+export default async function(walkthrough = false) {
+ if (walkthrough) {
+ console.log("\x1b[33m🛈 Entering walkthrough mode for any missing values.");
+ console.log(" \x1b[2mIf you don't want to enter a value, just hit enter.\x1b[0m\n");
+
+ // let toUse = await getInput("\x1b[36m[Installing packages] Use Yarn or NPM? \x1b[0m(\x1b[32my\x1b[0m/\x1b[31mN\x1b[0m) > ");
+ // toUse = toUse.toLowerCase() === "y" ? "yarn install" : "npm i";
+ // if ((await getInput(`\x1b[36m[Installing packages] Run ${toUse}? \x1b[0m(\x1b[32mY\x1b[0m/\x1b[31mn\x1b[0m) > `)).toLowerCase() !== "n") {
+ // console.log(`\x1b[32m[Installing packages] Running ${toUse}...\x1b[0m`);
+ // await exec(toUse);
+ // console.log(`\x1b[32m[Installing packages] Installed\x1b[0m`);
+ // } else {
+ // console.log("\x1b[32m[Installing packages] Skipping...\x1b[0m");
+ // }
+ }
+
+ let json;
+ let out = true
+ try {
+ json = JSON.parse(fs.readFileSync('./src/config/main.json', 'utf8'));
+ } catch (e) {
+ console.log("\x1b[31mâš No main.json found, creating one.")
+ console.log(" \x1b[2mYou can edit src/config/main.json directly using template written to the file.\x1b[0m\n")
+ out = false
+ json = {}
+ }
+ for (const key in defaultDict) {
+ if (!json[key]) {
+ if (walkthrough) {
+ switch (key) {
+ case "enableDevelopment": {
+ json[key] = (await getInput("\x1b[36mEnable development mode? \x1b[0m(\x1b[32mY\x1b[0m/\x1b[31mn\x1b[0m) > ") || "Y").toLowerCase() === "y"; break;
+ } case "owners": {
+ let chosen = "!";
+ let toWrite = []
+ while (chosen !== "") {
+ chosen = await getInput("\x1b[36mEnter an owner ID \x1b[0m(\x1b[35mleave blank to finish\x1b[0m) > ");
+ if (chosen !== "") { toWrite.push(chosen); }
+ }
+ json[key] = toWrite; break;
+ } default: {
+ json[key] = await getInput(`\x1b[36m${key} \x1b[0m(\x1b[35m${defaultDict[key]}\x1b[0m) > `);
+ }
+ }
+ }
+ else { json[key] = defaultDict[key] }
+ }
+ }
+ if (!json.mongoUrl.endsWith("/")) json.mongoUrl += "/";
+ if (!json.baseUrl.endsWith("/")) json.baseUrl += "/";
+ let hosts = fs.readFileSync('/etc/hosts', 'utf8').toString().split("\n");
+ let localhost = hosts.find(line => line.split(" ")[1] === "localhost");
+ if (localhost) { localhost = localhost.split(" ")[0]; }
+ else { localhost = "127.0.0.1" }
+ json.mongoUrl = json.mongoUrl.replace("localhost", localhost);
+ json.baseUrl = json.baseUrl.replace("localhost", localhost);
+
+ fs.writeFileSync("./src/config/main.json", JSON.stringify(json, null, 4))
+
+ if (walkthrough) {
+ console.log("\x1b[32m✓ All properties added.\x1b[0m")
+ }
+ return out;
+}