From 75d91b3d453f1b46fc79b46266bbfd71178306de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 2 May 2024 18:42:52 +0900 Subject: [PATCH] fix(searcher): forward node --- plugin/saucenao/searcher.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugin/saucenao/searcher.go b/plugin/saucenao/searcher.go index 843a16eb..f327501a 100644 --- a/plugin/saucenao/searcher.go +++ b/plugin/saucenao/searcher.go @@ -63,7 +63,15 @@ func init() { // 插件主体 } if illust.Pid > 0 { name := strconv.FormatInt(illust.Pid, 10) - var imgs message.Message + var imgs message.Message = message.Message{ + message.Text( + "标题: ", illust.Title, "\n", + "插画ID: ", illust.Pid, "\n", + "画师: ", illust.UserName, "\n", + "画师ID: ", illust.UserID, "\n", + "直链: ", "https://pixivel.moe/detail?id=", illust.Pid, + ), + } for i := range illust.ImageUrls { f := file.BOTPATH + "/" + illust.Path(i) n := name + "_p" + strconv.Itoa(i) @@ -87,19 +95,11 @@ func init() { // 插件主体 } imgs = append(imgs, message.Image("file:///"+f)) } - txt := message.Text( - "标题: ", illust.Title, "\n", - "插画ID: ", illust.Pid, "\n", - "画师: ", illust.UserName, "\n", - "画师ID: ", illust.UserID, "\n", - "直链: ", "https://pixivel.moe/detail?id=", illust.Pid, - ) if imgs != nil { - ctx.Send(message.Message{ctxext.FakeSenderForwardNode(ctx, txt), - ctxext.FakeSenderForwardNode(ctx, imgs...)}) + ctx.Send(message.Message{ctxext.FakeSenderForwardNode(ctx, imgs...)}) } else { - // 图片下载失败,仅发送文字结果 - ctx.SendChain(txt) + // 图片下载失败,直接发送文字结果 + ctx.SendChain(imgs...) } } else { ctx.SendChain(message.Text("图片不存在!"))