Jump to content
McKay Development

Recommended Posts

Posted

in class Bot:

confirmTrade(offer_id) {
    return new Promise((resolve, reject) => {
        this.community.acceptConfirmationForObject(this.identity_secret, offer_id, (err) => {
            console.log(this.identity_secret);
            console.log(offer_id);
            if (!err) {
                return resolve("Successfully confirmed trade #" + offer_id);
            } else {
                return reject(err.message);
            }
        });
    });
}

Call:

bot.confirmTrade(2541735824).then(resultAccepting => {
    console.log(resultAccepting);
}).catch(errAccepting => {
    console.log(errAccepting);
});

I use SDA and get identity_secret from maFile. Don't know why code not work. I see identity_secret and offer_id in console, but i receiving "Could not find confirmation for object".

 

 

d0kvJbFsQs2_JWqFGOSguA.jpg

 

 

Posted (edited)

Have you sent/accepted the offer already?

 

Yeah I forgot to add:

offer.accept(function(err, status) {
    if (err) {
        console.log(err.message);
        return;
    }
    console.log("Current trade status: " + status);
});

in newOffer event. Now it's work perfectly. So that not to create another topic. You can tell me how to do anti-spam in event friendMessage? For example stop event on 10 sec and in this time other !commands won't work.

Edited by bossikkk

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