mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:40:18 +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);
|
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);
|
const newPermissions = newState.channel.permissionsFor(newState.client.user);
|
||||||
if (!newPermissions.has('CONNECT') || !newPermissions.has('SPEAK') || !newPermissions.has('VIEW_CHANNEL')) {
|
if (!newPermissions.has('CONNECT') || !newPermissions.has('SPEAK') || !newPermissions.has('VIEW_CHANNEL')) {
|
||||||
try {
|
try {
|
||||||
const connection = await oldState.channel.join();
|
const connection = await oldState.channel.join();
|
||||||
radio.connection = connection;
|
return radio.connection = connection;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
radio.songs = [];
|
radio.songs = [];
|
||||||
radio.looping = false;
|
radio.looping = false;
|
||||||
@ -32,6 +27,11 @@ module.exports = {
|
|||||||
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
|
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) {
|
if (oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel || change) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user