Jump to content


Photo

Cannot read property '[object Object]' of null

node.js node-steam-user

  • Please log in to reply
4 replies to this topic

#1 Dijonigamer

Dijonigamer

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 18 July 2019 - 05:19 PM

Hi, I'm trying to make my bot work but I have the following error:

 

C:\Users\Admin\Desktop\123456789\SteamCardBot-master\index.js:91
        console.log("## Logged in as #" + client.steamID + " (" + personas[client.steamID].player_name + ")");
                                                                          ^
 
TypeError: Cannot read property '[object Object]' of null
    at client.getPersonas (C:\Users\Admin\Desktop\123456789\SteamCardBot-master\index.js:91:75)
    at Immediate.setImmediate (C:\Users\Admin\node_modules\@doctormckay\stdlib\components\promises.js:24:6)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
 

What am i missing?

 
I've this
let client = new SteamUser(),
manager = new TradeOfferManager({
"steam": client,
"language": "en",
"pollInterval": "10000",
"cancelTime": "7200000" // 2 hours in ms
}),
community = new SteamCommunity();
 
This is the logg
 
client.logOn({
accountName: CONFIG.USERNAME,
password: CONFIG.PASSWORD,
twoFactorCode: SteamTotp.getAuthCode(CONFIG.SHAREDSECRET),
rememberPassword: true
});

client.on("loggedOn", (details, parental) => {
client.getPersonas([client.steamID], (personas) => {
console.log("## Logged in as #" + client.steamID + " (" + personas[client.steamID].player_name + ")");
});
client.setPersona(1);
});

client.on("webSession", (sessionID, cookies) => {
manager.setCookies(cookies, (ERR) => {
if (ERR) {
console.log("## An error occurred while setting cookies.");
} else {
console.log("## Websession created and cookies set.");
}
});

 



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,188 posts

Posted 18 July 2019 - 09:38 PM

You need to update your code for v4. The first argument to all callbacks is now err.



#3 Dijonigamer

Dijonigamer

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 20 July 2019 - 10:03 AM

What is v4?Is only the loggedon what is wrong?



#4 aeonix

aeonix

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 20 July 2019 - 02:43 PM

Your code is outdated a litte bit. Upgrade it to node-steam-user v4 update or downgrade node-steam-user version.



#5 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,188 posts

Posted 20 July 2019 - 04:17 PM

Sorry, I could have been a little clearer. Not event callbacks, those are (mostly) unchanged. Callbacks to functions like getPersonas is what I'm talking about.

 

All the changes in v4 can be found here.


  • Dijonigamer likes this





Also tagged with one or more of these keywords: node.js, node-steam-user

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users