Fix off by one error

master
Talon 2023-03-21 13:40:22 +01:00
parent b6008e0ad3
commit c92eacb7fd
1 changed files with 1 additions and 2 deletions

View File

@ -3,12 +3,11 @@ const AudioQueue=require('../../AudioQueue.js')
module.exports = function (bot, api) { module.exports = function (bot, api) {
bot.on('voiceStateUpdate', async (oldState, newState) => { bot.on('voiceStateUpdate', async (oldState, newState) => {
console.log("Voice state update");
if (newState.member.user.bot) return; if (newState.member.user.bot) return;
if (oldState.channel && newState.channel) return; if (oldState.channel && newState.channel) return;
const channel = oldState.channel || newState.channel; const channel = oldState.channel || newState.channel;
if (!channel) return; if (!channel) return;
if (channel.members.size < 1) { if (channel.members.size < 2) {
return await api.leaveChannel(channel); return await api.leaveChannel(channel);
} }
await api.joinChannel(channel); await api.joinChannel(channel);