adma Posted September 26, 2016 Report Posted September 26, 2016 (edited) As the title says, occasionally, the newOffer event will trigger from a real trade. This is undesirable as I need to carry some functions out when a real trade is completed OR when a trade offer is received. This means that the 'functions' will sometimes occur twice. Is this intended or do I just have to work my way around it? Thanks. info: Received new trade offer from adma [U:1:94759074] info: Attempting to accept trade offer 1539324331 info: Accepted trade offer 1539324331 containing 1 keys info: Real time trade offer 1539324331 accepted Edited September 26, 2016 by adma Quote
Dr. McKay Posted September 26, 2016 Report Posted September 26, 2016 Check fromRealTimeTrade and abort if it's true in newOffer. adma 1 Quote
adma Posted September 26, 2016 Author Report Posted September 26, 2016 (edited) If I don't do anything in newOffer if the offer is fromRealTimeTrade , then realTimeTradeCompleted won't be emitted because I didn't accept it. Wouldn't I need something like fromTradeOffer and check that in realTimeTradeCompleted? I know that sounds silly because for realTimeTradeCompleted to emit the offer has to be from a real trade, but I don't have any other ideas. Edited September 26, 2016 by adma Quote
Dr. McKay Posted September 27, 2016 Report Posted September 27, 2016 You don't need to accept real-time-trade offers. Offers that are created from real-time trades are accepted automatically, you just need to confirm them. The wiki page on GitHub has more information. Quote
adma Posted September 27, 2016 Author Report Posted September 27, 2016 (edited) Well you see, in my original post for some reason the real time trade emitted the newOffer , as in it made a trade offer from the real trade. info: Received new trade offer from adma [U:1:94759074] // Bot receives trade offer (newOffer) info: Attempting to accept trade offer 1539324331 // Bot attempts to accept it info: Accepted trade offer 1539324331 containing 1 keys // Accepts it info: Real time trade offer 1539324331 completed // After accepting the trade offer, realTimeTradeCompleted is emitted This was generated from a real time trade where I gave the bot 1 key. When I did what you said in your previous post, the bot ignored the trade offer because it was from a realTimeTrade, and consequently left the trade offer just sitting there. For some odd reason an actual trade offer (that requires the bot to accept it) was made from the real time trade. {"level":"info","message":"Started trade with adma [U:1:94759074]","timestamp":"2016-09-26T22:43:41.250Z"} {"level":"info","message":"Ended real trade due to pending","timestamp":"2016-09-26T22:44:07.576Z"} {"level":"info","message":"Offer pending with trade offer 1541120781","timestamp":"2016-09-26T22:44:07.577Z"} {"level":"warn","message":"Received trade offer 1541120781 from real trade, ignoring","timestamp":"2016-09-26T22:45:21.723Z"} // this is newOffer I have messed around with it and can't seem to reproduce it anymore after passing a node-steam-user instance to the trade offer manager. Don't know if thats what fixed it. Edited September 27, 2016 by adma Quote
Dr. McKay Posted September 27, 2016 Report Posted September 27, 2016 You can accept it, but that's unnecessary. All you need to do is accept the confirmation. Quote
adma Posted September 27, 2016 Author Report Posted September 27, 2016 (edited) When I didn't accept it, realTimeTradeCompleted didn't emit. {"level":"warn","message":"Received trade offer 1541120781 from real trade, ignoring","timestamp":"2016-09-26T22:45:21.723Z"} {"level":"info","message":"Received trade offer 1541120781 changed from 2 to 6","timestamp":"2016-09-26T23:07:22.553Z"} // I cancelled the trade offer ~20 minutes after Edited September 27, 2016 by adma Quote
adma Posted September 27, 2016 Author Report Posted September 27, 2016 (edited) Yes. I'll break it down so we both don't get confused ... I will be 'user' , bot will be 'bot' This is what initially happened when bot accepts trade offer regardless of realTimeTrade,User trades bot and gives 1 key to bot User confirms mobile confirmation Bot emits 'newOffer' event (from the real time trade) Bot then accepts trade offer from 'newOffer', then does 'functions' Bot emits 'realTimeTradeCompleted', then does 'functions' Conclusion, bot does 'functions' twice from one real time tradeThis is what happened when bot does ignores trade offers that are realTimeTrade (ie. manager.newOffer .... if (!offer.realTimeTrade) { carry out 'functions' })User trades bot and gives 1 key to bot User confirms mobile confirmation Bot emits 'newOffer' event (from the real time trade) Bot does nothing with the trade from 'newOffer' because it is a realTimeTrade, so 'functions' aren't carried out Bot does not emit 'realTimeTradeCompleted' because trade offer from 'newOffer' isn't accepted Conclusion, bot does not carry out 'functions'I hope I'm making sense Edited September 27, 2016 by adma Quote
Dr. McKay Posted September 27, 2016 Report Posted September 27, 2016 You're declining the offer? Don't do that. And just to be super clear, this is happening via real-time trading with trade requests in Steam chat? Quote
adma Posted September 27, 2016 Author Report Posted September 27, 2016 Yes, this is happening through real time trading requested by me to the bot through Steam chat. And I made a mistake in my previous post, the bot does not decline the offer, the bot ignores it. Quote
Dr. McKay Posted September 27, 2016 Report Posted September 27, 2016 (edited) I can't reproduce this. I started a trade, put up an item on one side (the request sender), committed the trade, and confirmed it on the sender's side. The recipient briefly showed an active offer, then it immediately went accepted. Maybe it's possible that there's some kind of bug in the module, but I don't have time to test that right now. What happens if you wait 30 or so seconds after you get newOffer and then check its status via offer.update? Edited September 27, 2016 by Dr. McKay Quote
adma Posted September 27, 2016 Author Report Posted September 27, 2016 It seems I can't reproduce this behavior anymore, but I can tell you that it occurred when http://steamstat.us reported the TF2 API as being 'slow' I'll keep trying and see what I can find. Quote
adma Posted September 28, 2016 Author Report Posted September 28, 2016 (edited) Hi McKay, I found some time to fiddle around and try to remake the scenario. \info: [tradeStarted] Started real time trade info: Ended real trade due to pending info: Offer pending with trade offer 1543634806 info: [newOffer] Received trade offer 1543634806 info: [30 seconds after receiving trade offer 1543634806] warn: Trade offer 1543634806 state : Active I'm sure when accepting this offer, realTimeTradeCompleted will emit. Right now the TF2 / Steam / whatever services are being slow and giving lots of Error 28's and 'Data Temporarily Unavailable' ... I'll edit this post when it works. edit... eventually accepted it. info: [realTimeTradeCompleted] Real time trade 1543634806 completed warn: [realTimeTradeCompleted] Real time trade 1543634806 state : Accepted info: Received trade offer 1543634806 changed from 2 to 3 Edited September 28, 2016 by adma Quote
adma Posted September 28, 2016 Author Report Posted September 28, 2016 (edited) Anyway, for the time being I will use offer.data to do something like offer.data('accepted', 'true') when a trade offer is accepted, and then just do a check for true on realTimeTradeCompleted Edited September 28, 2016 by adma 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.