2024-03-29 14:30:48 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-05-15 20:41:53 +03:00
|
|
|
"surdeus.su/core/tg"
|
2024-03-29 14:30:48 +03:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
StartAbsPath tg.Path = "/"
|
|
|
|
)
|
2024-05-15 20:41:53 +03:00
|
|
|
|
2024-03-29 14:30:48 +03:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
})
|