Music not playing but connecting

Hey there! My music doesn't play when connecting. I think it's because I do not have a raw event. I'm not using discordjs or any library, I have a custom implementation. Any clue how I could get the info needed to play music without the raw event or make something similar?
58 Replies
like-gold
like-goldOP•2y ago
For extra context, I tried pushing up voice state events but that doesn't seem to work.
1Lucas1.apk
1Lucas1.apk•2y ago
Hello eralyne, you can manipulate the data to be sent by updateVoiceState Let's say you don't have data, you can create the parameters to be treated internally let's say
If(event == 'voice state') {
let data = {
op: '',
d: { object },
...}
}
If(event == 'voice state') {
let data = {
op: '',
d: { object },
...}
}
You treat the data out, then throw it to the updateVoiceState If you use ws you can put it in the message received by the discord api gateway
like-gold
like-goldOP•2y ago
This is what I've tried to push up
No description
No description
like-gold
like-goldOP•2y ago
I just tried which didn't seem to work. What exact info is updateVoiceState eexpecting?
No description
1Lucas1.apk
1Lucas1.apk•2y ago
You have to specify the events I'll do it here and send it to you @Eralyne What data does data receive, could you print it and send it to me
like-gold
like-goldOP•2y ago
No description
MEE6
MEE6•2y ago
GG @Eralyne, you just advanced to level 1!
1Lucas1.apk
1Lucas1.apk•2y ago
he does not specify which date he receives?
like-gold
like-goldOP•2y ago
oh, this is already filtered So this is in my voiceStateUpdate handler
1Lucas1.apk
1Lucas1.apk•2y ago
say this example?
{ "t": "VOICE_SERVER_UPDATE", "s": 2, "op": 0, "d": { } }
{ "t": "VOICE_SERVER_UPDATE", "s": 2, "op": 0, "d": { } }
like-gold
like-goldOP•2y ago
1 sec let me get the raw data
1Lucas1.apk
1Lucas1.apk•2y ago
There are two essential events VOICE_SERVER_UPDATE, VOICE_STATE_UPDATE
like-gold
like-goldOP•2y ago
Yeah, it's just the "d" portion stringified, I don't have any other portion of the gateway payload except the name of the event. Like I know this data is associated with VOICE_STATE_UPDATE and if I get VOICE_SERVER_UPDATE, I know that as well
No description
1Lucas1.apk
1Lucas1.apk•2y ago
if you can spell out the "t" it will work { t: "event", d: {} }
like-gold
like-goldOP•2y ago
So only t and d are needed?
1Lucas1.apk
1Lucas1.apk•2y ago
Yes t to identify the event d the event data
like-gold
like-goldOP•2y ago
Hmm, doesn't seem to work
No description
like-gold
like-goldOP•2y ago
let me try one more thing
1Lucas1.apk
1Lucas1.apk•2y ago
It has to be both If you play Moonlink it will identify the data as if it were this
like-gold
like-goldOP•2y ago
I have it in server update as well
No description
1Lucas1.apk
1Lucas1.apk•2y ago
try to explain better There are 2 events (each event has its date ) The t is used to identify updateVoiceState has ifs asking which event is which If it is not the two events it ignores by name If it is an event that is necessary, it will pick up and store it for the lavalink connections
like-gold
like-goldOP•2y ago
Yes, I get that. But as you can see here, my t is one of those
1Lucas1.apk
1Lucas1.apk•2y ago
How do you make the connection? With the discord api
like-gold
like-goldOP•2y ago
I have an external gateway that sends events to my client and then I reply when needed with ws
MEE6
MEE6•2y ago
GG @Eralyne, you just advanced to level 2!
like-gold
like-goldOP•2y ago
This is my response
No description
like-gold
like-goldOP•2y ago
It works enough to make it connect to the channel
1Lucas1.apk
1Lucas1.apk•2y ago
I also thought about using some ifs to know what data you have to create a name I'll see what data is and do the if
like-gold
like-goldOP•2y ago
I see your updateVoiceState function, maybe the issue of it not playing is not this
like-gold
like-goldOP•2y ago
This is what I send
No description
like-gold
like-goldOP•2y ago
Maybe it's an issue with my lavalink process?
1Lucas1.apk
1Lucas1.apk•2y ago
?eval let data = { endpoint: 'aaa', guild_id: 'aaa', token: 'aaa' } let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : event_name = null; data?.session_id && data?.guild_id && data?.channel_id && data?.mute && data?.deaf ? event_name = 'VOICE_STATE_UPDATE' : event_name = null; if (!event_name) return; event_name
Blobit - Moonlink.js
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
1Lucas1.apk
1Lucas1.apk•2y ago
Wait, I'm not done yet { "channel_id": "157733188964188161", "user_id": "80351110224678912", "session_id": "90326bd25d71d39b9ef95b299e3872ff", "deaf": false, "mute": false, "self_deaf": false, "self_mute": true, "suppress": false, "request_to_speak_timestamp": "2021-03-31T18:45:31.297561+00:00" } ?eval let data = { endpoint: 'aaa', guild_id: 'aaa', token: 'aaa' } let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : event_name = null; data?.session_id && data?.guild_id && data?.channel_id && data?.mute && data?.deaf ? event_name = 'VOICE_STATE_UPDATE' : event_name = null; if (!event_name) return; event_name bot died
like-gold
like-goldOP•2y ago
I took a look to see how far the code reaches. It goes through the entire updateVoiceState method
like-gold
like-goldOP•2y ago
But it fails at attemptConnection
No description
like-gold
like-goldOP•2y ago
one of either players or voiceServer do not seem to exist
1Lucas1.apk
1Lucas1.apk•2y ago
?eval let data = { endpoint: 'aaa', guild_id: 'aaa', token: 'aaa' } let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : event_name = null; data?.session_id && data?.guild_id && data?.channel_id && data?.mute && data?.deaf ? event_name = 'VOICE_STATE_UPDATE' : event_name = null; if (!event_name) return; event_name
Blobit - Moonlink.js
SyntaxError: Illegal return statement
SyntaxError: Illegal return statement
1Lucas1.apk
1Lucas1.apk•2y ago
?eval let data = { endpoint: 'aaa', guild_id: 'aaa', token: 'aaa' } let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : event_name = null; data?.session_id && data?.guild_id && data?.channel_id && data?.mute && data?.deaf ? event_name = 'VOICE_STATE_UPDATE' : event_name = null; event_name
like-gold
like-goldOP•2y ago
players exists, voiceServer for the guildId does not exist.
Blobit - Moonlink.js
null
null
like-gold
like-goldOP•2y ago
I don't think this is necessary. This bloats the code. Just specify what payload has to look like in the documentation. My implementation goes through voiceStateUpdate just fine now
1Lucas1.apk
1Lucas1.apk•2y ago
it's just a test Because he didn't get it right When the received event is the state' it saves the information to join with the server at the end
like-gold
like-goldOP•2y ago
Okay, I think I know my issue. I never get the Voice_Server_Update event Since I never get that on initial join, it's not going to be mapped
1Lucas1.apk
1Lucas1.apk•2y ago
There's no way to make him play the events without filtering them
like-gold
like-goldOP•2y ago
Not saying to filter them. I'm just saying for some reason my gateway doesn't get that event
1Lucas1.apk
1Lucas1.apk•2y ago
Try to see where they are received, because normally discord sends events
Blobit - Moonlink.js
null
null
1Lucas1.apk
1Lucas1.apk•2y ago
?eval let data = { endpoint: 'aaa', guild_id: 'aaa', token: 'aaa' } let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : data; data?.session_id && data?.guild_id && data?.channel_id && data?.mute && data?.deaf ? event_name = 'VOICE_STATE_UPDATE' : data ; event_name
Blobit - Moonlink.js
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
1Lucas1.apk
1Lucas1.apk•2y ago
?eval let data = { session_id: 'aba' } let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : data; data?.session_id ? event_name = 'VOICE_STATE_UPDATE' : data ; event_name
Blobit - Moonlink.js
'VOICE_STATE_UPDATE'
'VOICE_STATE_UPDATE'
1Lucas1.apk
1Lucas1.apk•2y ago
let event_name = null; data?. token && data?.endpoint && data?.guild_id ? event_name = 'VOICE_SERVER_UPDATE' : data; data?.session_id ? event_name = 'VOICE_STATE_UPDATE' : data ; This is a check with the necessary properties in the events
like-gold
like-goldOP•2y ago
what if endpoint is null for voice_server? That usually indicates that the bot needs to wait for the voice server to be reallocated It won't pass your check in this case
1Lucas1.apk
1Lucas1.apk•2y ago
hmmmm I don't think it will change, within Moonlink it usually only uses it once It takes this data together and sends it to lavalink, then lavalink establishes a connection
like-gold
like-goldOP•2y ago
Yeah, it seems my issue is that I just don't get the voice server update event. Guess I'll investigate that. I can fake its data but probably not good to do. Thanks for helping me isolate the issue
1Lucas1.apk
1Lucas1.apk•2y ago
have a great day :D

Did you find this page helpful?