fixed double UseTelegrator invokation

This commit is contained in:
2026-03-08 22:02:01 +04:00
parent 2cf4910abd
commit 401c8d02aa
2 changed files with 1 additions and 6 deletions
@@ -53,7 +53,6 @@ namespace Telegrator.Hosting.Web
{ {
// Building proxy application // Building proxy application
_innerApp = webApplicationBuilder.Build(); _innerApp = webApplicationBuilder.Build();
_innerApp.UseTelegratorWeb();
// Reruesting services for this host // Reruesting services for this host
_updateRouter = Services.GetRequiredService<IUpdateRouter>(); _updateRouter = Services.GetRequiredService<IUpdateRouter>();
@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Telegrator.Core; using Telegrator.Core;
@@ -12,14 +11,13 @@ namespace Telegrator.Hosting
public class TelegramBotHost : IHost, ITelegratorBot public class TelegramBotHost : IHost, ITelegratorBot
{ {
private readonly IHost _innerHost; private readonly IHost _innerHost;
private readonly IServiceProvider _serviceProvider;
private readonly IUpdateRouter _updateRouter; private readonly IUpdateRouter _updateRouter;
private readonly ILogger<TelegramBotHost> _logger; private readonly ILogger<TelegramBotHost> _logger;
private bool _disposed; private bool _disposed;
/// <inheritdoc/> /// <inheritdoc/>
public IServiceProvider Services => _serviceProvider; public IServiceProvider Services => _innerHost.Services;
/// <inheritdoc/> /// <inheritdoc/>
public IUpdateRouter UpdateRouter => _updateRouter; public IUpdateRouter UpdateRouter => _updateRouter;
@@ -40,8 +38,6 @@ namespace Telegrator.Hosting
// Building proxy hoster // Building proxy hoster
_innerHost = hostApplicationBuilder.Build(); _innerHost = hostApplicationBuilder.Build();
_serviceProvider = _innerHost.Services;
_innerHost.UseTelegrator();
// Reruesting services for this host // Reruesting services for this host
_updateRouter = Services.GetRequiredService<IUpdateRouter>(); _updateRouter = Services.GetRequiredService<IUpdateRouter>();