From ba772f3f7ca2cc1cef340d36358122012e3e60b7 Mon Sep 17 00:00:00 2001 From: Rikitav Date: Sun, 15 Mar 2026 19:21:32 +0400 Subject: [PATCH] * Fixed wrong UseTelegrator method using in web host * Fixed HostedUpdateWebhooker service discovery --- .../Hosting.Web/TelegramBotWebHostBuilder.cs | 2 +- src/Telegrator.Hosting.Web/Telegrator.Hosting.Web.csproj | 2 +- src/Telegrator.Hosting.Web/TypesExtensions.cs | 4 +++- src/Telegrator.Hosting/Telegrator.Hosting.csproj | 2 +- src/Telegrator/Telegrator.csproj | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Telegrator.Hosting.Web/Hosting.Web/TelegramBotWebHostBuilder.cs b/src/Telegrator.Hosting.Web/Hosting.Web/TelegramBotWebHostBuilder.cs index 752cfd7..97f5b9b 100644 --- a/src/Telegrator.Hosting.Web/Hosting.Web/TelegramBotWebHostBuilder.cs +++ b/src/Telegrator.Hosting.Web/Hosting.Web/TelegramBotWebHostBuilder.cs @@ -94,7 +94,7 @@ public class TelegramBotWebHostBuilder : ITelegramBotHostBuilder public TelegramBotWebHost Build() { TelegramBotWebHost host = new TelegramBotWebHost(_innerBuilder); - host.UseTelegrator(); + host.UseTelegratorWeb(); return host; } diff --git a/src/Telegrator.Hosting.Web/Telegrator.Hosting.Web.csproj b/src/Telegrator.Hosting.Web/Telegrator.Hosting.Web.csproj index dd09b44..e7f1904 100644 --- a/src/Telegrator.Hosting.Web/Telegrator.Hosting.Web.csproj +++ b/src/Telegrator.Hosting.Web/Telegrator.Hosting.Web.csproj @@ -15,7 +15,7 @@ True Telegrator.Hosting.Web - 1.16.6 + 1.16.7 Rikitav Tim4ik Rikitav Tim4ik https://github.com/Rikitav/Telegrator diff --git a/src/Telegrator.Hosting.Web/TypesExtensions.cs b/src/Telegrator.Hosting.Web/TypesExtensions.cs index 8317189..710af70 100644 --- a/src/Telegrator.Hosting.Web/TypesExtensions.cs +++ b/src/Telegrator.Hosting.Web/TypesExtensions.cs @@ -126,7 +126,9 @@ namespace Telegrator /// public static T UseTelegratorWeb(this T app) where T : IEndpointRouteBuilder, IHost { - HostedUpdateWebhooker webhooker = app.ServiceProvider.GetRequiredService(); + if (app.ServiceProvider.GetServices().FirstOrDefault(s => s is HostedUpdateWebhooker) is not HostedUpdateWebhooker webhooker) + throw new InvalidOperationException("No service for type 'Telegrator.Mediation.HostedUpdateWebhooker' has been registered."); + ITelegramBotInfo info = app.ServiceProvider.GetRequiredService(); IHandlersCollection handlers = app.ServiceProvider.GetRequiredService(); ILoggerFactory loggerFactory = app.ServiceProvider.GetRequiredService(); diff --git a/src/Telegrator.Hosting/Telegrator.Hosting.csproj b/src/Telegrator.Hosting/Telegrator.Hosting.csproj index 8f6f61e..e28ce2c 100644 --- a/src/Telegrator.Hosting/Telegrator.Hosting.csproj +++ b/src/Telegrator.Hosting/Telegrator.Hosting.csproj @@ -15,7 +15,7 @@ True Telegrator.Hosting - 1.16.6 + 1.16.7 Rikitav Tim4ik Rikitav Tim4ik https://github.com/Rikitav/Telegrator diff --git a/src/Telegrator/Telegrator.csproj b/src/Telegrator/Telegrator.csproj index ec54821..d2cc076 100644 --- a/src/Telegrator/Telegrator.csproj +++ b/src/Telegrator/Telegrator.csproj @@ -14,7 +14,7 @@ True Telegrator : Telegram.Bot mediator framework - 1.16.6 + 1.16.7 Rikitav Tim4ik Rikitav Tim4ik https://github.com/Rikitav/Telegrator