check if voice connection is actually open

This commit is contained in:
Elijah R 2024-01-25 22:29:32 -05:00
parent 5d11fbf12d
commit 56d57794c6

View file

@ -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,