Jump to content
McKay Development

Recommended Posts

Posted

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)

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.

Guest
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.

Loading...
×
×
  • Create New...