Is it possible to fetch a subscribed AudioPlayer from a VoiceConnection?

Hello there. So I'm making a song bot that plays local files. The current play command simply joins a voice channel (or moves to the current channel) and plays the song that was requested (from a selection of MP3 files on my local system). I am planning on making a queue system so you can queue whatever song you want. My problem comes with fetching the AudioPlayer. The discord.js/voice guide advised against keeping track of connections as you can accidentally create memory leaks. That said, I decided that I won't be keeping track of anything (apart from what is in the queue). From my understanding, an AudioPlayer is something like Media Player on Windows, an instance which a bunch of AudioResources can be passed in and it plays the latest one. If that is correct, then that means that it would be odd and wasteful to create an AudioPlayer for every single AudioResource, it would be the equivalent of opening a new Media Player window for every song. That being said, I plan on utilizing a single AudioPlayer per server. Now, since it was advised against to keep track of connections and such, is there a way for me to fetch that AudioPlayer using a VoiceConnection, or would I need to manually keep track of it? Also, would it maybe be better to create a new AudioPlayer for each song and just find a way to unsubscribe from the previous one? What do you recommend I do?
2 Replies
Batimius
BatimiusOP16mo ago
It doesn't show up as a valid property on TS nor the Docs.
Batimius
BatimiusOP16mo ago
Did they just forget to include it in the docs and in TS map? Oh I see. Thank you!
Want results from more Discord servers?
Add your server