Jump to content
McKay Development

Recommended Posts

Posted

Hello!

 

So, I noticed there's getNotifications() to get the number of notifications, but can I actually get, for example, who I have gotten a friend invite from?

 

Thanks!  :)

Posted (edited)

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
Posted

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.");
    }
    });
Posted (edited)

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
Posted

SteamUser = require('steam-user');

const client = new SteamUser();

'client' is how i called steam-user.

 

True, the event is only fired on a new friend invite.

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...