From aa71fa7cb8c66f5f54150728c5fd0f3e7e9fa28d Mon Sep 17 00:00:00 2001 From: fumiama Date: Thu, 27 Jan 2022 00:14:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20acgimage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_acgimage/classify.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/plugin_acgimage/classify.go b/plugin_acgimage/classify.go index 61759b18..d96785d9 100644 --- a/plugin_acgimage/classify.go +++ b/plugin_acgimage/classify.go @@ -11,7 +11,6 @@ import ( control "github.com/FloatTech/zbputils/control" "github.com/FloatTech/zbputils/ctxext" "github.com/FloatTech/zbputils/web" - "github.com/sirupsen/logrus" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/message" @@ -143,24 +142,19 @@ func replyClass(ctx *zero.Ctx, class int, dhash string, comment string, isupload var send ctxext.NoCtxSendMsg if class > 5 { send = ctxext.SendTo(ctx, ctx.Event.UserID) + if dhash != "" { + ctx.SendChain(message.Text(comment + "\n给你点提示哦:" + b14)) + } else { + ctx.SendChain(message.Text(comment)) + } } else { send = func(msg interface{}) int64 { return ctx.Send(append(msg.(message.Message), message.Text(comment))).ID() } } - if class > 5 { - if dhash != "" { - ctx.SendChain(message.Text(comment + "\n给你点提示哦:" + b14)) - return - } - ctx.SendChain(message.Text(comment)) - } - _, err = imgpool.NewImage(send, ctxext.GetMessage(ctx), b14, u) - if err != nil && err.Error() == "send image error" { - logrus.Debugln("[acgimage]", err) - img := message.Image(u) - ctx.SendChain(img, message.Text(comment)) + if err != nil && err.Error() == "send image error" && class <= 5 { + ctx.SendChain(message.Image(u), message.Text(comment)) } }