This commit is contained in:
Andrey Parhomenko 2024-01-05 03:35:27 +03:00
parent e62ccf5780
commit 07a1f562c8
2 changed files with 11 additions and 11 deletions

View file

@ -6,7 +6,7 @@ import (
"strings" "strings"
"fmt" "fmt"
"github.com/di4f/tg" "vultras.su/core/tg"
) )
type BotData struct { type BotData struct {
@ -137,25 +137,25 @@ var beh = tg.NewBehaviour().
panel = tg.NewMessage( panel = tg.NewMessage(
"Some panel", "Some panel",
).Panel(c, tg.RowserFunc(func(c *tg.Context) []tg.ButtonRow{ ).Panel(c, tg.RowserFunc(func(c *tg.Context) []tg.ButtonRow {
btns := []tg.ButtonRow{ btns := []tg.ButtonRow{
tg.ButtonRow{tg.NewButton("Static shit")}, tg.ButtonRow{tg.NewButton("Static shit")},
} }
for i:=0 ; i<ln ; i++ { for i := 0; i < ln; i++ {
num := 1 + n * ln + i num := 1 + n*ln + i
btns = append(btns, tg.ButtonRow{ btns = append(btns, tg.ButtonRow{
tg.NewButton("%d", num).WithAction(tg.Func(func(c *tg.Context){ tg.NewButton("%d", num).WithAction(tg.Func(func(c *tg.Context) {
c.Sendf("%d", num*num) c.Sendf("%d", num*num)
})), })),
tg.NewButton("%d", num*num), tg.NewButton("%d", num*num),
}) })
} }
btns = append(btns, tg.ButtonRow{ btns = append(btns, tg.ButtonRow{
tg.NewButton("Prev").WithAction(tg.ActionFunc(func(c *tg.Context){ tg.NewButton("Prev").WithAction(tg.ActionFunc(func(c *tg.Context) {
n-- n--
panel.Update(c) panel.Update(c)
})), })),
tg.NewButton("Next").WithAction(tg.ActionFunc(func(c *tg.Context){ tg.NewButton("Next").WithAction(tg.ActionFunc(func(c *tg.Context) {
n++ n++
panel.Update(c) panel.Update(c)
})), })),

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/di4f/tg module vultras.su/core/tg
go 1.20 go 1.20