feat(alias): log the shape of a capture at debug level

The capture failures worth debugging are all about what Telegram did not
deliver: a reply stripped of its content, a caption where text was
expected, or a kind that falls through the switch. None of that is
visible from the user-facing refusal, which only says "unsupported".

One alias_capture line per /alias reports field names, lengths and
counts — never message text, so aliased messages cannot travel with the
logs.
This commit is contained in:
tiennm99 committed 2026-09-08 16:02:18 +07:00
1 parent 2a86e028f6
commit cb86ec4cf3
4 files changed
+219 -1

No files matched your search

+19
View File
@@ -178,5 +178,24 @@ failure:
the reason `chathelper.Reply` documents: without it Telegram routes the message
to a supergroup's General topic instead of the topic the command was typed in.
## Debugging a capture
Set `LOG_LEVEL=debug` and every `/alias` logs one `alias_capture` line
describing what Telegram actually delivered:
```
alias_capture reply=present reply_id=9 fields=none text_len=0 caption_len=0
entities=0 captured=false from_id=555 from_bot=true
```
`fields=none captured=false from_bot=true` is the signature of another bot's
message arriving stripped. `reply=absent` means Telegram delivered the command
with no reply attached at all — indistinguishable from the caller forgetting to
reply, which is why the line exists.
It reports **shape, never content**: field names, lengths and counts, but no
message text. The line lands in stdout and whatever ships it, so aliased
messages must not travel with it; a test asserts nothing leaks.
Both handlers run under a 10-second deadline. The bot processes updates one at a
time, so that bound is what keeps a slow store from stalling other users.