-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
33 lines (30 loc) · 829 Bytes
/
Program.cs
File metadata and controls
33 lines (30 loc) · 829 Bytes
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
using TTX.AdminBot;
using TTX.AdminBot.Options;
using TTX.AdminBot.Services;
using TTX.AdminBot.Services.Commands;
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Configuration
.AddUserSecrets<Program>()
.AddEnvironmentVariables();
builder.Services
.AddOptions<TtxOptions>()
.Bind(builder.Configuration.GetSection("Ttx"))
.Services
.AddOptions<BotOptions>()
.Bind(builder.Configuration.GetSection("Bot"))
.Configure(opt =>
{
opt.Migrate = args.FirstOrDefault() == "migrate";
})
.Services
.AddHttpClient()
.AddLogging(opt =>
{
opt.AddConsole();
})
.AddSingleton<Bot>()
.AddSingleton<TtxApiClient>()
.AddScoped<ICommand, AddCommand>()
.AddHostedService<Worker>();
IHost host = builder.Build();
host.Run();