tg/cmd/test/keyboard.go

30 lines
573 B
Go

package main
import (
"surdeus.su/core/tg"
)
var HomeButton = tg.Buttonf("Home").Go(StartWidget)
var BackButton = tg.Buttonf("Back").Go(tg.Back)
var BackKeyboard = tg.NewKeyboard().Row(
BackButton,
)
var SendLocationKeyboard = tg.NewKeyboard().Row(
tg.Buttonf("Send location").
WithSendLocation(true).
WithAction(tg.Func(func(c tg.Context) {
l := c.CallbackUpdate().Message.Location
c.Sendf(
"Longitude: %f\n"+
"Latitude: %f\n"+
"Heading: %d"+
"",
l.Longitude,
l.Latitude,
l.Heading,
)
})),
).Row(
BackButton,
).Reply()