From 644749929e1f47ed8700a70d2c795fc5c3b08f2f Mon Sep 17 00:00:00 2001 From: FrigaT Date: Wed, 10 Dec 2025 20:31:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D0=B8=D0=B2=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0=20=D0=A2=D0=93,=20?= =?UTF-8?q?=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BE=D0=BD=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=83=D1=89=D0=B5=D0=BD=20=D0=B2=D1=82=D0=BE=D1=80=D1=8B=D0=BC?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D1=82=D0=BE=D0=BA=D0=B5=D0=BD=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BotPages.Telegram/TelegramAdapter.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BotPages.Telegram/TelegramAdapter.cs b/BotPages.Telegram/TelegramAdapter.cs index 482eb00..9bdde6c 100644 --- a/BotPages.Telegram/TelegramAdapter.cs +++ b/BotPages.Telegram/TelegramAdapter.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Telegram.Bot; +using Telegram.Bot.Exceptions; using Telegram.Bot.Types; using Telegram.Bot.Types.Enums; using Telegram.Bot.Types.ReplyMarkups; @@ -75,6 +76,15 @@ public sealed class TelegramAdapter : IMessangerAdapterSetup errorHandler: async (_, ex, ct2) => { _logger.Log(LogLevel.Warn, $"{MessengerType} error.", ex); + + if (ex is ApiRequestException apiEx) + { + if (apiEx.ErrorCode == 409) + { + _logger.Log(LogLevel.Critical, $"{MessengerType} остановлен."); + await _.Close(ct2); + } + } await Task.CompletedTask; },