Jump to content
McKay Development

getPersonas - unavailable data


Recommended Posts

Hi, when I use GetPersonas there's a possibility that the requested data would be unavailable. Unfortunately there's no error callback. How can I check it?

I mean something like this:

if (GetPersonas is unavailable)
   // do something...
Edited by iLuk
Link to comment
Share on other sites

I can do something like that:

var partnerName;

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

       partnerName = persona[partnerId].player_name;


if (partnerName == undefined)
       //  data unavailable


but is there a better option?

Link to comment
Share on other sites

It also happens when the bot is logged in. How can I edit this function to return error when it fails?

SteamUser.prototype.getPersonas = function(steamids, callback) {
var Flags = Steam.EClientPersonaStateFlag;
var flags = Flags.Status|Flags.PlayerName|Flags.QueryPort|Flags.SourceID|Flags.Presence|

var ids = steamids.map(function(id) {
if(typeof id === 'string') {
return (new SteamID(id)).getSteamID64();

return id.toString();

this._send(Steam.EMsg.ClientRequestFriendData, {
"friends": ids,
"persona_state_requested": flags

if(callback) {
var output = {};

var self = this;
ids.forEach(function(id) {
self.once('user#' + id, receive);

function receive(sid, user) {
var sid64 = sid.getSteamID64();
output[sid64] = user;

var index = ids.indexOf(sid64);
if(index != -1) {
ids.splice(index, 1);

if(ids.length === 0) {
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.

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.

  • Create New...