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
- 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!my code
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? (Sorry for tag)
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
It join voice channel with a command but then what should i do with the 'connection'
the same thing you do here in the voice state update
Joining the voice channel with this command
just copy and paste your voice state update over to the command file and then start debugging it
So should i log this section with console.log() and see the output? (I wanted to say that the connection here is undefined)
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
So should i do it like this?
I wrote all the imports after sending the ss
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
I made a code like this, but this time it gives an error like below, how do i fix it?
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>
and we are back to the voice state event....
you are moving and adding code to this script in unnecessary ways
But how can i make it shorter?
This code was not working
yea because newstate is not defined
if you dont know how to define variables then its gonna be hard for me to help
knowing the basics is also on the rules of this server
I fixed them but it was not happening again
Trying again
not true?
When it's like this, when you enter the voice, it doesn't say anything
(Successfully connecting to the voice channel)
I need to sleep and this will be left for tomorrow, good night hoping to fix it tomorrow :)
I will read what you wrote tomorrow
i am not sure as to why you are using a timeout inside the VoiceConnectionstatus.Ready event, just start playing the music when the bot is ready. Also would be more useful if you show the entire script
And last, please just remove everything from the voiceStateUpdate event since you are not going to be using it anymore
In order not to lose them, i put them in the comment line and only worked with the system in the commands
Here's my code;
When you enter the voice, sometimes you get pinged or it loads a little late, i used timeout to prevent this, sometimes i see that when i enter the voice channel i delayed for 1-2 seconds
you code looks correct
I dont see the issue
is the sound not going through? is it not playing at all?
It not playing at all
can you place
console.log("Ready to play audio")
inside your connection.on(VoiceConnectionstatus.Ready) event?Okey, i'm trying
He wrote it, but his voice doesn't say it
I corrected the old one because it was the wrong extension but it didn't work again
your audio resource path is wrong
why did you change it
since when did you change it
the path to the resource is just
./output/hg_h.mp3
it worked, i typed url instead of making a file like ./ thank you for your help
ohh sorry
Can i ask you one more question?
When this happens, it only works when i run the command and a member enters the voice channel, but not if they leave the voice channel and re-enter
what do you mean "when this happens" what happens
what is happening
when this code is*
In this code, when i open the bot and run the command, it works when i enter the sound, it does not work only if i exit the voice channel and re-enter, or if I throw the bot out of the sound and exit the voice channel myself and put the bot back in with the command and enter, it still does not work
(I will send a message from dm to the members coming to the voice channel)