TextDynasty Posted October 2, 2016 Report Posted October 2, 2016 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 Quote
Dr. McKay Posted October 2, 2016 Report Posted October 2, 2016 https://dev.doctormckay.com/topic/289-trading-and-escrow-mobile-trade-confirmations/ Quote
TextDynasty Posted October 2, 2016 Author Report Posted October 2, 2016 Thanks.But I got one more question is that how to set counting item like key trade offer bot? Quote
Dr. McKay Posted October 2, 2016 Report Posted October 2, 2016 I'd suggest taking questions like that to Stack Overflow or similar. Or just search this forum as I'm sure it's been discussed many times here. I'm not really here to teach you JavaScript though. Quote
adma Posted October 3, 2016 Report Posted October 3, 2016 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 Quote
TextDynasty Posted October 3, 2016 Author Report Posted October 3, 2016 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. Quote
TextDynasty Posted October 3, 2016 Author Report Posted October 3, 2016 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"); } } }); } }); }}); Quote
Dr. McKay Posted October 3, 2016 Report Posted October 3, 2016 No. Please read the documentation. Defindexes aren't currencyids. As far as I know, only Spiral Knights uses "currencies" in trading. 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.