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•2y ago
Message Not Public
Sign In & Join Server To View
Yes there sure is. You can listen to users, as well as play audio. the @discordjs/voice package is needed for that cause
for explanations, check: https://discordjs.guide/voice/audio-player.html#cheat-sheet
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
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
thanks! I'll look into it