Jump to content
McKay Development

Recommended Posts

Posted
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

Posted

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.

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