about summary refs log tree commit diff
path: root/Utilities/LibMatrix.DevTestBot/Program.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-04-23 22:15:00 +0200
committerRory& <root@rory.gay>2025-04-23 22:15:14 +0200
commit17288cf70c97ea48c310ab876ee44554c09e8fe0 (patch)
treea8aecca8602ee52b6487651473a4c2fa433622b2 /Utilities/LibMatrix.DevTestBot/Program.cs
parentAdd tombstone event content, URL-escape room id in synapse admin (diff)
downloadLibMatrix-17288cf70c97ea48c310ab876ee44554c09e8fe0.tar.xz
Update devtestbot to use bot utils
Diffstat (limited to '')
-rw-r--r--Utilities/LibMatrix.DevTestBot/Program.cs18
1 files changed, 6 insertions, 12 deletions
diff --git a/Utilities/LibMatrix.DevTestBot/Program.cs b/Utilities/LibMatrix.DevTestBot/Program.cs

index 8eaaea8..7eb74d4 100644 --- a/Utilities/LibMatrix.DevTestBot/Program.cs +++ b/Utilities/LibMatrix.DevTestBot/Program.cs
@@ -1,27 +1,21 @@ // See https://aka.ms/new-console-template for more information -using ArcaneLibs; using LibMatrix.ExampleBot.Bot; -using LibMatrix.ExampleBot.Bot.Interfaces; using LibMatrix.Services; +using LibMatrix.Utilities.Bot; 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<DevTestBotConfiguration>(); services.AddRoryLibMatrixServices(); - foreach (var commandClass in ClassCollector<ICommand>.ResolveFromAllAccessibleAssemblies()) { - Console.WriteLine($"Adding command {commandClass.Name}"); - services.AddScoped(typeof(ICommand), commandClass); - } + + services.AddMatrixBot() + .AddCommandHandler() + .DiscoverAllCommands() + .WithInviteHandler(ctx => Task.FromResult(ctx.MemberEvent.Sender!.EndsWith(":rory.gay"))); // services.AddHostedService<ServerRoomSizeCalulator>(); services.AddHostedService<PingTestBot>();