diff --git a/README.md b/README.md index 68efcbd6c4..f2fa6c0bab 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,8 @@ zerobot [-h] [-m] [-n nickname] [-t token] [-u url] [-g url] [-p prefix] [-d|w] - [x] 列出所有提醒 - [x] 翻牌 + + - [x] 赞我 - [x] [开启 | 关闭]入群验证 @@ -959,6 +961,24 @@ print("run[CQ:image,file="+j["img"]+"]") 来份萝莉 ``` + +
+ 桑帛云 API + + `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolimi"` + + - [x] 随机妹子 + + - [x] 随机绕口令 + + - [x] 颜值鉴定[图片] + + - [x] 随机情话 + + - [x] 发病 嘉然 + + - [x] 让[塔菲|嘉然|东雪莲]说我测尼玛 +
MagicPrompt-Stable-Diffusion吟唱提示 @@ -1509,6 +1529,18 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 团队七阶猜单词 +
+
+ 鬼东西 + + `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf"` + + - [x] 鬼东西列表 + + - [x] 查询鬼东西[序号][@xxx] + + - 注:由于需要科学,默认注释。 +
一些游戏王插件 @@ -1550,15 +1582,39 @@ print("run[CQ:image,file="+j["img"]+"]")
- 鬼东西 + 遇见API - `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf"` - - - [x] 鬼东西列表 - - - [x] 查询鬼东西[序号][@xxx] - - - 注:由于需要科学,默认注释。 + `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/yujn"` + + - [x] 小姐姐视频 + - [x] 小姐姐视频2 + - [x] 黑丝视频 + - [x] 白丝视频 + - [x] 欲梦视频 + - [x] 甜妹视频 + - [x] 双倍快乐 + - [x] 纯情女高 + - [x] 萝莉视频 + - [x] 玉足视频 + - [x] 帅哥视频 + - [x] 热舞视频 + - [x] 吊带视频 + - [x] 汉服视频 + - [x] 极品狱卒 + - [x] 清纯视频 + - [x] 快手变装 + - [x] 抖音变装 + - [x] 萌娃视频 + - [x] 穿搭视频 + - [x] 完美身材 + - [x] 御姐撒娇 + - [x] 绿茶语音 + - [x] 怼人语音 + - [x] 随机骚话 + - [x] 随机污句子 + - [x] 随机美句 + - [x] 土味情话 + - [x] 让[丁真|陈泽|梅西|孙笑川|科比|懒羊羊|胡桃|雫るる]说我测尼玛
diff --git a/go.mod b/go.mod index 233622e859..bca063579b 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/tidwall/gjson v1.14.4 github.com/wcharczuk/go-chart/v2 v2.1.0 - github.com/wdvxdr1123/ZeroBot v1.7.5-0.20231009162356-57f71b9f5258 + github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240410141841-6970df23ca54 gitlab.com/gomidi/midi/v2 v2.0.25 golang.org/x/image v0.3.0 golang.org/x/sys v0.8.0 diff --git a/go.sum b/go.sum index 1351145460..b551b3d3f8 100644 --- a/go.sum +++ b/go.sum @@ -216,8 +216,8 @@ github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYm github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/wcharczuk/go-chart/v2 v2.1.0 h1:tY2slqVQ6bN+yHSnDYwZebLQFkphK4WNrVwnt7CJZ2I= github.com/wcharczuk/go-chart/v2 v2.1.0/go.mod h1:yx7MvAVNcP/kN9lKXM/NTce4au4DFN99j6i1OwDclNA= -github.com/wdvxdr1123/ZeroBot v1.7.5-0.20231009162356-57f71b9f5258 h1:Q0dKoj9SHrR8WjjlcX+eyYBjQKqBn/x1pdJJO1IIOxQ= -github.com/wdvxdr1123/ZeroBot v1.7.5-0.20231009162356-57f71b9f5258/go.mod h1:y29UIOy0RD3P+0meDNIWRhcJF3jtWPN9xP9hgt/AJAU= +github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240410141841-6970df23ca54 h1:s7k0Pf4RoeCUHe9rlVsg0mqAH3WO7xLMhe9qih/CxnE= +github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240410141841-6970df23ca54/go.mod h1:y29UIOy0RD3P+0meDNIWRhcJF3jtWPN9xP9hgt/AJAU= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= diff --git a/main.go b/main.go index d267d696e2..715a8d825e 100644 --- a/main.go +++ b/main.go @@ -108,6 +108,7 @@ import ( _ "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 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/mcfish" // 钓鱼模拟器 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作 @@ -152,6 +153,7 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordle" // 猜单词 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ygo" // 游戏王相关插件 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/yujn" // 遇见API // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西 diff --git a/plugin/lolimi/lolimi.go b/plugin/lolimi/lolimi.go new file mode 100644 index 0000000000..7506b93369 --- /dev/null +++ b/plugin/lolimi/lolimi.go @@ -0,0 +1,132 @@ +// Package lolimi 来源于 https://api.lolimi.cn/ 的接口 +package lolimi + +import ( + "fmt" + "net/url" + "strconv" + "strings" + + "github.com/FloatTech/floatbox/binary" + "github.com/FloatTech/floatbox/web" + 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" +) + +const ( + lolimiURL = "https://api.lolimi.cn" + jiaranURL = lolimiURL + "/API/yyhc/jr.php?msg=%v&type=2" + tafeiURL = lolimiURL + "/API/yyhc/taf.php?msg=%v&type=2" + dxlURL = lolimiURL + "/API/yyhc/dxl.php?msg=%v&type=2" + raoURL = lolimiURL + "/API/rao/api.php" + yanURL = lolimiURL + "/API/yan/?url=%v" + xjjURL = lolimiURL + "/API/tup/xjj.php" + qingURL = lolimiURL + "/API/qing/api.php" + fabingURL = lolimiURL + "/API/fabing/fb.php?name=%v" +) + +var ( + engine = control.AutoRegister(&ctrl.Options[*zero.Ctx]{ + DisableOnDefault: false, + Brief: "桑帛云 API", + Help: "- 让[塔菲|嘉然|东雪莲]说我测尼玛\n- 随机绕口令\n- 颜值鉴定[图片]\n" + + "- 随机妹子\n- 随机情话\n- 发病 嘉然\n\n说明: 颜值鉴定只能鉴定三次元图片", + }) +) + +func init() { + engine.OnFullMatch("随机妹子").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + ctx.SendChain(message.Image(xjjURL)) + }) + engine.OnFullMatch("随机绕口令").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + data, err := web.GetData(raoURL) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(gjson.Get(binary.BytesToString(data), "data.Msg").String())) + }) + engine.OnFullMatch("随机情话").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + data, err := web.GetData(qingURL) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(binary.BytesToString(data))) + }) + engine.OnPrefix(`发病`).SetBlock(true).Handle(func(ctx *zero.Ctx) { + name := ctx.NickName() + data, err := web.GetData(fmt.Sprintf(fabingURL, url.QueryEscape(name))) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(gjson.Get(binary.BytesToString(data), "data").String())) + }) + engine.OnKeywordGroup([]string{"颜值鉴定"}, zero.MustProvidePicture).SetBlock(true). + Handle(func(ctx *zero.Ctx) { + list := ctx.State["image_url"].([]string) + if len(list) > 0 { + ctx.SendChain(message.Text("少女祈祷中...")) + data, err := web.GetData(fmt.Sprintf(yanURL, url.QueryEscape(list[0]))) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + assessment := gjson.Get(binary.BytesToString(data), "data.text").String() + if assessment == "" { + ctx.SendChain(message.Text("ERROR: 请输入正确的图片")) + return + } + var text strings.Builder // 创建一个strings.Builder实例 + text.WriteString("评价: ") + text.WriteString(assessment) // 添加评估信息 + + for i := 0; i <= 2; i++ { + key := gjson.Get(binary.BytesToString(data), "data.grade.key"+strconv.Itoa(i)).String() + score := gjson.Get(binary.BytesToString(data), "data.grade.score"+strconv.Itoa(i)).String() + if key != "" { + text.WriteString("\n") + text.WriteString(key) + text.WriteString(": ") + text.WriteString(score) + } + } + + ctx.SendChain(message.Text(text.String())) // 发送构建好的字符串 + } + }) + engine.OnRegex("^让(塔菲|嘉然|东雪莲)说([\\s\u4e00-\u9fa5\u3040-\u309F\u30A0-\u30FF\\w\\p{P}\u3000-\u303F\uFF00-\uFFEF]+)$").Limit(ctxext.LimitByGroup).Handle(func(ctx *zero.Ctx) { + name := ctx.State["regex_matched"].([]string)[1] + msg := ctx.State["regex_matched"].([]string)[2] + recordURL := "" + switch name { + case "塔菲", "东雪莲": + ttsURL := "" + if name == "塔菲" { + ttsURL = tafeiURL + } else { + ttsURL = dxlURL + } + data, err := web.GetData(fmt.Sprintf(ttsURL, url.QueryEscape(msg))) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + recordURL = gjson.Get(binary.BytesToString(data), "music").String() + case "嘉然": + recordURL = fmt.Sprintf(jiaranURL, url.QueryEscape(msg)) + default: + recordURL = fmt.Sprintf(jiaranURL, url.QueryEscape(msg)) + } + if recordURL == "" { + ctx.SendChain(message.Text("ERROR: 语音生成失败")) + return + } + ctx.SendChain(message.Record(recordURL)) + }) +} diff --git a/plugin/manager/manager.go b/plugin/manager/manager.go index d4dcec52a5..6b81376389 100644 --- a/plugin/manager/manager.go +++ b/plugin/manager/manager.go @@ -47,6 +47,7 @@ const ( "- 取消在\"cron\"的提醒\n" + "- 列出所有提醒\n" + "- 翻牌\n" + + "- 赞我\n" + "- 设置欢迎语XXX 可选添加 [{at}] [{nickname}] [{avatar}] [{uid}] [{gid}] [{groupname}]\n" + "- 测试欢迎语\n" + "- 设置告别辞 参数同设置欢迎语\n" + @@ -384,6 +385,24 @@ func init() { // 插件主体 ), ) }) + // 给好友点赞 + engine.OnFullMatch("赞我").SetBlock(true).Limit(ctxext.LimitByUser). + Handle(func(ctx *zero.Ctx) { + list := ctx.GetFriendList().Array() + flag := false + for _, v := range list { + if ctx.Event.UserID == v.Get("user_id").Int() { + flag = true + break + } + } + if !flag { + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("不加好友不给赞!")) + return + } + ctx.SendLike(ctx.Event.UserID, 10) + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("给你赞了10下哦,记得回我~")) + }) // 入群欢迎 engine.OnNotice().SetBlock(false). Handle(func(ctx *zero.Ctx) { diff --git a/plugin/yujn/yujn.go b/plugin/yujn/yujn.go new file mode 100644 index 0000000000..ac9e2ac579 --- /dev/null +++ b/plugin/yujn/yujn.go @@ -0,0 +1,144 @@ +// Package yujn 来源于 https://api.yujn.cn/ 的接口 +package yujn + +import ( + "fmt" + "net/url" + "strings" + + "github.com/FloatTech/floatbox/binary" + "github.com/FloatTech/floatbox/web" + 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" +) + +const ( + yujnURL = "https://api.yujn.cn" + zzxjjURL = yujnURL + "/api/zzxjj.php?type=video" + baisisURL = yujnURL + "/api/baisis.php?type=video" + heisisURL = yujnURL + "/api/heisis.php?type=video" + xjjURL = yujnURL + "/api/xjj.php?type=video" + tianmeiURL = yujnURL + "/api/tianmei.php?type=video" + ndymURL = yujnURL + "/api/ndym.php?type=video" + sbklURL = yujnURL + "/api/sbkl.php?type=video" + nvgaoURL = yujnURL + "/api/nvgao.php?type=video" + luoliURL = yujnURL + "/api/luoli.php?type=video" + yuzuURL = yujnURL + "/api/yuzu.php?type=video" + xggURL = yujnURL + "/api/xgg.php?type=video" + rewuURL = yujnURL + "/api/rewu.php?type=video" + diaodaiURL = yujnURL + "/api/diaodai.php?type=video" + hanfuURL = yujnURL + "/api/hanfu.php?type=video" + jpyzURL = yujnURL + "/api/jpmt.php?type=video" + qingchunURL = yujnURL + "/api/qingchun.php?type=video" + ksbianzhuang = yujnURL + "/api/ksbianzhuang.php?type=video" + dybianzhuang = yujnURL + "/api/bianzhuang.php?type=video" + mengwaURL = yujnURL + "/api/mengwa.php?type=video" + chuandaURL = yujnURL + "/api/chuanda.php?type=video" + wmscURL = yujnURL + "/api/wmsc.php?type=video" + yujieURL = yujnURL + "/api/yujie.php" + luchaURL = yujnURL + "/api/lvcha.php" + duirenURL = yujnURL + "/api/duiren.php" + saohuaURL = yujnURL + "/api/saohua.php" + qinghuaURL = yujnURL + "/api/qinghua.php" + wuURL = yujnURL + "/api/text_wu.php" + wenanURL = yujnURL + "/api/wenan.php" + yuyinURL = yujnURL + "/api/yuyin.php?type=json&from=%v&msg=%v" +) + +var ( + engine = control.AutoRegister(&ctrl.Options[*zero.Ctx]{ + DisableOnDefault: false, + Brief: "遇见API", + Help: "- 小姐姐视频\n- 小姐姐视频2\n- 黑丝视频\n- 白丝视频\n" + + "- 欲梦视频\n- 甜妹视频\n- 双倍快乐\n- 纯情女高\n" + + "- 萝莉视频\n- 玉足视频\n- 帅哥视频\n- 热舞视频\n" + + "- 吊带视频\n- 汉服视频\n- 极品狱卒\n- 清纯视频\n" + + "- 快手变装\n- 抖音变装\n- 萌娃视频\n- 穿搭视频\n" + + "- 完美身材\n- 御姐撒娇\n- 绿茶语音\n- 怼人语音\n" + + "- 随机骚话\n- 随机污句子\n- 随机美句\n- 土味情话\n- 让[丁真|陈泽|梅西|孙笑川|科比|懒羊羊|胡桃|雫るる]说我测尼玛", + }) + urlMap = map[string]string{ + "小姐姐视频": zzxjjURL, + "小姐姐视频2": xjjURL, + "黑丝视频": heisisURL, + "白丝视频": baisisURL, + "欲梦视频": ndymURL, + "甜妹视频": tianmeiURL, + "双倍快乐": sbklURL, + "纯情女高": nvgaoURL, + "萝莉视频": luoliURL, + "玉足视频": yuzuURL, + "帅哥视频": xggURL, + "热舞视频": rewuURL, + "吊带视频": diaodaiURL, + "汉服视频": hanfuURL, + "极品狱卒": jpyzURL, + "清纯视频": qingchunURL, + "快手变装": ksbianzhuang, + "抖音变装": dybianzhuang, + "萌娃视频": mengwaURL, + "穿搭视频": chuandaURL, + "完美身材": wmscURL, + "御姐撒娇": yujieURL, + "绿茶语音": luchaURL, + "怼人语音": duirenURL, + "随机骚话": saohuaURL, + "土味情话": qinghuaURL, + "随机污句子": wuURL, + } +) + +func init() { + // 这里是您的处理逻辑的switch case重构版本 + engine.OnFullMatchGroup([]string{"小姐姐视频", "小姐姐视频2", "黑丝视频", "白丝视频", "欲梦视频", "甜妹视频", "双倍快乐", "纯情女高", "萝莉视频", "玉足视频", "帅哥视频", "热舞视频", "吊带视频", "汉服视频", "极品狱卒", "清纯视频", "快手变装", "抖音变装", "萌娃视频", "穿搭视频", "完美身材"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + videoType := ctx.State["matched"].(string) // 假设这是获取消息文本的方式 + videoURL := urlMap[videoType] + ctx.SendChain(message.Video(videoURL)) + }) + engine.OnFullMatchGroup([]string{"御姐撒娇", "绿茶语音", "怼人语音"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + recordType := ctx.State["matched"].(string) // 假设这是获取消息文本的方式 + recordURL := urlMap[recordType] + ctx.SendChain(message.Record(recordURL)) + + }) + engine.OnFullMatchGroup([]string{"随机骚话", "土味情话", "随机污句子"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + textType := ctx.State["matched"].(string) // 假设这是获取消息文本的方式 + textURL := urlMap[textType] + data, err := web.GetData(textURL) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(binary.BytesToString(data))) + }) + engine.OnFullMatch("随机美句").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { + data, err := web.GetData(wenanURL) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + text := binary.BytesToString(data) + text = strings.ReplaceAll(text, "

", "") + text = strings.ReplaceAll(text, "

", "") + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text)) + }) + engine.OnRegex("^让(丁真|陈泽|梅西|孙笑川|科比|懒羊羊|胡桃|雫るる)说([\\s\u4e00-\u9fa5\u3040-\u309F\u30A0-\u30FF\\w\\p{P}\u3000-\u303F\uFF00-\uFFEF]+)$").Limit(ctxext.LimitByGroup).Handle(func(ctx *zero.Ctx) { + name := ctx.State["regex_matched"].([]string)[1] + msg := ctx.State["regex_matched"].([]string)[2] + data, err := web.GetData(fmt.Sprintf(yuyinURL, url.QueryEscape(name), url.QueryEscape(msg))) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + recordURL := gjson.Get(binary.BytesToString(data), "url").String() + if recordURL == "" { + ctx.SendChain(message.Text("ERROR: 语音生成失败")) + return + } + ctx.SendChain(message.Record(recordURL)) + }) +}