From 786b5055c2f41c71e169b025ef20df55e34b112d 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 03:19:46 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20del=20wenben=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 | 14 ----- main.go | 1 - plugin/wenben/wenben.go | 113 ---------------------------------------- 3 files changed, 128 deletions(-) delete mode 100644 plugin/wenben/wenben.go diff --git a/README.md b/README.md index 81585bd110..b682a51443 100644 --- a/README.md +++ b/README.md @@ -1327,20 +1327,6 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 警报 - [x] 每日特惠 - -
- 天气/拼音查询-名言 - - `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenben"` - - - [x] xx天气 - - - [x] xx拼音 - - - [x] 每日情话/一言/鸡汤 - - - [x] 绕口令 -
百度文心AI diff --git a/main.go b/main.go index 3c473cfb1f..8ceb3b48e7 100644 --- a/main.go +++ b/main.go @@ -137,7 +137,6 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wantquotes" // 据意查句 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/warframeapi" // warframeAPI插件 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenben" // 文本指令大全 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinvilg" // 百度文心AI画图 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wife" // 抽老婆 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordcount" // 聊天热词 diff --git a/plugin/wenben/wenben.go b/plugin/wenben/wenben.go deleted file mode 100644 index 51f664058e..0000000000 --- a/plugin/wenben/wenben.go +++ /dev/null @@ -1,113 +0,0 @@ -// Package wenben 文本链接 -package wenben - -import ( - "encoding/json" - "fmt" - "strings" - - "github.com/FloatTech/floatbox/web" - ctrl "github.com/FloatTech/zbpctrl" - "github.com/FloatTech/zbputils/control" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" - "github.com/wdvxdr1123/ZeroBot/utils/helper" -) - -const ( - tianqi = "https://xiaobai.klizi.cn/API/other/weather_1.php?data=&msg=%v" // api地址 - pinyin = "http://ovooa.com/API/pinyin/api.php?type=text&msg=%v" - yiyan = "https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i" // 动漫 漫画 游戏 文学 影视 诗词 - kouling = "http://ovooa.com/API/rao/api.php?type=text" // 口令 - tang = "http://api.btstu.cn/yan/api.php?charset=utf-8&encode=text" - qing = "https://xiaobai.klizi.cn/API/other/wtqh.php" -) - -type rspData struct { - Hitokoto string `json:"hitokoto"` - From string `json:"from"` - FromWho string `json:"from_who"` -} - -func init() { // 主函数 - en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{ - DisableOnDefault: false, - Brief: "天气/拼音查询", - Help: "文本命令大全\n" + - "- 天气查询:xxx天气" + - "- 拼音查询:xxx拼音" + - "- 每日一言" + - "- 每日鸡汤" + - "- 每日情话" + - "- 绕口令", - }) - en.OnSuffix("天气").SetBlock(true). - Handle(func(ctx *zero.Ctx) { - str := ctx.State["args"].(string) - es, err := web.GetData(fmt.Sprintf(tianqi, str)) // 将网站返回结果赋值 - if err != nil { - ctx.SendChain(message.Text("出现错误捏:", err)) - return - } - ctx.SendChain(message.Text(str, "天气如下:\n", helper.BytesToString(es))) - }) - en.OnSuffix("拼音").SetBlock(true). - Handle(func(ctx *zero.Ctx) { - str := ctx.State["args"].(string) - es, err := web.GetData(fmt.Sprintf(pinyin, str)) // 将网站返回结果赋值 - if err != nil { - ctx.SendChain(message.Text("出现错误捏:", err)) - return - } - ctx.SendChain(message.Text(str, "的拼音为:", helper.BytesToString(es))) - }) - en.OnFullMatch("每日情话").SetBlock(true). - Handle(func(ctx *zero.Ctx) { - data, err := web.GetData(qing) - if err != nil { - ctx.SendChain(message.Text("获取失败惹", err)) - return - } - ctx.SendChain(message.Text(helper.BytesToString(data))) - }) - en.OnFullMatch("每日鸡汤").SetBlock(true). - Handle(func(ctx *zero.Ctx) { - data, err := web.GetData(tang) - if err != nil { - ctx.SendChain(message.Text("获取失败惹", err)) - return - } - ctx.SendChain(message.Text(helper.BytesToString(data))) - }) - en.OnFullMatch("绕口令").SetBlock(true).Handle(func(ctx *zero.Ctx) { - data, err := web.GetData(kouling) - if err != nil { - ctx.SendChain(message.Text("获取失败惹", err)) - return - } - ctx.SendChain(message.Text(helper.BytesToString(data))) - }) - en.OnFullMatch("每日一言").SetBlock(true).Handle(func(ctx *zero.Ctx) { // 每日一言 - var rsp rspData - data, err := web.GetData(yiyan) - if err != nil { - ctx.SendChain(message.Text("Err:", err)) - return - } - err = json.Unmarshal(data, &rsp) - if err != nil { - ctx.SendChain(message.Text("出现错误捏:", err)) - return - } - var msg strings.Builder - msg.WriteString(rsp.Hitokoto) - msg.WriteString("\n出自:") - msg.WriteString(rsp.From) - msg.WriteByte('\n') - if len(rsp.FromWho) != 0 { - msg.WriteString("作者:") - msg.WriteString(rsp.FromWho) - } - ctx.SendChain(message.Text(msg.String())) - }) -}