How do I detect once the music has finished (djs v13.12.0) [Solved]
I have messed around with the player.on() function with createAudioPlayer and such but I can not find a solid way to loop it?
Heres my code:
I have tried unsubscribe, state change, idle and error and every single one just doesn't work
Can somebody help me?
I do not have any errors at all in the output and I put a console.log in the player and it wouldn't print anything
13 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
does the bot play audio at all?
I have code outside of it to play it and it plays that, it doesn't trigger the player.on event though
Theres the full code
well you are not listening to any event right now
player.on(' ') that is not gonna trigger at any time
Yes, but before I was and that wouldn't work so I just kept it on '' while im searching online trying to find fixes
So whenever I can see a thing that might work, I don't have to delete it and can just put it in
so you want to check whether or not the player is playing audio?
searching online right now, can't find anything besides idle which isn't even an option
I want the player to loop
okay
import AudioPlayerStatus from discordjs/voice
Done
then do
player.on(AudioPlayerStatus.Idle, () => {
and just put player.play(resource) insideAh, thank you. The only things I could actually find were with "Idle" on stack overflow but they were telling me to do AudioPlayer.Idle, not AudioPlayerStatus.Idle
Thanks for the help
use the official guide and docs
https://discord.js.org/#/docs/voice/main/typedef/AudioPlayerStatus docs
https://discordjs.guide/voice/ guide
I was looking there, but only in AudioPlayer