discordjs / voice

Implementation of the Discord Voice API for discord.js and other JS/TS libraries
Apache License 2.0
327 stars 111 forks source link

entersState seems to be locking the thread for itself, causing abortions to always happen #218

Closed yellows111 closed 2 years ago

yellows111 commented 2 years ago

Hey, trying to play around with discord.js v13/voice 0.6.0, and noticed this caveat (very quickly) after reading the examples.

entersState(connection, VoiceConnectionStatus.Ready, 30e3); // As mentioned and used in samples, ala /examples directory on repo.
console.log("Usually somehting would run here, but an abortion would not cause this to run");

and for the part of the interactions handler im using:

case 'join': {
    const channel = interaction.member?.voice.channel;
        if (channel) {
            try {
                await interaction.reply('Should of joined voice channel?');
                const connection = await connectToChannel(channel); // connectToChannel function is verbatim from the Basic Example
                // ...

Further details:

Relevant client options:

Hashiphoto commented 2 years ago

Not sure if you're experiencing the same issue I was, but I had to include Intents.FLAGS.GUILD_VOICE_STATES to get past the entersState line. The client won't know what state the connection is in without that intent.

yellows111 commented 2 years ago

Oh. my bad, that fixed it, should really of looked into what intents i'll use.