mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:00:18 +00:00
Fixing indentation and removing unnecessary line changes
This commit is contained in:
parent
ff49fbd16c
commit
84a780723e
@ -1,66 +1,48 @@
|
||||
module.exports = {
|
||||
name: "voiceStateUpdate",
|
||||
async execute(client, oldState, newState) {
|
||||
if (oldState.channel === null) return;
|
||||
let change = false;
|
||||
const radio = client.radio.get(newState.guild.id);
|
||||
if (!radio) return;
|
||||
name: "voiceStateUpdate",
|
||||
async execute(client, oldState, newState) {
|
||||
if (oldState.channel === null) return;
|
||||
let change = false;
|
||||
const radio = client.radio.get(newState.guild.id);
|
||||
if (!radio) return;
|
||||
|
||||
if (
|
||||
newState.member.id === client.user.id &&
|
||||
oldState.member.id === client.user.id
|
||||
) {
|
||||
if (newState.channel === null) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
return client.radio.delete(newState.guild.id);
|
||||
}
|
||||
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
||||
if (newState.channel === null) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
return client.radio.delete(newState.guild.id);
|
||||
}
|
||||
|
||||
const newPermissions = newState.channel.permissionsFor(
|
||||
newState.client.user
|
||||
);
|
||||
if (
|
||||
!newPermissions.has("CONNECT") ||
|
||||
!newPermissions.has("SPEAK") ||
|
||||
!newPermissions.has("VIEW_CHANNEL")
|
||||
) {
|
||||
try {
|
||||
setTimeout(
|
||||
async () => (radio.connection = await oldState.channel.join()),
|
||||
1000
|
||||
);
|
||||
} catch (error) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(oldState.guild.id);
|
||||
const newPermissions = newState.channel.permissionsFor(newState.client.user);
|
||||
if (!newPermissions.has("CONNECT") || !newPermissions.has("SPEAK") || !newPermissions.has("VIEW_CHANNEL")) {
|
||||
try {
|
||||
setTimeout(
|
||||
async () => (radio.connection = await oldState.channel.join()),
|
||||
1000
|
||||
);
|
||||
} catch (error) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(oldState.guild.id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (newState.channel !== radio.voiceChannel) {
|
||||
change = true;
|
||||
radio.voiceChannel = newState.channel;
|
||||
radio.connection = await newState.channel.join();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (newState.channel !== radio.voiceChannel) {
|
||||
change = true;
|
||||
radio.voiceChannel = newState.channel;
|
||||
radio.connection = await newState.channel.join();
|
||||
}
|
||||
}
|
||||
if (
|
||||
(oldState.channel.members.size === 1 &&
|
||||
oldState.channel === radio.voiceChannel) ||
|
||||
change
|
||||
) {
|
||||
setTimeout(() => {
|
||||
if (
|
||||
!radio ||
|
||||
!radio.connection.dispatcher ||
|
||||
!radio.connection.dispatcher === null
|
||||
)
|
||||
return;
|
||||
if (radio.voiceChannel.members.size === 1) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(newState.guild.id);
|
||||
if ((oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel) || change) {
|
||||
setTimeout(() => {
|
||||
if (!radio || !radio.connection.dispatcher || !radio.connection.dispatcher === null) return;
|
||||
if (radio.voiceChannel.members.size === 1) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(newState.guild.id);
|
||||
}
|
||||
}, 120000);
|
||||
}
|
||||
}, 120000);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user