简体   繁体   English

SteamBot不接受贸易报价OnTradeOfferUpdated

[英]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. 我已经尝试了很多事情,并且从我的实验来看,似乎OnTradeOfferUpdated没有调用过回调OnTradeOfferUpdated

 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. 我也尝试过, if没有,它仍然不接受该报价。

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. 您可能还想返回错误,但是您可以在机器人文档中找到更多错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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