YES
This commit is contained in:
parent
e62ccf5780
commit
07a1f562c8
2 changed files with 11 additions and 11 deletions
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/di4f/tg"
|
"vultras.su/core/tg"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BotData struct {
|
type BotData struct {
|
||||||
|
@ -130,32 +130,32 @@ var beh = tg.NewBehaviour().
|
||||||
"panel",
|
"panel",
|
||||||
tg.RenderFunc(func(c *tg.Context) tg.UI {
|
tg.RenderFunc(func(c *tg.Context) tg.UI {
|
||||||
var (
|
var (
|
||||||
n = 0
|
n = 0
|
||||||
ln = 4
|
ln = 4
|
||||||
panel *tg.PanelCompo
|
panel *tg.PanelCompo
|
||||||
)
|
)
|
||||||
|
|
||||||
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
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/di4f/tg
|
module vultras.su/core/tg
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue