Telegram bot: don't tell a linked member their code expired

Janie tapped a stale link code, got "That link code is expired or already
used", and immediately below it "Linked to position #34!". Both messages were
accurate — two different codes, the old one tapped first — but back to back
they read as a contradiction, and the expired message sends someone back to
the dashboard to redo something already done.

The bot now checks whether that chat is already linked before reporting a
dead code, and says so plainly: already linked to #34, nothing more to do,
here is what you can type. Only genuinely unlinked members get the
get-a-fresh-code path, and that copy now explains WHY codes die (single-use,
short-lived) and says to use the newest link.

Verified against live data: chat 652806260 -> position #34, so the link was
real and only the message was wrong.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-29 06:29:23 -05:00
parent 9f3f28c4bf
commit bd42708fa4
+11 -1
View File
@@ -282,7 +282,17 @@ async function handleUpdate(update) {
await dm(chatId, `✅ Linked to position #${rec.id}!\n\nFrom now on:\n💰 You get a DM the moment your position catches a payment\n📨 Team messages reach you here — reply to answer\n🎉 You're pinged when someone joins on your link\n\nTry: coach · team · links — or: msg <id> <your message>\n📱 Tap the ☰ menu button (next to the message box) to open your full dashboard right inside Telegram — no login needed.\nYour weekly 20-minute digest arrives Saturdays 10am Central (rhythm to adjust).`); await dm(chatId, `✅ Linked to position #${rec.id}!\n\nFrom now on:\n💰 You get a DM the moment your position catches a payment\n📨 Team messages reach you here — reply to answer\n🎉 You're pinged when someone joins on your link\n\nTry: coach · team · links — or: msg <id> <your message>\n📱 Tap the ☰ menu button (next to the message box) to open your full dashboard right inside Telegram — no login needed.\nYour weekly 20-minute digest arrives Saturdays 10am Central (rhythm to adjust).`);
return; return;
} }
await dm(chatId, `That link code is expired or already used. Get a fresh one from the Messages panel on your dashboard: https://rmcircle.team/my`); // A dead code from someone who is ALREADY linked is not a failure — it
// is usually a stale link they tapped twice, or an old one left over
// from an earlier attempt. Telling them it "expired" right after we
// confirmed their link reads as a contradiction and sends them back to
// the dashboard to redo something that is already done.
const already = chatMember(chatId);
if (already) {
await dm(chatId, `✅ You're already linked to position #${already} — nothing more to do.\n\nThat code was an older one (link codes are single-use), but your link is active. Try: coach · team · links\n📱 Tap the ☰ menu button next to the message box for your full dashboard.`);
return;
}
await dm(chatId, `That link code has expired or was already used — they're single-use and short-lived.\n\nGrab a fresh one: open https://rmcircle.team/my → Messages → sign in with your wallet → "Connect Telegram", and use the newest link.`);
return; return;
} }
await dm(chatId, `👋 This is the RM Circle companion bot.\n\nTo link your position: open your dashboard (https://rmcircle.team/my), sign in to Messages with your wallet, and tap "Connect Telegram". That proves the position is yours — no passwords.\n\nOnce linked you get payout pings, team messages, and your share links right here.`); await dm(chatId, `👋 This is the RM Circle companion bot.\n\nTo link your position: open your dashboard (https://rmcircle.team/my), sign in to Messages with your wallet, and tap "Connect Telegram". That proves the position is yours — no passwords.\n\nOnce linked you get payout pings, team messages, and your share links right here.`);