搜图下载使用animeapi,将文件判存移至utils

This commit is contained in:
fumiama
2021-10-23 00:54:38 +08:00
parent 591df6439c
commit 67555512e7
11 changed files with 108 additions and 56 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/FloatTech/ZeroBot-Plugin/utils/file"
)
var botpath, _ = os.Getwd()
@@ -53,7 +54,7 @@ func init() {
cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String()
cachefile := cachedir + cid
imgcq := `[CQ:image,file=` + "file:///" + cachefile + `]`
if _, err := os.Stat(cachefile); err != nil {
if file.IsNotExist(cachefile) {
im, err := req.Get(`https://res.fbigame.com/hs/v13/`+cid+
`.png?auth_key=`+gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(),
header,