Fix Bind Topic Error by making callback handling more robust

- Wrap answerCallbackQuery and editMessageText in try-catch to handle expired queries
- Answer callback queries as early as possible
- Add setup_tracking to allowed pending action types for better type safety
- Ignore 'query is too old' and 'message is not modified' errors gracefully
This commit is contained in:
2026-03-15 02:50:32 +04:00
parent 5e39cdf455
commit 07c5ffb82d
3 changed files with 116 additions and 69 deletions

View File

@@ -37,6 +37,10 @@ function parsePendingActionType(raw: string): TelegramPendingActionType {
return raw
}
if (raw === 'setup_tracking') {
return raw
}
throw new Error(`Unexpected telegram pending action type: ${raw}`)
}

View File

@@ -7,7 +7,8 @@ export const TELEGRAM_PENDING_ACTION_TYPES = [
'payment_topic_clarification',
'payment_topic_confirmation',
'reminder_utility_entry',
'setup_topic_binding'
'setup_topic_binding',
'setup_tracking'
] as const
export type TelegramPendingActionType = (typeof TELEGRAM_PENDING_ACTION_TYPES)[number]