Update index.js

This commit is contained in:
Hirzi
2021-07-03 21:36:57 +07:00
committed by GitHub
parent 3f445cc478
commit 726a555b1f
+115 -14
View File
@@ -29,18 +29,25 @@ client.login("ODU5MzA0NzQyOTcwODUxMzI5.YNqv5w.3ZqRw_qTN6seZt_Ue5K9BYJJzs4");
setInterval(() => {
let hosturl = "https://host.itzystore.xyz"
let id = "6154c1cc"
let apikey = "hgQGH3wpNVP98FTxl2PDOmjQLLmz4WBHsDft1HQPcosqPevS"
let ch = client.channels.cache.find(cn => cn.id === '837238424628363294')
//let Client = new node.NodeactylClient(hosturl, apikey);
//const stats = Client.getServerUsages(id);
//const status = (stats.current_state);
let id1 = "6154c1cc"
let name1 = "is-a6"
let id2 = "1151dae7"
let name2 = "is-b1"
let id3 = "6fcc4ff0"
let name3 = "is-b2"
let id4 = "e165f6ba"
let name4 = "is-b3"
let id5 = "899c59c4"
let name5 = "vectorcraft"
let id6 = "0482c8db"
let name6 = "is-ss1"
let id7 = "cfc4c6d4"
let name7 = "is-c1"
const ch = client.channels.cache.get('837238494765645834')
//const msg = ch.messages.cache.get('860438916275240971')
//if(status === 'offline') {
axios(`${hosturl}/api/client/servers/${id}/resources`, {
axios(`${hosturl}/api/client/servers/${id1}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
@@ -49,12 +56,106 @@ axios(`${hosturl}/api/client/servers/${id}/resources`, {
}
})
.then(response => {
ch.send(`Node is online\nTime : ${Date.now()}`).then(m => { m.delete({timeout: 20000}) })
let mn1 = `Node ${name1} is :green_circle: online`
})
.catch(err => {
ch.send(`Node is offline\nTime : ${Date.now()}`).then(m => { m.delete({timeout: 20000}) })
let mn1 = `Node ${name1} is :red_circle: offline`
});
//} else {
//}
axios(`${hosturl}/api/client/servers/${id2}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${apikey}`,
}
})
.then(response => {
let mn2 = `Node ${name2} is :green_circle: online`
})
.catch(err => {
let mn2 = `Node ${name2} is :red_circle: offline`
});
axios(`${hosturl}/api/client/servers/${id3}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${apikey}`,
}
})
.then(response => {
let mn3 = `Node ${name3} is :green_circle: online`
})
.catch(err => {
let mn3 = `Node ${name3} is :red_circle: offline`
});
axios(`${hosturl}/api/client/servers/${id4}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${apikey}`,
}
})
.then(response => {
let mn4 = `Node ${name4} is :green_circle: online`
})
.catch(err => {
let mn4 = `Node ${name4} is :red_circle: offline`
});
axios(`${hosturl}/api/client/servers/${id5}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${apikey}`,
}
})
.then(response => {
let mn5 = `Node ${name5} is :green_circle: online`
})
.catch(err => {
let mn5 = `Node ${name5} is :red_circle: offline`
});
axios(`${hosturl}/api/client/servers/${id6}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${apikey}`,
}
})
.then(response => {
let mn6 = `Node ${name6} is :green_circle: online`
})
.catch(err => {
let mn6 = `Node ${name6} is :red_circle: offline`
});
axios(`${hosturl}/api/client/servers/${id7}/resources`, {
"method": "GET",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${apikey}`,
}
})
.then(response => {
let mn7 = `Node ${name7} is :green_circle: online`
})
.catch(err => {
let mn7 = `Node ${name7} is :red_circle: offline`
});
let nodemessage = `${mn1}\n${mn2}\n${mn3}\n${mn4}\n${mn5}\n${mn6}\n${mn7}`
let embed = new Discord.MessageEmbed()
.setTitle('Node List')
.setDescription(nodemessage)
}, 20000)
ch.send(embed).then(msg => { msg.delete({timeout: 60000}) })
}, 60000)