fix: handle no queue dispatcher error when /queue and bot not in vc

This commit is contained in:
Marius Begby committed 2023-08-21 21:34:29 +02:00
1 parent 94ef202c7f
commit bd249e6867
1 file changed
+3 -2
@@ -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) {