roughnecks Posted December 28, 2018 Report Posted December 28, 2018 Hello My bot is not running. I send an offer to it and then start it. Trade offer gets accepted but I get the error message "This trade offer is no longer valid." It's happening when retrieving UserDetails: if (offer.itemsToGive.length === 0) { offer.getUserDetails((err, me, them) => { if (typeof (them) !== 'undefined') { donator = them.personaName; console.log(`donator is: ${donator}`); } else { console.log(err); } }); because I'm not getting donator's name. This is my console.log:Error: This trade offer is no longer valid. at SteamCommunity._checkTradeError (D:\Portable\Birba\node_modules\steamcommunity\components\http.js:144:13) at Request._callback (D:\Portable\Birba\node_modules\steamcommunity\components\http.js:52:80) at Request.self.callback (D:\Portable\Birba\node_modules\request\request.js:185:22) at Request.emit (events.js:182:13) at Request.<anonymous> (D:\Portable\Birba\node_modules\request\request.js:1161:10) at Request.emit (events.js:182:13) at Gunzip.<anonymous> (D:\Portable\Birba\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:273:13) at Gunzip.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12)Donation accepted. Status: accepted. Problem is, I'm posting a comment on bot's profile upon successful incoming donation and if there are offers BEFORE I run the bot, comments are not posted, since there's a check on "donator" and it doesn't return. BUT: If I keep the bot running and then send one more offer, it gets accepted and all is working fine without errors. donator is: roughnecks Donation accepted. Status: accepted. Comment Posted Quote
Dr. McKay Posted December 29, 2018 Report Posted December 29, 2018 You cannot call getUserDetails on a trade offer that is not active. Quote
roughnecks Posted December 29, 2018 Author Report Posted December 29, 2018 I read that in the doc but what's your definition of active? Maybe you mean that it's not a "new" trade offer but when a trade is pending to me is still "active" because I can accept it until it's canceled. So there's no other way to get sender's name for all the trades if I can't keep my bot always running? Quote
Dr. McKay Posted December 30, 2018 Report Posted December 30, 2018 Active means its state on Steam is Active. Anything that you can accept but haven't yet is active and you should be able to use getUserDetails on it. To get user details for trade offers that are no longer active, you'll need to use the WebAPI. Quote
roughnecks Posted January 13, 2019 Author Report Posted January 13, 2019 Still I don't understand why it's happening only for the first incoming offer, while all the following ones are working fine. Quote
roughnecks Posted January 13, 2019 Author Report Posted January 13, 2019 manager.on('newOffer', offer => { if (offer.partner.getSteamID64() === '76561198061492959') { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log(`Accepted offer from owner. Status: ${status}.`); } }); } else { if (offer.itemsToGive.length === 0) { offer.getUserDetails((err, me, them) => { if (typeof (them) !== 'undefined') { donator = them.personaName; //console.log(`donator is: ${donator}`); } else { console.log('getuserdetails' + err); } }); offer.accept((err, status) => { offer.getReceivedItems((err, items) => { if (typeof (items) !== 'undefined') { donationnum = items.length; //console.log(`donationnum is: ${donationnum}`); } else { console.log('getreceiveditems' + err); } }); if (err) { console.log(err); } else { console.log(`Donation accepted. Status: ${status}.`); success = 1; } }); setTimeout(postComment, 3000); } else { offer.decline(err => { if (err) { console.log(err); } else { console.log('Offer declined (wanted our items).'); } }); } } }); Quote
Dr. McKay Posted January 15, 2019 Report Posted January 15, 2019 You're firing off getUserDetails and accept at the same time. The accept request is probably getting processed by Steam before the details one, and thus Steam no longer believes the offer is active when the details request gets processed. Quote
Recommended Posts
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.