From 83b46dd07145ed73294ee4b42bd9457256d7e460 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: Wed, 1 May 2024 02:59:06 +0900
Subject: [PATCH] =?UTF-8?q?chore:=20del=20jiuejuezi=20due=20to=20=E8=B7=91?=
=?UTF-8?q?=E8=B7=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 16 ---------
main.go | 1 -
plugin/juejuezi/juejuezi.go | 71 -------------------------------------
3 files changed, 88 deletions(-)
delete mode 100644 plugin/juejuezi/juejuezi.go
diff --git a/README.md b/README.md
index 0654737758..46251a1972 100644
--- a/README.md
+++ b/README.md
@@ -819,14 +819,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 更新[屌|弔|吊]图
-
-
- 小鸡词典
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jikipedia"`
-
- - [x] [查梗|小鸡词典][梗]
-
日语听力学习材料
@@ -841,14 +833,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 日语歌曲 xxx
-
-
- 绝绝子
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi"`
-
- - [x] 喝奶茶绝绝子 | 绝绝子吃饭
-
疯狂星期四
diff --git a/main.go b/main.go
index 4f924f2385..d5f50f0349 100644
--- a/main.go
+++ b/main.go
@@ -99,7 +99,6 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jptingroom" // 日语听力学习材料
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi" // 绝绝子生成器
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/kfccrazythursday" // 疯狂星期四
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolimi" // 桑帛云 API
diff --git a/plugin/juejuezi/juejuezi.go b/plugin/juejuezi/juejuezi.go
deleted file mode 100644
index d701991dc8..0000000000
--- a/plugin/juejuezi/juejuezi.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Package juejuezi 绝绝子
-package juejuezi
-
-import (
- "fmt"
- "io"
- "net/http"
- "strings"
-
- ctrl "github.com/FloatTech/zbpctrl"
- "github.com/FloatTech/zbputils/control"
- "github.com/FloatTech/zbputils/ctxext"
- "github.com/tidwall/gjson"
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
- "github.com/wdvxdr1123/ZeroBot/utils/helper"
-)
-
-const (
- juejueziURL = "https://www.offjuan.com/api/juejuezi/text"
- referer = "https://juejuezi.offjuan.com/"
- ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
-)
-
-func init() {
- control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "绝绝子生成器",
- Help: "例: 喝奶茶绝绝子\n绝绝子吃饭",
- }).OnRegex("[\u4E00-\u9FA5]{0,10}绝绝子[\u4E00-\u9FA5]{0,10}").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
- toDealStr := []rune(strings.ReplaceAll(ctx.ExtractPlainText(), "绝绝子", ""))
- switch len(toDealStr) {
- case 0, 1:
- ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("不要只输入绝绝子"))
- case 2:
- data, err := juejuezi(string(toDealStr[0]), string(toDealStr[1]))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text(gjson.Get(helper.BytesToString(data), "text").String()))
- default:
- params := ctx.GetWordSlices(string(toDealStr)).Get("slices").Array()
- data, err := juejuezi(params[0].String(), params[1].String())
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text(gjson.Get(helper.BytesToString(data), "text").String()))
- }
- })
-}
-
-func juejuezi(verb, noun string) (data []byte, err error) {
- juejueziStr := fmt.Sprintf("{\"verb\":\"%s\",\"noun\":\"%s\"}", verb, noun)
- client := &http.Client{}
- // 提交请求
- request, err := http.NewRequest("POST", juejueziURL, strings.NewReader(juejueziStr))
- if err != nil {
- return nil, err
- }
- request.Header.Add("Referer", referer)
- request.Header.Add("User-Agent", ua)
- response, err := client.Do(request)
- if err != nil {
- return nil, err
- }
- data, err = io.ReadAll(response.Body)
- response.Body.Close()
- return
-}