BMO_Bot Posted January 27, 2020 Report Share Posted January 27, 2020 (edited) When I send a trade offer to my bot, it doesn't process it. I tried to check the code but I can't find anything wrong. Pls help! Here the bot trades code: function acceptOffer(offer) { offer.accept((err) => { community.checkConfirmations(); console.log(`\x1b[32m%s\x1b[0m` ,`Il Bot ha accettato un'offerta di scambio Id: ${offer.id} .`); if (err) console.log(`\x1b[41m%s\x1b[0m` ,`C'è stato un errore nell'accettare un'offerta di scambio Id: ${offer.id} .`); }); } function declineOffer(offer) { offer.decline((err) => { console.log(`\x1b[33m%s\x1b[0m` ,`Abbiamo rifiutato un'offerta di scambioId: ${offer.id} .`); if (err) console.log(`\x1b[41m%s\x1b[0m` ,`C'è stato un errore nel declino un'offerta di scambio Id: ${offer.id} .`); }); } function processOffer(offer) { if (offer.isGlitched() || offer.state === 11) { console.log(`\x1b[41m%s\x1b[0m` ,`L'offerta ${offer.id} ha avuto un problema, declino in corso....`); declineOffer(offer); } else if (offer.partner.getSteamID64() === config.ownerid64) { acceptOffer(offer); }else { var itemsBot = offer.itemsToGive; var userItems = offer.itemsToReceive; var valoreItemBot = 0; var valoreUserItem = 0; for (var i in itemsBot) { var item = itemsBot.market_name; if(prezzi[item]) { valoreItemBot += prezzi[item].sell; } else { console.log(`\x1b[41m%s\x1b[0m` ,`Valore invalido offerta Id: ${offer.id} .`); valoreItemBot += 9999999999999999; } } for(var i in userItems) { var item = userItems.market_name; if(prezzi[item]) { valoreUserItem += prezzi[item].buy; } else { console.log(`\x1b[41m%s\x1b[0m` ,`L'utente non aveva abbastanza metallo, offerta Id: ${offer.id} .`); } } console.log(`\x1b[41m%s\x1b[0m` ,"Valore Degli Items Del Bot: "+ valoreItemBot); console.log(`\x1b[32m%s\x1b[0m`, "Valore Degli Items Dell'Utente: "+ valoreUserItem); if (valoreItemBot <= valoreUserItem) { acceptOffer(offer); } else { declineOffer(offer); } }} client.setOption("promptSteamGuardCode", false); manager.on('newOffer', (offer) => { processOffer(offer);}); Sorry if the console log are in italian, Prezzi means Prices. Edited January 28, 2020 by BMO_Bot Quote Link to comment Share on other sites More sharing options...
BMO_Bot Posted January 28, 2020 Author Report Share Posted January 28, 2020 I solved the problem 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.