简体   繁体   中英

SteamBot not accepting trade offer OnTradeOfferUpdated

Whenever my bot receives a trade offer it doesn't accept it, it doesn't do anything with it. I've tried many things and from my experiments it looks like the callback OnTradeOfferUpdated isn't being called at all.

 public override void OnTradeOfferUpdated(TradeOffer offer)
        {
            if (offer.OfferState == TradeOfferState.TradeOfferStateActive)
            {
                offer.Accept();
            }
        }

It doesn't accept any offers when the bot is started, or when I send the offer. I have tried without the if as well and it still doesn't accept the offer.

Any ideas?

If you are running into an error it may be because you are trying to accept your own offer (that the account sent) and will create an error as you cannot accept a sent trade.

To clean this up here is the code:

     public override void OnTradeOfferUpdated(TradeOffer offer)
    {
        if (offer.OfferState == TradeOfferState.TradeOfferStateActive && !offer.IsOurOffer)
        {
            offer.Accept();
        }
    }

You may want to return errors as well but you can find that further into the documentation of the bot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM