From 9c439e0a622a75f1f619f2ed5fa478590ea14ac4 Mon Sep 17 00:00:00 2001 From: Hirzi Date: Mon, 4 Nov 2024 06:20:46 +0700 Subject: [PATCH] docs: improve readme and guide --- README.md | 42 ++++++++++-------------- guide/changing-env-configuration.md | 10 +++--- guide/channel-id.md | 1 + guide/custom-emoji.md | 1 + guide/{ => installation}/docker.md | 0 guide/installation/egg.md | 44 +++++++++++++++++++++++++ guide/installation/manual.md | 34 ++++++++++++++++++++ guide/notifier.md | 5 ++- guide/panel-api-key.md | 1 + pterostats-egg.json | 50 +++++++++++++++++++++++++++++ 10 files changed, 156 insertions(+), 32 deletions(-) rename guide/{ => installation}/docker.md (100%) create mode 100644 guide/installation/egg.md create mode 100644 guide/installation/manual.md create mode 100644 pterostats-egg.json diff --git a/README.md b/README.md index b078a7e..72cbf0d 100644 --- a/README.md +++ b/README.md @@ -7,49 +7,41 @@ ## Introduction + PteroStats is a Discord App/Bot designed to check Pterodactyl or Pelican Panel stats and post it to your Discord server. -## Preview -PteroStats Setup Preview -PteroStats Image Preview -PteroStats Console Preview +PteroStats Image Preview + +## Installation + +> Node.js 18 or newer is required. + +1. [Create your Discord App/Bot](https://discordjs.guide/preparations/setting-up-a-bot-application). +2. [Invite your Discord App/Bot to your Discord server](https://discordjs.guide/preparations/adding-your-bot-to-servers.html). +3. Choose installation method. + - [Using egg (Recomended)](https://github.com/HirziDevs/PteroStats/blob/main/guide/installation/egg.md) + - [Manual](https://github.com/HirziDevs/PteroStats/blob/main/guide/installation/manual.md) + - [Using docker](https://github.com/HirziDevs/PteroStats/blob/main/guide/installation/docker.md) ## Guide -- [Starting the App/Bot](#starting-the-appbot) - [Changing Env Configuration](https://github.com/HirziDevs/PteroStats/blob/main/guide/changing-env-configuration.md) - [How to get Panel API key](https://github.com/HirziDevs/PteroStats/blob/main/guide/panel-api-key.md) - [How to get Channel ID](https://github.com/HirziDevs/PteroStats/blob/main/guide/channel-id.md) - [How to use Custom Emoji](https://github.com/HirziDevs/PteroStats/blob/main/guide/custom-emoji.md) - [Blacklist Nodes](https://github.com/HirziDevs/PteroStats/blob/main/guide/blacklist-nodes.md) -- [Notifier](https://github.com/HirziDevs/PteroStats/blob/main/guide/notifier.md) -- [Docker](https://github.com/HirziDevs/PteroStats/blob/main/guide/docker.md) - -### Starting the App/Bot -1. [Create your Discord App/Bot](https://discordjs.guide/preparations/setting-up-a-bot-application). -2. [Invite your Discord App/Bot to your Discord server](https://discordjs.guide/preparations/adding-your-bot-to-servers.html). -3. Download this repository: - - Manually: [Download this repository](https://github.com/HirziDevs/PteroStats/archive/refs/heads/main.zip) and extract it. - - Using GIT: Run `git clone https://github.com/HirziDevs/PteroStats.git` in the command line. -4. Run `npm install` in the root directory of the app/bot files. -5. Run `node index.js` and answer the prompted questions to set up the app/bot. - - Setup - - - [How to get Panel API key](https://github.com/HirziDevs/PteroStats/blob/main/guide/panel-api-key.md) - - [How to get Channel ID](https://github.com/HirziDevs/PteroStats/blob/main/guide/channel-id.md) - -6. Run `node index.js` if you want to start the app/bot again, and you're done! - - Console Logging +- [Notifier (Discord Webhook)](https://github.com/HirziDevs/PteroStats/blob/main/guide/notifier.md) ## Reporting a Bug Enable `log_error` in the `config.yml` file and check the console for the error message. Please also send the `logs.txt` file created by the bot, which contains information that will help with the bug report. After that, report it to our Discord server at [Support Server](https://discord.znproject.my.id). ## Links + ### Support Server + - [Discord](https://discord.znproject.my.id) ### Pterodactyl & Pelican Panel server + Please do not ask about PteroStats here. - [Pterodactyl Discord Server](https://discord.gg/pterodactyl) - [Pelican Discord Server](https://discord.gg/pelican-panel) \ No newline at end of file diff --git a/guide/changing-env-configuration.md b/guide/changing-env-configuration.md index 2a2774f..45322cd 100644 --- a/guide/changing-env-configuration.md +++ b/guide/changing-env-configuration.md @@ -1,15 +1,13 @@ ## Changing Env Configuration + > [!TIP] > You can change other configuration at the `config.yml` file. 1. Delete `.setup-complete` file in the root directory of the app/bot files. -2. Run `node index.js` and answer the prompted questions to set up the app/bot. + +2. Restart the server and answer the prompted questions to set up the app/bot. Setup - [How to get Panel API key](https://github.com/HirziDevs/PteroStats/blob/main/guide/panel-api-key.md) - - [How to get Channel ID](https://github.com/HirziDevs/PteroStats/blob/main/guide/channel-id.md) - -3. Run `node index.js` if you want to start the app/bot again, and you're done! - - Console Logging \ No newline at end of file + - [How to get Channel ID](https://github.com/HirziDevs/PteroStats/blob/main/guide/channel-id.md) \ No newline at end of file diff --git a/guide/channel-id.md b/guide/channel-id.md index 229c536..f3b9d19 100644 --- a/guide/channel-id.md +++ b/guide/channel-id.md @@ -1,4 +1,5 @@ ## Channel ID + 1. Enable Developer Mode in your Discord settings. Discord User Settings diff --git a/guide/custom-emoji.md b/guide/custom-emoji.md index 586ef3b..4fca97e 100644 --- a/guide/custom-emoji.md +++ b/guide/custom-emoji.md @@ -1,4 +1,5 @@ ## Custom Emoji + 1. Type `\` in the server that has the custom emoji you want. Type \ on the chat diff --git a/guide/docker.md b/guide/installation/docker.md similarity index 100% rename from guide/docker.md rename to guide/installation/docker.md diff --git a/guide/installation/egg.md b/guide/installation/egg.md new file mode 100644 index 0000000..a3bdc75 --- /dev/null +++ b/guide/installation/egg.md @@ -0,0 +1,44 @@ +## Using PteroStats Egg + +1. Download and import [`pterostats-egg.json`](https://raw.githubusercontent.com/hirzidevs/pterostats/main/pterostats-egg.json) egg to your panel. + + - Pterodactyl Panel + + Add pterostats egg to pterodactyl panel + + - Pelican Panel (From File) + + Add pterostats egg to pelican panel (From File) + + - Pelican Panel (From URL) + + Add pterostats egg to pelican panel (From URL) + +2. Create a server and use the egg. + + - Pterodactyl Panel + + Create a server and use the pterostats egg in pterodactyl panel + + - Pelican Panel + + Create a server and use the pterostats egg in pelican panel + +3. Finish the server creation process and wait until server installation is completed. + +4. Start the server. + + Start the server + +5. Answer the prompted questions in the console to set up the app/bot. + + Setup + + - [How to get Panel API key](https://github.com/HirziDevs/PteroStats/blob/main/guide/panel-api-key.md) + - [How to get Channel ID](https://github.com/HirziDevs/PteroStats/blob/main/guide/channel-id.md) + +## Links + +### Support Server + +- [Discord](https://discord.znproject.my.id) \ No newline at end of file diff --git a/guide/installation/manual.md b/guide/installation/manual.md new file mode 100644 index 0000000..3ecce94 --- /dev/null +++ b/guide/installation/manual.md @@ -0,0 +1,34 @@ +## Manual + +1. Download this repository: + + - Manually: [Download this repository](https://github.com/HirziDevs/PteroStats/archive/refs/heads/main.zip) and extract it. + + - Using GIT: Run `git clone https://github.com/HirziDevs/PteroStats.git` in the command line. + +2. Install required dependencies and start the app/bot. + + - Using PM2 ([Why use PM2?](https://discordjs.guide/improving-dev-environment/pm2.html)) + + 1. Run `npm install` in the root directory of the app/bot files. + + 2. Install PM2 using `npm install -g pm2` command. + + 2. Run `pm2 start index.js -n PteroStats` to start the app/bot. + + - Using [nodejs-generic](https://github.com/pelican-eggs/generic/tree/main/nodejs) egg + + 1. Just start the server to start the app/bot. + +3. Answer the prompted questions in the console to set up the app/bot. + + Setup + + - [How to get Panel API key](https://github.com/HirziDevs/PteroStats/blob/main/guide/panel-api-key.md) + - [How to get Channel ID](https://github.com/HirziDevs/PteroStats/blob/main/guide/channel-id.md) + +## Links + +### Support Server + +- [Discord](https://discord.znproject.my.id) \ No newline at end of file diff --git a/guide/notifier.md b/guide/notifier.md index fec6db9..6c2592d 100644 --- a/guide/notifier.md +++ b/guide/notifier.md @@ -1,15 +1,18 @@ -## Notifier +## Notifier (Discord Webhook) + Get a notification on Discord when your panel or specific nodes are currently down. Notifier Preview ### Enabling Notifier + Open `config.yml` and set `enable` at the notifier configuration to `true` Notifier Config ### Getting Discord Webhook URL + 1. Go to the channel settings of the channel you want to set for the notifier. Notifier Config diff --git a/guide/panel-api-key.md b/guide/panel-api-key.md index 2203d28..d37f87d 100644 --- a/guide/panel-api-key.md +++ b/guide/panel-api-key.md @@ -1,4 +1,5 @@ ## Panel API Key + > [!WARNING] > The use of Application API keys is **deprecated**; you should use **Client API keys**. diff --git a/pterostats-egg.json b/pterostats-egg.json new file mode 100644 index 0000000..46361c0 --- /dev/null +++ b/pterostats-egg.json @@ -0,0 +1,50 @@ +{ + "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PANEL", + "meta": { + "version": "PTDL_v2", + "update_url": "https:\/\/raw.githubusercontent.com\/hirzidevs\/pterostats\/main\/pterostats-egg.json" + }, + "exported_at": "2024-11-03T23:00:50+00:00", + "name": "PteroStats", + "author": "hello@lezetho.co.uk", + "uuid": "0428b22c-0027-4014-8852-481f31342781", + "description": "a generic node.js egg\r\n\r\nThis will clone a git repo. it defaults to master if no branch is specified.\r\n\r\nInstalls the node_modules on install. If you set user_upload then I assume you know what you are doing.", + "features": [], + "docker_images": { + "NodeJS 21": "ghcr.io\/parkervcp\/yolks:nodejs_21", + "NodeJS 20": "ghcr.io\/parkervcp\/yolks:nodejs_20", + "NodeJS 19": "ghcr.io\/parkervcp\/yolks:nodejs_19", + "NodeJS 18": "ghcr.io\/parkervcp\/yolks:nodejs_18" + }, + "file_denylist": [], + "startup": "npm install && \/usr\/local\/bin\/node \"\/home\/container\/index.js\" ${NODE_ARGS}", + "config": { + "files": "{}", + "startup": "{\r\n \"done\": [\r\n \"PteroStats installed.\"\r\n ]\r\n}", + "logs": "{}", + "stop": "^C" + }, + "scripts": { + "installation": { + "script": "#!\/bin\/bash\r\n# PteroStats Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y git curl jq file unzip make gcc g++ python3 python3-dev python3-pip libtool\r\n\r\necho -e \"Updating npm. please wait...\"\r\nnpm install npm@latest --location=global\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\ngit clone https:\/\/github.com\/HirziDevs\/PteroStats.git .\/\r\n\r\necho \"Installing nodejs packages\"\r\nif [[ ! -z ${NODE_PACKAGES} ]]; then\r\n \/usr\/local\/bin\/npm install ${NODE_PACKAGES}\r\nfi\r\n\r\nif [ -f \/mnt\/server\/package.json ]; then\r\n \/usr\/local\/bin\/npm install --production\r\nfi\r\n\r\necho -e \"Install completed\"\r\nexit 0", + "container": "node:18-bookworm-slim", + "entrypoint": "bash" + } + }, + "variables": [ + { + "name": "Additional Arguments.", + "description": "Any extra arguments to execute.", + "env_variable": "NODE_ARGS", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": [ + "nullable", + "string", + "max:64" + ], + "sort": 1 + } + ] +} \ No newline at end of file