Jump to content
McKay Development

Receive friend requests/Adding friends


UKF

Recommended Posts

Hello,

How can I add a friend if a friend request is received?

I tried using addFriend(steamID), here's the code, am I doing something wrong?

var SteamUser = require('steam-user');
var client = new SteamUser();

client.on("friend", function (steamID) {
        client.addFriend(steamID);
    }
);

Thanks for the help!

UKF

Link to comment
Share on other sites

 

I got it to work by using on('friendRelationship')

If I'm not wrong, it should be client.on('friendRelationship'), function(parameters) { ... });

Also, a question, these #paramaters, can be used such as client.on('parameter') etc...?

And how could I get the the user's steam name? (not 64bit ID).

 

Thank you

UKF

Link to comment
Share on other sites

The names are the player_name property in each object in the array provided in the callback.

 

I am new into the callback things and not a professional :D

I got this to work somehow:

 

var botName;

 

setInterval(function () {

    if (botName == undefined) {

        client.getPersonas([client.steamID], function (persona) {

            botName = persona[client.steamID].player_name;

        });

    }

}, 5000);

 

Is it the right usage? Or is there a better way?

Link to comment
Share on other sites

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