mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-10-05 02:13:50 +00:00
The bot runs with WithNotAsyncHandlers and a single worker, so handlers execute inline on the polling goroutine. A panic in any handler therefore killed the process and took every user's bot down with it. Wrap the command closure, the callback closure and the detached command hook in a recover barrier. The callback path also answers the pending query so the client stops spinning rather than waiting out its timeout. The barrier is a backstop, not a licence to skip nil checks: handlers still guard their own inputs.