Fix off by one error
parent
b6008e0ad3
commit
c92eacb7fd
|
@ -3,12 +3,11 @@ const AudioQueue=require('../../AudioQueue.js')
|
|||
|
||||
module.exports = function (bot, api) {
|
||||
bot.on('voiceStateUpdate', async (oldState, newState) => {
|
||||
console.log("Voice state update");
|
||||
if (newState.member.user.bot) return;
|
||||
if (oldState.channel && newState.channel) return;
|
||||
const channel = oldState.channel || newState.channel;
|
||||
if (!channel) return;
|
||||
if (channel.members.size < 1) {
|
||||
if (channel.members.size < 2) {
|
||||
return await api.leaveChannel(channel);
|
||||
}
|
||||
await api.joinChannel(channel);
|
||||
|
|
Loading…
Reference in New Issue