diff options
Diffstat (limited to '')
-rw-r--r-- | Bot/FileStorageProvider.cs | 2 | ||||
-rw-r--r-- | Bot/Interfaces/ICommand.cs | 6 | ||||
-rw-r--r-- | Bot/MRUBotConfiguration.cs | 4 | ||||
-rw-r--r-- | LibMatrix.ExampleBot.csproj | 1 | ||||
-rw-r--r-- | Program.cs | 64 |
5 files changed, 38 insertions, 39 deletions
diff --git a/Bot/FileStorageProvider.cs b/Bot/FileStorageProvider.cs index 2dfcee5..935d53f 100644 --- a/Bot/FileStorageProvider.cs +++ b/Bot/FileStorageProvider.cs @@ -19,7 +19,7 @@ public class FileStorageProvider : IStorageProvider { new Logger<FileStorageProvider>(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/Bot/Interfaces/ICommand.cs b/Bot/Interfaces/ICommand.cs index 393ddbb..2ba5a27 100644 --- a/Bot/Interfaces/ICommand.cs +++ b/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<bool> CanInvoke(CommandContext ctx) { return Task.FromResult(true); } - + public Task Invoke(CommandContext ctx); -} \ No newline at end of file +} diff --git a/Bot/MRUBotConfiguration.cs b/Bot/MRUBotConfiguration.cs index c7620df..dcdfc4c 100644 --- a/Bot/MRUBotConfiguration.cs +++ b/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/LibMatrix.ExampleBot.csproj b/LibMatrix.ExampleBot.csproj index 94c9045..a905524 100644 --- a/LibMatrix.ExampleBot.csproj +++ b/LibMatrix.ExampleBot.csproj @@ -17,7 +17,6 @@ </PropertyGroup> <ItemGroup> - <ProjectReference Include="..\..\..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj" /> <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj" /> </ItemGroup> diff --git a/Program.cs b/Program.cs index ef40ecb..6d8775e 100644 --- a/Program.cs +++ b/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<TieredStorageService>(x => - new TieredStorageService( - cacheStorageProvider: new FileStorageProvider("bot_data/cache/"), - dataStorageProvider: new FileStorageProvider("bot_data/data/") - ) - ); - 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<ServerRoomSizeCalulator>(); - services.AddHostedService<MRUBot>(); -}).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<TieredStorageService>(x => + new TieredStorageService( + cacheStorageProvider: new FileStorageProvider("bot_data/cache/"), + dataStorageProvider: new FileStorageProvider("bot_data/data/") + ) + ); + 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<ServerRoomSizeCalulator>(); + services.AddHostedService<MRUBot>(); +}).UseConsoleLifetime().Build(); + +await host.RunAsync(); |