Lonster_Mosnter Posted August 24, 2017 Report Share Posted August 24, 2017 manager.on('receivedOfferChanged', (offer) => {community.postUserComment(offer.partner.toString(), math.pickRandom([Comments.comments0, Comments.comments1, Comments.comments2, Comments.comments3, Comments.comments4, Comments.comments5]))}); Is the code the only thing i cannot figure out is how to make it comment only when it accepts an trade offer I tried putting it like this if (ourValue <= theirValue) { acceptOffer(offer); manager.on('receivedOfferChanged', (offer) => {community.postUserComment(offer.partner.toString(), math.pickRandom([Comments.comments0, Comments.comments1, Comments.comments2, Comments.comments3, Comments.comments4, Comments.comments5]))});} else { declineOffer(offer); }; but it didnt even comment like that And also tried function acceptOffer(offer) { offer.accept((err) => { manager.on('receivedOfferChanged', (offer) => {community.postUserComment(offer.partner.toString(), math.pickRandom([Comments.comments0, Comments.comments1, Comments.comments2, Comments.comments3, Comments.comments4, Comments.comments5]))}); community.checkConfirmations(); console.log("We Accepted an offer"); if (err) console.log("There was an error accepting the offer."); });};and nothing am i doing something wrong? Quote Link to comment Share on other sites More sharing options...
xLeeJYx Posted August 24, 2017 Report Share Posted August 24, 2017 (edited) manager.on('receivedOfferChanged', (offer)=>{ if(offer.state === 3){ community.postUserComment(offer.partner.toString(), "Comment", (err)=>{ if(err) throw err.message console.log("Commented on " + offer.partner.toString() + "'s profile")}) } }) You dont put this thing in the offer.accept and you didnt even include callback Edited August 24, 2017 by xLeeJYx Quote Link to comment Share on other sites More sharing options...
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.