From b93c5e7e284c73c97192bf4ff7002c4b396ed2e9 Mon Sep 17 00:00:00 2001 From: Rory& Date: Mon, 16 Sep 2024 08:43:42 +0200 Subject: Sync optimisation changes --- Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs') diff --git a/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs b/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs index 215f28a..5a0b7ad 100644 --- a/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs +++ b/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs @@ -19,7 +19,7 @@ public class BotInstaller(IServiceCollection services) { public BotInstaller AddMatrixBot() { services.AddSingleton(); - services.AddScoped(x => { + services.AddSingleton(x => { var config = x.GetService() ?? throw new Exception("No configuration found!"); var hsProvider = x.GetService() ?? throw new Exception("No homeserver provider found!"); var hs = hsProvider.GetAuthenticatedWithToken(config.Homeserver, config.AccessToken).Result; @@ -37,7 +37,7 @@ public class BotInstaller(IServiceCollection services) { } public BotInstaller DiscoverAllCommands() { - foreach (var commandClass in new ClassCollector().ResolveFromAllAccessibleAssemblies()) { + foreach (var commandClass in ClassCollector.ResolveFromAllAccessibleAssemblies()) { Console.WriteLine($"Adding command {commandClass.Name}"); services.AddScoped(typeof(ICommand), commandClass); } -- cgit 1.4.1