mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 23:30:20 +00:00
optimize(img): drop remote image pool
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user