Jump to content
McKay Development

Doesn't accept the offer


Recommended Posts

I don't know why it doesn't accept my trade offer I'm stupid

client.on('webSession', (sessionIDcookies=> {
  community.setCookies(cookies);
  community.startConfirmationChecker(10000config.identitySercet);
});

 

function acceptOffer(offer) {
  community.ConfirmationChecker();
  console.log("we accepted a offer :)")
  offer.accept((err=> {
      if (errconsole.log("There was an error accepting the offer.");
   });
}

 

function declineOffer(offer) {
  console.log("we decline a offer :(")
  offer.decline((err=> {
      if (errconsole.log("There was an error declining the offer.");
   });
}

 

manger.on('newOffer',(offer=>{
  if(offer.partner.getSteam64ID() == config.OwnerId) {
    acceptOffer(offer);
  } else {
    declineOffer(offer);
  }
})
Edited by BillTheBober
Link to comment
Share on other sites

Are you sure 

offer.partner.getSteam64ID() == config.OwnerId

is getting triggered correctly?

Or maybe it is and the problem is with your acceptOffer function, I would recommend something like this:

function acceptOffer(offer) {
    offer.accept((err) => {
        if (err) {
            console.log('There was an error accepting the offer');
            return;
        }

        // if we have to give items we have to confirm, otherwise we dont have to
        if (offer.itemsToGive.length != 0) {
            community.acceptConfirmationForObject(config.identity_secret, offer.id, (err) => {
                if (err) {
                    console.log('There was an error confirming the offer');
                    return;
                }

                console.log('Accepted and confirmed the offer');
            })
        } else {
            console.log('Accepted the 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...