Jump to content
McKay Development

Accept offer by offer ID


Deeerby

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
        }
      }
    );
Link to comment
Share on other sites

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"?


image.png.9fae31d314380572ee7492e5f0a1917d.png

 

Edited by Deeerby
Link to comment
Share on other sites

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 by Deeerby
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...