Add catches just in case
This commit is contained in:
parent
cb9e49dd2c
commit
4336162c36
16
index.js
16
index.js
|
@ -96,7 +96,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
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);
|
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) {
|
if (fromChannel?.type == Discord.ChannelType.GuildVoice || toChannel?.type == Discord.ChannelType.GuildVoice) {
|
||||||
fromChannel?.members?.forEach(member => {
|
fromChannel?.members?.forEach(member => {
|
||||||
member.voice?.setChannel(toChannel);
|
member.voice?.setChannel(toChannel).catch(err => {
|
||||||
|
// Do nothing, 99% missing permissions
|
||||||
|
});;
|
||||||
});
|
});
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: "Moved all users from " + fromChannel.name + " to " + toChannel.name,
|
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 => {
|
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(null);
|
member.voice.setChannel(null).catch(err => {
|
||||||
|
// Do nothing, 99% missing permissions
|
||||||
|
});;
|
||||||
});
|
});
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: "Disconnected all users",
|
content: "Disconnected all users",
|
||||||
|
@ -163,7 +169,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
}
|
}
|
||||||
if (channel?.type == Discord.ChannelType.GuildVoice) {
|
if (channel?.type == Discord.ChannelType.GuildVoice) {
|
||||||
channel?.members?.forEach(member => {
|
channel?.members?.forEach(member => {
|
||||||
member.voice?.setChannel(null);
|
member.voice?.setChannel(null).catch(err => {
|
||||||
|
// Do nothing, 99% missing permissions
|
||||||
|
});
|
||||||
});
|
});
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: "Disconnected all users from " + channel.name,
|
content: "Disconnected all users from " + channel.name,
|
||||||
|
|
Loading…
Reference in a new issue