edit README

This commit is contained in:
源文雨
2022-12-26 13:11:38 +08:00
parent 19e3688499
commit 7d1a4b4005
7 changed files with 19 additions and 5 deletions

View File

@@ -81,6 +81,10 @@ func init() {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
if len(illust.ImageUrls) == 0 {
ctx.SendChain(message.Text("ERROR: nil image url"))
return
}
u := illust.ImageUrls[0]
n := u[strings.LastIndex(u, "/")+1 : len(u)-4]
f := illust.Path(0)

View File

@@ -2,6 +2,7 @@
package setutime
import (
"errors"
"fmt"
"strconv"
"strings"
@@ -154,6 +155,9 @@ func (p *imgpool) size(imgtype string) int {
}
func (p *imgpool) push(ctx *zero.Ctx, imgtype string, illust *pixiv.Illust) {
if len(illust.ImageUrls) == 0 {
return
}
u := illust.ImageUrls[0]
n := u[strings.LastIndex(u, "/")+1 : len(u)-4]
m, err := imagepool.GetImage(n)
@@ -222,6 +226,9 @@ func (p *imgpool) add(ctx *zero.Ctx, imgtype string, id int64) error {
if err != nil {
return err
}
if len(illust.ImageUrls) == 0 {
return errors.New("nil image url")
}
err = imagepool.SendImageFromPool(strconv.FormatInt(illust.Pid, 10)+"_p0", illust.Path(0), func() error {
return illust.DownloadToCache(0)
}, ctxext.Send(ctx), ctxext.GetMessage(ctx))