Jump to content
McKay Development

Recommended Posts

Posted

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?

Posted (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 by xLeeJYx

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