From 4336162c36fdbc0e3bdb45786b03e4e1652dd95d Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Tue, 18 Jun 2024 14:20:10 -0600 Subject: [PATCH] Add catches just in case --- index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 97f94f8..6f449be 100644 --- a/index.js +++ b/index.js @@ -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,