diff --git a/telegramSafe.js b/telegramSafe.js index 2d7aa45..4c58204 100644 --- a/telegramSafe.js +++ b/telegramSafe.js @@ -180,9 +180,24 @@ function init(bot) { // layer and pass through to the original. if (typeof tg.callApi === 'function') { const _MANAGED = new Set([ + // ── Individually-patched above — skip double-wrap ──────────────── 'sendMessage', 'editMessageText', 'answerCbQuery', 'answerCallbackQuery', 'sendPhoto', 'sendDocument', 'sendAnimation', 'sendSticker', 'forwardMessage', + // ── Long-poll — MUST bypass the 15-second API_CALL_TIMEOUT_MS ──── + // Telegraf passes timeout=50 to getUpdates so Telegram holds the + // connection open for up to 50 s. Wrapping it with globalThrottle's + // 15-second race fires on every poll cycle and kills the bot. + 'getUpdates', + // ── Startup / lifecycle calls — fast one-shots ─────────────────── + // Pass through directly so they are never blocked behind a queued + // getUpdates slot in the global rate-limit chain. + 'getMe', + 'deleteWebhook', + 'setWebhook', + 'getWebhookInfo', + 'close', + 'logOut', ]); const _callApi = tg.callApi.bind(tg); tg.callApi = (method, data, signal) => {