Jump to content
McKay Development

Recommended Posts

Posted

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

Posted

 

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

 

You can use getPersonas to get names and other profile data.

Posted

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?

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