roughnecks Posted January 16, 2019 Report Posted January 16, 2019 community.acceptConfirmationForObject(identitySecret, offer.id, function(err) { if(err){ console.log(chalk.red("Confirmation Failed for " + offer.id + ": " + err)); } else { console.log(chalk.green("Offer " + offer.id + ": Confirmed!")); } }); How can I delay this ^ for a couple seconds, avoiding it being fired earlier than offer.accept (which is right before)? I know this is more a coding issue rather than module's issue but I'm beginning to code in js and this async stuff hurts Thanks Quote
Dr. McKay Posted January 17, 2019 Report Posted January 17, 2019 Put it inside of the callback to accept. Quote
roughnecks Posted January 17, 2019 Author Report Posted January 17, 2019 This is my code: if (offer.partner.getSteamID64() === '76561198061492959') { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log(chalk.green(`Accepted offer ${offer.id} from owner. Status: ${status}.`)); community.acceptConfirmationForObject(identitySecret, offer.id, function(err) { if(err){ console.log(chalk.red("Confirmation Failed for " + offer.id + ": " + err)); } else { console.log(chalk.green("Offer " + offer.id + ": Confirmed!")); } }); } }); It's working fine (at least when I tried) but I read on another thread where you suggested to add a delay just to be sure the confirmation would fire after accepting the offer - and I didn't want to necro that post. Quote
Dr. McKay Posted January 17, 2019 Report Posted January 17, 2019 I really don't mind necroing on this forum. You definitely need to put the confirmation acceptance inside the callback to accept, but within that callback it's not a bad idea to add a short delay. Use setTimeout for this. roughnecks 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.