✏️ 解决hs cache问题

This commit is contained in:
fumiama 2021-10-07 12:23:59 +08:00
parent c3e0520aec
commit 3faec79371

View File

@ -48,11 +48,11 @@ func init() {
return return
} }
var sk message.Message var sk message.Message
var imgcq string
var data []byte var data []byte
for i := 0; i < t && i < 5; i++ { for i := 0; i < t && i < 5; i++ {
cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String() cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String()
cachefile := cachedir + cid cachefile := cachedir + cid
imgcq := `[CQ:image,file=` + "file:///" + cachefile + `]`
if _, err := os.Stat(cachefile); err != nil { if _, err := os.Stat(cachefile); err != nil {
im, err := req.Get(`https://res.fbigame.com/hs/v13/`+cid+ im, err := req.Get(`https://res.fbigame.com/hs/v13/`+cid+
`.png?auth_key=`+gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(), `.png?auth_key=`+gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(),
@ -69,8 +69,6 @@ func init() {
} }
if err != nil { if err != nil {
imgcq = err.Error() imgcq = err.Error()
} else {
imgcq = `[CQ:image,file=` + "file:///" + cachefile + `]`
} }
} }
sk = append( sk = append(