Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions telegramSafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down