Update voiceStateUpdate event

This commit is contained in:
Christer Warén 2021-09-16 19:43:19 +03:00
parent 7757788f99
commit ead52decf2

View File

@ -51,17 +51,17 @@ module.exports = {
//radio.connection = await newState.channel.join(); //radio.connection = await newState.channel.join();
} }
} }
if ((oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel) || change) { if ((oldState.channel.members.filter(member => !member.user.bot).size === 0 && oldState.channel === radio.voiceChannel) || change) {
setTimeout(() => { setTimeout(() => {
if (!radio || !radio.connection || !radio.connection === null) return; if (!radio || !radio.connection || !radio.connection === null) return;
if (radio.voiceChannel.members.size === 1) { if (radio.voiceChannel.members.filter(member => !member.user.bot).size === 0) {
client.statistics.update(client, newState.guild, radio); client.statistics.update(client, newState.guild, radio);
radio.connection?.destroy(); radio.connection?.destroy();
radio.message?.delete(); radio.message?.delete();
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop'); client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
client.radio.delete(newState.guild.id); client.radio.delete(newState.guild.id);
} }
}, 60000); }, 5000);
} }
}, },
}; };