about summary refs log tree commit diff
path: root/Utilities/LibMatrix.DevTestBot/Program.cs
blob: 7eb74d473772cff4a3a53df4a8ba6c7e8fbf4f1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See https://aka.ms/new-console-template for more information

using LibMatrix.ExampleBot.Bot;
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<DevTestBotConfiguration>();
    services.AddRoryLibMatrixServices();

    services.AddMatrixBot()
        .AddCommandHandler()
        .DiscoverAllCommands()
        .WithInviteHandler(ctx => Task.FromResult(ctx.MemberEvent.Sender!.EndsWith(":rory.gay")));

    // services.AddHostedService<ServerRoomSizeCalulator>();
    services.AddHostedService<PingTestBot>();
}).UseConsoleLifetime().Build();

await host.RunAsync();