Bot isn't playing any Sound
Hey! I'm working for a games company and got tasked to create a discord bot that plays our ambient music in a voice channel. I'm using discord.js 14.12.1 and the bot itself works correctly and also joins the voice channel as it should.
But it somehow doesn't play any audio. We're using local .mp3 files.
Here's the code part for the AudioPlayer
I've also added some logs but apparently it's always "playing"
And here's the Dependecy Report
4 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!Thank you for your quick reply! I tried both methods but it still won't play any audio sadly.
I even tried to follow this but that also didn't work (https://discordjs.guide/voice/audio-resources.html#creation)
Could there be some other issues?
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
To debug your voice connection and player:
- Use
debug: true
when creating your VoiceConnection
and AudioPlayer
- Add an event listener to the <VoiceConnection> and the <AudioPlayer>:
- Add an error
listener to the stream you are passing to the resource:
Note: The <>
represents classes that need to be adapted to their respective name in your code
I managed to fix it now after some struggles. I forgot to set the GuildVoiceStates gateway intent.