Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 911 forks source link

When sending TradeOffer server returns an error 500 #1122

Closed Veanvi closed 5 years ago

Veanvi commented 6 years ago

I call the method SendWithToken in class TradeOffer and SteamWeb.Request gives an error message: System.Net.WebException: "The remote server returned an error: (500) Internal server error."

I call so:

tradingManager.SendOfferWithToken( myInventory.items.Values.ToList(), hisInventory.items.Values.ToList(), hostTradeLink, "Test" );

My class wrap:

`

    public string SendOfferWithToken(List<GenericInventory.Item> ourItems, List<GenericInventory.Item> theirItems, string token, string message = "")
    {
        string tradeOfferId;
        var accIdOther = token.Split(new[] { "partner=" }, StringSplitOptions.None)[1].Split('&')[0];
        var tradeOffer = FormTradeOffer(ourItems, theirItems, int.Parse(accIdOther));

        var splitter = "token=";
        token = token.Split(new[] { splitter }, StringSplitOptions.None)[1];

        tradeOffer.SendWithToken(out tradeOfferId, token, message);
        return tradeOfferId;
    }

    private List<CEconAsset> ConvertToCecon(List<GenericInventory.Item> items)
    {
        var result = new List<CEconAsset>();

        if (items != null && items.Count > 0)
            foreach (var item in items)
            {
                result.Add(new CEconAsset
                {
                    AssetId = item.Assetid.ToString(),
                    ContextId = item.ContextId.ToString(),
                    AppId = item.AppId.ToString()
                });
            }
        return result;
    }

    private TradeOffer FormTradeOffer(List<GenericInventory.Item> ourItems, List<GenericInventory.Item> theirItems, int accountIdOther = 0)
    {
        var itemsToGive = ConvertToCecon(ourItems);
        var itemsToRecieve = ConvertToCecon(theirItems);

        var offer = new Offer();
        if (accountIdOther != 0)
            offer.AccountIdOther = accountIdOther;
        offer.ItemsToGive = itemsToGive;
        offer.ItemsToReceive = itemsToRecieve;

        var tradeOffer = new TradeOffer(session, offer);
        return tradeOffer;
    }

`

Am I doing something wrong?

Veanvi commented 6 years ago

Found what was my mistake, I somehow did not correctly send out non-unique items. Those items that stack.

TimoKruth commented 5 years ago

@AndreyVerhovnikov Could you close this issue then pls?

TimoKruth commented 5 years ago

@BlueRaja is there a chance to get some of the other posts in this issue tracker closed as well? As they aren't issues with the project but help requests mostly without answers. And the issue tracker is a bit overloaded due to these posts. I would love to help but dont have the rights to do so.