about summary refs log tree commit diff
path: root/MatrixRoomUtils.Bot/Program.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-26 02:43:54 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-27 17:43:00 +0200
commit3ed00f732a284b5a3e96e52d4e3a71869135869b (patch)
tree308cdd5c9891a676dc55cbf0e0e998ab5a74b2d2 /MatrixRoomUtils.Bot/Program.cs
parentWorking state, refactored Rory&::LibMatrix (diff)
downloadMatrixUtils-3ed00f732a284b5a3e96e52d4e3a71869135869b.tar.xz
Dependency injection stuff
Diffstat (limited to 'MatrixRoomUtils.Bot/Program.cs')
-rw-r--r--MatrixRoomUtils.Bot/Program.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Bot/Program.cs b/MatrixRoomUtils.Bot/Program.cs

index e8a5b96..0e27286 100644 --- a/MatrixRoomUtils.Bot/Program.cs +++ b/MatrixRoomUtils.Bot/Program.cs
@@ -1,6 +1,8 @@ // See https://aka.ms/new-console-template for more information using MatrixRoomUtils.Bot; +using MatrixRoomUtils.Bot.Interfaces; +using MatrixRoomUtils.Core.Extensions; using MatrixRoomUtils.Core.Services; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -16,6 +18,10 @@ var host = Host.CreateDefaultBuilder(args).ConfigureServices((_, services) => { ); services.AddScoped<MRUBotConfiguration>(); services.AddRoryLibMatrixServices(); + foreach (var commandClass in new ClassCollector<ICommand>().ResolveFromAllAccessibleAssemblies()) { + Console.WriteLine($"Adding command {commandClass.Name}"); + services.AddScoped(typeof(ICommand), commandClass); + } services.AddHostedService<MRUBot>(); }).UseConsoleLifetime().Build();