Jump to content
McKay Development

Recommended Posts

Posted (edited)

 

addFriend(steamID[, callback])
steamID - The SteamID of the user you want to add as a friend, as a SteamID object or a string that can parse into one
callback - Optional. Called when Steam responds to this request.
err - An Error object on failure, or null on success. If this is an Error object, it will have an eresult property.
personaName - If successful, the current persona name of the user you added.

 

Hello!

I was looking for a solution for 2 days! But I didn't find any example.

How can I SEND a friend request to a user - https://steamcommunity.com/profiles/76561198398979571

I made hundreds of examples but they don't work...

I'm tired, please help!

Edited by 3035129850591873351975
Posted

I'm sorry, I started learning Java only 3 days ago. The last code, this is your example:

client.on('friendRelationship', function(steamID, relationship) {
    if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
        client.addFriend(steamID);
    }
});

I can't figure out where to write 76561198398979571
I didn't find any examples, videos or tutorials((

const SteamUser = require('steam-user')
const config = require('./config.js')

const client = new SteamUser;

const logOnOptions = {
    accountName : config.accountName,
    password : config.password
};

client.logOn(logOnOptions);

client.on('loggedOn', () => {
    console.log(client.steamID + ' logged in Steam.');
    
    client.setPersona(SteamUser.EPersonaState.Online);
});

client.on('friendRelationship', function(steamID, relationship) {
    if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
        client.addFriend(steamID);
    }
});

 

Posted

That's an old example. SteamUser.Steam.EFriendRelationship.RequestRecipient should instead be SteamUser.EFriendRelationship.RequestRecipient.

Regardless, if you want to initiate a friend request, use client.addFriend for that. For example, client.addFriend('76561198398979571')

Posted

I have tried many options, some of them are:

 

client.on('friendRelationship', function(steamID, relationship) {
    if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {
        client.addFriend('76561198398979571');
    }
});

 

client.addFriend('76561198398979571', function(steamID) {
});

 

client.on('friendRelationship', function(sid, relationship) {
    if(relationship == 2) {
        client.addFriend('76561198398979571');
    }
});

 

client.on('friendRelationship', function(steamID, relationship) {
    if (steamID) {
        client.addFriend('76561198398979571');
    }
    if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
        client.addFriend(steamID);
    }
});

 

But none of the options work... I added an account check for bans. All is clear.

 

client.on('accountLimitations', function (limited, communityBanned, locked, canInviteFriends) {
    if (limited) {
        console.log("Our account is limited. We cannot send friend invites, use the market, open group chat, or access the web API.");
    }
    if (communityBanned){
        console.log("Our account is banned from Steam Community");
    }
    if (locked){
        console.log("Our account is locked. We cannot trade/gift/purchase items, play on VAC servers, or access Steam Community.  Shutting down.");
        process.exit(1);
    }
    if (!canInviteFriends){
        console.log("Our account is unable to send friend requests.");
    }
});

 

I tried sending an invitation to other users. Does not work.

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