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"
|
|
|
|
)
|
|
|
|
|
|
|
|
var StartWidget = tg.RenderFunc(func(c tg.Context) tg.UI {
|
|
|
|
return tg.UI{
|
|
|
|
tg.Messagef(
|
|
|
|
fmt.Sprint(
|
2024-07-21 16:02:47 +03:00
|
|
|
"Hello, %s!",
|
|
|
|
"The testing bot started!",
|
2024-03-29 14:30:48 +03:00
|
|
|
"You can see the basics of usage in the ",
|
2024-07-21 16:02:47 +03:00
|
|
|
"cmd/test/main.go file and other files in the cmd/test!",
|
2024-03-29 14:30:48 +03:00
|
|
|
),
|
|
|
|
c.CallbackUpdate().SentFrom().UserName,
|
|
|
|
).Inline(
|
|
|
|
tg.NewKeyboard().Row(
|
2024-07-21 16:02:47 +03:00
|
|
|
tg.Buttonf("TeleGopher surdeus.su page").
|
2024-07-23 21:43:26 +03:00
|
|
|
WithURL("https://surdeus.su/core/tg"),
|
2024-03-29 14:30:48 +03:00
|
|
|
).Inline(),
|
|
|
|
),
|
|
|
|
|
|
|
|
tg.Messagef("Choose your interest").Reply(
|
2024-07-21 16:02:47 +03:00
|
|
|
tg.NewKeyboard().List(
|
2024-07-23 16:08:39 +03:00
|
|
|
tg.Buttonf("Back").Go(BackWidget),
|
2024-07-21 16:02:47 +03:00
|
|
|
tg.Buttonf("Inc/Dec").Go(IncDecWidget),
|
|
|
|
tg.Buttonf("Mutate messages").Go(MutateMessagesWidget),
|
|
|
|
tg.Buttonf("Send location").Go(LocationWidget),
|
|
|
|
tg.Buttonf("Dynamic panel").Go(DynamicPanelWidget),
|
|
|
|
tg.Buttonf("Check panic").Go(nil),
|
2024-03-29 14:30:48 +03:00
|
|
|
).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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
})
|