optimize: gif plugin for image cache (#901) (fix #900)

修改gif插件图片保存方式
This commit is contained in:
vatebur
2024-05-09 15:29:20 +08:00
committed by GitHub
parent d832f9aaea
commit 8fa928d37f
3 changed files with 8 additions and 7 deletions

View File

@@ -152,8 +152,9 @@ func init() { // 插件主体
datapath = file.BOTPATH + "/" + en.DataFolder()
en.OnRegex(`^(` + strings.Join(cmd, "|") + `)[\s\S]*?(\[CQ:(image\,file=([0-9a-zA-Z]{32}).*|at.+?(\d{5,11}))\].*|(\d+))$`).
SetBlock(true).Handle(func(ctx *zero.Ctx) {
c := newContext(ctx.Event.UserID)
list := ctx.State["regex_matched"].([]string)
atUserID, _ := strconv.ParseInt(list[4]+list[5]+list[6], 10, 64)
c := newContext(ctx.Event.UserID, atUserID)
err := c.prepareLogos(list[4]+list[5]+list[6], strconv.FormatInt(ctx.Event.UserID, 10))
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))