Discrepancy between .playable and .subscribers
Just curious to why this is. I've noticed that, after the bot has been running for some time, a discrepancy will manifest between these two lines of code.
The expected behaviour is that both lines of code would output the same thing; the number of VoiceChannels that is playing/subscribed to a given AudioPlayer.
Sometimes the difference can be significant - i.e. 30 versus 80. I get that
.subscribers
technically shouldn't be used but I'm wondering how/why a channel would be left in .subscribers
but is not "playable".
Is it bug? Is discordjs/voice leaving garbage channels behind that should've been removed? Or is this expected behaviour. And what circumstances can have a channel classified as a subscriber but is not playable? I've tested permissions and dirty disconnecting the voice but can't intentionally reproduce.
discord.js/voice: 0.16.1
discord.js: 14.14.13 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!I think this might be relevant to the issues where bot leaves Voice Channels randomly out of the blue for no reason. The latest discordjs/voice version seems to have drastically reduced the amount of times this happens but I just noticed in a few of my servers, where the bot should have been connected/playing, it wasnt - but those channels were still present in
.subscribers
<AudioPlayer>.playable
just contains subscribed connections that are Ready
if there's a discrepancy between all subscribers and playable connections, it sounds like not all subscribed connections are ready
Is it a bug?this can happen for a wide variety of reasons, some of which aren't actually issues, so as a whole this behavior isn't a bug
Is discordjs/voice leaving garbage channels behind that should've been removed?assuming you're referring to connections, not the channels themselves, this would be depend more on your code as detailed on the guide, disconnects can happen for a few reasons, some of which you would likely not want to destroy the connection, so cleanup is generally left to you though afaik
<VoiceConnection>.destroy()
and <VoiceConnection>.disconnect()
do unsubscribe from players
I think this might be relevant to the issues where bot leaves Voice Channels randomly out of the blue for no reasonfor the above reasons, it is possible that this is related, but it'd be up to you to properly handle these disconnects