tg/cmd/test/keyboard.go

31 lines
561 B
Go
Raw Normal View History

2024-03-29 14:30:48 +03:00
package main
import (
"vultras.su/core/tg"
)
var HomeButton = tg.Buttonf("Home").Go("/")
var BackButton = tg.Buttonf("Back").Go("-")
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()