Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (37 loc) · 1.6 KB
/
Copy pathProgram.cs
File metadata and controls
46 lines (37 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using LMCLO.Config;
using LMCLO.Milky;
using LMCLO.OneBot;
using LMCLO.Services;
using Microsoft.Extensions.Options;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddSimpleConsole(options =>
{
options.TimestampFormat = null;
options.SingleLine = false;
});
builder.Logging.AddFilter("System.Net.Http.HttpClient", LogLevel.None);
builder.Logging.AddFilter("System.Net.Http", LogLevel.None);
builder.Logging.AddFilter("Microsoft.Hosting.Lifetime", LogLevel.Warning);
builder.Logging.AddFilter("Microsoft.AspNetCore", LogLevel.Warning);
builder.Services.AddHttpClient();
builder.Services.AddControllers();
builder.Services.Configure<LMCLOOptions>(builder.Configuration.GetSection("LMCLO"));
builder.Services.AddSingleton(sp => sp.GetRequiredService<IOptions<LMCLOOptions>>().Value);
builder.Services.AddSingleton<EventBus>();
builder.Services.AddSingleton<MessageConverter>();
builder.Services.AddSingleton<ApiDispatcher>();
builder.Services.AddSingleton<EventTranslator>();
builder.Services.AddSingleton<QuickOperationHandler>();
builder.Services.AddSingleton<MilkyClient>();
builder.Services.AddSingleton<RuntimeState>();
builder.Services.AddSingleton<MessageDb>();
builder.Services.AddHostedService<MilkyEventHostedService>();
builder.Services.AddSingleton<ForwardWSServiceFactory>();
builder.Services.AddSingleton<ReverseWSServiceFactory>();
builder.Services.AddSingleton<HttpServiceFactory>();
builder.Services.AddSingleton<HttpPostService>();
builder.Services.AddHostedService<OneBotServiceCoordinator>();
var app = builder.Build();
app.MapControllers();
app.Run();