fix(telegram): support relay — text_mention card + reopen deleted topic #132
Reference in New Issue
Block a user
Delete Branch "feature/telegram-support-card-mention"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two info-card nuances and a topic-deletion bug, all found in live prod use.
1. Card — name & profile link
tg://user?id=link → renders as dead text for a client that doesn't already know the user (the test-vs-prod difference)./was auto-detected by Telegram as a tappable bot command.Fix: build the card with message entities; the display name is a
text_mention(the reliable mention for a username-less user the bot has already seen) → it links the profile and, being inside an entity, suppresses/command/@mentionauto-detection on the name. HTML parse mode and thetg://link are gone; offsets are UTF-16.2. Deleted topic silently lost to General
Deleting a user's whole topic made the next message land in General with no card. Root cause (confirmed against the prod bot logs — neither a relay error nor a reopen was logged): Telegram routes a
copyMessageaimed at a deleted topic into General with no error, so the error-based recreate never fired.Fix: probe topic liveness before reuse — re-applying the info card's reply markup is a no-op that errors only when the card (hence the topic) is gone — and reopen the topic + card on that signal. The post-copy recreate stays as a race backstop.
Tests:
go test -race ./platform/telegram/...green; new cases for the/-name entity, the UTF-16 offset, and reopen-on-delete. gofmt/vet clean.Ship target: v1.5.1 to prod after approve.
fix(telegram): support card — text_mention name, no command/dead linkto fix(telegram): support relay — text_mention card + reopen deleted topic