BennetGa Posted September 1, 2017 Report Posted September 1, 2017 Hey Guys, I'm currently having issues with my Bot. I send out trades and if the User declines it, I want to have feedback on that. The only problem I'm currently facing is the fact, that for some reason, the "receivedOfferCahnged" does not get triggered if the User declines the offer. Here is my code, thanks in advance! manager.on('receivedOfferChanged', function(offer, oldState) { console.log(`Offer #${offer.id} changed: ${TradeOfferManager.ETradeOfferState[oldState]} -> ${TradeOfferManager.ETradeOfferState[offer.state]}`); if (offer.state == TradeOfferManager.ETradeOfferState.Accepted) { offer.getReceivedItems(function(err, items) { if (err) { console.log("Couldn't get received items: " + err); } else { var names = items.map(function(item) { return item.name; }); console.log("Received: " + names.join(', ')); connection.query("UPDATE tradeoffer SET status='accepted' WHERE offerid='" + offer.id + "'", function(err, rows, fields) { if (err) console.log(err); postReq("accepted", offer.id); }); } }); } if (offer.state == TradeOfferManager.ETradeOfferState.Countered) { offer.decline(); connection.query("UPDATE tradeoffer SET status='countered' WHERE offerid='" + offer.id + "'", function(err, rows, fields) { if (err) console.log(err); postReq("countered", offer.id); }); } if (offer.state == TradeOfferManager.ETradeOfferState.Declined) { connection.query("UPDATE tradeoffer SET status='declined' WHERE offerid='" + offer.id + "'", function(err, rows, fields) { if (err) console.log(err); postReq("declined", offer.id); }); } if (offer.state == TradeOfferManager.ETradeOfferState.InEscrow) { offer.decline(); connection.query("UPDATE tradeoffer SET status='escrow' WHERE offerid='" + offer.id + "'", function(err, rows, fields) { if (err) console.log(err); postReq("escrow", offer.id); }); } if (offer.state == TradeOfferManager.ETradeOfferState.InvalidItems) { connection.query("UPDATE tradeoffer SET status='invalid' WHERE offerid='" + offer.id + "'", function(err, rows, fields) { if (err) console.log(err); postReq("invalid", offer.id); }); } }); Quote
Axle Posted September 1, 2017 Report Posted September 1, 2017 Use sentOfferChanged. https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager#sentofferchanged Quote
BennetGa Posted September 2, 2017 Author Report Posted September 2, 2017 Use sentOfferChanged. https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager#sentofferchanged Okay, thank you very much! Quote
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.