mirror of
https://github.com/HirziDevs/PteroStats
synced 2026-02-03 19:42:41 +00:00
Update ready.js
This commit is contained in:
148
events/ready.js
148
events/ready.js
@@ -5,7 +5,6 @@ const axios = require('axios');
|
||||
const db = require('quick.db');
|
||||
const ping = require('ping-tcp-js');
|
||||
const chalk = require('chalk');
|
||||
const node = require('nodeactyl');
|
||||
const config = require('../config.json');
|
||||
|
||||
setInterval(() => {
|
||||
@@ -25,26 +24,12 @@ let statusoffline = config.monline
|
||||
let adminapikey = config.adminapikey
|
||||
let hostname = config.hostname
|
||||
|
||||
let id1 = "6154c1cc"
|
||||
let name1 = "**Node IS-A6**"
|
||||
let id2 = "1151dae7"
|
||||
let name2 = "**Node IS-B1**"
|
||||
let id3 = "6fcc4ff0"
|
||||
let name3 = "**Node IS-B2**"
|
||||
let id4 = "e165f6ba"
|
||||
let name4 = "**Node IS-B5**"
|
||||
let id5 = "899c59c4"
|
||||
let name5 = "**Node VectorCraft**"
|
||||
let id6 = "0482c8db"
|
||||
let name6 = "**Node IS-SS1**"
|
||||
let id7 = "cfc4c6d4"
|
||||
let name7 = "**Node IS-C1**"
|
||||
let id8 = "3e96a95b"
|
||||
let name8 = "**Node IS-C2**"
|
||||
let id1 = "Server ID"
|
||||
let name1 = "**Node Name**"
|
||||
|
||||
let dbip1 = "47.241.176.6"
|
||||
let dbport1 = "3306"
|
||||
let dbname1 = "**MariaDB**"
|
||||
let dbip1 = "Database Ip"
|
||||
let dbport1 = "Database Port"
|
||||
let dbname1 = "**Example DB**"
|
||||
|
||||
|
||||
//Node Status Checker
|
||||
@@ -62,111 +47,6 @@ axios(`${hosturl}/api/client/servers/${id1}/resources`, {
|
||||
.catch(err => {
|
||||
db.set("mn1",`${name1}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id2}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn2",`${name2}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn2",`${name2}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id3}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn3",`${name3}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn3",`${name3}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id4}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn4",`${name4}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn4",`${name4}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id5}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn5",`${name5}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn5",`${name5}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id6}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn6",`${name6}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn6",`${name6}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id7}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn7",`${name7}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn7",`${name7}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
axios(`${hosturl}/api/client/servers/${id8}/resources`, {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${apikey}`,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
db.set("mn8",`${name8}: ${statusonline}`)
|
||||
})
|
||||
.catch(err => {
|
||||
db.set("mn8",`${name8}: ${statusoffline}`)
|
||||
});
|
||||
|
||||
//Database Status Checker
|
||||
ping.ping(dbip1, dbport1)
|
||||
@@ -180,25 +60,11 @@ ping.ping(dbip1, dbport1)
|
||||
//Embed Message
|
||||
let mn1 = db.get("mn1")
|
||||
if(mn1 === null) mn1 = `${name1}: checking status`
|
||||
let mn2 = db.get("mn2")
|
||||
if(mn2 === null) mn2 = `${name2}: checking status`
|
||||
let mn3 = db.get("mn3")
|
||||
if(mn3 === null) mn3 = `${name3}: checking status`
|
||||
let mn4 = db.get("mn4")
|
||||
if(mn4 === null) mn4 = `${name4}: checking status`
|
||||
let mn5 = db.get("mn5")
|
||||
if(mn5 === null) mn5 = `${name5}: checking status`
|
||||
let mn6 = db.get("mn6")
|
||||
if(mn6 === null) mn6 = `${name6}: checking status`
|
||||
let mn7 = db.get("mn7")
|
||||
if(mn7 === null) mn7 = `${name7}: checking status`
|
||||
let mn8 = db.get("mn8")
|
||||
if(mn8 === null) mn8 = `${name8}: checking status`
|
||||
|
||||
|
||||
let db1 = db.get("db1")
|
||||
if(db1 === null) db1 = `${dbname1}: checking status`
|
||||
|
||||
let nodemessage = `__**Nodes List**__\n${mn1}\n${mn2}\n${mn3}\n${mn4}\n${mn5}\n${mn6}\n${mn7}\n${mn8}\n\n__**DataBases List**__\n${db1}`
|
||||
let nodemessage = `__**Nodes List**__\n${mn1}\n\n__**DataBases List**__\n${db1}`
|
||||
let embed = new MessageEmbed()
|
||||
.setTitle(`${hostname} Uptime`)
|
||||
.setColor(config.embedcolor)
|
||||
|
||||
Reference in New Issue
Block a user