Remove the check

This commit is contained in:
Christopher Cookman 2024-06-28 18:23:49 -06:00
parent 4336162c36
commit 8efc569cea
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

100
index.js
View file

@ -92,26 +92,19 @@ client.on('interactionCreate', async interaction => {
ephemeral: true ephemeral: true
}); });
} }
if (toChannel?.type == Discord.ChannelType.GuildVoice) { interaction.guild.channels.cache.forEach(channel => {
interaction.guild.channels.cache.forEach(channel => { if (channel?.type == Discord.ChannelType.GuildVoice) {
if (channel?.type == Discord.ChannelType.GuildVoice) { channel.members.forEach(member => {
channel.members.forEach(member => { member.voice.setChannel(toChannel).catch(err => {
member.voice.setChannel(toChannel).catch(err => { // Do nothing, 99% missing permissions
// Do nothing, 99% missing permissions });;
});; });
}); }
} });
}); interaction.reply({
interaction.reply({ content: "Moved all users to " + toChannel.name,
content: "Moved all users to " + toChannel.name, ephemeral: true
ephemeral: true });
});
} else {
return interaction.reply({
content: "You must specify a voice channel",
ephemeral: true
});
}
break; break;
case "move": case "move":
fromChannel = interaction.options.getChannel("from"); fromChannel = interaction.options.getChannel("from");
@ -122,41 +115,27 @@ client.on('interactionCreate', async interaction => {
ephemeral: true ephemeral: true
}); });
} }
if (fromChannel?.type == Discord.ChannelType.GuildVoice || toChannel?.type == Discord.ChannelType.GuildVoice) { fromChannel?.members?.forEach(member => {
fromChannel?.members?.forEach(member => { member.voice?.setChannel(toChannel).catch(err => {
member.voice?.setChannel(toChannel).catch(err => { // Do nothing, 99% missing permissions
});;
});
interaction.reply({
content: "Moved all users from " + fromChannel.name + " to " + toChannel.name,
ephemeral: true
});
break;
case "disconnectall":
interaction.guild.channels.cache.forEach(channel => {
channel.members?.forEach(member => {
member.voice.setChannel(null).catch(err => {
// Do nothing, 99% missing permissions // Do nothing, 99% missing permissions
});; });;
}); });
interaction.reply({ interaction.reply({
content: "Moved all users from " + fromChannel.name + " to " + toChannel.name, content: "Disconnected all users",
ephemeral: true ephemeral: true
}); });
} else {
return interaction.reply({
content: "You must specify a voice channel",
ephemeral: true
});
}
break;
case "disconnectall":
interaction.guild.channels.cache.forEach(channel => {
if (channel?.type == Discord.ChannelType.GuildVoice) {
channel.members?.forEach(member => {
member.voice.setChannel(null).catch(err => {
// Do nothing, 99% missing permissions
});;
});
interaction.reply({
content: "Disconnected all users",
ephemeral: true
});
} else {
return interaction.reply({
content: "You must specify a voice channel",
ephemeral: true
});
}
}); });
break; break;
case "disconnect": case "disconnect":
@ -167,22 +146,15 @@ client.on('interactionCreate', async interaction => {
ephemeral: true ephemeral: true
}); });
} }
if (channel?.type == Discord.ChannelType.GuildVoice) { channel?.members?.forEach(member => {
channel?.members?.forEach(member => { member.voice?.setChannel(null).catch(err => {
member.voice?.setChannel(null).catch(err => { // Do nothing, 99% missing permissions
// Do nothing, 99% missing permissions
});
}); });
interaction.reply({ });
content: "Disconnected all users from " + channel.name, interaction.reply({
ephemeral: true content: "Disconnected all users from " + channel.name,
}); ephemeral: true
} else { });
return interaction.reply({
content: "You must specify a voice channel",
ephemeral: true
});
}
break; break;
} }
}); });