From 3505016f703a12275278f672cbd33cdfd9ffc45a Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sat, 2 Mar 2024 19:37:43 -0500 Subject: [PATCH 1/7] Added missing parameters for bstatus^ command --- BoosterManager/Commands.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoosterManager/Commands.cs b/BoosterManager/Commands.cs index edefb57..755231c 100644 --- a/BoosterManager/Commands.cs +++ b/BoosterManager/Commands.cs @@ -177,6 +177,9 @@ internal static class Commands { case "BSTATUS" or "BOOSTERSTATUS": return ResponseBoosterStatus(access, steamID, args[1]); + + case "BSTATUS^" or "BOOSTERSTATUS^": + return ResponseBoosterStatus(access, steamID, args[1], true); case "BSTOP" or "BOOSTERSTOP" when args.Length > 2: return ResponseBoosterStop(access, steamID, args[1], Utilities.GetArgsAsText(args, 2, ",")); From 7b24f3d0ffdf99dc6b35e85cac2a757bd2f437e7 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Mon, 4 Mar 2024 06:42:29 -0500 Subject: [PATCH 2/7] Update README --- BoosterManager/Docs/InventoryHistory.md | 4 ++++ README.md | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BoosterManager/Docs/InventoryHistory.md b/BoosterManager/Docs/InventoryHistory.md index 096e801..2e85df8 100644 --- a/BoosterManager/Docs/InventoryHistory.md +++ b/BoosterManager/Docs/InventoryHistory.md @@ -47,6 +47,7 @@ I feel the need to provide unofficial documentation here, because doing anything Much of the inventory history is delivered as `html` that needs to be parsed. +> [!NOTE] > The BoosterManager plugin does not, and likely never will, support parsing of `html`. The best I can do is to offer this incomplete list of possible history event descriptions. Be aware that each of these descriptions describes a unique type of event. For example, "Listed on the Community Market" and "You listed an item on the Community Market." are different types of events, and not two different ways to describe the same event. @@ -138,6 +139,7 @@ Not all gaps are as large as in the examples above. It's very common to have lo In my experience, because small gaps tend to only happen due to market-related activity, they can be safely ignored, as market history is more accurately collected using the Market History API. +> [!NOTE] > The BoosterManager plugin cannot detect this bug. You'll need to monitor the plugin's activity yourself to ensure there's no gaps. Within your `InventoryHistoryAPI`, `page - data["cursor"]["time"]` represents the size of the gap in seconds between the current page and the next page. Be aware that `data["cursor"]` [can be](#history-ends-early-bug) `null`. You can attempt to address this bug with your API by setting the `next_page` or `next_cursor` response parameters, telling the plugin which page you'd like it to fetch next. ## History Ends Early Bug @@ -152,6 +154,7 @@ For example, assuming we have history older than `4/30/21`, this can happen: This is resolved the same way as the [Missing History Bug](#missing-history-bug): by searching for history events at times past the cutoff. +> [!NOTE] > The BoosterManager plugin will detect when the bug may have occurred. On the `InventoryHistoryAPI` side of things, the value for `data[cursor]` will be `null` when it receives a page with this bug on it. If your API does not send a `next_page` or `next_cursor` response parameter, then the plugin will stop running and send a link in the Steam Chat to the page where the bug occurred. ## Missing Descriptions Bugs @@ -170,4 +173,5 @@ There's at least one instance where this type of error will never go away by rel - Most events involving Steam Gems on or before December 12, 2014 will appear as "Unknown Asset" in place of the gems, and will have no `descriptions` entry. This is likely due to a gem duplication exploit and the resulting rollbacks. +> [!NOTE] > The BoosterManager plugin does not detect these bugs. You can tell the plugin to refresh the page by sending back `cursor` and `page` in the `next_cursor` and `next_page` response parameters respectively. diff --git a/README.md b/README.md index 3204382..f2bcfb0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This project is based off of the [Booster Creator Plugin](https://github.com/Rud - Unpack the downloaded .zip file to the `plugins` folder inside your ASF folder. - (Re)start ASF, you should get a message indicating that the plugin loaded successfully. -> **Note** +> [!NOTE] > This plugin is only tested to work with ASF-generic. It may or may not work with other ASF variants, but feel free to report any issues you may encounter. ## Usage @@ -197,7 +197,7 @@ Example: "GamesToBooster": [730, 570], ``` -> **Note** +> [!NOTE] > It's not possible to remove any of these `AppIDs` from the booster queue using any commands. Any changes you want to make will need to be made in the configuration file. --- @@ -212,7 +212,7 @@ Example: "BoosterDelayBetweenBots": 60, ``` -> **Note** +> [!NOTE] > This is not recommended to be used except in the most extreme cases. --- From 0ce418bce98fe6a5ad0a0f38bf43c314036f6c3f Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sat, 9 Mar 2024 12:06:10 -0500 Subject: [PATCH 3/7] Version bump --- BoosterManager/BoosterManager.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BoosterManager/BoosterManager.csproj b/BoosterManager/BoosterManager.csproj index 4b1f4a0..9f92a0d 100644 --- a/BoosterManager/BoosterManager.csproj +++ b/BoosterManager/BoosterManager.csproj @@ -2,7 +2,7 @@ Citrinate - 2.8.3 + 2.8.4 enable latest net8.0 From 4eb902e4091563304a0592347c95057499109a75 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sat, 9 Mar 2024 14:00:06 -0500 Subject: [PATCH 4/7] Remove ASFEnhance exception error --- BoosterManager/AdapterBridge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BoosterManager/AdapterBridge.cs b/BoosterManager/AdapterBridge.cs index 857a75c..0c7a4b8 100644 --- a/BoosterManager/AdapterBridge.cs +++ b/BoosterManager/AdapterBridge.cs @@ -23,8 +23,8 @@ public static bool InitAdapter(string pluginName, string pluginId, string? cmdPr } } } - } catch (Exception ex) { - ASF.ArchiLogger.LogGenericException(ex, "Community with ASFEnhance failed"); + } catch (Exception) { + ASF.ArchiLogger.LogGenericDebug("Could not find ASFEnhance plugin"); } return false; From 09c39344ef36f38dc1183036cc86ba5844d90779 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sun, 10 Mar 2024 18:25:10 -0400 Subject: [PATCH 5/7] Remove ASFE DisabledCmds support --- BoosterManager/AdapterBridge.cs | 10 ++++++++++ BoosterManager/BoosterManager.cs | 10 ++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/BoosterManager/AdapterBridge.cs b/BoosterManager/AdapterBridge.cs index 0c7a4b8..8aaad50 100644 --- a/BoosterManager/AdapterBridge.cs +++ b/BoosterManager/AdapterBridge.cs @@ -1,6 +1,7 @@ using System; using System.Reflection; using ArchiSteamFarm.Core; +using ArchiSteamFarm.Steam; // ASFEnhanced Adapter https://github.com/chr233/ASFEnhanceAdapterDemoPlugin @@ -29,4 +30,13 @@ public static bool InitAdapter(string pluginName, string pluginId, string? cmdPr return false; } + + internal static string? Response(Bot bot, EAccess access, ulong steamID, string message, string[] args) { + // ASFEnhance wants to intercept commands meant for this plugin, for the purpose of it's DisabledCmds config setting. + // Seems buggy though: https://github.com/Citrinate/FreePackages/issues/28 + // Therefore I'm feeding it this dummy response function, as ASFEnhance requires that cmdHandler not be null. + // This disables DisabledCmds support, but should not effect PLUGINSUPDATE command support + + return null; + } } diff --git a/BoosterManager/BoosterManager.cs b/BoosterManager/BoosterManager.cs index be42569..28fbea5 100644 --- a/BoosterManager/BoosterManager.cs +++ b/BoosterManager/BoosterManager.cs @@ -16,28 +16,22 @@ namespace BoosterManager { public sealed class BoosterManager : IASF, IBotModules, IBotCommand2, IBotTradeOfferResults { public string Name => nameof(BoosterManager); public Version Version => typeof(BoosterManager).Assembly.GetName().Version ?? new Version("0"); - private bool ASFEnhanceEnabled = false; public Task OnLoaded() { ASF.ArchiLogger.LogGenericInfo("BoosterManager ASF Plugin by Citrinate"); // ASFEnhanced Adapter https://github.com/chr233/ASFEnhanceAdapterDemoPlugin var flag = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - var handler = typeof(Commands).GetMethod(nameof(Commands.Response), flag); + var handler = typeof(AdapterBridge).GetMethod(nameof(AdapterBridge.Response), flag); const string pluginId = nameof(BoosterManager); const string cmdPrefix = "BOOSTERMANAGER"; const string repoName = "Citrinate/BoosterManager"; - var registered = AdapterBridge.InitAdapter(Name, pluginId, cmdPrefix, repoName, handler); - ASFEnhanceEnabled = registered; + AdapterBridge.InitAdapter(Name, pluginId, cmdPrefix, repoName, handler); return Task.CompletedTask; } public async Task OnBotCommand(Bot bot, EAccess access, string message, string[] args, ulong steamID = 0) { - if (ASFEnhanceEnabled) { - return null; - } - return await Commands.Response(bot, access, steamID, message, args).ConfigureAwait(false); } From 45c2f5dad21be9ff258e9122c9c951f14e4a0c86 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sun, 10 Mar 2024 20:44:58 -0400 Subject: [PATCH 6/7] Fix errors on non-generic ASF #13 --- BoosterManager/Boosters/BoosterPageResponse.cs | 2 +- BoosterManager/Json.cs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/BoosterManager/Boosters/BoosterPageResponse.cs b/BoosterManager/Boosters/BoosterPageResponse.cs index edcf62b..111a403 100644 --- a/BoosterManager/Boosters/BoosterPageResponse.cs +++ b/BoosterManager/Boosters/BoosterPageResponse.cs @@ -37,7 +37,7 @@ internal BoosterPageResponse(Bot bot, IDocument? boosterPage) { IEnumerable? enumerableBoosters; try { - enumerableBoosters = JsonSerializer.Deserialize>(info.Value, new JsonSerializerOptions { NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString }); + enumerableBoosters = JsonSerializer.Deserialize>(info.Value); } catch (JsonException ex) { Bot.ArchiLogger.LogGenericError(ex.Message); diff --git a/BoosterManager/Json.cs b/BoosterManager/Json.cs index 27c3e0c..e94b4d7 100644 --- a/BoosterManager/Json.cs +++ b/BoosterManager/Json.cs @@ -37,6 +37,7 @@ internal sealed class BoosterInfo { [JsonInclude] [JsonPropertyName("price")] + [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] [JsonRequired] internal uint Price { get; private init; } @@ -118,22 +119,22 @@ internal sealed class MarketListingsResponse { [JsonInclude] [JsonPropertyName("listings")] [JsonRequired] - internal JsonArray? Listings { get; private init; } + internal List? Listings { get; private init; } [JsonInclude] [JsonPropertyName("listings_on_hold")] [JsonRequired] - internal JsonArray? ListingsOnHold { get; private init; } = new(); + internal List? ListingsOnHold { get; private init; } = new(); [JsonInclude] [JsonPropertyName("listings_to_confirm")] [JsonRequired] - internal JsonArray ListingsToConfirm { get; private init; } = new(); + internal List ListingsToConfirm { get; private init; } = new(); [JsonInclude] [JsonPropertyName("buy_orders")] [JsonRequired] - internal JsonArray BuyOrders { get; private init; } = new(); + internal List BuyOrders { get; private init; } = new(); [JsonConstructor] private MarketListingsResponse() { } @@ -167,7 +168,7 @@ internal sealed class MarketHistoryResponse { [JsonInclude] [JsonPropertyName("events")] - internal JsonArray? Events { get; private init; } + internal List? Events { get; private init; } [JsonInclude] [JsonPropertyName("purchases")] @@ -232,7 +233,7 @@ internal sealed class InventoryHistoryResponse { [JsonInclude] [JsonPropertyName("apps")] - internal JsonArray Apps { get; private init; } = new(); + internal List Apps { get; private init; } = new(); [JsonInclude] [JsonPropertyName("cursor")] From a48e7b7ccd3493c0efb5e1c5d41bdafada9be10c Mon Sep 17 00:00:00 2001 From: Citrinate Date: Mon, 11 Mar 2024 17:09:03 -0400 Subject: [PATCH 7/7] Version bump --- BoosterManager/BoosterManager.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BoosterManager/BoosterManager.csproj b/BoosterManager/BoosterManager.csproj index 9f92a0d..b486824 100644 --- a/BoosterManager/BoosterManager.csproj +++ b/BoosterManager/BoosterManager.csproj @@ -2,7 +2,7 @@ Citrinate - 2.8.4 + 2.8.5 enable latest net8.0