Jump to content
McKay Development

Recommended Posts

Posted

Hi.

How to make it confirm the trade offer like keys or something? Because my bot is currently accepting all offer that only receiving items.

 

 

New offer #1551249841 from [u:1:342508768]
Offer accepted
 
But it didn't confirm the trade.
 
Thanks for helping
Posted

Thanks.

But I got one more question is that how to set counting item like key trade offer bot? 

var keys = offer.itemsToReceive.map {
	if (item.name == "Mann Co. Supply Crate Key") {
		return item;
	}
}

var keyAmount = keys.length

Something like that should work, and is handy if you wanted to send keys ... you could also do something like

var keyAmount = 0;

offer.itemsToReceive.forEach(function(item) {
	if (item.name == "Mann Co. Supply Crate Key") {
		keyAmount++;
	}
}

// do something with keyAmount
Posted
var keys = offer.itemsToReceive.map {
	if (item.name == "Mann Co. Supply Crate Key") {
		return item;
	}
}

var keyAmount = keys.length

Something like that should work, and is handy if you wanted to send keys ... you could also do something like

var keyAmount = 0;

offer.itemsToReceive.forEach(function(item) {
	if (item.name == "Mann Co. Supply Crate Key") {
		keyAmount++;
	}
}

// do something with keyAmount

Thanks very much i will try this after the bot cools down the trade hold.

Posted

just asking

 

will this works?

 

 
var item_from_me =
{
    "appid": 440,
    "contextid": 2,
    "amount": 21,
    "currencyid": "5002"
}
 
var item_from_them =
{
    "appid": 440,
    "contextid": 2,
    "amount": 1,
    "currencyid": "5021"
}
offers.on('newOffer', function (offer) {
    if (offer > 0) {
    offers.getOffers({
      get_received_offers: 1,
      active_only: 1,
      time_historical_cutoff: Math.round(Date.now() / 1000)
    }, function(error, body) {
      if(body.response.trade_offers_received) {
        body.response.trade_offers_received.forEach(function(offer) {
          if (offer.trade_offer_state == 2) {
            console.log(offer);
            console.log('Recieved trade offer: ' + offer.tradeofferid);
            if (offer.items_to_give === item_from_me && offer.items_to_recieve === item_from_them) {
              offers.acceptOffer({tradeOfferId: offer.tradeofferid});
              console.log("Offer accepted");
              if (offer.steamid_other !== admin) {
                steam.sendMessage(admin, offer.steamid_other + " just donated!");
              }
            } else {
              offers.declineOffer({tradeOfferId: offer.tradeofferid});
              console.log("Offer declined");
            }
          }
        });
      }
    });
  }
});

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