Hello, I have a system that sends a tradeoffer to a person and then you have to confirm it via website. When confirming, the bot executes following code:
offers.getOffer(m.tradeid,function(err,offer){
if(err) return logger.info("Confirmation error: "+err);
switch(offer.state)
{
case 2: notify(m.client,'Your offer is still pending.'); break;
case 1: removeOffer(m.client,m.tradeid,"Invalid trade offer, declining..."); break;
case 3: break;//accepted
case 4:{
offer.decline(function(err){ //this is wrong, the offer ID is no longer valid
if(err) logger.info("There was an error declining bad trade offer: "+err);
removeOffer(m.client,m.tradeid,"Do not modify the trades sent by our bots. Trade offer cancelled.");
});
break;
}
case 6: removeOffer(m.client,m.tradeid,"Trade offer cancelled by the bot."); break;
case 7: removeOffer(m.client,m.tradeid,"Trade offer cancelled."); break;
case 8: removeOffer(m.client,m.tradeid,"Items no longer available.");
}
});If the offer.state equals 4 (Countered), I should decline the counter-offer, but the ID is no longer valid. How can I get the new ID of a counter-offer?