Jump to content
McKay Development

Recommended Posts

Posted

I'm using the Doctor McKay library for login and trade starting, but I am then using seishun's steam-trade to automate trading. Here's my current code. 

client.on("tradeRequest", function(steamID, respond) {
	logger.info("Incoming Trade Request from " + steamID.getSteam3RenderedID());
	respond(true);
})

client.on("tradeStarted", function(steamID) {
	steamTrade.open(JSON.stringify(steamID));
})

steamTrade.on('offerChanged', function(added, item) {
    console.log('they ' + (added ? 'added ' : 'removed '));
    console.log(item);
    for(var i = 0; i < steamTrade.themAssets.length; i++) {
        console.log(steamTrade.themAssets[i]);
    }
});

When I log the item , the console prints out undefined and returns an error. (I assume this means the item is undefined?) Seishun told me that the reason this happens is because the tradeStarted event returns steamID as an object, not a string? I thought the JSON.stringify would convert this object to a string, but obviously I am mistaken? 

C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:208
      return self._themInventories[item.appid][item.contextid][item.assetid];
                                              ^

TypeError: Cannot read property '2' of undefined
    at C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:208:47
    at Array.map (native)
    at SteamTrade._onTradeStatusUpdate (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:206:72)
    at Request._callback (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:244:10)
    at Request.self.callback (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\node_modules\request\request.js:187:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\node_modules\request\request.js:1044:10)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)

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