From 65f83bc5222c22488139a69e6f6ddd91f8edb110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 2 Sep 2021 17:57:37 +0300 Subject: [PATCH] Updated SIGINT event --- src/client/events/SIGINT.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/events/SIGINT.js b/src/client/events/SIGINT.js index ec06265..6186db3 100644 --- a/src/client/events/SIGINT.js +++ b/src/client/events/SIGINT.js @@ -11,15 +11,13 @@ module.exports = { let currentRadios = client.radio.keys(); let radio = currentRadios.next(); - let stoppedRadios = ""; - client.user.setStatus('idle'); while (!radio.done) { - let currentRadio = await client.radio.get(radio.value); - currentRadio.guild = await client.datastore.getEntry(radio.value).guild; + let currentRadio = client.radio.get(radio.value); + currentRadio.guild = client.datastore.getEntry(radio.value).guild; if (currentRadio) { - await client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio); + client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio); currentRadio.connection?.destroy(); currentRadio.audioPlayer?.stop(); currentRadio.message?.delete(); @@ -33,7 +31,7 @@ module.exports = { client.radio.delete(radio.value); } - radio = await currentRadios.next(); + radio = currentRadios.next(); } @@ -44,9 +42,11 @@ module.exports = { client.user.setStatus('dnd'); - setTimeout(function () { - process.exit(); - }, 5000); + setInterval(() => { + if(radio.done){ + process.exit(); + } + }, 1000); }, 5000); } } \ No newline at end of file