mirror of
https://github.com/lukaszraczylo/go-telegram.git
synced 2026-12-03 07:26:37 +00:00
* chore(api): regenerate for BotFullInfo and optional chat_id Telegram split BotFullInfo out of User and getMe now returns it, and chat_id is optional in the methods that accept an ephemeral callback reply. Regenerate the API, make MeCache cache BotFullInfo, and wrap the now-optional chat_id arguments in the examples. This is the output of make regen, so the weekly regen job no longer fails its api test. * chore(api): pin the 2026-11-29 API snapshot the regen used codegen-clean regenerates from testdata/html/latest.html, so the new BotFullInfo output needs a matching snapshot.
20 lines
451 B
Go
20 lines
451 B
Go
package main
|
|
|
|
import (
|
|
"github.com/lukaszraczylo/go-telegram/api"
|
|
"github.com/lukaszraczylo/go-telegram/dispatch"
|
|
)
|
|
|
|
// register wires all handlers onto the router.
|
|
func register(r *dispatch.Router) {
|
|
r.OnCommand("/ping", handlePing)
|
|
}
|
|
|
|
func handlePing(c *dispatch.Context, m *api.Message) error {
|
|
_, err := api.SendMessage(c.Ctx, c.Bot, &api.SendMessageParams{
|
|
ChatID: api.Ptr(api.ChatIDFromInt(m.Chat.ID)),
|
|
Text: "pong",
|
|
})
|
|
return err
|
|
}
|