From bd249e686701f3473a2c5c24eba5a996d7c1732d Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 21 Aug 2023 21:34:29 +0200 Subject: [PATCH] fix: handle no queue dispatcher error when /queue and bot not in vc --- src/utils/validation/voiceChannelValidator.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/validation/voiceChannelValidator.js b/src/utils/validation/voiceChannelValidator.js index e2585ac2..df832389 100644 --- a/src/utils/validation/voiceChannelValidator.js +++ b/src/utils/validation/voiceChannelValidator.js @@ -23,8 +23,9 @@ exports.notInVoiceChannel = async (interaction) => { }; exports.notInSameVoiceChannel = async (interaction, queue) => { - if (!queue.dispatcher) { - return true; + if (!queue || !queue.dispatcher) { + // If there is no queue or bot is not in voice channel, then there is no need to check if user is in same voice channel. + return false; } if (interaction.member.voice.channel.id !== queue.dispatcher.channel.id) {