Add check for status url

This commit is contained in:
Christopher Cookman 2024-06-18 21:59:06 -06:00
parent ab70230a1a
commit 1431419167
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -749,14 +749,16 @@ dcClient.on('ready', async () => {
}) })
}, config.status.interval * 1000); }, config.status.interval * 1000);
const start = Date.now(); const start = Date.now();
axios.get("https://discord.com/api/gateway").then((result) => { if (config.status?.url) {
const latency = Date.now() - start; axios.get("https://discord.com/api/gateway").then((result) => {
axios.get(config.status.url + `?status=up&msg=OK&ping=${latency}`).then((result) => { const latency = Date.now() - start;
//sendLog(`${colors.cyan("[INFO]")} Sent ping to Uptime Kuma`); axios.get(config.status.url + `?status=up&msg=OK&ping=${latency}`).then((result) => {
}).catch((error) => { //sendLog(`${colors.cyan("[INFO]")} Sent ping to Uptime Kuma`);
sendLog(`${colors.red("[ERROR]")} Error sending ping ${error}`); }).catch((error) => {
}); sendLog(`${colors.red("[ERROR]")} Error sending ping ${error}`);
}) });
})
}
// Start doing SSH stuff // Start doing SSH stuff
sendLog(`${colors.cyan("[INFO]")} Starting SSH connection`); sendLog(`${colors.cyan("[INFO]")} Starting SSH connection`);