From 89b4f2db92970fdeb81419837b7dcbeb62a63348 Mon Sep 17 00:00:00 2001 From: gutii Date: Thu, 23 Apr 2026 23:11:27 +0400 Subject: [PATCH] * Added automatic webhook deleting on first receiving --- src/Telegrator.Hosting/Polling/HostedUpdateReceiver.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Telegrator.Hosting/Polling/HostedUpdateReceiver.cs b/src/Telegrator.Hosting/Polling/HostedUpdateReceiver.cs index deab9c2..06489b8 100644 --- a/src/Telegrator.Hosting/Polling/HostedUpdateReceiver.cs +++ b/src/Telegrator.Hosting/Polling/HostedUpdateReceiver.cs @@ -25,6 +25,9 @@ public class HostedUpdateReceiver(ITelegramBotClient botClient, IUpdateRouter up { logger.LogInformation("Starting receiving updates via long-polling"); _receiverOptions.AllowedUpdates = _updateRouter.HandlersProvider.AllowedTypes.ToArray(); + + botClient.DeleteWebhook(options.Value.DropPendingUpdates).Wait(); + DefaultUpdateReceiver updateReceiver = new DefaultUpdateReceiver(botClient, _receiverOptions); await updateReceiver.ReceiveAsync(_updateRouter, stoppingToken).ConfigureAwait(false); }