From 71d115dc8e915a620dd935955ba980fcbe421dad Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Fri, 1 Dec 2023 12:16:00 +0100 Subject: Cleanup, move ArcaneLibs to submodule instead of parent submodule --- .../Bot/FileStorageProvider.cs | 2 +- .../Bot/Interfaces/ICommand.cs | 6 +- .../Bot/MRUBotConfiguration.cs | 4 +- .../LibMatrix.ExampleBot.csproj | 1 - ExampleBots/LibMatrix.ExampleBot/Program.cs | 64 +++++++++++----------- 5 files changed, 38 insertions(+), 39 deletions(-) (limited to 'ExampleBots/LibMatrix.ExampleBot') diff --git a/ExampleBots/LibMatrix.ExampleBot/Bot/FileStorageProvider.cs b/ExampleBots/LibMatrix.ExampleBot/Bot/FileStorageProvider.cs index 2dfcee5..935d53f 100644 --- a/ExampleBots/LibMatrix.ExampleBot/Bot/FileStorageProvider.cs +++ b/ExampleBots/LibMatrix.ExampleBot/Bot/FileStorageProvider.cs @@ -19,7 +19,7 @@ public class FileStorageProvider : IStorageProvider { new Logger(new LoggerFactory()).LogInformation("test"); Console.WriteLine($"Initialised FileStorageProvider with path {targetPath}"); TargetPath = targetPath; - if(!Directory.Exists(targetPath)) { + if (!Directory.Exists(targetPath)) { Directory.CreateDirectory(targetPath); } } diff --git a/ExampleBots/LibMatrix.ExampleBot/Bot/Interfaces/ICommand.cs b/ExampleBots/LibMatrix.ExampleBot/Bot/Interfaces/ICommand.cs index 393ddbb..2ba5a27 100644 --- a/ExampleBots/LibMatrix.ExampleBot/Bot/Interfaces/ICommand.cs +++ b/ExampleBots/LibMatrix.ExampleBot/Bot/Interfaces/ICommand.cs @@ -1,4 +1,4 @@ -namespace LibMatrix.ExampleBot.Bot.Interfaces; +namespace LibMatrix.ExampleBot.Bot.Interfaces; public interface ICommand { public string Name { get; } @@ -7,6 +7,6 @@ public interface ICommand { public Task CanInvoke(CommandContext ctx) { return Task.FromResult(true); } - + public Task Invoke(CommandContext ctx); -} \ No newline at end of file +} diff --git a/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBotConfiguration.cs b/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBotConfiguration.cs index c7620df..dcdfc4c 100644 --- a/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBotConfiguration.cs +++ b/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBotConfiguration.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Configuration; -namespace LibMatrix.ExampleBot.Bot; +namespace LibMatrix.ExampleBot.Bot; public class MRUBotConfiguration { public MRUBotConfiguration(IConfiguration config) { @@ -9,4 +9,4 @@ public class MRUBotConfiguration { public string Homeserver { get; set; } = ""; public string AccessToken { get; set; } = ""; public string Prefix { get; set; } -} \ No newline at end of file +} diff --git a/ExampleBots/LibMatrix.ExampleBot/LibMatrix.ExampleBot.csproj b/ExampleBots/LibMatrix.ExampleBot/LibMatrix.ExampleBot.csproj index 94c9045..a905524 100644 --- a/ExampleBots/LibMatrix.ExampleBot/LibMatrix.ExampleBot.csproj +++ b/ExampleBots/LibMatrix.ExampleBot/LibMatrix.ExampleBot.csproj @@ -17,7 +17,6 @@ - diff --git a/ExampleBots/LibMatrix.ExampleBot/Program.cs b/ExampleBots/LibMatrix.ExampleBot/Program.cs index ef40ecb..6d8775e 100644 --- a/ExampleBots/LibMatrix.ExampleBot/Program.cs +++ b/ExampleBots/LibMatrix.ExampleBot/Program.cs @@ -1,32 +1,32 @@ -// See https://aka.ms/new-console-template for more information - -using ArcaneLibs; -using LibMatrix.ExampleBot.Bot; -using LibMatrix.ExampleBot.Bot.Interfaces; -using LibMatrix.ExampleBot.Bot.StartupTasks; -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 TieredStorageService( - 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(); - services.AddHostedService(); -}).UseConsoleLifetime().Build(); - -await host.RunAsync(); +// See https://aka.ms/new-console-template for more information + +using ArcaneLibs; +using LibMatrix.ExampleBot.Bot; +using LibMatrix.ExampleBot.Bot.Interfaces; +using LibMatrix.ExampleBot.Bot.StartupTasks; +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 TieredStorageService( + 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(); + services.AddHostedService(); +}).UseConsoleLifetime().Build(); + +await host.RunAsync(); -- cgit 1.4.1