From 6b6347d678b8d5a851bba7fca1bd5842071ccc18 Mon Sep 17 00:00:00 2001 From: Josh <43449531+joshbker@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:37:05 +0000 Subject: [PATCH] fix: don't allow user limit less than 1 --- src/main/kotlin/com/learnspigot/bot/voicechat/VCCommand.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/com/learnspigot/bot/voicechat/VCCommand.kt b/src/main/kotlin/com/learnspigot/bot/voicechat/VCCommand.kt index 9e0ac99..17bdee6 100644 --- a/src/main/kotlin/com/learnspigot/bot/voicechat/VCCommand.kt +++ b/src/main/kotlin/com/learnspigot/bot/voicechat/VCCommand.kt @@ -24,6 +24,11 @@ class VCCommand { event: SlashCommandInteractionEvent, @Description("Max user limit") @Optional limit: Int?, ) { + if (limit != null && limit < 1) { + event.reply("The max user limit must be 1 or higher.").setEphemeral(true).queue() + return + } + val guild = event.guild ?: return val newChannel = guild.createVoiceChannel( "${event.member!!.effectiveName}'s channel",