From cb9e49dd2ceabf2f953ed33d36de4c7f7a556123 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Tue, 18 Jun 2024 14:15:20 -0600 Subject: [PATCH] Fix possible loophole --- index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/index.js b/index.js index e35954a..97f94f8 100644 --- a/index.js +++ b/index.js @@ -85,6 +85,13 @@ client.on('interactionCreate', async interaction => { switch (interaction.commandName) { case "moveall": toChannel = interaction.options.getChannel("to"); + // Check that toChannel is in same guild as interaction + if (toChannel?.guild != interaction.guild) { + return interaction.reply({ + content: "You must specify a voice channel in this server", + ephemeral: true + }); + } if (toChannel?.type == Discord.ChannelType.GuildVoice) { interaction.guild.channels.cache.forEach(channel => { if (channel?.type == Discord.ChannelType.GuildVoice) { @@ -107,6 +114,12 @@ client.on('interactionCreate', async interaction => { case "move": fromChannel = interaction.options.getChannel("from"); toChannel = interaction.options.getChannel("to"); + if (toChannel?.guild != interaction.guild || fromChannel?.guild != interaction.guild) { + return interaction.reply({ + content: "You must specify a voice channel in this server", + ephemeral: true + }); + } if (fromChannel?.type == Discord.ChannelType.GuildVoice || toChannel?.type == Discord.ChannelType.GuildVoice) { fromChannel?.members?.forEach(member => { member.voice?.setChannel(toChannel); @@ -142,6 +155,12 @@ client.on('interactionCreate', async interaction => { break; case "disconnect": channel = interaction.options.getChannel("channel"); + if (channel?.guild != interaction.guild) { + return interaction.reply({ + content: "You must specify a voice channel in this server", + ephemeral: true + }); + } if (channel?.type == Discord.ChannelType.GuildVoice) { channel?.members?.forEach(member => { member.voice?.setChannel(null);