refactor!: change enable at nodes_settings to details and add status at panel_settings to enable or disable panel status field

This commit is contained in:
Hirzi
2023-01-02 13:15:40 +00:00
parent e03c0daf2f
commit 46c94908df
3 changed files with 4 additions and 10 deletions

View File

@@ -65,7 +65,7 @@ status:
# How to get nodes id: https://github.com/HirziDevs/PteroStats#blacklist-nodes
nodes_settings:
blacklist: [] # You can add node id to remove the node from status embed (Example: "blacklist: [1]")
enable: false
details: false # enable nodes details like memory and disk
servers: true
location: true
allocations: true
@@ -73,6 +73,7 @@ nodes_settings:
# Panel Users and Servers Settings
panel_settings:
status: true # enable panel stats under nodes stats
servers: true
users: true

View File

@@ -22,13 +22,6 @@ module.exports = {
client.config.refresh = 10
}
if (client.config.bot_status || client.config.nodes_resource || client.config.panel_resource) {
console.log(chalk.cyan('[PteroStats] ') + chalk.red('You used `bot_status`, `panel_resource` and `nodes_resource` instead of `presence`, `panel_settings` and `nodes_settings` in the config, please update your config file at ') + chalk.green('https://github.com/HirziDevs/PteroStats/blob/main/config.yml ') + chalk.red('before it can no longer be supported'))
client.config.presence = client.config.bot_status
client.config.nodes_settings = client.config.nodes_resource
client.config.panel_settings = client.config.panel_resource
}
if (client.config.presence.text && client.config.presence.type) {
switch (client.config.presence.type.toLowerCase()) {
case 'playing':

View File

@@ -68,7 +68,7 @@ module.exports = async function postStatus({ client, panel, nodes }) {
description = description + '\n```'
if (client.config.nodes_settings.enable) {
if (client.config.nodes_settings.details) {
text = text + '\n**' + title.replace(':', ':**') + '\n' + description
} else {
text = text + '\n**' + title.replace(':', ':**')
@@ -102,7 +102,7 @@ module.exports = async function postStatus({ client, panel, nodes }) {
embed.setDescription(desc.replaceAll('{{time}}', format) + '\n**Nodes Stats [' + Math.floor(nodes.length - blacklist) + ']**' + text)
const EmbedFields = []
if (client.config.panel_settings.users || client.config.panel_settings.servers) {
if (client.config.panel_settings.status) {
let stats = '**Status:** ' + String(panel.status).replace('true', client.config.status.online).replace('false', client.config.status.offline) + '\n\n'
if (client.config.panel_settings.users) stats = stats + 'Users: ' + String(panel.total_users).replace('-1', '`Unknown`') + '\n'