Audio Not Playing

Discord JS Ver 14.13.0, Voice ver 0.16.0, Node 16.14.0 The bot joins the channel that I am in, however it doesn't play any audio and doesn't give any errors, I don't understand why?
49 Replies
d.js toolkit
d.js toolkit16mo ago
- 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!
SpecialSauce
SpecialSauce16mo ago
Log some values to see what’s happening. Does it stop executing at any point that you expect it to reach?
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
It seems to go through the entire script, logging all the way The audio file is in the same folder as the script btw
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
it could quite possibly be the position of the audio file
No description
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
I changed up the code a bit, but it still doesn't play a sound, also includes the logs
ShompiFlen
ShompiFlen16mo ago
pretty confident that your issue is the path to the audio file its not relative to the script the createAudioResource function is called the path that it takes starts from the root of the project, where the package.json is most likely. try createAudioResource("./commands/soundstuff/critSong.mp3")
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
That didn't work, I have no idea why
ShompiFlen
ShompiFlen16mo ago
no errors? no nothing? wait why is your nodemodules folder inside your commands folder that makes no sense ah no wait it isnt nevermind
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
Hm? Yeah there is no errors whatsoever! I don't understand why?!
ShompiFlen
ShompiFlen16mo ago
show me your dependencies whatever is on package.json, also do you have ffmpeg installed and added in the environment variables of your system? also upload your latest code to pastebin or something so i can see it
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
I do have ffmpeg, idk if there is a specific version for djs
No description
ShompiFlen
ShompiFlen16mo ago
there shouldnt but that one looks outdated...
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
It is a little old yeah
ShompiFlen
ShompiFlen16mo ago
im pretty sure you need a couple more dependencies
ShompiFlen
ShompiFlen16mo ago
like opus for example
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
opus? so like npm install opus
ShompiFlen
ShompiFlen16mo ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
i did initially i'll install some more of those dependency
ShompiFlen
ShompiFlen16mo ago
you dont need to install every of them, only one per category and as it says there, if you want to play audios that are different from webm opus and ogg you do need some extra dependencies. You are trying to play an mp3 file although ffmpeg should be enough but try installing the sodium wrappers and a couple others the recommended ones should be alright
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
Sodium is having trouble installing, do i really have to install VS 2015?
ShompiFlen
ShompiFlen16mo ago
yes you can install those through commandline though i dont quite remember the command, something about build essentials npm install --global --production --add-python-to-path windows-build-tools
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
It just seems to hang at one point I still can't get sodium to work, and I feel i corrupted it somehow, but i have these dependencies
ShompiFlen
ShompiFlen16mo ago
hmm first of all i dont know why you have npm as a dependency there if you hover over libsodium what does it say
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
That's just a spell checker extension I have Don't mind it
ShompiFlen
ShompiFlen16mo ago
So what you mean by can't get sodium to work?, if you are getting any kind of errors in console from libraries or anything you should show it here, we can't really guess what is happening
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
There is no like errors at all Its just not playing ANY audio, and I have no idea why
duck
duck16mo ago
could you share your current code and generate a dependency report?
d.js docs
d.js docs16mo ago
guide Getting Started: Debugging Dependencies read more
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
All of my code and the audio file is here, I'll generate the dep report rq
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
Okay so sodium did somehow install, but its like half corrupted, so I have two
No description
duck
duck16mo ago
just the relevant code in a pastebin please
d.js docs
d.js docs16mo ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
duck
duck16mo ago
1. the line in which you call player.play() is commented out 2. you didn't previously have an ogg file to play, but on the assumption that it's there, you'll want to specify the inputType as StreamType.OggOpus 3. I notice you have some logs, so just to confirm, does LOG 3 log as expected?
d.js docs
d.js docs16mo ago
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 one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
// Add one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
- Add an error listener to the stream you are passing to the resource:
<Stream>.on('error', console.error)
<Stream>.on('error', console.error)
Note: The <> represents classes that need to be adapted to their respective name in your code
duck
duck16mo ago
I do notice you aren't necessarily waiting for your connection to be ready, so it'd be nice to see this for both your player and connection
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
why does it go from playing to autopaused instantly?
duck
duck16mo ago
that suggests that the player believes that it doesn't have any valid subscribed connections please also listen to the debug event for your connection or otherwise ensure that your connection enters the Ready state
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
And I put it right under
No description
duck
duck16mo ago
ok so then nothing even logs please ensure you have the GuildVoiceStates intent
A̶̎t̵̟͊l̸a̷̚͜sG̸̻̾am̸̫̾e̶r2̴̂7̶̃
🤦‍♂️ I feel like an idiot now Yeah that was the issue
Want results from more Discord servers?
Add your server