diff --git a/Telegrator.Hosting/TelegramBotHostBuilder.cs b/Telegrator.Hosting/TelegramBotHostBuilder.cs index a5b3d39..c15713c 100644 --- a/Telegrator.Hosting/TelegramBotHostBuilder.cs +++ b/Telegrator.Hosting/TelegramBotHostBuilder.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Telegram.Bot; using Telegram.Bot.Polling; using Telegrator.Hosting; @@ -71,11 +72,11 @@ namespace Telegrator.Hosting if (!_settings.DisableAutoConfigure) { - Services.Configure(Configuration.GetSection(nameof(TelegratorOptions))); Services.Configure(Configuration.GetSection(nameof(ReceiverOptions))); Services.Configure(Configuration.GetSection(nameof(TelegramBotClientOptions)), new TelegramBotClientOptionsProxy()); } + Services.AddSingleton>(Options.Create(_settings)); return new TelegramBotHost(_innerBuilder, _handlers); } }