Slime Posted March 27, 2019 Report Posted March 27, 2019 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); }}); Quote
Dr. McKay Posted March 28, 2019 Report Posted March 28, 2019 Replace user.value == 2 with client.myFriends[sid.toString()] == SteamUser.EFriendRelationship.RequestRecipient Quote
Slime Posted March 28, 2019 Author Report Posted March 28, 2019 Replace user.value == 2 with client.myFriends[sid.toString()] == SteamUser.EFriendRelationship.RequestRecipientIt 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. Quote
Dr. McKay Posted March 29, 2019 Report Posted March 29, 2019 client.myFriends is useless before friendsList is emitted. Quote
Slime Posted March 29, 2019 Author Report Posted March 29, 2019 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]); } } }); root89 1 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.