#joinVoiceChannel on completion or on error

9 messages · Page 1 of 1 (latest)

kind wasp
#

Need help help capturing new channel the bot joins

tight rover
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

kind wasp
#

When i simply use joinVoiceChannel then client....voice.channelId, Even with await i get the old channel

#

so i had to make a delay of 2 seconds so the bot has time to move channels

#

How i can i wait until the bot is finished moving or reconnecting or has an error before moving on
when using joinVoiceChannel

#
    const connection = await joinVoiceChannel({
                channelId: interaction.member.voice.channelId,
                guildId: interaction.member.guild.id,
                adapterCreator: interaction.member.guild.voiceAdapterCreator,
            });
    
      console.log("your channel "+interaction.member.voice.channelId);
      await new Promise(resolve => setTimeout(resolve, 2000));
      console.log("My New channel2 "+ connection.joinConfig.channelId);```
ancient trench
#

I think you can listen to an event emitted by voiceconnection when it's "ready"

#

might be as simple as connection.on('ready', ...)

kind wasp
#

Except when its moving from 1 Voice channel to another it goes from ready to ready