From 56d57794c640a5202ce306763e473745acc3f338 Mon Sep 17 00:00:00 2001 From: Elijah R Date: Thu, 25 Jan 2024 22:29:32 -0500 Subject: [PATCH] check if voice connection is actually open --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 21bc04c..9dd5832 100644 --- a/src/index.ts +++ b/src/index.ts @@ -70,7 +70,8 @@ client.on('interactionCreate', async i => { audioStream(); // connect to voice channel if not already connected var guild = cmd.guild!; - if (getVoiceConnection(guild.id)) { + var con = getVoiceConnection(guild.id); + if (con && con.state.status == VoiceConnectionStatus.Ready) { await cmd.editReply(`Connected to ${vncname}`); return; } @@ -79,7 +80,7 @@ client.on('interactionCreate', async i => { await cmd.editReply(`Connected to ${vncname}`); return; } - var con = joinVoiceChannel({ + con = joinVoiceChannel({ guildId: guild.id, channelId: channel.id, adapterCreator: guild.voiceAdapterCreator,