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?
extended-salmon
extended-salmon425d ago
For extra context, I tried pushing up voice state events but that doesn't seem to work.
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d ago
This is what I've tried to push up
No description
No description
extended-salmon
extended-salmon425d ago
I just tried which didn't seem to work. What exact info is updateVoiceState eexpecting?
No description
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d ago
No description
wise-white
wise-white425d ago
GG @Eralyne, you just advanced to level 1!
1Lucas1.apk
1Lucas1.apk425d ago
he does not specify which date he receives?
extended-salmon
extended-salmon425d ago
oh, this is already filtered So this is in my voiceStateUpdate handler
1Lucas1.apk
1Lucas1.apk425d ago
say this example?
{ "t": "VOICE_SERVER_UPDATE", "s": 2, "op": 0, "d": { } }
{ "t": "VOICE_SERVER_UPDATE", "s": 2, "op": 0, "d": { } }
extended-salmon
extended-salmon425d ago
1 sec let me get the raw data
1Lucas1.apk
1Lucas1.apk425d ago
There are two essential events VOICE_SERVER_UPDATE, VOICE_STATE_UPDATE
extended-salmon
extended-salmon425d 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.apk425d ago
if you can spell out the "t" it will work { t: "event", d: {} }
extended-salmon
extended-salmon425d ago
So only t and d are needed?
1Lucas1.apk
1Lucas1.apk425d ago
Yes t to identify the event d the event data
extended-salmon
extended-salmon425d ago
Hmm, doesn't seem to work
No description
extended-salmon
extended-salmon425d ago
let me try one more thing
1Lucas1.apk
1Lucas1.apk425d ago
It has to be both If you play Moonlink it will identify the data as if it were this
extended-salmon
extended-salmon425d ago
I have it in server update as well
No description
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d ago
Yes, I get that. But as you can see here, my t is one of those
1Lucas1.apk
1Lucas1.apk425d ago
How do you make the connection? With the discord api
extended-salmon
extended-salmon425d ago
I have an external gateway that sends events to my client and then I reply when needed with ws
wise-white
wise-white425d ago
GG @Eralyne, you just advanced to level 2!
extended-salmon
extended-salmon425d ago
This is my response
No description
extended-salmon
extended-salmon425d ago
It works enough to make it connect to the channel
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d ago
I see your updateVoiceState function, maybe the issue of it not playing is not this
extended-salmon
extended-salmon425d ago
This is what I send
No description
extended-salmon
extended-salmon425d ago
Maybe it's an issue with my lavalink process?
1Lucas1.apk
1Lucas1.apk425d 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
sunny-green
sunny-green425d ago
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d ago
I took a look to see how far the code reaches. It goes through the entire updateVoiceState method
extended-salmon
extended-salmon425d ago
But it fails at attemptConnection
No description
extended-salmon
extended-salmon425d ago
one of either players or voiceServer do not seem to exist
1Lucas1.apk
1Lucas1.apk425d 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
sunny-green
sunny-green425d ago
SyntaxError: Illegal return statement
SyntaxError: Illegal return statement
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d ago
players exists, voiceServer for the guildId does not exist.
sunny-green
sunny-green425d ago
null
null
extended-salmon
extended-salmon425d 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.apk425d 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
extended-salmon
extended-salmon425d 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.apk425d ago
There's no way to make him play the events without filtering them
extended-salmon
extended-salmon425d ago
Not saying to filter them. I'm just saying for some reason my gateway doesn't get that event
1Lucas1.apk
1Lucas1.apk425d ago
Try to see where they are received, because normally discord sends events
sunny-green
sunny-green425d ago
null
null
1Lucas1.apk
1Lucas1.apk425d 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
sunny-green
sunny-green425d ago
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
'VOICE_SERVER_UPDATE'
1Lucas1.apk
1Lucas1.apk425d 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
sunny-green
sunny-green425d ago
'VOICE_STATE_UPDATE'
'VOICE_STATE_UPDATE'
1Lucas1.apk
1Lucas1.apk425d 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
extended-salmon
extended-salmon425d 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.apk425d 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
extended-salmon
extended-salmon425d 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.apk425d ago
have a great day :D