From 7894b0132f9d532dffa5b6be9ee653db56deb974 Mon Sep 17 00:00:00 2001 From: Archi Date: Thu, 15 Dec 2022 22:02:19 +0100 Subject: [PATCH] Update RemoteCommunication on bot modules reload Archi, you designed that interface yourself exactly for this purpose, silly! This way bot reload in config will trigger remote communication changes. --- .../ItemsMatcherPlugin.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs index 2e57e6792..00733d025 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Composition; using System.Threading.Tasks; using ArchiSteamFarm.Core; @@ -30,12 +31,13 @@ using ArchiSteamFarm.Plugins.Interfaces; using ArchiSteamFarm.Steam; using ArchiSteamFarm.Steam.Storage; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using SteamKit2; namespace ArchiSteamFarm.OfficialPlugins.ItemsMatcher; [Export(typeof(IPlugin))] -internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotIdentity { +internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotIdentity, IBotModules { private static readonly ConcurrentDictionary RemoteCommunications = new(); [JsonProperty] @@ -52,7 +54,13 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotIdentity { } } - public async Task OnBotInit(Bot bot) { + public Task OnBotInit(Bot bot) { + ArgumentNullException.ThrowIfNull(bot); + + return Task.CompletedTask; + } + + public async Task OnBotInitModules(Bot bot, IReadOnlyDictionary? additionalConfigProperties = null) { ArgumentNullException.ThrowIfNull(bot); if (RemoteCommunications.TryRemove(bot, out RemoteCommunication? remoteCommunications)) {