42 Replies
@gino
@Lupine
This is not very helpful, can you expand on what exactly you mean by
the bot is not playing the song
. Is it joining the channel and sitting in silence? Is it not joining the channel at all? Do you have any logs that may or may not suggest why the bot is not playing from both Lavaclient and Lavalink?the bot is joining the voice channel but not playing anything,
This is the logs from lavalink
Have you configured your voice state/server update events properly?
I don't know lol, I am new to this music thing,
are you referring to this
Yes, whatever your method is for handling events, you will need to listen to VoiceServerUpdate and VoiceStateUpdate and pass the data from the event into Node#handleVoiceUpdate
Oh, this is my index.js
but the bot is still not playing anything
@Lupine
Is this just a template or it is an working example, if not, can I get some working example codes for handleVoiceUpdate()
What is your method for handling events currently? For example your message event
All you need to do is listen to the VoiceStateUpdate and VoiceServerUpdate events using the same method and pass the data into the handleVoiceUpdate method
this is my messageCreate.js
the only files that have music codes are index.js and play.js as of now, for testing
Right, so you can create something similar for VoiceStateUpdate and VoiceServerUpdate and simply pass the parameter from your execute method into the handleVoiceUpdate method on the Node
This is how I do it, but you should note that you cannot copy and paste this because I handle events differently
But the premise is the same. I listen to event, and pass the data from the event into the handleVoiceUpdate method
I do the same for the VoiceStateUpdate event as well
alright, I will try it
@Lupine , Hey , I did what you told me
This is my VoiceStateUpdate.js, and similar is for VoiceServerUpdate,
And in index.js, I have listened to this event like this
But the bot is still not playing
I dont understand how your bot is structured, to me this looks like you are listening to the event twice. Where is your event handler? how are you listening to the messageCreate event currently?
For the normal events, I have the event handler in index.js
and for the websocket events, I have also listened it it index.js but seperately
and the events for voice updates, are handeled seperately (last sent code block), it doesn't go on normal event handler (first sent code block)
Put some log messages in the event. If the bot is sitting in silence its usually because these events are not setup correctly
Yeah, I did it and getting logs in the event. The events are properly listened
Request a new song, and send logs for both Lavaclient and Lavalink
This is the logs from lavalink,
And I didn't got any error logs from from lavaclient, there is no logs after client ready log
If there is no logs after the client ready log then that suggests your event isnt working
Anytime someone mutes their client, joins a voice channel, leaves a voice channel etc. that event should fire
the custom logs is printing, like I put console.log("VoiceStateUpdate");, on VoiceStateUpdate event, like this,
"VoiceStateUpdate" is logging in the console.
Right okay, its just a second ago you said you werent getting any logs after your ready event...
Yeah, lol. Sorry for confusion
What to do next ?
Try passing in the name of the event as a string
"VOICE_SERVER_UPDATE"
"VOICE_STATE_UPDATE"
Im not sure if GatewayDispatchEvents.VoiceStateUpdate is a little different. This library requires using the raw updates
yeah, did it and still not playing
:AHHHH:
Listen to it via the client as well, you should be able to drop the ws property
I didn't understand
You can listen to events directly from the client
Yeah, did it and still no result
I still dont understand the structure of your bot? Why do you seemingly listen and handle your VoiceState and VoiceServer updates in your index file whilst also having a handler in seperate files?
I have this is my index.js
and in WebSocketEvents/VoiceStateUpdate.js, I have this, this is all codes in the file
and similar is for VoiceServerUpdate
Im aware this is what you have
Im just trying to wrap my head around why you appear to handle your other events differently
Unless you havent been sending the full file each time
oh lol, I also have this is my index.js
client.on(file.split('.')[0], event.execute.bind(null, client));
So you are listening to events more than once?
If you have a file in there called VoiceServerUpdate. youll be listening to it more than once
One) In this event handler code
Two) In your index file from the previous code snippets you have sentNo, I don't have VoiceServerUpdate in there, this handler only handles the files in events folder, and I have VoiceServerUpdate in WebSocketEvents folder
const events = fs.readdirSync('./bots/music-bot/events/').filter((file)
I have event hander for both normal events and websocketevents in index.jsRight, but without knowing the structure of your project, I cannot possibly know that
In this message here: https://discord.com/channels/323365823572082690/1235136736351227914/1235178827416866827 you mentioned you had a file called VoiceStateUpdate.js
wait, I will send you the folder structure
I can only assume that would be in your event folder as it matches the structure of your message event file
This is my folder structure
I have different handler for the files in events, and the files in WebSocketEvents, both in index.js
ONE
TWO
These both are in index.js, one handles the websocket events such as VoiceStateUpdate, VoiceServerUpdate,
and two handles the normal events such as messageCreate, ready etc,
In your client
Have you considered that the guild might not have been cached yet?
Where you define your node, in the sendGatewayPayload property. Try logging out the guild
it is logging out the guild,
@Lupine , is there anything we can do
Quick question
Are u able to play SoundCloud
how do I do that ?
const results = await client.lavaclient.api.loadTracks("scsearch:never gonna give you up");
No, it is not playing soundcloud