mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-08-21 04:24:48 +00:00
The go-telegram/bot v1.20.0 MatchTypeCommand does byte-exact equality on the full bot_command entity, which in groups is "cmd@botname" (length 15 for /help@miti99bot) — never equal to the registered name "cmd". All 27 commands silently missed when used in group chats. Swap RegisterHandler(..., MatchTypeCommand, ...) for a local matchFunc that strips the @suffix before comparing. Telegram only routes /cmd@otherbot to otherbot, so the suffix is safe to drop unconditionally. Add a structured `dispatch` log line in the webhook (update_id, chat_id, chat_type, text preview) so the next silent-drop symptom shows up in CloudWatch without code archaeology — the existing [TGBOT] [UPDATE] line only prints struct pointers. 12 new TestMatchCommand sub-tests cover DM, group, mid-text, wrong command, non-command entity, and bounds edge cases.