The system does not work when the bot is on have voice channel and when someone enters the sound

When i put the bot in the voice channel with the command, the command does not work when someone comes or when someone enters the voice normally, the bot enters the voice and plays the mp3, if they exit and enter, the bot stops talking
33 Replies
d.js toolkit
d.js toolkit13mo 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!
ZeKe
ZeKe13mo ago
my code
ZeKe
ZeKe13mo ago
need help @ShompiFlen I remember you helped me before and i tagged you for that. i have been waiting for 2 days to get help with something in the @discord.js/voice module but no one has helped me, i apologize for tagging you, can you please help me? uzgun (Sorry for tag)
ShompiFlen
ShompiFlen13mo ago
i did tell you that your bot should join the voice channel through a command instead of a voice state update, you havent changed this this looks like the same code from last week
ZeKe
ZeKe13mo ago
It join voice channel with a command but then what should i do with the 'connection'
ShompiFlen
ShompiFlen13mo ago
the same thing you do here in the voice state update
ZeKe
ZeKe13mo ago
Joining the voice channel with this command
ShompiFlen
ShompiFlen13mo ago
just copy and paste your voice state update over to the command file and then start debugging it
ZeKe
ZeKe13mo ago
So should i log this section with console.log() and see the output? (I wanted to say that the connection here is undefined)
ShompiFlen
ShompiFlen13mo ago
of course its undefined because you are not defining a connection anywhere again just get rid of all the code on the voice state update event, you dont need it there anymore move it to your command
ZeKe
ZeKe13mo ago
So should i do it like this? I wrote all the imports after sending the ss
ShompiFlen
ShompiFlen13mo ago
your if statememt in line 28 is not going to work because you dont have a newstate there. I think you can just remove that anyways
ZeKe
ZeKe13mo ago
I made a code like this, but this time it gives an error like below, how do i fix it?
throw new Error("Cannot play a resource that has already ended.");
^

Error: Cannot play a resource that has already ended.
throw new Error("Cannot play a resource that has already ended.");
^

Error: Cannot play a resource that has already ended.
I think i accidentally left the ping sender on in the reply, sorry. I think i need to sleep and this will be left for tomorrow, good night hoping to fix it tomorrow <:pepe_smile:884630934060695574>
ShompiFlen
ShompiFlen13mo ago
and we are back to the voice state event.... you are moving and adding code to this script in unnecessary ways
ZeKe
ZeKe13mo ago
But how can i make it shorter? This code was not working
Want results from more Discord servers?
Add your server