From d0c0bf70346efca3d158662e73d9e8838ffe4a25 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 9 Jun 2026 12:57:37 +0800 Subject: [PATCH] Fix Telegram bot binding fallback --- frontend/components/account/AccountCenter.tsx | 18 +++-- .../account/__tests__/paymentShell.test.ts | 21 ++++++ frontend/components/account/account-copy.ts | 10 ++- .../components/account/useAccountPayment.ts | 2 + frontend/components/account/useBilling.ts | 67 ++++++++++++++++--- src/bot/handlers/basic.py | 33 +++++++++ tests/test_bot_basic_handler.py | 50 ++++++++++++++ tests/test_web_observability.py | 4 ++ web/services/auth_api.py | 2 + 9 files changed, 189 insertions(+), 18 deletions(-) diff --git a/frontend/components/account/AccountCenter.tsx b/frontend/components/account/AccountCenter.tsx index dae95610..10d634dd 100644 --- a/frontend/components/account/AccountCenter.tsx +++ b/frontend/components/account/AccountCenter.tsx @@ -102,6 +102,7 @@ export function AccountCenter() { lastPaymentStartedAt, telegramBindOpening, telegramBindUrl, + telegramBindCommand, manualPayment, manualTxHash, txValidation, @@ -175,6 +176,7 @@ export function AccountCenter() { submitManualPaymentTx, validateTxHash, handleOverlayCheckout, + createTelegramBotBindCommand, openTelegramBotBindLink, } = useAccountPayment({ isEn, @@ -497,9 +499,7 @@ export function AccountCenter() { : monthlyReferralLimit * referralRewardPoints; // ── Telegram bind command ────────────────────────────── - const bindCommand = userId - ? `/bind ${userId}${email ? ` ${email}` : ""}` - : "/bind "; + const bindCommand = telegramBindCommand || copy.telegramBindCommandPlaceholder; // ── Copy handler ────────────────────────────────────── const handleCopy = (text: string) => { @@ -509,6 +509,13 @@ export function AccountCenter() { }); }; + const handleCopyTelegramBindCommand = async () => { + if (!isAuthenticated || telegramBindOpening) return; + const command = await createTelegramBotBindCommand(); + if (!command) return; + handleCopy(command); + }; + const applyReferralCode = useCallback(async () => { const code = referralCodeInput.trim(); if (!code || referralApplying) return; @@ -1040,8 +1047,9 @@ export function AccountCenter() { : copy.telegramBotBindLink}