Jump to content
McKay Development

Recommended Posts

Posted

Hi,

I have a bot that accepts keys and does stuff with the partners name, steamid and amount of keys in the trade. Right now I am using the trade manager manager.on('newOffer') to decline offers with non key items and accept offers with only keys,and it works fine with offers that are made using trade offers. However, in test conditions I traded the bot a non key item in a normal trade and accepted my end of the mobile confirmations. Once I accepted the mobile confirmation on my end, the bot doesn't get receive a trade offer and insteads receives the items straight away, bypassing the newOffer event. I confirmed that it bypasses this and receives the item straight away by commenting out the newOffer listen, the bot still receives the items straight away.

 

I can check if the trade is keys only in the real trade but how do I listen for the items being received from a mobile confirmed real trade, and can I get the partners information (steamid, name) from that? I hope I made it clear.

 

Thanks.

Posted

I haven't experimented too much with real-time trades, but as far as I can tell it looks like the first party to confirm the real-time trade is the offer "sender". So if your bot is the first party to "click" the green button then your bot is the sender of the trade and consequently the offer won't come in newOffer (I think unknownOfferSent should be emitted?). Depending on the speed of the other user, you may get sentOfferChanged or not.

 

Basically the flow would be one of the two following scenarios:

 

User is fast

  1. Bot confirms real-time trade
  2. User confirms real-time trade
  3. Bot accepts mobile confirmation
  4. User accepts mobile confirmation and items are exchanged
  5. TradeOfferManager polls, sees the accepted offer, and unknownOfferSent is emitted with state == 3.

User isn't as fast

  1. Bot confirms real-time trade
  2. User confirms real-time trade
  3. Bot accepts mobile confirmation
  4. TradeOfferManager polls, sees the offer, and unknownOfferSent is emitted with state == 9 (probably)
  5. User accepts mobile confirmation and items are exchanged
  6. TradeOfferManager polls, sees the accepted offer, and sentOfferChanged is emitted with state == 3

If your bot isn't confirming the trade first, then the other user has to confirm it first. Once they do, you get the confirmation on your end, which you need to confirm. TradeOfferManager won't emit newOffer for non-active offers, so if you confirm it before TradeOfferManager sees it, then you won't get any events at all. This doesn't seem like it's super-desirable behavior, so I might add a unknownOfferReceived event for this situation. If you don't confirm it before TradeOfferManager sees it, then you'll get newOffer, and receivedOfferChanged after it's confirmed (and therefore accepted).

 

This is all assuming that I'm correct in that the first party to confirm a real-time trade is the sender of the offer.

Posted

Thanks for the reply Doctor Mckay, I'll fool around with real trades and see how it works with the unknownOfferSent and sentOfferChanged events..

Posted (edited)

It doesn't seem I can get the bot to send the offer. 

 

I stripped the trade down to that so the bot instantly confirms, and also waited a few seconds before confirming myself. It still asks me to confirm the mobile end, and once I do the bot receives the items instantly like before...

trade.on("ready", function(){
	trade.ready();
	trade.confirm();
});

Also tried confirming first, and the same happens. In both cases when the offer was mobile accepted on my end, the bots pollData emitted a '3' (Accepted).

trade.on("ready", function(){
	trade.ready();
	trade.chatMsg("Confirming trade in 10 seconds");
	setTimeout(function(){
		trade.confirm();
	}, 10000);
});
"1531655513":3,
"1531678634":3

However, unknownOfferSent , receivedOfferChanged, newOffer, nor sentOfferChanged events were emitted. Is there any simple way to detect the user mobile confirming or am I missing something crucial?

 

** TO clarify, the bot (in this case) only receives items. The user does not receive any items.

Edited by adma
Posted

Based on some testing I just did, it looks like the "sender" of the offer is actually the party who sent the Steam trade request. If you're receiving trade requests to your bot and accepting them, then the offers are always being "sent" by the human. Since the bot isn't giving anything away and consequently doesn't have to confirm anything, the offers are immediately going "Accepted" once they're visible to you. That's why you aren't getting any events at all.

 

I think I'll add a couple new events to handle real-time-trade offers (realTimeTradeConfirmationRequired and realTimeTradeCompleted sounds good to me).

Posted

Alright, thanks for the information McKay. In the mean time I will make the bot trade the user when the user tries to trade the bot.

 

Appreciate your help :) 

Posted

In order for that to work, make sure you listen for both unknownOfferSent (for offers that get confirmed by the user before the manager sees them), and sentOfferChanged (for offers that get confirmed by the user after the manager sees them).

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