From 2e538e3905e8878c8ed8f3a3f3a93758f1e4382e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E6=9F=B3=E7=85=9C?= <101934327+fangliuyu@users.noreply.github.com> Date: Sat, 3 Dec 2022 12:28:57 +0800 Subject: [PATCH] =?UTF-8?q?ygo:=20=E4=BC=98=E5=8C=96=E6=8C=87=E4=BB=A4=20(?= =?UTF-8?q?#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- plugin/ygo/ygotrade.go | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9405c0ec..5da037c1 100644 --- a/README.md +++ b/README.md @@ -1372,9 +1372,9 @@ print("run[CQ:image,file="+j["img"]+"]") ###### `"github.com/FloatTech/ZeroBot-Plugin/plugin/ygo/ygotrade.go"` - [x] 查卡价 [卡名] - - [x] 查卡价 [卡名] [稀有度 稀有度 ...] + - [x] 查卡价 [卡名] -r [稀有度 稀有度 ...] - [x] 查卡店 [卡名] - - [x] 查卡店 [卡名] [稀有度] + - [x] 查卡店 [卡名] -r [稀有度] - 注:卡店只支持单个稀有度查询 diff --git a/plugin/ygo/ygotrade.go b/plugin/ygo/ygotrade.go index 95d56cb6..9f8f9295 100644 --- a/plugin/ygo/ygotrade.go +++ b/plugin/ygo/ygotrade.go @@ -1,7 +1,6 @@ // Package ygo 一些关于ygo的插件 package ygo - import ( "encoding/json" "errors" @@ -49,14 +48,14 @@ type tradeInfo struct { func init() { engine := control.Register("ygotrade", &ctrl.Options[*zero.Ctx]{ DisableOnDefault: false, - Brief: "游戏王卡价查询",// 本插件基于集换社API - Help: "- 查卡价 [卡名]\n- 查卡价 [卡名] [稀有度 稀有度 ...]\n- 查卡店 [卡名]\n- 查卡店 [卡名] [稀有度]", + Brief: "游戏王卡价查询", // 本插件基于集换社API + Help: "- 查卡价 [卡名]\n- 查卡价 [卡名] -r [稀有度 稀有度 ...]\n- 查卡店 [卡名]\n- 查卡店 [卡名] -r [稀有度]", }).ApplySingle(ctxext.DefaultSingle) engine.OnPrefix("查卡价", func(ctx *zero.Ctx) bool { ctx.State["args"] = strings.TrimSpace(ctx.State["args"].(string)) return ctx.State["args"].(string) != "" }).SetBlock(true).Handle(func(ctx *zero.Ctx) { - cardName, rarity, _ := strings.Cut(ctx.State["args"].(string), " ") + cardName, rarity, _ := strings.Cut(ctx.State["args"].(string), " -r ") listOfTrace, err := getRarityTrade(cardName, rarity) if err != nil { ctx.SendChain(message.Text("ERROR: ", err)) @@ -80,7 +79,7 @@ func init() { ctx.State["args"] = strings.TrimSpace(ctx.State["args"].(string)) return ctx.State["args"].(string) != "" }).SetBlock(true).Handle(func(ctx *zero.Ctx) { - cardName, rarity, _ := strings.Cut(ctx.State["args"].(string), " ") + cardName, rarity, _ := strings.Cut(ctx.State["args"].(string), " -r ") if strings.Count(rarity, " ") > 0 { ctx.SendChain(message.Text("ERROR: ", "卡店查询不支持查找多个罕贵度")) return