This commit is contained in:
potassium 2024-12-27 00:31:19 +03:00
parent ddc2c6640f
commit 0912afa68a

View File

@ -98,13 +98,7 @@ func GetImage(link string) (image.Image, error) {
}
defer resp.Body.Close()
if resp == nil {
log.Fatal("pizdec")
}
img, _, err := image.Decode(resp.Body)
if img == nil {
log.Fatal("img is nil")
}
if err != nil {
return nil, err
}
@ -115,7 +109,7 @@ func HandleCommand(update tg.Update, bot *tg.BotAPI) {
maxCost := 5
var err error
for i := 0; i <= maxCost; i++ {
buf := new(bytes.Buffer)
buf := new(bytes.Buffer)
var img = imageutils.Concat(
Must(GetImage(fmt.Sprintf(LinkFormat,
takeOne(ShuffledCardPool)))),
@ -123,14 +117,7 @@ buf := new(bytes.Buffer)
takeOne(ShuffledCardPool)))),
imageutils.Right,
)
if img == nil {
log.Fatal("pizdec")
}
err = png.Encode(
buf,
img,
)
err = png.Encode(buf, img)
if err != nil {
log.Println("error on decode:", err)
}