From 94efc8a1af8cc2fdd3c00121005273d9340a2f5a 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: Mon, 13 May 2024 00:50:46 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20add=20plugin=20=E6=8A=BD?= =?UTF-8?q?=E6=89=91=E5=85=8B=EF=BC=81=20(#903)"=20(#905)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit cda583e7b6257a7e8628d46ad51d3173c4e950a7. --- README.md | 9 -------- main.go | 1 - plugin/poker/poker.go | 52 ------------------------------------------- 3 files changed, 62 deletions(-) delete mode 100644 plugin/poker/poker.go diff --git a/README.md b/README.md index 2dbdbe1a..9dcef358 100644 --- a/README.md +++ b/README.md @@ -1483,15 +1483,6 @@ print("run[CQ:image,file="+j["img"]+"]") -
- 抽扑克 - - `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/yujn"` - - - [x] 抽扑克牌 - -
- ### *低优先级*
diff --git a/main.go b/main.go index 208914ae..e1881754 100644 --- a/main.go +++ b/main.go @@ -115,7 +115,6 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nwife" // 本地老婆 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/poker" // 抽扑克 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术 diff --git a/plugin/poker/poker.go b/plugin/poker/poker.go deleted file mode 100644 index 9f028827..00000000 --- a/plugin/poker/poker.go +++ /dev/null @@ -1,52 +0,0 @@ -package poker - -import ( - "encoding/json" - "math/rand" - - fcext "github.com/FloatTech/floatbox/ctxext" - ctrl "github.com/FloatTech/zbpctrl" - "github.com/FloatTech/zbputils/control" - "github.com/FloatTech/zbputils/ctxext" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" -) - -// 图片来源 https://www.bilibili.com/opus/834601953403076633 - -var cardImgPathList []string - -func init() { - engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{ - DisableOnDefault: false, - Brief: "抽扑克牌", - Help: "- 抽扑克\n- poker", - PublicDataFolder: "Poker", - }).ApplySingle(ctxext.DefaultSingle) - - getImg := fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { - data, err := engine.GetLazyData("imgdata.json", true) - if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) - return false - } - err = json.Unmarshal(data, &cardImgPathList) - if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) - return false - } - return true - }) - - engine.OnFullMatchGroup([]string{"抽扑克", "poker"}, getImg).SetBlock(true). - Handle(func(ctx *zero.Ctx) { - randomIndex := rand.Intn(len(cardImgPathList)) - randomImgPath := cardImgPathList[randomIndex] - imgData, err := engine.GetLazyData(randomImgPath, true) - if err != nil { - ctx.Send("[poker]读取扑克图片失败") - return - } - ctx.Send(message.ImageBytes(imgData)) - }) -}