Deeerby Posted February 5, 2022 Report Posted February 5, 2022 Hey! Is there a way to accept offer by it's offer ID? I am receiving offer ID from my web API, so all what I want to do is deal only with that offer, I am looking for something like offer.confirm (id) -> community.acceptConfirmationForObject(id). Is there a way to do so, without having to have listener (manager.on("newOffer") on every incoming new offer? Quote
Dr. McKay Posted February 6, 2022 Report Posted February 6, 2022 Accepting a specific offer by ID without retrieving its data first isn't a supported use-case for TradeOfferManager, since it's designed to make the process as simple as possible and performs various checks and such. You'd need to either fetch the offer first using getOffer or manually craft the HTTP request that TradeOfferManager makes. Deeerby 1 Quote
Deeerby Posted February 6, 2022 Author Report Posted February 6, 2022 Might be stupid question, but why I can't encapsulate getOffer method into async? const offerObject = await tradeHandler.manager.getOffer( depositResponse.offerId, async function (err, offer) { if (err) { console.log(err); } else { return await offer; } } ); Quote
Dr. McKay Posted February 9, 2022 Report Posted February 9, 2022 This is how you would encapsulate it: const offerObject = await new Promise((resolve, reject) => tradeHandler.manager.getOffer(depositResponse.offerId, (err, offer) => { if (err) { return reject(err); } resolve(offer); }); Deeerby 1 Quote
Deeerby Posted February 9, 2022 Author Report Posted February 9, 2022 (edited) 11 hours ago, Dr. McKay said: This is how you would encapsulate it: const offerObject = await new Promise((resolve, reject) => tradeHandler.manager.getOffer(depositResponse.offerId, (err, offer) => { if (err) { return reject(err); } resolve(offer); }); Thanks! After running bot for 3 days, with minor issues and it managing to resolve it on its own, I have encountered an error that seemed to be a "killer", or at least seemed to be looping on it. Error occurs while accepting trade offer, what does it exactly trying to tell me by "malformed JSON response"? Edited February 9, 2022 by Deeerby Quote
Dr. McKay Posted February 10, 2022 Report Posted February 10, 2022 That means Steam didn't send back a valid response. Quote
Deeerby Posted February 10, 2022 Author Report Posted February 10, 2022 (edited) What is it causing such behavior? Is it bot or steam itself, such as steam APIs being down? It seems that even after the trade expires, and after creating new trade, it still receives it malf json response, even though the getOffer beforehand works fine. Edited February 10, 2022 by Deeerby Quote
Dr. McKay Posted February 11, 2022 Report Posted February 11, 2022 That sort of error is caused by Steam unreliability. Just retry and hopefully it should work. Deeerby 1 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.