Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(telegram): handle RetryAfter delay internally in channel (#2552)
Flo0709fda56888
diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.pyindex 439d1c4d9..8cb85844c 100644--- a/nanobot/channels/telegram.py+++ b/nanobot/channels/telegram.py@@ -432,7 +432,9 @@ class TelegramChannel(BaseChannel):await self._send_text(chat_id, chunk, reply_params, thread_kwargs)async def _call_with_retry(self, fn, *args, **kwargs):- """Call an async Telegram API function with retry on pool/network timeout."""+ """Call an async Telegram API function with retry on pool/network timeout and RetryAfter."""+ from telegram.error import RetryAfter+for attempt in range(1, _SEND_MAX_RETRIES + 1):try:return await fn(*args, **kwargs)@@ -445,6 +447,15 @@ class TelegramChannel(BaseChannel):attempt, _SEND_MAX_RETRIES, delay,)await asyncio.sleep(delay)+ except RetryAfter as e:+ if attempt == _SEND_MAX_RETRIES:+ raise+ delay = float(e.retry_after)+ logger.warning(+ "Telegram Flood Control (attempt {}/{}), retrying in {:.1f}s",+ attempt, _SEND_MAX_RETRIES, delay,+ )+ await asyncio.sleep(delay)async def _send_text(self,