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,