mirror of
https://github.com/musix-org/musix-oss
synced 2024-11-10 08:10:18 +00:00
21 lines
841 B
JavaScript
21 lines
841 B
JavaScript
module.exports = {
|
|
name: 'voiceStateUpdate',
|
|
async execute(client, oldState, newState) {
|
|
const serverQueue = client.queue.get(newState.guild.id);
|
|
if (!serverQueue) return;
|
|
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
|
if (newState.member.voice.channel === null) {
|
|
serverQueue.songs = [];
|
|
serverQueue.looping = false;
|
|
serverQueue.endReason = "manual disconnect";
|
|
return client.queue.delete(newState.guild.id);
|
|
}
|
|
if (newState.member.voice.channel !== serverQueue.voiceChannel) {
|
|
serverQueue.voiceChannel = newState.member.voice.channel;
|
|
serverQueue.connection = newState.connection;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|