diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs index 6ba34da6e..57f91fe2e 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs @@ -63,7 +63,7 @@ internal static class Backend { return await bot.ArchiWebHandler.WebBrowser.UrlPost(request, data: data, requestOptions: WebBrowser.ERequestOptions.ReturnRedirections | WebBrowser.ERequestOptions.ReturnClientErrors).ConfigureAwait(false); } - internal static async Task<(HttpStatusCode StatusCode, ImmutableHashSet Users)?> GetListedUsersForMatching(Guid licenseID, Bot bot, IReadOnlyCollection inventory, IReadOnlyCollection acceptedMatchableTypes, string tradeToken) { + internal static async Task<(HttpStatusCode StatusCode, ImmutableHashSet Users)?> GetListedUsersForMatching(Guid licenseID, Bot bot, IReadOnlyCollection inventory, IReadOnlyCollection acceptedMatchableTypes) { if (licenseID == Guid.Empty) { throw new ArgumentOutOfRangeException(nameof(licenseID)); } @@ -78,21 +78,13 @@ internal static class Backend { throw new ArgumentNullException(nameof(acceptedMatchableTypes)); } - if (string.IsNullOrEmpty(tradeToken)) { - throw new ArgumentNullException(nameof(tradeToken)); - } - - if (tradeToken.Length != BotConfig.SteamTradeTokenLength) { - throw new ArgumentOutOfRangeException(nameof(tradeToken)); - } - Uri request = new(ArchiNet.URL, "/Api/Listing/Inventories"); Dictionary headers = new(1, StringComparer.Ordinal) { { "X-License-Key", licenseID.ToString("N") } }; - InventoriesRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), bot.SteamID, tradeToken, inventory, acceptedMatchableTypes, ASF.GlobalConfig?.MaxTradeHoldDuration ?? GlobalConfig.DefaultMaxTradeHoldDuration); + InventoriesRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), bot.SteamID, inventory, acceptedMatchableTypes); ObjectResponse>>? response = await bot.ArchiWebHandler.WebBrowser.UrlPostToJsonObject>, InventoriesRequest>(request, headers, data, requestOptions: WebBrowser.ERequestOptions.ReturnClientErrors | WebBrowser.ERequestOptions.AllowInvalidBodyOnErrors).ConfigureAwait(false); diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Data/InventoriesRequest.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Data/InventoriesRequest.cs index b0b409706..897c1829a 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Data/InventoriesRequest.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Data/InventoriesRequest.cs @@ -24,7 +24,6 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using ArchiSteamFarm.Steam.Data; -using ArchiSteamFarm.Steam.Storage; using Newtonsoft.Json; using SteamKit2; @@ -40,16 +39,10 @@ internal sealed class InventoriesRequest { [JsonProperty(Required = Required.Always)] internal readonly ImmutableHashSet MatchableTypes; - [JsonProperty(Required = Required.Always)] - internal readonly byte MaxTradeHoldDuration; - [JsonProperty(Required = Required.Always)] internal readonly ulong SteamID; - [JsonProperty(Required = Required.Always)] - internal readonly string TradeToken; - - internal InventoriesRequest(Guid guid, ulong steamID, string tradeToken, IReadOnlyCollection inventory, IReadOnlyCollection matchableTypes, byte maxTradeHoldDuration) { + internal InventoriesRequest(Guid guid, ulong steamID, IReadOnlyCollection inventory, IReadOnlyCollection matchableTypes) { if (guid == Guid.Empty) { throw new ArgumentOutOfRangeException(nameof(guid)); } @@ -58,14 +51,6 @@ internal sealed class InventoriesRequest { throw new ArgumentOutOfRangeException(nameof(steamID)); } - if (string.IsNullOrEmpty(tradeToken)) { - throw new ArgumentNullException(nameof(tradeToken)); - } - - if (tradeToken.Length != BotConfig.SteamTradeTokenLength) { - throw new ArgumentOutOfRangeException(nameof(tradeToken)); - } - if ((inventory == null) || (inventory.Count == 0)) { throw new ArgumentNullException(nameof(inventory)); } @@ -76,9 +61,7 @@ internal sealed class InventoriesRequest { Guid = guid; SteamID = steamID; - TradeToken = tradeToken; Inventory = inventory.Select(static asset => new AssetInInventory(asset)).ToImmutableHashSet(); MatchableTypes = matchableTypes.ToImmutableHashSet(); - MaxTradeHoldDuration = maxTradeHoldDuration; } } diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs index 79ed90cb9..3ff9e0470 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs @@ -431,14 +431,6 @@ internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable { try { Bot.ArchiLogger.LogGenericInfo(Strings.Starting); - string? tradeToken = await Bot.ArchiHandler.GetTradeToken().ConfigureAwait(false); - - if (string.IsNullOrEmpty(tradeToken)) { - Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(tradeToken))); - - return; - } - HashSet ourInventory; try { @@ -473,7 +465,7 @@ internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable { } // ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework - (HttpStatusCode StatusCode, ImmutableHashSet Users)? response = await Backend.GetListedUsersForMatching(ASF.GlobalConfig.LicenseID.Value, Bot, ourInventory, acceptedMatchableTypes, tradeToken!).ConfigureAwait(false); + (HttpStatusCode StatusCode, ImmutableHashSet Users)? response = await Backend.GetListedUsersForMatching(ASF.GlobalConfig.LicenseID.Value, Bot, ourInventory, acceptedMatchableTypes).ConfigureAwait(false); if (response == null) { Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(response)));