docs: improve readme and guide

This commit is contained in:
Hirzi
2024-11-04 06:20:46 +07:00
parent 7d3493ff0c
commit 9c439e0a62
10 changed files with 156 additions and 32 deletions

View File

@@ -7,49 +7,41 @@
</div> </div>
## Introduction ## Introduction
PteroStats is a Discord App/Bot designed to check Pterodactyl or Pelican Panel stats and post it to your Discord server. PteroStats is a Discord App/Bot designed to check Pterodactyl or Pelican Panel stats and post it to your Discord server.
## Preview <img alt="PteroStats Image Preview" src="https://usercontent.catto.pictures/hirzi/e6f6fe6a-8c0e-4c7a-8b73-d4af752324f4.png" width="300"/>
<img alt="PteroStats Setup Preview" src="https://usercontent.catto.pictures/hirzi/b8645828-591d-4d52-b6d8-51f8df60440c.png" width="300" style="margin-right: 20px;"/>
<img alt="PteroStats Image Preview" src="https://usercontent.catto.pictures/hirzi/e6f6fe6a-8c0e-4c7a-8b73-d4af752324f4.png" width="300" style="margin-right: 20px;"/> ## Installation
<img alt="PteroStats Console Preview" src="https://usercontent.catto.pictures/hirzi/8ce3aac6-5c46-4626-bd14-af994b602f8e.png" width="300"/>
> 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 ## Guide
- [Starting the App/Bot](#starting-the-appbot)
- [Changing Env Configuration](https://github.com/HirziDevs/PteroStats/blob/main/guide/changing-env-configuration.md) - [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 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 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) - [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) - [Blacklist Nodes](https://github.com/HirziDevs/PteroStats/blob/main/guide/blacklist-nodes.md)
- [Notifier](https://github.com/HirziDevs/PteroStats/blob/main/guide/notifier.md) - [Notifier (Discord Webhook)](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.
<img alt="Setup" src="https://usercontent.catto.pictures/hirzi/b8645828-591d-4d52-b6d8-51f8df60440c.png" width="300"/>
- [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!
<img alt="Console Logging" src="https://usercontent.catto.pictures/hirzi/8ce3aac6-5c46-4626-bd14-af994b602f8e.png" width="300"/>
## Reporting a Bug ## 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). 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 ## Links
### Support Server ### Support Server
- [Discord](https://discord.znproject.my.id) - [Discord](https://discord.znproject.my.id)
### Pterodactyl & Pelican Panel server ### Pterodactyl & Pelican Panel server
Please do not ask about PteroStats here. Please do not ask about PteroStats here.
- [Pterodactyl Discord Server](https://discord.gg/pterodactyl) - [Pterodactyl Discord Server](https://discord.gg/pterodactyl)
- [Pelican Discord Server](https://discord.gg/pelican-panel) - [Pelican Discord Server](https://discord.gg/pelican-panel)

View File

@@ -1,15 +1,13 @@
## Changing Env Configuration ## Changing Env Configuration
> [!TIP] > [!TIP]
> You can change other configuration at the `config.yml` file. > You can change other configuration at the `config.yml` file.
1. Delete `.setup-complete` file in the root directory of the app/bot files. 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.
<img alt="Setup" src="https://usercontent.catto.pictures/hirzi/b8645828-591d-4d52-b6d8-51f8df60440c.png" width="300"/> <img alt="Setup" src="https://usercontent.catto.pictures/hirzi/b8645828-591d-4d52-b6d8-51f8df60440c.png" width="300"/>
- [How to get Panel API key](https://github.com/HirziDevs/PteroStats/blob/main/guide/panel-api-key.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 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!
<img alt="Console Logging" src="https://usercontent.catto.pictures/hirzi/8ce3aac6-5c46-4626-bd14-af994b602f8e.png" width="300"/>

View File

@@ -1,4 +1,5 @@
## Channel ID ## Channel ID
1. Enable Developer Mode in your Discord settings. 1. Enable Developer Mode in your Discord settings.
<img alt="Discord User Settings" src="https://usercontent.catto.pictures/hirzi/36894499-b141-488f-98ed-40245c8f6862.png" width="400"/> <img alt="Discord User Settings" src="https://usercontent.catto.pictures/hirzi/36894499-b141-488f-98ed-40245c8f6862.png" width="400"/>

View File

@@ -1,4 +1,5 @@
## Custom Emoji ## Custom Emoji
1. Type `\` in the server that has the custom emoji you want. 1. Type `\` in the server that has the custom emoji you want.
<img alt="Type \ on the chat" src="https://usercontent.catto.pictures/hirzi/2e3c821f-92f9-4b5c-863a-e020b2fbc426.png" width="350"/> <img alt="Type \ on the chat" src="https://usercontent.catto.pictures/hirzi/2e3c821f-92f9-4b5c-863a-e020b2fbc426.png" width="350"/>

44
guide/installation/egg.md Normal file
View File

@@ -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
<img alt="Add pterostats egg to pterodactyl panel" src="https://usercontent.catto.pictures/hirzi/78c212c1-cb2d-4dcb-b987-5a817e33fc05.png" width="300"/>
- Pelican Panel (From File)
<img alt="Add pterostats egg to pelican panel (From File)" src="https://usercontent.catto.pictures/hirzi/7feb28b3-5111-4a5b-83aa-37da29c58d4d.png" width="300"/>
- Pelican Panel (From URL)
<img alt="Add pterostats egg to pelican panel (From URL)" src="https://usercontent.catto.pictures/hirzi/ffcb138f-b489-43b1-a81d-aca0b26394e5.png" width="300"/>
2. Create a server and use the egg.
- Pterodactyl Panel
<img alt="Create a server and use the pterostats egg in pterodactyl panel" src="https://usercontent.catto.pictures/hirzi/5d2f87ac-6e77-4362-8b7c-8a9955f94fa3.png" width="300"/>
- Pelican Panel
<img alt="Create a server and use the pterostats egg in pelican panel" src="https://usercontent.catto.pictures/hirzi/1ca15f64-53b7-4343-97a4-f1808f1fecae.png" width="300"/>
3. Finish the server creation process and wait until server installation is completed.
4. Start the server.
<img alt="Start the server" src="https://usercontent.catto.pictures/hirzi/0918ecf9-bae3-401e-9810-05839c401405.png" width="300"/>
5. Answer the prompted questions in the console to set up the app/bot.
<img alt="Setup" src="https://usercontent.catto.pictures/hirzi/b8645828-591d-4d52-b6d8-51f8df60440c.png" width="300"/>
- [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)

View File

@@ -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.
<img alt="Setup" src="https://usercontent.catto.pictures/hirzi/b8645828-591d-4d52-b6d8-51f8df60440c.png" width="300"/>
- [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)

View File

@@ -1,15 +1,18 @@
## Notifier ## Notifier (Discord Webhook)
Get a notification on Discord when your panel or specific nodes are currently down. Get a notification on Discord when your panel or specific nodes are currently down.
<img alt="Notifier Preview" src="https://usercontent.catto.pictures/hirzi/a2b8e36f-7448-4849-a14a-b1eb4ec8fb26.png" width="250"/> <img alt="Notifier Preview" src="https://usercontent.catto.pictures/hirzi/a2b8e36f-7448-4849-a14a-b1eb4ec8fb26.png" width="250"/>
### Enabling Notifier ### Enabling Notifier
Open `config.yml` and set `enable` at the notifier configuration to `true` Open `config.yml` and set `enable` at the notifier configuration to `true`
<img alt="Notifier Config" src="https://usercontent.catto.pictures/hirzi/b4c3f1d0-e053-402c-8401-4de44926fce6.png" width="300"/> <img alt="Notifier Config" src="https://usercontent.catto.pictures/hirzi/b4c3f1d0-e053-402c-8401-4de44926fce6.png" width="300"/>
### Getting Discord Webhook URL ### Getting Discord Webhook URL
1. Go to the channel settings of the channel you want to set for the notifier. 1. Go to the channel settings of the channel you want to set for the notifier.
<img alt="Notifier Config" src="https://usercontent.catto.pictures/hirzi/7d7712b9-d9ac-4650-83ac-21dc3f20c3fe.png" width="300"/> <img alt="Notifier Config" src="https://usercontent.catto.pictures/hirzi/7d7712b9-d9ac-4650-83ac-21dc3f20c3fe.png" width="300"/>

View File

@@ -1,4 +1,5 @@
## Panel API Key ## Panel API Key
> [!WARNING] > [!WARNING]
> The use of Application API keys is **deprecated**; you should use **Client API keys**. > The use of Application API keys is **deprecated**; you should use **Client API keys**.

50
pterostats-egg.json Normal file
View File

@@ -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
}
]
}