zephylac Posted July 29, 2016 Report Posted July 29, 2016 (edited) Hi I'm using getPersonas to retrieve people's username from a steam id but when I'm calling it ir returns me an error. I've checked npm and I have the last version of steam-user. Is it uncompatible with node-steam? var ids = steamids.map(function(id) { ^ TypeError: steamids.map is not a function at SteamUser.getPersonas (***/node_modules/steam-user/components/friends.js:119:21) P.S:I didn't forget to call the lib: // Requires var Steam = require("steam"), SteamGroups = require("steam-groups"), User = require('steam-user'), util = require("util"), fs = require("fs"), csgo = require("../"), readlineSync = require("readline-sync"), crypto = require("crypto"), pg = require('pg'); // Objects var bot = new Steam.SteamClient(), steamUser = new Steam.SteamUser(bot), steamFriends = new Steam.SteamFriends(bot), steamGroup = new SteamGroups(bot), steamGC = new Steam.SteamGameCoordinator(bot, 730), CSGOCli = new csgo.CSGOClient(steamUser, steamGC, false), advUser = new User(); Edited July 29, 2016 by zephylac Quote
Dr. McKay Posted July 29, 2016 Report Posted July 29, 2016 You need to pass in an array (it can have only one item in it). Quote
rusty Posted July 30, 2016 Report Posted July 30, 2016 (edited) When using getPersonas, it simply does this. AKA, it does nothing. I'm assuming the callback just doesn't get called??? Code: function makeAccount(account_name) { client.getPersonas([account_name], function(per){ console.log(per[account_name].player_name); accounts.splice(0, 1); CountAccounts++ run(); }); } Edited July 30, 2016 by rusty Quote
Dr. McKay Posted July 30, 2016 Report Posted July 30, 2016 You can't use an account name, you have to use a SteamID. Quote
Van Kappa Posted November 15, 2016 Report Posted November 15, 2016 Hello, and sorry for bumping! I am getting this as response, which I supose being invalid: My code: steamUser.getPersonas(["76561198313712684"], function (data) { console.log(data) }); Not sure if helps, but I'm calling this as soon as the webSession event fires (already tried with loggedOn event, same result). Am I missing something? Thank you Quote
Dr. McKay Posted November 16, 2016 Report Posted November 16, 2016 What's invalid about that response? Quote
Van Kappa Posted November 16, 2016 Report Posted November 16, 2016 Persona State is null, and should be 1 (since i am online on steam) or at least 0 (offline) Quote
Van Kappa Posted November 17, 2016 Report Posted November 17, 2016 Yes it is. As I said, I called that method as soon as the webSession event fires. Quote
Dr. McKay Posted November 17, 2016 Report Posted November 17, 2016 Like, actually online? You used setPersona to mark it as online? Quote
Dr. McKay Posted November 19, 2016 Report Posted November 19, 2016 client.setPersona(SteamUser.EPersonaState.Offline); That says offline to me. Quote
Van Kappa Posted November 19, 2016 Report Posted November 19, 2016 (edited) self.steamInterface.on("webSession", function (sessionID, sessionCookies) { self.sessionID = sessionID; self.sessionCookies = sessionCookies; sessionCookies.forEach( function(cookie) { self.httpRequestJar.setCookie(self.httpRequest.cookie(cookie), 'https://steamcommunity.com'); } ); self.steamWebInterface.setCookies(sessionCookies); self.steamTradeOffers.setCookies(sessionCookies, function (e) { if(!e) { self.apiKey = self.steamTradeOffers.apiKey; //I DO REQUEST getPersonas HERE } else { self.emit("error", e); } } ); } ); self.steamInterface.on("loggedOn", function (response) { if(response.eresult == steamInterface.EResult.OK) { self.steamInterface.setPersona(steamInterface.EPersonaState.Online, self.nickname); } } );Maybe I should wait for an event/callback from setPersona, but how? Edited November 19, 2016 by Van Kappa Quote
Dr. McKay Posted November 19, 2016 Report Posted November 19, 2016 That looks right to me. Are you friends with the people you're requesting data for? Quote
Van Kappa Posted November 21, 2016 Report Posted November 21, 2016 No i am not. It does not work if they arent friends? Quote
Van Kappa Posted November 22, 2016 Report Posted November 22, 2016 Hmm that explains why thenI think I will go with the GetPlayerSummary API method then Thabk you Quote
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.