Jump to content
McKay Development

newOffer triggered on real trade


adma

Recommended Posts

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 by adma
Link to comment
Share on other sites

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 by adma
Link to comment
Share on other sites

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 by adma
Link to comment
Share on other sites

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 by adma
Link to comment
Share on other sites

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,

  1. User trades bot and gives 1 key to bot
  2. User confirms mobile confirmation
  3. Bot emits 'newOffer' event (from the real time trade)
  4. Bot then accepts trade offer from 'newOffer', then does 'functions'
  5. Bot emits 'realTimeTradeCompleted', then does 'functions'
  6. Conclusion, bot does 'functions' twice from one real time trade

This is what happened when bot does ignores trade offers that are realTimeTrade (ie. manager.newOffer .... if (!offer.realTimeTrade) { carry out 'functions' })

  1. User trades bot and gives 1 key to bot
  2. User confirms mobile confirmation
  3. Bot emits 'newOffer' event (from the real time trade)
  4. Bot does nothing with the trade from 'newOffer' because it is a realTimeTrade, so 'functions' aren't carried out
  5. Bot does not emit 'realTimeTradeCompleted' because trade offer from 'newOffer' isn't accepted
  6. Conclusion, bot does not carry out 'functions'

I hope I'm making sense

Edited by adma
Link to comment
Share on other sites

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 by Dr. McKay
Link to comment
Share on other sites

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 by adma
Link to comment
Share on other sites

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