Some Problems Migrating to v5
Hey all, sorry this is probably a very stupid post, I haven’t touched this in over a year and I learned about Lavalink v4 and Lavaclient v5 being released
After getting errors with searches returning 400 errors and whatnot, I decided to migrate my discord bot from Lavalink v3 and Lavaclient v4.
I’ve come into many problems with this migration but I had a few I wasn’t sure about and I didn’t find any documentation for migrating.
From what I can tell, @lavaclient/queue, @lavaclient/types, and @lavaclient/spotify are all deprecated and don’t work anymore?
Are there any alternatives yet for these I can begin to implement into Lavaclient? My main errors now lie with these packages no longer working
I don’t have much Java experience as someone mentioned Lavalink plug-ins to me, but I’d be terrible at those
I was also told possibly about LavaSrc, but I’m not sure how I’d go at implementing that client side too.
Again thank you! Sorry if this seems like a horribly stupid question, it’s been a while since I’ve touched JS
50 Replies
hi
From what I can tell, @lavaclient/queue, @lavaclient/types, [...] are all deprecated and don’t work anymore?The queue plugin is being rewritten since it kinda sucks, there's a port at
@lavaclient/plugin-queue
types has been rewritten to support runtime validation at lavalink-protocol
and @lavaclient/spotify...As you've already mentioned, LavaSrc exists. I still believe client-side fetching is better all around but LavaSrc will be faster.
but I’m not sure how I’d go at implementing that client side too.You just call the load tracks endpoint like any other query
Ah okay thank you! So (again sorry for my stupidity), besides these changes there isn’t really any other major or breaking changes I should have to worry about, besides just updating to accommodate for these?
depends on what you mean
v5 is an entire rewrite
check the pinned messages in the project discussion thread
I've been fairly busy lately, in a new career and all over the place but I recently took over this project from a friend. It's been a while since I've touched lavaclient or much NodeJS for that matter, so I'm getting stuck quite easily haha. Sorry for my ignorance
I checked out the pinned thread which seems like most the information I'll need once I figure out how to talk with Lavalink now.
So most of what I'm needing to figure out is how to update the rest of my code, how to find existing players, create a player, pass track data, etc. etc.
One of the issues I've had troubles with specifically is dealing with players. Especially in regards to starting a queue and whatnot. Simply doing:
Won't work, so I'm having some difficulties trying to figure out the new system for players, queue, etc.
player.queue.start starts the queue
Ah okay thank you, so there shouldn’t be much difference with controlling the players and queue?
no not really
Alright that should help thank you! This is all quite new for me again as the last time I worked with lavaclient must’ve been over a year ago.
By change is there any form of docs or whatnot for the player, queue, etc., I can refer to? Just getting caught on little things like
players.get(GuildId)
and whatnot.
Thank you again!check the latest message in the pinned thread
TS Docs | Reference docs for npm packages
Generate type documentation for npm libraries
Ah thank you very much I’ll take a look at these! Sorry again for my ignorance when it comes to this all
it’s fine
Yeah I'm having tons of issues when trying to start queue and player and whatnot. Player will join the voice channel but stop there; not actually play the track. trackStart isn't at all being triggered, etc.
Esp having difficulties with things like:
Which should in theory be a pretty easy task, just loading an array
tracks
populated with const track = results.data[0];
, etc.
Just given the serious issues I have with the time to do this, I'll probably have to find a new client or wait until there's more docs on this, I'm having trouble with all these simple functions even mentioned in those docs. Hopefully coming back to this in a bit should make it easier if either more is available on it or I can get the time to figure this out on my ownI can't really do much without your code tbh
https://github.com/lavaclient/lavaclient/tree/master/packages/test
take a look at that, it's more of a testing playground than an example though
although I haven't updated it yet, the djs v13 example may be helpful since it gives you an idea on how you should use the queue
also W apple music user
Could you send your lavalink logs too
it may be more simple than something like misusing the library
should've started at that tbf 🙃
Ah thank you I'll take a look at those
As for my code, I'm happy to provide it, so far just working at the basics before adding in everything:
Lavalink Logs Show:
It's very likely I missed something, I'm not very thorough with these so I'd suspect its user error haha, also appreciate the Apple Music its great haha
had to backtrack. these logs don't show the full process of connecting, loading track, creating a player, and updating it
This same bot account has been used with Lavalink v3 and Lavaclient v4 for a while before this, only thing that triggered the update was Lavaplayer giving 400 errors when returning search results from YouTube, so I figured the best fix would be upgrading
did you disconnect after running the play command and stuff
ahahahahaha
i see
i should really fix this LMFAO
lavaclient#createPlayer is an internal method, it should only be overridden from the user, not called.
use lavaclient#players#create instead
Took a SC of the Lavalink logs, might show a bit more here haha
ah I'll try out that might be the issue
createPlayer is just
new Player(guildId, this)
it doesn't register the playerAh I see, replacing that line with
yup
still seems to not want to play anything through voice, lavalink logs are all showing similar as to what they were before:
Although from before, it seems loading anything player.queue was undefined, like
player.queue.start
or player.queue.on
, so I probably had an issue with how queue was defined from there, that was causing the immediate disconnect haha
Thank you again for all this help I'm a total idiot when it comes to this stuff LMAOyou need
require("@lavaclient/plugin-queue/register"
) at the top of your index.js
I'm not helping much either tbhAh I see, got the queue stuff working thank you! Despite doing that although and trying:
It still does not play the track,
trackStart
also doesn't seem to trigger
Knowing me, prob my bad code hahalavalink logs
should use this code too https://github.com/lavaclient/lavaclient/blob/master/packages/test/src/index.ts#L81-L106
GitHub
lavaclient/packages/test/src/index.ts at master · lavaclient/lavacl...
A simple, easy-to-use, and flexible lavalink client for node.js - lavaclient/lavaclient
lavalink:
ah thank you I'll add that rn
Put that in but still doesn't seem to change any of the logs
it's not supposed to, i just want to see the results
Ah I see my bad. Testing it and nothing seems different at least in terms of behaviour, etc.
btw player.queue doesn't have a track start event
player does
nvm im a fucking liar LMFAO
wtf is your issue lmfao
I'm honestly not sure lmao
Right now player seems to connect and track data loads fine, but the bot wont play anything, just sits in call
it's because your code isn't submitting voice updates
show me your bot logs
Bot logs are here, kinda went nuts earlier and logged all the track data to see if there was any issue there so its a bit overkill LMAO
you didn't add this ?
remove
: unknown[]
Ah I had added that but left some of the type annotation in, thats my bad
These are the current logs:
Had to cut off the one ws event log just cause it was too long for this message but I can send a txt or a paste of it if needed
track exception event :mm:
try this jar https://repo.lavalink.dev/artifacts/lavalink/fe62703c/Lavalink.jar
Ah that worked for getting the Exception out the way, but still wont play anything in the call
Trying again I get these logs
Also just realizing the time now, it's near midnight over here so I'll likely have to look at this tomorrow with fresh eyes haha. Have work super early in the morning which sucks but I'll definitely take another look at these tomorrow. Thank you again for all the help I do appreciate it
and there are no bot logs like
"updating voice status in guild"
"submitting voice update to node."
?
Sounds good. Sorry for the relentless back & forth, I don't think it's to do with the library but I don't know for sure lol
There is this I found just from a quick search of the logs
Nothing else although
I'll push an update for more voice status debug logging
You're all good haha I apologize for my ignorance with these things, you're helping a ton, I'd be completely lost on my own lmao
Its interesting being back with NodeJS, I started using it years ago, now out of high school and working sometimes 50 hours a week I stopped using it entirely but it's good to be back working with it, just forgot all of it haha
unfortunately i'm jobless so I have too much time to dedicate to my projects :')
Ah haha I’d love that so much more. Just in the process of becoming a full time paramedic so I’m having to work a lot more than I like lmao
Nothing wrong with too much time haha
wrong server mb
hey @gino sorry for ping but u available?
don’t ask to ask
also create a new thread