Callback Queries
Callback queries are used to handle user interactions with inline buttons. When a user clicks on an inline button, a callback query is sent to the bot. You can handle these queries using the AddCallbackHandler
method.
package main
import (
"fmt"
"github.com/amarnathcjd/gogram/telegram"
)
func main() {
client, _ := telegram.NewClient(telegram.ClientConfig{ // Create a new client
AppID: 6,
AppHash: "app_hash",
})
client.AddCallbackHandler(telegram.OnCallbackQuery, func(update *telegram.CallbackQuery) error {
update.Answer("query-data: " + update.DataString())
return nil
})
client.Start()
}