diff options
author | Rory& <root@rory.gay> | 2024-09-16 08:43:42 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-09-16 08:43:42 +0200 |
commit | b93c5e7e284c73c97192bf4ff7002c4b396ed2e9 (patch) | |
tree | 254ea85c256b7f8c582a6755e7918ba48585ae87 /Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs | |
parent | meow (diff) | |
download | LibMatrix-dev/moderationclient-changes.tar.xz |
Sync optimisation changes github/dev/moderationclient-changes dev/moderationclient-changes
Diffstat (limited to 'Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs')
-rw-r--r-- | Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs | 4 |
1 files changed, 2 insertions, 2 deletions
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<LibMatrixBotConfiguration>(); - services.AddScoped<AuthenticatedHomeserverGeneric>(x => { + services.AddSingleton<AuthenticatedHomeserverGeneric>(x => { var config = x.GetService<LibMatrixBotConfiguration>() ?? throw new Exception("No configuration found!"); var hsProvider = x.GetService<HomeserverProviderService>() ?? 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<ICommand>().ResolveFromAllAccessibleAssemblies()) { + foreach (var commandClass in ClassCollector<ICommand>.ResolveFromAllAccessibleAssemblies()) { Console.WriteLine($"Adding command {commandClass.Name}"); services.AddScoped(typeof(ICommand), commandClass); } |