From 726a555b1fab4b5cfefb3856b30b3de634146edf Mon Sep 17 00:00:00 2001 From: Hirzi <64255651+HirziDevs@users.noreply.github.com> Date: Sat, 3 Jul 2021 21:36:57 +0700 Subject: [PATCH] Update index.js --- index.js | 129 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 115 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index 601afd7..418c888 100644 --- a/index.js +++ b/index.js @@ -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)