McMuffinDK Posted February 26, 2018 Report Posted February 26, 2018 I am trying to get my CS:GO inventory with getInventoryContents(appid, contextid, tradableOnly, callback). My full code is: "use strict"; const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeOfferManager({ steam: client, community: community, language: 'en' }); var steamLogOn = { accountName: 'FancyUsername', password: 'VerySecurePassword', twoFactorCode: SteamTotp.generateAuthCode('Shared_Secret') }; client.logOn(steamLogOn); client.on('loggedOn', () => { console.log('[Steam] Logged in'); }); client.on('webSession', (sessionid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); }); manager.getInventoryContents(730, 2, true, (err, inventory) => { if (err) { throw err; } else { console.log(inventory); } }); The error i get is: /var/www/bot/node_modules/steamcommunity/components/users.js:374 "uri": "https://steamcommunity.com/inventory/" + userID.getSteamID64() + "/" + appID + "/" + contextID, ^ TypeError: Cannot read property 'getSteamID64' of null at get (/var/www/bot/node_modules/steamcommunity/components/users.js:374:60) at SteamCommunity.getUserInventoryContents (/var/www/bot/node_modules/steamcommunity/components/users.js:370:2) at TradeOfferManager.getUserInventoryContents (/var/www/bot/node_modules/steam-tradeoffer-manager/lib/index.js:293:18) at TradeOfferManager.getInventoryContents (/var/www/bot/node_modules/steam-tradeoffer-manager/lib/index.js:281:7) at Object.<anonymous> (/var/www/bot/test.js:34:9) at Module._compile (module.js:660:30) at Object.Module._extensions..js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) Quote
Dr. McKay Posted February 26, 2018 Report Posted February 26, 2018 You aren't using async properly. You need to call getInventoryContents inside of the webSession event, after you call setCookies. Quote
McMuffinDK Posted February 27, 2018 Author Report Posted February 27, 2018 You aren't using async properly. You need to call getInventoryContents inside of the webSession event, after you call setCookies.Ah yeah ofcause.. sorry it was a nobrainer from me 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.