Add catches just in case

This commit is contained in:
Christopher Cookman 2024-06-18 14:20:10 -06:00
parent cb9e49dd2c
commit 4336162c36
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -96,7 +96,9 @@ client.on('interactionCreate', async interaction => {
interaction.guild.channels.cache.forEach(channel => {
if (channel?.type == Discord.ChannelType.GuildVoice) {
channel.members.forEach(member => {
member.voice.setChannel(toChannel);
member.voice.setChannel(toChannel).catch(err => {
// Do nothing, 99% missing permissions
});;
});
}
});
@ -122,7 +124,9 @@ client.on('interactionCreate', async interaction => {
}
if (fromChannel?.type == Discord.ChannelType.GuildVoice || toChannel?.type == Discord.ChannelType.GuildVoice) {
fromChannel?.members?.forEach(member => {
member.voice?.setChannel(toChannel);
member.voice?.setChannel(toChannel).catch(err => {
// Do nothing, 99% missing permissions
});;
});
interaction.reply({
content: "Moved all users from " + fromChannel.name + " to " + toChannel.name,
@ -139,7 +143,9 @@ client.on('interactionCreate', async interaction => {
interaction.guild.channels.cache.forEach(channel => {
if (channel?.type == Discord.ChannelType.GuildVoice) {
channel.members?.forEach(member => {
member.voice.setChannel(null);
member.voice.setChannel(null).catch(err => {
// Do nothing, 99% missing permissions
});;
});
interaction.reply({
content: "Disconnected all users",
@ -163,7 +169,9 @@ client.on('interactionCreate', async interaction => {
}
if (channel?.type == Discord.ChannelType.GuildVoice) {
channel?.members?.forEach(member => {
member.voice?.setChannel(null);
member.voice?.setChannel(null).catch(err => {
// Do nothing, 99% missing permissions
});
});
interaction.reply({
content: "Disconnected all users from " + channel.name,