#Leaves automatically without even touching the audio file once
47 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
[email protected]
Node v17.8.0
No errors are thrown
play.ts: https://sourceb.in/0u2ybqONYe
compiled play.js: https://sourceb.in/G8XKmdramh
issue explained above
screenshots below:
this is a screenshot of the bot editing the message right after joining, hasn't even touched the audio file that ytdl piped, at all
my ytfiles folder already has the audio files ready (my play.ts is in ZBot-En \ ZBot-En \ commands)
Why are you downloading the video instead of passing the stream directly to the resource?
I personally use this configs in the Ytdl that may help:
{
quality: 'highestaudio',
highWaterMark: 1048576 * 64,
dlChunkSize: 0,
};
Also add an error listener to:
- The ytdl stream
- The player
- The connection
So you can catch errors
oh fucking hell
i didnt notice that was a solution 🥲
but either way can I still just pass it directly into the stream or how do I do it with YTDL and stuff
Bc I think your problem is, you are trying to read a video that's not fully downloaded yet
Assign the ytdl function to a const and pass it to the resource
Add the error listeners it will help you a lot!!!
The connection and the player also has an debug event which is useful
do I still have to do .pipe or what
or do I just pass it directly without the .pipe
Simple as passing a string
Assign to a const an use it as param
No need for fancy stream things
const downloadedFile = ytdl(link)
const audioResource = createAudioResource(downloadedFile)
Test it, lol
or easier
const audioResource = createAudioResource(ytdl(link))
will either work?
ok
but i gotta like compile it all lmfao
This is better since you can add the error event
downloadedFile.on('error', console.error)
.
ive prob already compiled both of them but imma test it first and then add your suggestions
works @oblique kettle ty, also another question
if say a song ends would that be the idle event?
Np
Depends on how your players is configured:
goddamn error
lemme add the error listeners immediately
Actually no, it will go to the idle
Lol not this too
this one?
what does this object of options do
Yeah, ty
It helps ytdl works better with Discord, I got those from the Ytdl server
https://www.npmjs.com/package/ytdl-core
You can read the descriptions for each property here
tysm for the help its working now
Library: Audio Player