Я делаю steamBot, который берет предметы у пользователей, и мне нужно получить название этих предметов и цену, чтобы отправить их на мой сайт. Как мне получить имя каждого элемента в массиве элементов? Я уже знаю items[i].appid assetsid и другие, но как я могу получить название и среднюю цену?
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 + " just donated!");
}
} else {
offers.declineOffer({tradeOfferId: offer.tradeofferid});
console.log("Don't receive items from other's games!");
}
}
});
}
});
}
});