mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-22 22:43:17 +00:00
Update voiceStateUpdate.js
This commit is contained in:
parent
f1184c6e0d
commit
035173b6cc
@ -12,16 +12,11 @@ module.exports = {
|
||||
return client.radio.delete(newState.guild.id);
|
||||
}
|
||||
|
||||
if (newState.channel !== radio.voiceChannel) {
|
||||
change = true;
|
||||
radio.voiceChannel = newState.channel;
|
||||
radio.connection = newState.connection;
|
||||
}
|
||||
const newPermissions = newState.channel.permissionsFor(newState.client.user);
|
||||
if (!newPermissions.has('CONNECT') || !newPermissions.has('SPEAK') || !newPermissions.has('VIEW_CHANNEL')) {
|
||||
try {
|
||||
const connection = await oldState.channel.join();
|
||||
radio.connection = connection;
|
||||
return radio.connection = connection;
|
||||
} catch (error) {
|
||||
radio.songs = [];
|
||||
radio.looping = false;
|
||||
@ -32,6 +27,11 @@ module.exports = {
|
||||
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
if (newState.channel !== radio.voiceChannel) {
|
||||
change = true;
|
||||
radio.voiceChannel = newState.channel;
|
||||
radio.connection = newState.connection;
|
||||
}
|
||||
}
|
||||
if (oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel || change) {
|
||||
setTimeout(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user