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();
|