Jump to content


Photo
Question

Question regarding myFriends

node.js node-steam-user

  • Please log in to reply
4 replies to this topic

#1 Poketz

Poketz

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 12 February 2017 - 10:50 AM

Firstly, thanks for the great work on steam-user. It's great.

 

I'm having some issues with getting my friends list, having read the docs I understand it can be accessed via myFriends.

 

I've tried the following but it keeps returning undefined.

 

function getMyFriends(callback) {
    if(err)
        return callback(err);
    if(!user.myFriends)
        callback(null,user.myFriends)
}

 

What event do I need to wait for to ensure it holds something?



#2 Dr. McKay

Dr. McKay

    Administrator

  • Administrator
  • 1,170 posts

Posted 12 February 2017 - 10:35 PM

You need to wait for this event: https://github.com/D...ser#friendslist

 

Also, the problems I see with your code are that err doesn't exist, and that you're only sending back the friends list if it's falsy (which would never result in sending back the friends list).



#3 Poketz

Poketz

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 14 February 2017 - 05:18 PM

Thank you very much, I completley missed the event - couldn't see the forest for the trees.

 

And you're quite right, my code was garbage. :)



#4 Poketz

Poketz

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 14 February 2017 - 06:18 PM

On the top of my Friends is their a way to either establish a list of only my friends that are online.

 

or even better.. an event that advises me when they start a game?



#5 Dr. McKay

Dr. McKay

    Administrator

  • Administrator
  • 1,170 posts

Posted 14 February 2017 - 09:22 PM

The user event will be emitted anytime someone's persona data changes (e.g. they go online/offline or start/quit a game).

 

Also, at any time the users property contains the current persona data for everyone we know about.







Also tagged with one or more of these keywords: Question, node.js, node-steam-user

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users