Node-steam-trade, how to get items names? -


i'm making steambot, take items users , need name of items , it's price send on site. how should name of each item in items array? have alreay know items[i].appid assetid , others, how can name , average price?

 steam.on('tradeoffers', function(number) {   if (number > 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);              var exception = false;             var items = offer.items_to_receive;             for(var i=0; i< items.length;i++)             {                 if(items[i].appid != "730")                 {                     exception = true;                     break;                 }             }             var descriptionofitems = ""; // assetid + classid             for(var i=0; i< items.length;i++)             {                 appid += items[i].assetid + "-" + items[i].classid + " ";             }               if (!offer.items_to_give && !exception) {               offers.acceptoffer({tradeofferid: offer.tradeofferid});               console.log("offer accepted");               steam.sendmessage(offer.steamid_other, "thanks you!");               if (offer.steamid_other !== admin) {                 steam.sendmessage(admin, offer.steamid_other+ " - " + descriptionofitems + " donated!");               }             } else {               offers.declineoffer({tradeofferid: offer.tradeofferid});               console.log("don't receive items other's games!");             }           }         });       }     });   } }); 

i'm i'm still looking better way this, in mean time, can this:

included in trade offer object "steamid_other" can use query inventory:

'http://steamcommunity.com/profiles/' + steamid_other + '/inventory/json/730/2/?l=english' 

you can match items in trade ones in inventory , access "market_hash_name" can used query price information, so:

'http://steamcommunity.com/market/priceoverview/?appid=730&currency=3&market_hash_name=' + encodeuri(items[key].market_hash_name) 

let me know if find better solution, luck


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -