Jump to content
McKay Development

How do I accept specific trade offers, and some other questions


Jams

Recommended Posts

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.

 

 

Link to comment
Share on other sites

  • 2 weeks later...
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

Link to comment
Share on other sites

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