steam-forward / node-steam-forum

Forum about coding for Steam on Node.js and JavaScript
43 stars 6 forks source link

Invalid offer.trade_offer_state #69

Closed StevePavlin closed 9 years ago

StevePavlin commented 9 years ago

I'm pretty sure this is one of valve's many problems with their api.

Here is me inspecting element the trade offer on the offers page that the bot requested me. I previously declined it using the popup window.

https://i.gyazo.com/6730e963858983a296ad0b7afed2a203.png

We find tradeofferid: 648163636

Now by using this code in my poll offers function:

this.pollOffers = function() {

        setInterval(function() {
            offers.getOffers({
                get_sent_offers: 1,
                active_only: 1,
                time_historical_cutoff: Date.now()
            }, function(err, body) {
                if (err) {
                    console.log(err);
                }

                if (body == undefined) {
                    console.log("body undefined");
                    return false;
                }

                if (body.response.trade_offers_sent) {
                    body.response.trade_offers_sent.forEach(function (offer) {

                        console.log(offer["tradeofferid"] + " state:" + offer["trade_offer_state"]);

                        // We found an offer we need to handle
                        if (offer.trade_offer_state == 3) {
                            if (offer.items_to_receive !== undefined) {

                                _this.handleAcceptedOffer(offer);
                            }

                        }

                        if (offer.trade_offer_state == 6 || offer.trade_offer_state == 7 || offer.trade_offer_state == 10) {

                            if (offer.items_to_receive !== undefined) {

                                   // I want declined offers to land here!
                            }
                        }
                    });
                }
            });
        }, 3000);

};

I recieve: 648163636 state:2

By this article: https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService

tradeofferstate 2 means: "This trade offer has been sent, neither party has acted on it yet."

This is obviously wrong and it seems to be on their end, it makes me believe that these "tradeofferstates" are not reliable... I cannot continue the development of my application until I figure out why this is happening. Any suggestions?

tacyarg commented 9 years ago

I accept thousands of trades a day and never have this issue.