diff --git a/Indo.md b/Indo.md index dc60b8f..c9e0003 100644 --- a/Indo.md +++ b/Indo.md @@ -1,6 +1,6 @@
## Bahasa / Language
[[Indonesia]](https://github.com/HirziDevs/PteroStats/blob/dev/Indo.md) | [[Inggris]](https://github.com/HirziDevs/PteroStats/blob/dev/README.md)
@@ -10,91 +10,109 @@
## Pengenalan
PteroStats adalah bot yang dirancang untuk memeriksa status panel pterodactyl dan dikirim ke server discord
+## Contoh
+
+
## Instalasi
- - [Mendapatkan apikey dari pterodactyl](#mendapatkan-apikey-dari-pterodactyl)
- - [Membuat Discord Bot](#membuat-discord-bot)
- - [Menginvite Discord Bot](#menginvite-discord-bot)
- - [Mendapatkan Channel ID](#mendapatkan-channel-id)
- - [Memulai Bot](#memulai-bot)
+ 1. [Mendapatkan apikey dari pterodactyl](#mendapatkan-apikey-dari-pterodactyl)
+ 2. [Membuat Discord Bot](#membuat-discord-bot)
+ 3. [Menginvite Discord Bot](#menginvite-discord-bot)
+ 4. [Mendapatkan Channel ID](#mendapatkan-channel-id)
+ 5. [Memulai Bot](#memulai-bot)
+
- [Mengunakan custom emoji](#mengunakan-custom-emoji)
- [Blacklist Nodes](#blacklist-nodes)
### Mendapatkan apikey dari pterodactyl
-- Pergi ke `panel admin pterodactyl` dan pergi ke `Application API`
+1. Pergi ke `panel admin pterodactyl` dan pergi ke `Application API`
- 
+
-- Klik tombol `Create New`
+2. Klik tombol `Create New`
- 
+
-- Set semua permission ke `read` dan untuk description kamu bisa mengisi apa saja
+3. Set semua permission ke `read` dan untuk description kamu bisa mengisi apa saja
- 
+
-- Copy apikey-nya.
+4. Copy apikey-nya.
- 
+
+
+5. Paste panel apikeynya dan panel urlnya di config
+
+
### Membuat Discord Bot
Kalian bisa cek [website ini](https://discordjs.guide/preparations/setting-up-a-bot-application.html)
+Paste bot tokennya di config
+
+
+
### Menginvite Discord Bot
Kalian bisa cek [website ini](https://discordjs.guide/preparations/adding-your-bot-to-servers.html)
### Mendapatkan Channel ID
1. Aktifkan `Developer Mode` di settings discord kamu
- 
+
2. Klik kanan teks channel dan pilih `Copy ID`
- 
+
+
+3. Paste id channelnya di config
+
+
### Memulai Bot
-- Masukan `token` bot discord di `line token` yang terdapat di file `config.yml`
-- Copy `id channel` diserver discord kamu dan masukan ke line `channel` di file `config.yml`
-- Masukan `apikey` dan `url` pterodactyl di `line panel` di file `config.yml`
-- Jalankan command `npm install` di folder yang berisi file bot
-- Jalankan command `node index` dan kamu selesai!
+1. Pastikan kamu telah melakukan semua yang ada diatas
+2. Jalankan command `npm install` di folder yang berisi file bot
+3. Jalankan command `node index` dan kamu selesai!
Jika kamu mendapat masalah bisa dm `Hirzi#8701` didiscord atau join [server support kami](https://discord.gg/zv6maQRah3)
### Mengunakan custom emoji
1. ketik `\` di server yang ada custom emojinya
- 
+
2. Pilih custom emoji yang kamu mau
- 
+
3. Copy textnya!
- 
+
+
+4. Paste id emojinya di config
+
+
### Blacklist Nodes
1. Pilih node yang ada di node list admin page
-
- 
+
+
2. Cek urlnya dan copy id nodenya
- 
+
3. Masukan ke blacklist di config
- 
+
Kamu bisa memasukan lebih dari 1 node untuk di blacklist
-
+
## Permission apikey
-Pilih Aktifkan `read` di semua opsi permission, jika tetap error pilih `read & write` di semua opsi permission
+Jika kamu mengalami error 403 coba aktifkan `read & write` di semua opsi permission
-
+
## Links
diff --git a/README.md b/README.md
index 88d5880..2a46ba9 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## Language / Bahasa
[[English]](https://github.com/HirziDevs/PteroStats/blob/dev/README.md) | [[Indonesia]](https://github.com/HirziDevs/PteroStats/blob/dev/Indo.md)
@@ -10,91 +10,109 @@
## Introduction
PteroStats is a bot designed to check Pterodactyl Panel and Nodes status and post it to your discord server
+## Example
+
+
## Installation
-- [Getting apikey from pterodactyl](#getting-apikey-from-pterodactyl)
-- [Creating Discord Bot](#creating-discord-bot)
-- [Inviting Discord Bot](#inviting-discord-bot)
-- [Getting Channel ID](#getting-channel-id)
-- [Starting bot](#starting-bot)
+1. [Getting apikey from pterodactyl](#getting-apikey-from-pterodactyl)
+2. [Creating Discord Bot](#creating-discord-bot)
+3. [Inviting Discord Bot](#inviting-discord-bot)
+4. [Getting Channel ID](#getting-channel-id)
+5. [Starting bot](#starting-bot)
+
- [Using Custom Emoji](#using-custom-emoji)
- [Blacklist Nodes](#blacklist-nodes)
### Getting apikey from pterodactyl
-- Go to your `pterodactyl admin page` and go to `Application API`.
+1. Go to your `pterodactyl admin page` and go to `Application API`.
- 
+
-- Click on the `Create New` button
+2. Click on the `Create New` button
- 
+
-- Set all options permission to `read` and for description you can put whatever you want
+3. Set all options permission to `read` and for description you can put whatever you want
- 
+
-- Copy the apikey.
+4. Copy the apikey.
- 
+
+
+5. Paste the panel apikey and panel url at the config
+
+
### Creating Discord Bot
Please refer to [this website](https://discordjs.guide/preparations/setting-up-a-bot-application.html)
+Paste the bot token at the config
+
+
+
### Inviting Discord Bot
Please refer to [this website](https://discordjs.guide/preparations/adding-your-bot-to-servers.html)
### Getting Channel ID
1. Enable Developer Feature at your discord settings
- 
+
2. Right Click text channel and select `Copy ID`
- 
+
+
+3. Paste the channel id at the config
+
+
### Starting bot
-- Put discord bot token in `config.yml` at `token line`.
-- Put your pterodactyl `apikey` and `url` in `config.yml` at `panel line`.
-- Copy `channel id` from your discord server and put it in `config.yml` file at `channel line`.
-- Run `npm install` in the root directory of the bot files.
-- Run `node index` and you are done.
+1. Make sure you have done the things above
+2. Run `npm install` in the root directory of the bot files.
+3. Run `node index` and you are done.
if you need help contact me on discord `Hirzi#8701` or join [our discord support server](https://discord.gg/zv6maQRah3)
### Using Custom Emoji
1. type `\` in guild that has custom emoji you want
- 
+
2. Select custom emoji you want
- 
+
3. Copy the text!
- 
+
+
+4. Paste the emoji id at the config
+
+
### Blacklist Nodes
1. Select node from node list on admin page
-
- 
+
+
2. Check the url and copy the node id
- 
+
-3. Add the id to the blacklist on config
+3. Paste the id to the blacklist on config
- 
+
You can add more than one node in the blacklist
-
+
-## Admin Apikey Permission
+## Apikey permission
-enable `read` on all options, if still didn't work enable `read & write` on all options
+If you having issue with 403 error try to enable `read & write` on all options
-
+
## Links
diff --git a/events/ready.js b/events/ready.js
index 234338e..fd993af 100644
--- a/events/ready.js
+++ b/events/ready.js
@@ -5,14 +5,14 @@ module.exports = {
name: 'ready',
once: true,
execute(client) {
- console.log(chalk.cyan('[PteroStats]') + chalk.green(' Bot is up!'))
- console.log(chalk.cyan('[PteroStats]') + chalk.green(' If you need support you can join our discord server https://discord.gg/zv6maQRah3'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.green('Bot is up!'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.green('If you need support you can join our discord server https://discord.gg/zv6maQRah3'))
- if (client.guilds.cache.size < 1) return console.log(chalk.cyan('[PteroStats]') + chalk.red(' There is bot is not in servers, please invite the bot first!'))
+ if (client.guilds.cache.size < 1) return console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! This bot is not on any discord servers'))
if (client.config.bot_status.enable) {
if (!['PLAYING', 'WATCHING', 'LISTENING', 'COMPETING'].includes(client.config.bot_status.type)) {
- console.log('Invalid Status Type!, Can be "WATCHING", "PLAYING", "LISTENING", or "COMPETING"')
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Status Type!, Can be "WATCHING", "PLAYING", "LISTENING", or "COMPETING"'))
} else {
client.user.setActivity(client.config.bot_status.text, { type: client.config.bot_status.type })
}
diff --git a/handlers/checkStatus.js b/handlers/checkStatus.js
index 2f2f53e..06f5b08 100644
--- a/handlers/checkStatus.js
+++ b/handlers/checkStatus.js
@@ -6,17 +6,17 @@ const postStatus = require('./postStatus')
module.exports = function checkStatus(client) {
if (client.config.channel.startsWith('Put')) {
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' Err! Invalid Channel ID'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Channel ID'))
process.exit()
} else if (client.config.panel.url.startsWith('Put')) {
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' Err! Invalid Panel URL'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Panel URL'))
process.exit()
} else if (client.config.panel.key.startsWith('Put')) {
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' Err! Invalid Apikey'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Apikey'))
process.exit()
} else if (!client.config.panel.url.startsWith('http')) {
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' Err! Invalid Panel URL'))
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' 1. Make sure the panel url is starts with "https://" or "http://"'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Panel URL'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('1. Make sure the panel url is starts with "https://" or "http://"'))
process.exit()
}
@@ -30,7 +30,7 @@ module.exports = function checkStatus(client) {
total_users: -1,
}
- console.log(chalk.cyan('[PteroStats]') + chalk.green(' Getting nodes stats'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.green('Getting nodes stats'))
const panelStats = new Promise((resolve, reject) => {
axios(client.config.panel.url + '/api/application/users', {
@@ -58,15 +58,15 @@ module.exports = function checkStatus(client) {
}).catch((err) => {
if (err.response) {
if (err.response.status === 403) {
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' Err! Invalid apikey'))
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' 1. Make sure the apikey is from admin page not account page'))
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' 2. Make sure the apikey has read permission on all options'))
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' 3. Make sure the apikey is exist'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid apikey'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('1. Make sure the apikey is from admin page not account page'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('2. Make sure the apikey has read permission on all options'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('3. Make sure the apikey is exist'))
} else if (err.response.status === 404) {
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' Err! Invalid Panel URL'))
- console.log(chalk.cyan('[PteroStats]') + chalk.red(' 1. Make sure the panel url is like "https://panel.example.com"'))
- } else console.log(chalk.cyan('[PteroStats] ') + err)
- } else console.log(chalk.cyan('[PteroStats] ') + err)
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Panel URL'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.red('1. Make sure the panel url is like "https://panel.example.com"'))
+ } else console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! ' + err))
+ } else console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! ' + err))
resolve()
})
})
diff --git a/handlers/postStatus.js b/handlers/postStatus.js
index c738889..8483e95 100644
--- a/handlers/postStatus.js
+++ b/handlers/postStatus.js
@@ -7,11 +7,11 @@ module.exports = async function postStatus(client, panel, nodes) {
if (!client.config.nodes_resource.blacklist) client.config.nodes_resource.blacklist = []
if (!Array.isArray(client.config.nodes_resource.blacklist) && Number.isInteger(client.config.nodes_resource.blacklist)) client.config.nodes_resource.blacklist = [client.config.nodes_resource.blacklist]
- if (client.guilds.cache.size < 1) return console.log(chalk.cyan('[PteroStats]') + chalk.red(' This bot is not on any discord servers'))
+ if (client.guilds.cache.size < 1) return console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! This bot is not on any discord servers'))
const channel = await client.channels.cache.get(client.config.channel)
- if (!channel) return console.log(chalk.cyan('[PteroStats]') + chalk.red(' Invalid Channel ID'))
+ if (!channel) return console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Channel ID'))
let messages = await channel.messages.fetch({ limit: 10 })
messages = messages.filter(m => m.author.id === client.user.id).last();
@@ -162,6 +162,6 @@ module.exports = async function postStatus(client, panel, nodes) {
if (!messages) channel.send({ embeds: [embed], components: row })
else messages.edit({ embeds: [embed], components: row })
- console.log(chalk.cyan('[PteroStats]') + chalk.green(' Stats posted!'))
+ console.log(chalk.cyan('[PteroStats] ') + chalk.green('Stats posted!'))
})
}
\ No newline at end of file