player.timeRemains()
Is there is a way to find out how many milliseconds are left for the current song?
29 Replies
Hello
All good
A simple solution is to do a mathematical calculation
foreign-sapphireOP•2y ago
thx, i was wondering what the player.current field was. thought it was the current track
ðŸ¤
Have a great day
foreign-sapphireOP•2y ago
u2
@1Lucas1.apk sorry for ping, but how can i get the current track if one is playing?
It's player.current
foreign-sapphireOP•2y ago
current is always null btw
?eval client.moon.players.get(message.guild.id).current
foreign-sapphireOP•2y ago
thx that's weird
but i can check again
Is there any problem getting it on the map?
foreign-sapphireOP•2y ago
no i don't belive so
ðŸ¤
I'm finishing some school work, I'll be back soon
foreign-sapphireOP•2y ago
have fun :)
GG @LuLeu, you just advanced to level 1!
What version of node are you using?
foreign-sapphireOP•2y ago
v18.17.1
Did you test the console on the map?
console.log(client.moon.map)
Just to see what comes back
foreign-sapphireOP•2y ago
1 sec
now i use node lts
And player.current returns null 🤔
foreign-sapphireOP•2y ago
now current works strange
but now the player sometimes crashed internally when looking up a spotify track. dont have the error currently but i can send it if it comes up again
Yesterday I noticed this error, I'm going to add some missing ifs, I think it should solve it
foreign-sapphireOP•2y ago
is there any reason why player.current is any?
GitHub
moonlink.js/src/@Moonlink/MoonlinkPlayers.ts at v2 · 1Lucas1apk/moo...
MoonLink.js is a simple package for lavalink client, perfect for you to create your discord bot with songs, and very simple and easy to use. Support Server: https://discord.gg/xQq2A8vku3 - 1Lucas1...
If you give console.log to player, what does it return?
foreign-sapphireOP•2y ago
nono current is defined but it has the type any. why not just MoonlinkTrack | null?
foreign-sapphireOP•2y ago
in your defined MoonlinkPlayer.d.ts current is defined as a any type. https://github.com/1Lucas1apk/moonlink.js/blob/v2/src/@Moonlink/MoonlinkPlayers.ts#L56
GitHub
moonlink.js/src/@Moonlink/MoonlinkPlayers.ts at v2 · 1Lucas1apk/moo...
MoonLink.js is a simple package for lavalink client, perfect for you to create your discord bot with songs, and very simple and easy to use. Support Server: https://discord.gg/xQq2A8vku3 - 1Lucas1...
GG @LuLeu, you just advanced to level 2!
I understand, the right thing would be
public current: Record<string, any> | null;
Because current it changes to a json, and then the class it had in it no longer exists, so it becomes Record<string, any>
I will fix this in the next version