retrieving a subscribed AudioPlayer on a voice connection

I mean we have the function getVoiceConnection that retrieves a VoiceConnection for a guild so is there any way to get an AudioPlayer from it so that I can pause/resume/destroy it from any command?
5 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Jiron
Jiron2y ago
Yes there sure is. You can listen to users, as well as play audio. the @discordjs/voice package is needed for that cause
Jiron
Jiron2y ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Jiron
Jiron2y ago
Playing audio is relatively easy once you get a bit of knowledge, receiving audio and replaying/saving it somewhere usually takes a little longer to learn. The docs would be here: https://discordjs.github.io/voice/classes/voicereceiver.html You can ofc just search a little online and find working code. Just know that djs v12 is very to djs v13 and up so make sure you don't bump into old code (unless you want to use an old version that is).
VoiceReceiver | @discordjs/voice
Documentation for @discordjs/voice
xubby
xubbyOP2y ago
thanks! I'll look into it
Want results from more Discord servers?
Add your server