Hello good day, I am new to coding.
mainClient.on('webSession', function(sessionID, cookies) {
mainManager.setCookies(cookies, function(err) {
if (err) { // Handle Error.
console.log(err);
process.exit(1); // Exit, if we cannot connect, since we can't do anything.
return;
}
mainManager.getInventoryContents(753, 6, true, function(err, inv) { // Load Inventory
if (err) { // Handle Error.
console.log('Error, in loading our inventory.')
return;
}
if (inv.length == 0){
console.log('Inventory is empty, add some items(cheap ones, like trading cards or gems)')
}
var firstOffer = mainManager.createOffer(config.accounts.account2.tradelink); // Intialize Trade Offer
var itemname = inv[0].market_hash_name.toLowerCase();
console.log('The item in which we are using is a/an ' + itemname)
firstOffer.addMyItem(inv[0]);
firstOffer.setMessage(SECURITY_CODE.toString()); // Set a message, so no one can slip in a trade, and try to steal your items.
firstOffer.send((err, status) => { // Send offer.
if (status == 'pending') { // Check if it needs to be confirmed.
mainCommunity.acceptConfirmationForObject(config.accounts.account1.identity_secret, firstOffer.id, function(err) { // Try to accept Trade
if (err) { // Handle, any accepting errors.
console.log('Error accepting Trade.');
return;
} else { // It worked fine, Now the farm begins.
console.log('Trade offered. Counter is at : ' + counter);
}
});
}
});
});
});
// Set Cookies.
mainCommunity.setCookies(cookies);
}); If one of the err fails, It cannot return to first. I mean is it stock like example " Error accepting Trade" . Like that. I just want to return until it goes to console.log('Trade offered. Counter is at : ' + counter);. Thank you for the help.