Access to client instance from player
Hey everyone, I'd like to know if there's a way to access the client object from the player. If not, I'd like to know if there's a way to get the actual channel (TextChannel object) from the player.textChannel attribute
55 Replies
I didn't quite understand your question
Do you want the channel attributes?
Like client.channels.cache.get(id)?
inland-turquoiseOPβ’14mo ago
yup
but the thing is that i don't have accest to my client instance
I would need to pass the client but idk if possible
You can pass the client attributes through the handler that executes the commands
Events*
I got the word wrong
inland-turquoiseOPβ’14mo ago
Yeah i'll look into that
I already do a separate event handling for moonlink
I understood
Moonlink does not export the client, because it may sometimes be a different client
This can make very unnecessary code
That will never be used
inland-turquoiseOPβ’14mo ago
Yeah I can understand that
GG @Xotak, you just advanced to level 1!
I hope you can solve your problem, if you have any further questions, just come here to ask and I will try to help you resolve it.
Have a great day π
You can also use get and set from the player, I forgot about them
The set and get are stored in the player's data, some isolated values ββof the player's attributes, this may be useful for you
inland-turquoiseOPβ’14mo ago
Oh you can store more data than those ?

Yes
?eval a
inland-turquoiseOPβ’14mo ago
Nice, I tried to add a client attribute in the create but that didn't work. I'll try to set a client like that. Does it work that way ?
Probably yes, because the Channel's attributes are still there
Stay in sync with the DJs
inland-turquoiseOPβ’14mo ago
So if i understood properly, the set method change the map propriety of the player object ?
Almost that, the set assigns the values ββto data which is an object
And class inheritance is not lost
So you can use it when using get
inland-turquoiseOPβ’14mo ago
I just need to access to channel cache, if I add a key with
client
as the name and the client as a value and if I do a player.get("client")
I would get the client object right ?I think it would work
Yes, it works, this creates a reference to the value, instead of a copy
inland-turquoiseOPβ’14mo ago
Took a break but it looks like it's working.
I just upgraded moonlink and I'm having an issue with the voiceRegion in PlayerManager
I logged the PlayersManager and looks like cacke is empty
Trying to look into it, seems like it's not related to sharding
GG @Xotak, you just advanced to level 2!
inland-turquoiseOPβ’14mo ago
I'll open an issue on GH
I'll look in the forums before
Found nothing
Issue #72
reinstalled moonlink didn't work
Can you put a log in node_modules?
Apologies for the delay
inland-turquoiseOPβ’14mo ago
No worries
Where should I put that log ?
I don't have my PC rn, I'll do it tmr (I'm in UTC+1)
In moonlink.js/dist/src/@Managers/PlayerManager.js
On line 76
Before her puts
console.log(voiceRegion, this)
To see what happens before issuing the error
inland-turquoiseOPβ’14mo ago
Okay I'll do that. Do you want me to update the issue afterwards or I post the output here ?
You can post here
inland-turquoiseOPβ’14mo ago
Okay
This may help to find the error, It's probably in the voiceRegion
inland-turquoiseOPβ’14mo ago
Nearly 11pm here, I'll go to sleep. I'll go back to it early in the morning so I should have an answer in a few hours
Okay, no problem, I'll wait
inland-turquoiseOPβ’14mo ago
I put your name in my README as a thanks for your help
You also helped me find a console.log that I didn't remember was there
inland-turquoiseOPβ’14mo ago
Oh right, the one that sends metrics about Lavalink ?
Yes
There was a console.log in Websocket, and I forgot to remove it when I was debugging the code
inland-turquoiseOPβ’14mo ago
Console.log, best friend when debugging
I think I have a problem with queueing, but that's in my play command since I don't have that issue with the sample code.
Also, it would be great if there was more info on what does the method does. I can help with that if needed
Ho, but this might also help fix other bugs in the code
It's normal for this to happen
Each Dev sometimes has different syntax, this can cause hidden errors to occur in the code
inland-turquoiseOPβ’14mo ago
Yup
And since I do handlers and stuff, sometimes it gets complicated
That's why I opened this issue in the first place
The playerManager is responsible for managing player information, such as endpoints, issuing playerDisconnected, updating information for lavalink such as changing the voice channel
And it is also what manages the player classes
And there is also voiceRegion that I implemented in a version
inland-turquoiseOPβ’14mo ago
I meant on https://moonlink.js.org/
Welcome to Moonlink.js
a universe of songs...
GG @Xotak, you just advanced to level 3!
So far, the documentation is not very updated
inland-turquoiseOPβ’14mo ago
That's why I proposed my help
If you don't plan it to do now, don't hesitate to ping me if you need help
(Says the person that doesn't even completed his own)
I'm a little embarrassed to ask for help π₯Ί
inland-turquoiseOPβ’14mo ago
No it's completely fine
I am asking myself for help too
I saw on your GH that you study on your own, you don't have to know everything
I'm left speechless :shy:
Well I try to do my best (documentation is not my thing)
inland-turquoiseOPβ’14mo ago
Me neither
I just saw I didn't push the beginning of my docs
π
inland-turquoiseOPβ’14mo ago
Well, it's really time for me to get to sleep. I don't know how your docs work but if it's just editing the markdown files I'm down
Have a great night, the moonlink docs have another doc that explains how it works
https://docus.dev
Home
The best place to start your documentation.
Bye see you tomorrow
Before I publish, could you test the version to see if it is working correctly?
npm uninstall moonlink.js && npm install https://github.com/Ecliptia/moonlink.js
GitHub
GitHub - Ecliptia/moonlink.js: MoonLink.js is a simple package for ...
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 - GitHub ...
inland-turquoiseOPβ’14mo ago
That's what I did before closing the issue
It worked, and queue was fixed
Well, I understand, thank you very much for reporting
I'll see if I didn't leave any console.log this time
inland-turquoiseOPβ’14mo ago
Thanks for the release. I'll update my package.json accordingly
You're welcome, have a great day
inland-turquoiseOPβ’14mo ago
Thanks, you too !