From 8fdc48e5b21b1eea61534b181585858727500f34 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 14 Aug 2023 04:26:27 +0200 Subject: Move more projects over --- LibMatrix.ExampleBot/Program.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 LibMatrix.ExampleBot/Program.cs (limited to 'LibMatrix.ExampleBot/Program.cs') diff --git a/LibMatrix.ExampleBot/Program.cs b/LibMatrix.ExampleBot/Program.cs new file mode 100644 index 0000000..93a5f27 --- /dev/null +++ b/LibMatrix.ExampleBot/Program.cs @@ -0,0 +1,28 @@ +// See https://aka.ms/new-console-template for more information + +using LibMatrix.ExampleBot.Bot; +using LibMatrix.ExampleBot.Bot.Interfaces; +using LibMatrix.Extensions; +using LibMatrix.Services; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +Console.WriteLine("Hello, World!"); + +var host = Host.CreateDefaultBuilder(args).ConfigureServices((_, services) => { + services.AddScoped(x => + new( + cacheStorageProvider: new FileStorageProvider("bot_data/cache/"), + dataStorageProvider: new FileStorageProvider("bot_data/data/") + ) + ); + services.AddScoped(); + services.AddRoryLibMatrixServices(); + foreach (var commandClass in new ClassCollector().ResolveFromAllAccessibleAssemblies()) { + Console.WriteLine($"Adding command {commandClass.Name}"); + services.AddScoped(typeof(ICommand), commandClass); + } + services.AddHostedService(); +}).UseConsoleLifetime().Build(); + +await host.RunAsync(); -- cgit 1.4.1