Local Audio Streams
I've been trying for the last 4 hours to try and get local audio files or audio streams to work with djs and im still quite lost. I've tried everything and read the docs, im just not understanding how to do this.
All I want for now is to play a local audio file in a voice channel, so that I can move forward
I've gotten some weird errors, but I feel like Im going about this all wrong. Help very much needed
5 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!djs: 14.13.0
node: v18.17.1
djs voice: 0.16.0
not sure if it matters, but im running all this in es6 format
you dont have to await any of that
but make sure the right path gets to the resource
on top of confirming the path, you'll also want to check:
- that the file is valid
- that you have the proper dependencies to play the given file
- that your connection enters the ready state (and check if you have the
GuildVoiceStates
intent if it doesn't)
- whether the player goes through its lifecycle as expectedTo 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
Getting Started: Introduction - Debugging Dependencies
read more