and finally it all works as intended
This commit is contained in:
parent
73afcc1861
commit
93fe4fd479
13
market.go
13
market.go
@ -10,6 +10,7 @@ import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"time"
|
||||
"slices"
|
||||
|
||||
"git.niplace.ru/XoxJlopeZi4BB/imageutils"
|
||||
"git.niplace.ru/XoxJlopeZi4BB/paxpamir/token"
|
||||
@ -31,10 +32,10 @@ func shuffle[S ~[]E, E any](a S) {
|
||||
}
|
||||
}
|
||||
|
||||
func takeOne[S ~[]T, T any](s S) T {
|
||||
v := s[0]
|
||||
s = s[2:]
|
||||
fmt.Println(s)
|
||||
func takeOne[S ~[]T, T any](s *S) T {
|
||||
var new = slices.Clone(*s)
|
||||
v := new[0]
|
||||
*s = new[1:]
|
||||
return v
|
||||
}
|
||||
|
||||
@ -113,9 +114,9 @@ func HandleCommand(update tg.Update, bot *tg.BotAPI) {
|
||||
buf := new(bytes.Buffer)
|
||||
var img = imageutils.Concat(
|
||||
Must(GetImage(fmt.Sprintf(LinkFormat,
|
||||
takeOne(ShuffledCardPool)))),
|
||||
takeOne(&ShuffledCardPool)))),
|
||||
Must(GetImage(fmt.Sprintf(LinkFormat,
|
||||
takeOne(ShuffledCardPool)))),
|
||||
takeOne(&ShuffledCardPool)))),
|
||||
imageutils.Right,
|
||||
)
|
||||
err = png.Encode(buf, img)
|
||||
|
Loading…
Reference in New Issue
Block a user