Kraxie Posted May 13, 2017 Report Posted May 13, 2017 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! Quote
jafix Posted May 14, 2017 Report Posted May 14, 2017 (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 May 14, 2017 by jafix Quote
TomYoki Posted May 14, 2017 Report Posted May 14, 2017 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."); } }); Quote
Kraxie Posted May 14, 2017 Author Report Posted May 14, 2017 (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 May 14, 2017 by Kraxie Quote
jafix Posted May 15, 2017 Report Posted May 15, 2017 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. Quote
Recommended Posts
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.