Jump to content
McKay Development

Get friend invites?


Kraxie

Recommended Posts

Though it is possible to listen for friendRelationship

client.on('friendRelationship', function(sid, relationship) {
	
    //incoming friend requests
    if(relationship == 2) {
        console.log(sid + ' added me.');
    }
});

sid is the id of the friend who added you

Edited by jafix
Link to comment
Share on other sites

Here's how you can automatically accept them, it will also log who has added you

 

client.on('friendRelationship', function(steamID, relationship) {

    if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
        client.addFriend(steamID);
        console.log("Accepted friend request from: " + steamID);
        client.chatMessage(steamID, "This line is optional, this message user will receive when bot is added.");
    }
    });
Link to comment
Share on other sites

What is 'client' and I assume this is only triggered when the account recieves an invite and doesn't trigger for the invites it currently has.

If there isn't a way, can I load the friend invites page and get all friend invites from there?

 

Update:

Okay, so I ended up with this to check current invites:

community.httpRequest("http://steamcommunity.com/my/home/invites/", (err, response, body) => {
    if (err) {
        console.log("Error: %s", err.message)
    } else {
        // Sort them here
    }
})

 

Edited by Kraxie
Link to comment
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...