Updated SIGINT event

This commit is contained in:
Christer Warén 2021-09-02 17:37:07 +03:00
parent 46237fd91e
commit 74239f71a7

View File

@ -3,7 +3,8 @@ import Discord from "discord.js";
module.exports = { module.exports = {
name: 'SIGINT', name: 'SIGINT',
async execute(client) { async execute(client) {
/*setTimeout(function () { setTimeout(async function () {
client.user.setStatus('idle');
let message = {}; let message = {};
if (!client.stations) return process.exit(); if (!client.stations) return process.exit();
@ -14,12 +15,11 @@ module.exports = {
client.user.setStatus('idle'); client.user.setStatus('idle');
while (!radio.done) { while (!radio.done) {
let currentRadio = await client.radio.get(radio.value);
let currentRadio = client.radio.get(radio.value); currentRadio.guild = await client.datastore.getEntry(radio.value).guild;
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
if (currentRadio) { if (currentRadio) {
client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio); await client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
currentRadio.connection?.destroy(); currentRadio.connection?.destroy();
currentRadio.audioPlayer?.stop(); currentRadio.audioPlayer?.stop();
currentRadio.message?.delete(); currentRadio.message?.delete();
@ -31,16 +31,22 @@ module.exports = {
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
currentRadio.textChannel.send({ embeds: [cembed] }); currentRadio.textChannel.send({ embeds: [cembed] });
client.radio.delete(radio.value); client.radio.delete(radio.value);
stoppedRadios += "-" + radio.value + ": " + currentRadio.guild.name + "\n";
} }
radio = currentRadios.next();
radio = await currentRadios.next();
} }
console.log("\n"); console.log("\n");
client.funcs.logger("Bot", "Closing"); client.funcs.logger("Bot", "Closing");
console.log("\n");*/ console.log("\n");
client.user.setStatus('dnd');
setTimeout(function () {
process.exit(); process.exit();
/*}, 5000);*/ }, 5000);
}, 5000);
} }
} }