From 4edfe6848c49035574d3c7789cdb1179c0f55215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 6 Sep 2021 21:44:59 +0300 Subject: [PATCH] Updated SIGINT event --- src/client/events/SIGINT.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/client/events/SIGINT.js b/src/client/events/SIGINT.js index 55d2a0b..a63248a 100644 --- a/src/client/events/SIGINT.js +++ b/src/client/events/SIGINT.js @@ -1,23 +1,18 @@ -const { REST } = require('@discordjs/rest'); -const { Routes } = require('discord-api-types/v9'); -const { token, version } = require('../../config.js'); - module.exports = { name: 'SIGINT', - async execute(client) { + execute(client) { client.user.setStatus('dnd'); console.log("\n"); client.funcs.logger("Bot", "Closing"); console.log("\n"); + + client.funcs.saveRadios(client); - setTimeout(async function () { - let message = {}; - - if (!client.stations) return process.exit(); - - await client.funcs.saveRadios(client); - await process.exit(); - }, 5000); + setInterval(() => { + if(client.radio.size == 0){ + process.exit(); + } + }, 500); } } \ No newline at end of file