Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. function handleOffers() {
  2. Bot.offers.getOffers({
  3. get_received_offers: 1,
  4. active_only: 1,
  5. time_historical_cutoff: Math.round(Date.now() / 1000)
  6. }, function(error, body) {
  7. body.response.trade_offers_received.forEach(function(offer) {
  8. console.log(JSON.stringify(offer));
  9.  
  10. // Check if they are a robber
  11. if (offer.trade_offer_state != 2 || offer.items_to_give) {
  12. console.log('declined');
  13. Bot.offers.declineOffer({'tradeOfferId': offer.tradeofferid});
  14. return;
  15. }
  16.  
  17. var itemIds = [];
  18. // Check its a CS:GO item
  19. offer.items_to_receive.forEach(function(item) {
  20. if(item.appid != '730') {
  21. console.log('declined');
  22. Bot.offers.declineOffer({'tradeOfferId': offer.tradeofferid});
  23. return;
  24. } else {
  25. itemIds.push(item);
  26. }
  27. });
  28.  
  29. Bot.offers.loadPartnerInventory({
  30. 'partnerSteamId': offer.steamid_other,
  31. 'appId': '730',
  32. 'contextId': '2'
  33. }, function(partnerItems) {
  34. // partnerItems.forEach(function( partnerItem) {
  35. console.log(partnerItems);
  36. // });
  37. });
  38.  
  39. console.log(itemIds);
  40.  
  41. Bot.offers.acceptOffer({tradeOfferId: offer.tradeofferid});
  42. });
  43. });
  44. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement