From da3c418a1a9cff0e85dbd6b481e5735916dd533c Mon Sep 17 00:00:00 2001 From: Rikitav Date: Sat, 2 Aug 2025 02:38:34 +0400 Subject: [PATCH] * Fixed unnecesary configuring of TelegraotrOptions inside Builder --- Telegrator.Hosting/TelegramBotHostBuilder.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } }