mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 03:13:20 +00:00
Update voiceStateUpdate.js
This commit is contained in:
parent
20f038f23c
commit
30e8da52d7
@ -1,6 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'voiceStateUpdate',
|
name: 'voiceStateUpdate',
|
||||||
async execute(client, oldState, newState) {
|
async execute(client, oldState, newState) {
|
||||||
|
console.log('voicesateupate')
|
||||||
let change = false;
|
let change = false;
|
||||||
const radio = client.radio.get(newState.guild.id);
|
const radio = client.radio.get(newState.guild.id);
|
||||||
if (!radio) return;
|
if (!radio) return;
|
||||||
@ -19,13 +20,16 @@ module.exports = {
|
|||||||
if (oldState.channel === null) return;
|
if (oldState.channel === null) return;
|
||||||
if (oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel || change) {
|
if (oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel || change) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
console.log('timeout')
|
||||||
if (!radio) return;
|
if (!radio) return;
|
||||||
if (radio.voiceChannel.members.size === 1) {
|
if (radio.voiceChannel.members.size === 1) {
|
||||||
radio.songs = [];
|
radio.songs = [];
|
||||||
radio.looping = false;
|
radio.looping = false;
|
||||||
radio.connection.dispatcher.destroy();
|
radio.connection.dispatcher.destroy();
|
||||||
|
radio.voiceChannel.leave();
|
||||||
|
client.radio.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
}, 12000);
|
}, 1200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user