Update voiceStateUpdate event

This commit is contained in:
Christer Warén 2021-09-16 04:53:15 +03:00
parent 1f4c3a08d0
commit 062a163a11

View File

@ -14,7 +14,7 @@ module.exports = {
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) { if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
if (newState.channel === null) { if (newState.channel === null) {
client.funcs.statisticsUpdate(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');
@ -36,7 +36,7 @@ module.exports = {
1000 1000
); );
} catch (error) { } catch (error) {
client.funcs.statisticsUpdate(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');
@ -55,7 +55,7 @@ module.exports = {
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.size === 1) {
client.funcs.statisticsUpdate(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');