plugCubed/plugAPI

User.language is null

Closed this issue · 2 comments

Hello! Thanks for PlugAPI it's awesome!

Now the problem is that the user object contains numerous undefined properties when the user targeted is an other user than the bot itself.

Is there a way to retrieve a user current language when answering to him?

Thanks

Hi,

When the bot first starts, it retrieves all user data from /_/rooms/state , however they strip a lot of the user data from that JSON object.

However, I do believe when a user has joined after the bot has started its fine.... But I can not recall if it has the language data you need or not.

Regardless, there is a way to grab the full user object via sending an API request to /_/users/:id. In plugAPI v5 there's a method called bot.getJar , this is an instance of a cookie jar that can be utilized in any HTTP request module to send API requests and get responses.

Hi,

Thanks for your response...

I added updateUser in my fork to refresh a user

I also changed the addSongToPlaylist so i can add songs by id and updated the _editPlaylistLength because the playlist count was not correct when adding several songs