Jams Posted April 10, 2016 Report Posted April 10, 2016 Node.js is a new thing for me, as I have only started learning it about yesterday. I've been attempting to build a trade bot the accepts trade offers as long as the items that are being received are valued more than the items of the bot. To find the value of items, I use steam-market-pricing. My question is, how do I identify what items the person is offering, and what the person wants to receive from the trade offer? Furthermore, how do I only accept these offers? Sorry if the questions are vague, I'll clear up if you don't understand. I'm working off of this code from a guide just to make my life a bit easier. Quote
Guest akagna Posted April 16, 2016 Report Posted April 16, 2016 I'm sitting right here, when some answers came i want to look. Quote
timgfx Posted April 30, 2016 Report Posted April 30, 2016 itemsToReceive, itemsToGive. https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOffer. Tradeoffer properties. If your tradeoffer is var'ed as offer you would do offer.itemsToReceive to get an array of items you will receive. Quote
timgfx Posted April 30, 2016 Report Posted April 30, 2016 https://dev.doctormckay.com/topic/266-how-can-i-pull-the-item-names/ Quote
timgfx Posted April 30, 2016 Report Posted April 30, 2016 var givePrice = 0; var getPrice = 0; offer.itemsToGive.forEach(item => market.getItemPrice(730, item.market_hash_price, function(err, data){ givePrice = givePrice + parseInt(data.median_price); })); offer.itemsToReceive.forEach(item => market.getItemPrice(730, item.market_hash_price, function(err, data){ getPrice = getPrice + parseInt(data.median_price); })); setTimeout(function(){ if (getPrice > givePrice) { offer.accept(true, function(err, status) { if(err) { console.log('Error: ' + err); } else if(status == 'accepted') { console.log('Offer accepted'); } } } else { offer.decline(); } },10000); // giving it 10 seconds to load all the item median prices (yes im lazy) I guess that could work 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.