From a5ffaadf316e2cfc98234d323e168c41aa3f91c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Wed, 4 Aug 2021 14:34:41 +0300 Subject: [PATCH] Updated voiceStateUpdate --- src/client/events/voiceStateUpdate.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/client/events/voiceStateUpdate.js b/src/client/events/voiceStateUpdate.js index ded8338..75a2732 100644 --- a/src/client/events/voiceStateUpdate.js +++ b/src/client/events/voiceStateUpdate.js @@ -16,7 +16,14 @@ module.exports = { if (!newPermissions.has("CONNECT") || !newPermissions.has("SPEAK") || !newPermissions.has("VIEW_CHANNEL")) { try { setTimeout( - async () => (radio.connection = await oldState.channel.join()), + async () => ( + radio.connection = await joinVoiceChannel({ + channelId: oldState.channel.id, + guildId: oldState.channel.guild.id, + adapterCreator: createDiscordJSAdapter(oldState.channel) + }) + //radio.connection = await oldState.channel.join() + ), 1000 ); } catch (error) { @@ -30,7 +37,13 @@ module.exports = { if (newState.channel !== radio.voiceChannel) { change = true; radio.voiceChannel = newState.channel; - radio.connection = await newState.channel.join(); + /*radio.connection = getVoiceConnection(voiceChannel.guild.id) ?? + joinVoiceChannel({ + channelId: voiceChannel.id, + guildId: voiceChannel.guild.id, + adapterCreator: createDiscordJSAdapter(voiceChannel) + });*/ + //radio.connection = await newState.channel.join(); } } if ((oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel) || change) {