45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"surdeus.su/core/tg"
|
|
"fmt"
|
|
)
|
|
|
|
var StartWidget = tg.RenderFunc(func(c tg.Context) tg.UI {
|
|
return tg.UI{
|
|
tg.Messagef(
|
|
fmt.Sprint(
|
|
"Hello, %s!",
|
|
"The testing bot started!",
|
|
"You can see the basics of usage in the ",
|
|
"cmd/test/main.go file and other files in the cmd/test!",
|
|
),
|
|
c.CallbackUpdate().SentFrom().UserName,
|
|
).Inline(
|
|
tg.NewKeyboard().Row(
|
|
tg.Buttonf("TeleGopher surdeus.su page").
|
|
WithURL("https://surdeus.su/core/tg"),
|
|
).Inline(),
|
|
),
|
|
|
|
tg.Messagef("Choose your interest").Reply(
|
|
tg.NewKeyboard().List(
|
|
tg.Buttonf("Back").Go(BackWidget),
|
|
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),
|
|
).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)
|
|
}
|
|
}
|
|
}),
|
|
}
|
|
})
|