mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
ygo: 优化指令 (#513)
This commit is contained in:
parent
a69399fa58
commit
2e538e3905
@ -1372,9 +1372,9 @@ print("run[CQ:image,file="+j["img"]+"]")
|
|||||||
|
|
||||||
###### `"github.com/FloatTech/ZeroBot-Plugin/plugin/ygo/ygotrade.go"`
|
###### `"github.com/FloatTech/ZeroBot-Plugin/plugin/ygo/ygotrade.go"`
|
||||||
- [x] 查卡价 [卡名]
|
- [x] 查卡价 [卡名]
|
||||||
- [x] 查卡价 [卡名] [稀有度 稀有度 ...]
|
- [x] 查卡价 [卡名] -r [稀有度 稀有度 ...]
|
||||||
- [x] 查卡店 [卡名]
|
- [x] 查卡店 [卡名]
|
||||||
- [x] 查卡店 [卡名] [稀有度]
|
- [x] 查卡店 [卡名] -r [稀有度]
|
||||||
- 注:卡店只支持单个稀有度查询
|
- 注:卡店只支持单个稀有度查询
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
// Package ygo 一些关于ygo的插件
|
// Package ygo 一些关于ygo的插件
|
||||||
package ygo
|
package ygo
|
||||||
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
@ -49,14 +48,14 @@ type tradeInfo struct {
|
|||||||
func init() {
|
func init() {
|
||||||
engine := control.Register("ygotrade", &ctrl.Options[*zero.Ctx]{
|
engine := control.Register("ygotrade", &ctrl.Options[*zero.Ctx]{
|
||||||
DisableOnDefault: false,
|
DisableOnDefault: false,
|
||||||
Brief: "游戏王卡价查询",// 本插件基于集换社API
|
Brief: "游戏王卡价查询", // 本插件基于集换社API
|
||||||
Help: "- 查卡价 [卡名]\n- 查卡价 [卡名] [稀有度 稀有度 ...]\n- 查卡店 [卡名]\n- 查卡店 [卡名] [稀有度]",
|
Help: "- 查卡价 [卡名]\n- 查卡价 [卡名] -r [稀有度 稀有度 ...]\n- 查卡店 [卡名]\n- 查卡店 [卡名] -r [稀有度]",
|
||||||
}).ApplySingle(ctxext.DefaultSingle)
|
}).ApplySingle(ctxext.DefaultSingle)
|
||||||
engine.OnPrefix("查卡价", func(ctx *zero.Ctx) bool {
|
engine.OnPrefix("查卡价", func(ctx *zero.Ctx) bool {
|
||||||
ctx.State["args"] = strings.TrimSpace(ctx.State["args"].(string))
|
ctx.State["args"] = strings.TrimSpace(ctx.State["args"].(string))
|
||||||
return ctx.State["args"].(string) != ""
|
return ctx.State["args"].(string) != ""
|
||||||
}).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
}).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)
|
listOfTrace, err := getRarityTrade(cardName, rarity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
@ -80,7 +79,7 @@ func init() {
|
|||||||
ctx.State["args"] = strings.TrimSpace(ctx.State["args"].(string))
|
ctx.State["args"] = strings.TrimSpace(ctx.State["args"].(string))
|
||||||
return ctx.State["args"].(string) != ""
|
return ctx.State["args"].(string) != ""
|
||||||
}).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
}).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 {
|
if strings.Count(rarity, " ") > 0 {
|
||||||
ctx.SendChain(message.Text("ERROR: ", "卡店查询不支持查找多个罕贵度"))
|
ctx.SendChain(message.Text("ERROR: ", "卡店查询不支持查找多个罕贵度"))
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user