mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
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:
1 parent
2a86e028f6
commit
cb86ec4cf3
4 files changed
+219
-1
No files matched your search
@@ -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.
|
||||
Reference in new issue
Block a user