Jump to content
McKay Development

Recommended Posts

Posted

Hey,  

I am still not too good with Node or JS, but working on it! ;)

 

I have a working NodeJS bot to accept item donations. Sometimes, offers are glitched. The bots console log tell me, that it accepted them, which of course doesn't work. If I restart the bot, it finds the offer and accepts it (if it's not glitched anymore).

 

I managed to let the bot find out if an offer is glitched.

 

if(offer.isGlitched() == true) {
    console.log("Offer is glitched!");
} else {
    console.log("Offer is not glitched!");
}

Now ... since I don't fully understand how the bot gets the new offers, I don't know how to manually refresh them.  

 

Lets say, I would use the code above right after a new offers is received and "isGlitched()" equals "true", what would I need to have a few seconds delay and then just refresh all offers until the offer is not glitched anymore?

if(offer.isGlitched() == true) {

    console.log("Offer is glitched!");
    setTimeout(function(){

        //Reload offers!

    }, 15000);

} else {

console.log("Offer is not glitched!");

    //Some conditions
    
    offer.accept();"

}

What would I need as "Reload offers!"?

 

This might be some easy-to-solve question, but I tried and didn't succeed. Any help is greatly appreciated!

 

Posted (edited)

Hey and thank you,

I found an answer made by you on here.

offer.update(function(err) {
    if (err) {
        console.log(err);
    } else {
        // now the offer is fresh from the WebAPI
    }
});

I was just wondering, If my bot finds a new offer, sees that it's glitched and runs the code above instead of accepting / checking trade conditions, will the same offer just pop up again? Will he then find it automatically Or will I need to tell my bot to "forget" the offer he just found after / before I updated?

Edited by MrInka

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