Bot Joins Voice Channel but Doesn't Play Audio File (ogg)
I managed to get the bot to join the vc but it just sits there. Here's the code:
(In this case theNumber is 1, but it will vary based on user input. The ogg sound files are in ./sound/ directory)
I have several audio players because I hope to play multiple audio streams at once, not sure if it'll actually work though
Here's my package.json:
8 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!
- ✅
Marked as resolved by OPDiscord.js version: [email protected]
Node -v: v18.16.1
show your client intents and your folder structure please
also i think you are missing one of these dependencies
@discordjs/opus
or
opusscript
pretty sure you need at least one of those
@discordjs/opus is recommended
Sure
I installed @discordjs/opus and the issue persists
I'm playing the audio file from an event in the events folder and the sound is from the sounds folder
okay so here
why is there a comma separating the path
const resource = createAudioResource('./sounds', theNumber + '.ogg');
the first argument should be the entire path to the file
that comma is separating itOh, that's because I had a path.join statement which I removed
That was the issue
I also had to add a / to replace the path.join