50 lines
1 KiB
Go
50 lines
1 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"vultras.su/core/tg"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
StartAbsPath tg.Path = "/"
|
||
|
)
|
||
|
var StartWidget = tg.RenderFunc(func(c tg.Context) tg.UI {
|
||
|
return tg.UI{
|
||
|
tg.Messagef(
|
||
|
fmt.Sprint(
|
||
|
"Hello, %s!\n",
|
||
|
"The testing bot started!\n",
|
||
|
"You can see the basics of usage in the ",
|
||
|
"cmd/test/main.go file!",
|
||
|
),
|
||
|
c.CallbackUpdate().SentFrom().UserName,
|
||
|
).Inline(
|
||
|
tg.NewKeyboard().Row(
|
||
|
tg.Buttonf("TeleGopher Vultras page").
|
||
|
WithUrl("https://vultras.su/core/tg"),
|
||
|
).Inline(),
|
||
|
),
|
||
|
|
||
|
tg.Messagef("Choose your interest").Reply(
|
||
|
tg.NewKeyboard().Row(
|
||
|
tg.Buttonf("Inc/Dec").Go(IncDecPath),
|
||
|
).Row(
|
||
|
tg.Buttonf("Mutate messages").Go(MutateMessagesPath),
|
||
|
).Row(
|
||
|
tg.Buttonf("Send location").Go(LocationPath),
|
||
|
).Row(
|
||
|
tg.Buttonf("Dynamic panel").Go(PanelPath),
|
||
|
).Reply(),
|
||
|
),
|
||
|
|
||
|
// Testing reaction to editing messages.
|
||
|
tg.Func(func(c tg.Context) {
|
||
|
for u := range c.Input() {
|
||
|
if u.EditedMessage != nil {
|
||
|
c.Sendf2("The new message is `%s`", u.EditedMessage.Text)
|
||
|
}
|
||
|
}
|
||
|
}),
|
||
|
}
|
||
|
})
|