iLuk Posted March 24, 2016 Report Share Posted March 24, 2016 (edited) 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 March 31, 2016 by iLuk Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted March 29, 2016 Report Share Posted March 29, 2016 I've never experienced a persona data being unavailable. Is there any specific condition which makes it unavailable, or are you talking about just regular Steam failures? Quote Link to comment Share on other sites More sharing options...
iLuk Posted March 29, 2016 Author Report Share Posted March 29, 2016 (edited) When you are logged out. It happened to my bot when it was reconnecting to Steam after losing the connection. @EditCan I check somehow if the bot is logged in? Edited March 30, 2016 by iLuk Quote Link to comment Share on other sites More sharing options...
iLuk Posted March 31, 2016 Author Report Share Posted March 31, 2016 I can do something like that: var partnerName; client.getPersonas([partnerId], function (persona) { partnerName = persona[partnerId].player_name; }); setTimeout(function(){ if (partnerName == undefined) // data unavailable },2000);but is there a better option? Quote Link to comment Share on other sites More sharing options...
iLuk Posted April 7, 2016 Author Report Share Posted April 7, 2016 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| Flags.Metadata|Flags.LastSeen|Flags.ClanInfo|Flags.GameExtraInfo|Flags.GameDataBlob| Flags.ClanTag|Flags.Facebook; 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) { callback(output); } } } }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.