mirror of
https://github.com/HirziDevs/PteroStats
synced 2026-01-09 15:44:01 +00:00
FIx bot only show 1 nodes
This commit is contained in:
@@ -80,7 +80,7 @@ module.exports = function checkStatus(client) {
|
||||
Authorization: 'Bearer ' + client.config.panel.key
|
||||
}
|
||||
}).then((res) => {
|
||||
res.data.data.forEach((node) => {
|
||||
res.data.data.forEach((node, i) => {
|
||||
axios(client.config.panel.url + '/api/application/nodes/' + node.attributes.id + '/configuration', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
@@ -120,7 +120,7 @@ module.exports = function checkStatus(client) {
|
||||
})
|
||||
stats.then(() => {
|
||||
nodes.push(body)
|
||||
resolve()
|
||||
if (i + 1 === res.data.data.length) resolve()
|
||||
})
|
||||
}).catch((err) => {
|
||||
resolve()
|
||||
|
||||
@@ -6,6 +6,7 @@ module.exports = async function postStatus(client, panel, nodes) {
|
||||
if (!client.config.nodes_resource) client.config.nodes_resource = client.config.resource
|
||||
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 (!['mb', 'gb', 'percent'].includes(client.config.nodes_resource.unit)) return console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! Invalid Unit at nodes_resource'))
|
||||
|
||||
if (client.guilds.cache.size < 1) return console.log(chalk.cyan('[PteroStats] ') + chalk.red('Err! This bot is not on any discord servers'))
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"axios": "^0.27.2",
|
||||
"chalk": "4.1.1",
|
||||
"discord.js": "^13.8.0",
|
||||
"discord.js": "^13.8.1",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16.x"
|
||||
"node": "^16.x"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user