tg/cmd/test/keyboard.go

31 lines
573 B
Go
Raw Normal View History

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