optimize(img): drop remote image pool

This commit is contained in:
源文雨
2024-10-14 02:57:08 +09:00
parent ef3fa92de3
commit 8bcab9bf43
7 changed files with 23 additions and 69 deletions

View File

@@ -22,7 +22,6 @@ import (
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/img/pool"
)
const (
@@ -73,20 +72,10 @@ func init() { // 插件主体
for i := range illust.ImageUrls {
f := file.BOTPATH + "/" + illust.Path(i)
n := name + "_p" + strconv.Itoa(i)
var m *pool.Image
if file.IsNotExist(f) {
m, err = pool.GetImage(n)
if err == nil {
imgs = append(imgs, message.Image(m.String()))
continue
}
logrus.Debugln("[saucenao]开始下载", n)
logrus.Debugln("[saucenao]urls:", illust.ImageUrls)
err1 := illust.DownloadToCache(i)
if err1 == nil {
m.SetFile(f)
_, _ = m.Push(ctxext.SendToSelf(ctx), ctxext.GetMessage(ctx))
}
if err1 != nil {
logrus.Debugln("[saucenao]下载err:", err1)
}