-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
31 lines (22 loc) · 1.07 KB
/
Program.cs
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
using fastfood_order.Data;
using fastfood_order.Services;
using Microsoft.EntityFrameworkCore;
using Telegram.Bot;
using Telegram.Bot.Polling;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<BotDbContext>(
options => options.UseSqlite(builder.Configuration.GetConnectionString("BotConnection")));
var token = builder.Configuration.GetValue("BotToken", string.Empty);
builder.Services.AddSingleton(new TelegramBotClient(token));
builder.Services.AddSingleton<IUpdateHandler, BotUpdateHandler>();
builder.Services.AddHostedService<BotBackgroundService>();
builder.Services.AddScoped<UserService>();
builder.Services.AddLocalization();
var app = builder.Build();
var supportedCultures = new[] { "uz-Uz", "en-Us", "ru-Ru" };
var localizationOptions = new RequestLocalizationOptions().SetDefaultCulture(supportedCultures[0])
.SetDefaultCulture(supportedCultures[0])
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures);
app.UseRequestLocalization(localizationOptions);
app.Run();