From 37033fe48dda0c4fe20091b7171a063f4de1cf71 Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 14 Feb 2022 16:34:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=90=9C=E5=9B=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20yandex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_saucenao/searcher.go | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/plugin_saucenao/searcher.go b/plugin_saucenao/searcher.go index 9c0465b4..62a76760 100644 --- a/plugin_saucenao/searcher.go +++ b/plugin_saucenao/searcher.go @@ -5,19 +5,21 @@ import ( "fmt" "strconv" - "github.com/FloatTech/AnimeAPI/ascii2d" - "github.com/FloatTech/AnimeAPI/pixiv" - "github.com/FloatTech/AnimeAPI/saucenao" - control "github.com/FloatTech/zbputils/control" - "github.com/FloatTech/zbputils/ctxext" - "github.com/FloatTech/zbputils/file" - "github.com/FloatTech/zbputils/img/pool" - "github.com/FloatTech/zbputils/process" "github.com/sirupsen/logrus" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" + "github.com/FloatTech/AnimeAPI/ascii2d" + "github.com/FloatTech/AnimeAPI/pixiv" + "github.com/FloatTech/AnimeAPI/saucenao" + "github.com/FloatTech/AnimeAPI/yandex" + + "github.com/FloatTech/zbputils/control" "github.com/FloatTech/zbputils/control/order" + "github.com/FloatTech/zbputils/ctxext" + "github.com/FloatTech/zbputils/file" + "github.com/FloatTech/zbputils/img/pool" + "github.com/FloatTech/zbputils/process" ) func init() { // 插件主体 @@ -122,6 +124,23 @@ func init() { // 插件主体 ) continue } + if result, err := yandex.Yandex(pic); err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + } else { + // 返回SauceNAO的结果 + ctx.SendChain( + message.Text("我有把握是这个!"), + message.Text( + "\n", + "标题:", result.Title, "\n", + "插画ID:", result.Pid, "\n", + "画师:", result.UserName, "\n", + "画师ID:", result.UserId, "\n", + "直链:", "https://pixivel.moe/detail?id=", result.Pid, + ), + ) + continue + } if result, err := ascii2d.Ascii2d(pic); err != nil { ctx.SendChain(message.Text("ERROR: ", err)) continue