Jump to content
McKay Development

Get ID of the counter-offer


Recommended Posts

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...