From 820dfd9d8a12cffc4274e503992a9e3613e6692e Mon Sep 17 00:00:00 2001 From: hirzidevs Date: Fri, 13 Sep 2024 19:52:39 +0700 Subject: [PATCH] refactor: rename installer to setup --- README.md | 4 ++-- handlers/{installer.js => setup.js} | 8 ++++---- index.js | 2 +- config.js => setup.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename handlers/{installer.js => setup.js} (96%) rename config.js => setup.js (93%) diff --git a/README.md b/README.md index 0ee218b..69bf81a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ PteroStats is a Discord App/Bot that designed to check Pterodactyl or Pelican Pa 4. Run `npm install` in the root directory of the app/bot files. 5. Run `node index` and answer the provided questions to set up the app/bot. - Installer + Setup - [Getting Panel API Key](#getting-panel-api-key) - [Getting a Channel ID](#getting-channel-id) @@ -44,7 +44,7 @@ PteroStats is a Discord App/Bot that designed to check Pterodactyl or Pelican Pa Console Logging ### Changing Env Configuration -1. Run `node config` in the root directory of the app/bot files. +1. Run `node setup` in the root directory of the app/bot files. 2. Enter `2` to change configuration. Change Configuration diff --git a/handlers/installer.js b/handlers/setup.js similarity index 96% rename from handlers/installer.js rename to handlers/setup.js index ff70ac1..78a88d8 100644 --- a/handlers/installer.js +++ b/handlers/setup.js @@ -26,7 +26,7 @@ const isValidURL = (url) => { } }; -module.exports = function Installer() { +module.exports = function Setup() { console.log(cliColor.cyanBright("Welcome to PteroStats!")) console.log(cliColor.yellow("Please fill in the following credentials to set up the app.\n ")); @@ -81,12 +81,12 @@ module.exports = function Installer() { require("./app.js")() }).catch(() => { console.log(cliColor.redBright("❌ Invalid Channel ID.")); - console.log(" \n" + cliColor.redBright("Please run the installer again and fill in the correct credentials.")); + console.log(" \n" + cliColor.redBright("Please run the setup again and fill in the correct credentials.")); process.exit() }) }).catch(() => { console.log(cliColor.redBright("❌ Invalid Discord Bot Token.")); - console.log(" \n" + cliColor.redBright("Please run the installer again and fill in the correct credentials.")); + console.log(" \n" + cliColor.redBright("Please run the setup again and fill in the correct credentials.")); process.exit() }) }).catch((error) => { @@ -118,7 +118,7 @@ module.exports = function Installer() { } else { console.log(cliColor.cyanBright("[PteroStats] ") + cliColor.redBright(`Unexpected error: ${error.message}`)); } - console.log(" \n" + cliColor.redBright("Please run the installer again and fill in the correct credentials.")); + console.log(" \n" + cliColor.redBright("Please run the setup again and fill in the correct credentials.")); process.exit() }) } diff --git a/index.js b/index.js index 6a5d066..f8dead1 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,6 @@ console.log( ` \n \n${package.description}\n ` ); -if (!fs.existsSync(".env")) return require("./handlers/installer.js")(); +if (!fs.existsSync(".env")) return require("./handlers/setup.js")(); require("./handlers/app.js")(); \ No newline at end of file diff --git a/config.js b/setup.js similarity index 93% rename from config.js rename to setup.js index ee1c62c..f5d2c94 100644 --- a/config.js +++ b/setup.js @@ -22,7 +22,7 @@ console.log( ` \n \n${package.description}\n ` ); -if (!fs.existsSync(".env")) return require("./handlers/installer.js")(); +if (!fs.existsSync(".env")) return require("./handlers/setup.js")(); console.log(cliColor.yellowBright( "Configuration is already set. Please select one of the following options:\n \n" + @@ -35,7 +35,7 @@ readline.question('> ', async (answer) => { switch(answer) { case '2': - require('./handlers/installer.js')(); + require('./handlers/setup.js')(); break; case '1': require('./handlers/app.js')();