1. That`s the funny thing, I don`t understand why, but when personas is before err, it is just logging into console all the data instead of errors, like:
{
'22222222222222222': {
rich_presence: [],
persona_state: 3,
game_played_app_id: 0,
...etc
}
}
The only way it works correctly in this order is like this, the problem still persists :
client.getPersonas([receivers[i]], function (personas, err) {
if (personas) {
console.log(personas)
} else {
let data = err[receivers[i]].persona_state
2. Actually in the real code I am fetching data row by row from sqlite database, checking for each row a column wasMessagedToday, if it is false, then calling getPersonas() and if messaged successfully, updating wasMessagedToday value in database to true. Maybe there is a better way, but I am an absolute newbie in database stuff.
3. Thank you, thank you!!! I`ve tried already few ways to delay time including setTimeout(checkOnline, 2000) after setting persona to Online, but it wasn`t working. Tried now to increase the delay to 10 seconds and now data from getPersonas() is correct at every run! I guess Steam is really slow with status updates. So the fix looks like this:
client.on('loggedOn', function () {
console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
client.setPersona(SteamUser.EPersonaState.Online)
setTimeout(checkOnline, 10000);
});