seishun / node-steam

Interface directly with Steam servers from Node.js
MIT License
1k stars 180 forks source link

Accepting Steam Friends #350

Closed iTzxBeaTz closed 8 years ago

iTzxBeaTz commented 8 years ago

Hey, i want to accept friend requests. BUT i searched here and all what i founded doesnt work.

steam.on('relationships', function() { for (var friend in steam.friends) { console.log('User: ' + friend); if (steam.friends[friend] == 2) { client.addFriend(friend); console.log('SteamID ' + friend + ' added!') } } });

this doesnt work. I changed everything on this code to make it work. But i failed.

i hope anyone can help me.

starwolfy commented 8 years ago
    steamFriends.on('friend', function(source, type) {
        //auto accept friend requests
        if(type == Steam.EFriendRelationship.RequestRecipient) {
            console.log("Accepted a friend request from: " + source);
            steamFriends.addFriend(source);
        }
    });

To accept them when your bot is online.


    steamFriends.on('relationships', function() {
        for (var prop in steamFriends.friends) {
            if (steamFriends.friends.hasOwnProperty(prop)) {
                if (steamFriends.friends[prop] == 2) {
                    steamFriends.addFriend(prop);
                    console.log("Accepted a friend request from (offline): " + prop);
                }
            }
        }
    });

To accept them when the invitations were sent while the bot was offline.

seishun commented 8 years ago

@iTzxBeaTz your code is for v0.6. See the release notes for relevant changes.

iTzxBeaTz commented 8 years ago

i have the newest version. Trade Offers works, sending messages works fine. But Accepting Friend Requests doesnt work...