jafix Posted March 11, 2017 Report Posted March 11, 2017 (edited) console.log('[OFFER] Checking trade hold'); offer.getUserDetails(function(them) { //check for escrow if (them.escrowDays > 0) { offer.decline(); console.log('[OFFER] Declined - Trade hold'); tradelog.info('Trade offer #' + offer.id + ' from ' + offer.partner.getSteamID64() + ' declined: trade hold'); } else { //script to check trade contents } }); I have this part in the manager.on('newOffer', function (offer) { part, so them and offer are defined. The error I'm getting is: Cannot property 'escrowDays' of null. Edited March 11, 2017 by jafix Quote
jafix Posted March 11, 2017 Author Report Posted March 11, 2017 I don't know how, but recoding it helped. Quote
Dr. McKay Posted March 11, 2017 Report Posted March 11, 2017 The problem was because you were missing a few arguments in your callback function. The names don't really matter, it's the order that matters. Quote
jafix Posted March 12, 2017 Author Report Posted March 12, 2017 console.log('[OFFER] Checking trade hold'); offer.getUserDetails(function(err, them) { //check for escrow if (err) { throw err; } if (them.escrowDays != 0) { offer.decline(); console.log('[OFFER] Declined - Trade hold'); tradelog.info('Trade offer #' + offer.id + ' from ' + offer.partner.getSteamID64() + ' declined: trade hold'); client.chatMessage(offer.partner.getSteamID64(), "Sorry, we don't accept trade hold"); } else { //check trade contents } }); This is my script now but my bot accepted an offer resulting in a trade hold, why is that? Quote
Dr. McKay Posted March 12, 2017 Report Posted March 12, 2017 The problem was because you were missing a few arguments in your callback function. The names don't really matter, it's the order that matters. The first argument is me. 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.