Retrieve voice channel reference from voice connection
I'm trying to deal with the client being dragged to a different channel.
I'm using code very similar to the example in the docs with dealing with re-joins and that works, but I also store a reference to the original voice channel.
I would like to update that reference, but I'm not sure how to retrieve it. I only have the voice connection state and voice connection itself
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!you could listen to the VoiceStateUpdate event and check wether or not its your bot. Then check if the old channel corelates to the new channel and then update the related references
Yeah, I went with that approach.
I was hoping that maybe some event or the voice connection has a reference to the channel but I guess not.
Is there some reason for the voice connection object not having a reference to the channel?
Out of curiosity
Uh I think there is a method to get the voice channel withing /voice
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
ah nevermind that doesnt really get you the channel the bot is in
Updating the session id & gateway info should handle that automatically