Jump to content
McKay Development
Slime

How to get an array of the users whom relationship is 2 (Waiting for friend request to accept)?

Recommended Posts

I would like it to accept everyone who added me when the bot wasn't opened. i've tried to do that but i think i didn't get how it works, here's what i tried:
 

client.on('loggedOn', () => {
    client.setPersona(1);
    client.getPersonas(client.myFriends);
});

client.on('user', function (sid, user) {
    console.log(sid + " " + user.value);
    if (user.value == 2) {
        client.addFriend(sid);
        client.getChatHistory(sid);
    }
});

Share this post


Link to post
Share on other sites

Replace user.value == 2 with client.myFriends[sid.toString()] == SteamUser.EFriendRelationship.RequestRecipient

It seems to be working tho the client.myFriends don't include the users that are waiting for you to accept thier friend request...

Is there a way to get them from any other array or something?

Thanks for the quick respond btw.

Share this post


Link to post
Share on other sites

Thanks for the info and the quick answer as always. i've made this and it works if anyone wants it:
 

client.on('friendsList', function () {
    console.log("Searching for friend requests...");
    for (var i = 0; i < Object.keys(client.myFriends).length; i++) {
        if (client.myFriends[Object.keys(client.myFriends)[i]] == SteamUser.EFriendRelationship.RequestRecipient) {
            console.log("Added " + Object.keys(client.myFriends)[i]);
            client.addFriend(Object.keys(client.myFriends)[i]);
            client.getChatHistory(Object.keys(client.myFriends)[i]);
        }
    }
});

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...