diff --git a/README.md b/README.md
index dce2097ac9..992af5991e 100644
--- a/README.md
+++ b/README.md
@@ -620,6 +620,14 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 磕cp大老师 雪乃
+
+
+ 今日早报
+
+ `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dailynews"`
+
+ - [x] 今日早报
+
DeepDanbooru二次元图标签识别
@@ -872,6 +880,14 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 喝奶茶绝绝子 | 绝绝子吃饭
+
+
+ 疯狂星期四
+
+ `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/kfccrazythursday"`
+
+ - [x] 疯狂星期四
+
kokomi原神面板
@@ -1283,6 +1299,16 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 更新vtb
+
+
+ vtb语录
+
+ `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtbmusic"`
+
+ - [x] vtb点歌
+
+ - [x] vtb随机点歌
+
钱包
diff --git a/main.go b/main.go
index 012bcd174d..9ab13ce678 100644
--- a/main.go
+++ b/main.go
@@ -56,89 +56,91 @@ import (
// vvvvvvvvvvvvvv //
// vvvv //
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ahsai" // ahsai tts
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ai_false" // 服务器监控
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aipaint" // ai绘图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/alipayvoice" // 支付宝到账语音
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/autowithdraw" // 触发者撤回时也自动撤回
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/b14" // base16384加解密
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baidu" // 百度一下
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/book_review" // 哀伤雪刃吧推书记录
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi" // 藏头诗
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chrev" // 英文字符翻转
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/coser" // 三次元小姐姐
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cpstory" // cp短打
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/danbooru" // DeepDanbooru二次元图标签识别
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress" // 女装
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drift_bottle" // 漂流瓶
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi" // 黑丝
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/image_finder" // 关键字搜图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jiami" // 兽语加密
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jikipedia" // 小鸡词典
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jptingroom" // 日语听力学习材料
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi" // 绝绝子生成器
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu_calendar" // 摸鱼人日历
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativesetu" // 本地涩图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativewife" // 本地老婆
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nbnhhsh" // 拼音首字母缩写释义工具
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nihongo" // 日语语法学习
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan" // QQ权重查询
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/scale" // 叔叔的AI二次元图片放大
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/score" // 分数
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtb_quotation" // vtb语录
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun" // 网易云音乐热评
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/warframeapi" // warframeAPI插件
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenben" // 文本指令大全
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinAI" // 百度文心AI画图
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/word_count" // 聊天热词
- _ "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/ahsai" // ahsai tts
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ai_false" // 服务器监控
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aipaint" // ai绘图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/alipayvoice" // 支付宝到账语音
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/autowithdraw" // 触发者撤回时也自动撤回
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/b14" // base16384加解密
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baidu" // 百度一下
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/book_review" // 哀伤雪刃吧推书记录
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi" // 藏头诗
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chrev" // 英文字符翻转
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/coser" // 三次元小姐姐
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cpstory" // cp短打
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dailynews" // 今日早报
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/danbooru" // DeepDanbooru二次元图标签识别
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress" // 女装
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drift_bottle" // 漂流瓶
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi" // 黑丝
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/image_finder" // 关键字搜图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jiami" // 兽语加密
+ _ "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/magicprompt" // magicprompt吟唱提示
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu_calendar" // 摸鱼人日历
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativesetu" // 本地涩图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativewife" // 本地老婆
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nbnhhsh" // 拼音首字母缩写释义工具
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nihongo" // 日语语法学习
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan" // QQ权重查询
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/scale" // 叔叔的AI二次元图片放大
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/score" // 分数
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtb_quotation" // vtb语录
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtbmusic" // vtb点歌
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun" // 网易云音乐热评
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/warframeapi" // warframeAPI插件
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenben" // 文本指令大全
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinAI" // 百度文心AI画图
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/word_count" // 聊天热词
+ _ "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/thesaurus" // 词典匹配回复
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西
diff --git a/plugin/bilibili/bilibili.go b/plugin/bilibili/bilibili.go
index c1907ac200..f6de28e712 100644
--- a/plugin/bilibili/bilibili.go
+++ b/plugin/bilibili/bilibili.go
@@ -340,7 +340,7 @@ func init() {
for i := 0; i < len(danmaku.Data.Data); i++ {
totalDanmuku += len(danmaku.Data.Data[i].Danmakus) + 1
}
- cw := 10000
+ cw := 3000
mcw := float64(2000)
ch := 550 + len(danmaku.Data.Data)*int(faceH) + totalDanmuku*int(danmuH)
canvas = gg.NewContext(cw, ch)
diff --git a/plugin/bilibili/bilibilipush.go b/plugin/bilibili/bilibilipush.go
index 2b87afdac3..09bb21514e 100644
--- a/plugin/bilibili/bilibilipush.go
+++ b/plugin/bilibili/bilibilipush.go
@@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"fmt"
+ "net/http"
"strconv"
"time"
@@ -175,7 +176,19 @@ func getName(buid int64) (name string, err error) {
var ok bool
if name, ok = upMap[buid]; !ok {
var data []byte
- data, err = web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", referer, ua, nil)
+ data, err = web.RequestDataWithHeaders(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", func(r *http.Request) error {
+ r.Header.Set("refer", referer)
+ r.Header.Set("user-agent", ua)
+ cookie := ""
+ if cfg != nil {
+ cookie, err = cfg.Load()
+ if err != nil {
+ return err
+ }
+ }
+ r.Header.Set("cookie", cookie)
+ return nil
+ }, nil)
if err != nil {
return
}
diff --git a/plugin/dailynews/dailynews.go b/plugin/dailynews/dailynews.go
new file mode 100644
index 0000000000..8b34fbb4fd
--- /dev/null
+++ b/plugin/dailynews/dailynews.go
@@ -0,0 +1,37 @@
+// Package dailynews 今日早报
+package dailynews
+
+import (
+ "github.com/FloatTech/floatbox/binary"
+ "github.com/FloatTech/floatbox/web"
+ ctrl "github.com/FloatTech/zbpctrl"
+ "github.com/FloatTech/zbputils/control"
+ "github.com/tidwall/gjson"
+ zero "github.com/wdvxdr1123/ZeroBot"
+ "github.com/wdvxdr1123/ZeroBot/message"
+)
+
+const api = "http://dwz.2xb.cn/zaob"
+
+func init() {
+ engine := control.Register("dailynews", &ctrl.Options[*zero.Ctx]{
+ DisableOnDefault: false,
+ Brief: "今日早报",
+ Help: "- 今日早报",
+ PrivateDataFolder: "dailynews",
+ })
+
+ engine.OnFullMatch(`今日早报`).SetBlock(true).
+ Handle(func(ctx *zero.Ctx) {
+ data, err := web.GetData(api)
+ if err != nil {
+ return
+ }
+ picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String()
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR:", err))
+ return
+ }
+ ctx.SendChain(message.Image(picURL))
+ })
+}
diff --git a/plugin/jikipedia/main.go b/plugin/jikipedia/main.go
deleted file mode 100644
index b50098f5a6..0000000000
--- a/plugin/jikipedia/main.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Package jikipedia 小鸡词典
-// 修改自https://github.com/TeamPGM/PagerMaid_Plugins_Pyro ,非常感谢!!
-package jikipedia
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net/http"
- "strings"
-
- "github.com/FloatTech/floatbox/binary"
- 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 (
- url = "https://api.jikipedia.com/go/search_entities"
-)
-
-type value struct {
- Phrase string `json:"phrase"`
- Page int `json:"page"`
- Size int `json:"size"`
-}
-
-func init() {
- // 初始化engine
- engine := control.Register("jikipedia", &ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "小鸡词典",
- Help: "- [查梗|小鸡词典][梗]",
- },
- )
- engine.OnPrefixGroup([]string{"小鸡词典", "查梗"}).Limit(ctxext.LimitByGroup).SetBlock(true).Handle(
- func(ctx *zero.Ctx) {
- keyWord := strings.Trim(ctx.State["args"].(string), " ")
-
- definition, err := parseKeyword(keyWord)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- if definition.String() == "" {
- ctx.SendChain(message.Text("好像什么都没查到,换个关键词试一试?"))
- return
- }
- imgURL := definition.Get("images.0.scaled.path").String()
- ctx.SendChain(message.Text("【标题】:", definition.Get("term.title"),
- "\n【释义】:", definition.Get("plaintext"),
- "\n【原文】:https://jikipedia.com/definition/", definition.Get("id")),
- message.Image(imgURL))
- },
- )
-}
-
-func parseKeyword(keyWord string) (definition gjson.Result, err error) {
- client := &http.Client{}
-
- values := value{Phrase: keyWord, Page: 1, Size: 10}
- jsonData, err := json.Marshal(values)
- if err != nil {
- return
- }
- var request *http.Request
- request, err = http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- return
- }
- request.Header = http.Header{
- "Accept": {"application/json, text/plain, */*"},
- "Accept-Encoding": {"gzip, deflate, br"},
- "Accept-Language": {"zh-CN,zh-TW;q=0.9,zh;q=0.8"},
- "Client": {"web"},
- "Client-Version": {"2.7.2g"},
- "Connection": {"keep-alive"},
- "Host": {"api.jikipedia.com"},
- "Origin": {"https://jikipedia.com"},
- "Referer": {"https://jikipedia.com/"},
- "Sec-Fetch-Dest": {"empty"},
- "Sec-Fetch-Mode": {"cors"},
- "Sec-Fetch-Site": {"same-site"},
- "Token": {""},
- "User-Agent": {"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Mobile Safari/537.36"},
- "XID": {"uNo5bL1nyNCp/Gm7lJAHQ91220HLbMT8jqk9IJYhtHA4ofP+zgxwM6lSDIKiYoppP2k1IW/1Vxc2vOVGxOOVReebsLmWPHhTs7NCRygfDkE="},
- "sec-ch-ua": {`" Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"`},
- "sec-ch-ua-mobile": {"?1"},
- "sec-ch-ua-platform": {`"Android"`},
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- var response *http.Response
- response, err = client.Do(request)
- if err != nil {
- return
- }
- defer response.Body.Close()
- if response.StatusCode != http.StatusOK {
- extraInfo := ""
- if response.StatusCode == 423 {
- extraInfo = "\n调用过多被网站暂时封禁,请等待数个小时后使用该功能~"
- }
- s := fmt.Sprintf("status code: %d%s", response.StatusCode, extraInfo)
- err = errors.New(s)
- return
- }
- data, err := io.ReadAll(response.Body)
- if err != nil {
- return
- }
- gjson.Get(binary.BytesToString(data), "data").ForEach(func(key, value gjson.Result) bool {
- definition = value.Get("definitions.0")
- return definition.String() == ""
- })
- return
-}
diff --git a/plugin/kfccrazythursday/kfccrazythursday.go b/plugin/kfccrazythursday/kfccrazythursday.go
new file mode 100644
index 0000000000..b3789817f4
--- /dev/null
+++ b/plugin/kfccrazythursday/kfccrazythursday.go
@@ -0,0 +1,31 @@
+// Package kfccrazythursday 疯狂星期四
+package kfccrazythursday
+
+import (
+ "github.com/FloatTech/floatbox/web"
+ ctrl "github.com/FloatTech/zbpctrl"
+ "github.com/FloatTech/zbputils/control"
+ "github.com/tidwall/gjson"
+ zero "github.com/wdvxdr1123/ZeroBot"
+ "github.com/wdvxdr1123/ZeroBot/message"
+)
+
+const (
+ crazyURL = "https://www.iculture.cc/demo/CrazyThursday/api/kfc.php"
+)
+
+func init() {
+ engine := control.Register("kfccrazythursday", &ctrl.Options[*zero.Ctx]{
+ DisableOnDefault: false,
+ Brief: "疯狂星期四",
+ Help: "疯狂星期四\n",
+ })
+ engine.OnFullMatch("疯狂星期四").SetBlock(true).Handle(func(ctx *zero.Ctx) {
+ data, err := web.GetData(crazyURL)
+ if err != nil {
+ ctx.SendChain(message.Text("Error:", err))
+ return
+ }
+ ctx.SendChain(message.Text(gjson.ParseBytes(data).Get("@this.0.content").String()))
+ })
+}
diff --git a/plugin/vtbmusic/vtbmusic.go b/plugin/vtbmusic/vtbmusic.go
new file mode 100644
index 0000000000..bbee2ab96e
--- /dev/null
+++ b/plugin/vtbmusic/vtbmusic.go
@@ -0,0 +1,321 @@
+// Package vtbmusic vtb点歌
+package vtbmusic
+
+import (
+ "encoding/json"
+ "fmt"
+ "math/rand"
+ "net/http"
+ "os"
+ "path"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/FloatTech/floatbox/binary"
+ "github.com/FloatTech/floatbox/file"
+ "github.com/FloatTech/floatbox/web"
+ ctrl "github.com/FloatTech/zbpctrl"
+ "github.com/FloatTech/zbputils/control"
+ "github.com/FloatTech/zbputils/img/text"
+ zero "github.com/wdvxdr1123/ZeroBot"
+ "github.com/wdvxdr1123/ZeroBot/message"
+)
+
+const (
+ getGroupListURL = "https://aqua.chat/v1/GetGroupsList"
+ getMusicListURL = "https://aqua.chat/v1/GetMusicList"
+ fileURL = "https://cdn.aqua.chat/"
+ musicListBody = `{"search":{"condition":"VocalId","keyword":"%v"},"sortField":"CreateTime","sortType":"desc","pageIndex":1,"pageRows":10000}`
+)
+
+type groupsList struct {
+ Total int `json:"Total"`
+ Data []struct {
+ ID string `json:"Id"`
+ CreateTime string `json:"CreateTime"`
+ Name string `json:"Name"`
+ GroupImg string `json:"GroupImg"`
+ VocalList []struct {
+ ID string `json:"Id"`
+ CreateTime string `json:"CreateTime"`
+ ChineseName string `json:"ChineseName"`
+ OriginName string `json:"OriginName"`
+ AvatarImg string `json:"AvatarImg"`
+ } `json:"VocalList"`
+ } `json:"Data"`
+ Success bool `json:"Success"`
+ ErrorCode int `json:"ErrorCode"`
+ Msg interface{} `json:"Msg"`
+}
+
+type musicList struct {
+ Total int `json:"Total"`
+ Data []struct {
+ ID string `json:"Id"`
+ CreateTime string `json:"CreateTime"`
+ PublishTime interface{} `json:"PublishTime"`
+ CreatorID interface{} `json:"CreatorId"`
+ CreatorRealName interface{} `json:"CreatorRealName"`
+ Deleted bool `json:"Deleted"`
+ OriginName string `json:"OriginName"`
+ VocalID string `json:"VocalId"`
+ VocalName string `json:"VocalName"`
+ CoverImg string `json:"CoverImg"`
+ Music string `json:"Music"`
+ Lyric interface{} `json:"Lyric"`
+ CDN string `json:"CDN"`
+ BiliBili interface{} `json:"BiliBili"`
+ YouTube interface{} `json:"YouTube"`
+ Twitter interface{} `json:"Twitter"`
+ Likes interface{} `json:"Likes"`
+ Length float64 `json:"Length"`
+ Label interface{} `json:"Label"`
+ IsLike bool `json:"isLike"`
+ Duration float64 `json:"Duration"`
+ Source interface{} `json:"Source"`
+ SourceName interface{} `json:"SourceName"`
+ Statis struct {
+ PlayCount int `json:"PlayCount"`
+ CommentCount int `json:"CommentCount"`
+ LikeCount int `json:"LikeCount"`
+ ShareCount int `json:"ShareCount"`
+ } `json:"Statis"`
+ VocalList []struct {
+ ID string `json:"Id"`
+ Cn string `json:"cn"`
+ Jp string `json:"jp"`
+ En string `json:"en"`
+ Originlang string `json:"originlang"`
+ } `json:"VocalList"`
+ } `json:"Data"`
+ Success bool `json:"Success"`
+ ErrorCode int `json:"ErrorCode"`
+ Msg interface{} `json:"Msg"`
+}
+
+func init() { // 插件主体
+ engine := control.Register("vtbmusic", &ctrl.Options[*zero.Ctx]{
+ DisableOnDefault: false,
+ Brief: "vtbmusic.com点歌",
+ Help: "- vtb点歌\n" +
+ "- vtb随机点歌",
+ PrivateDataFolder: "vtbmusic",
+ })
+ storePath := engine.DataFolder()
+ // 开启
+ engine.OnFullMatch(`vtb点歌`).SetBlock(true).
+ Handle(func(ctx *zero.Ctx) {
+ next := zero.NewFutureEvent("message", 999, false, ctx.CheckSession(), zero.RegexRule(`^\d+$`))
+ recv, cancel := next.Repeat()
+ defer cancel()
+ i := 0
+ paras := [3]int{}
+ data, err := web.PostData(getGroupListURL, "application/json", strings.NewReader(`{"PageIndex":1,"PageRows":9999}`))
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ var (
+ gl groupsList
+ ml musicList
+ num int
+ imageBytes []byte
+ )
+ err = json.Unmarshal(data, &gl)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ tex := "请输入群组序号\n"
+ for i, v := range gl.Data {
+ tex += fmt.Sprintf("%d. %s\n", i, v.Name)
+ }
+ imageBytes, err = text.RenderToBase64(tex, text.FontFile, 400, 20)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+binary.BytesToString(imageBytes))); id.ID() == 0 {
+ ctx.SendChain(message.Text("ERROR: 可能被风控了"))
+ }
+ for {
+ select {
+ case <-time.After(time.Second * 120):
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("vtb点歌超时"))
+ return
+ case c := <-recv:
+ msg := c.Event.Message.ExtractPlainText()
+ num, err = strconv.Atoi(msg)
+ if err != nil {
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("请输入数字!"))
+ continue
+ }
+ switch i {
+ case 0:
+ if num < 0 || num >= len(gl.Data) {
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("序号非法!"))
+ continue
+ }
+ if len(gl.Data[num].VocalList) == 0 {
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("无内容, 点歌失败"))
+ return
+ }
+ paras[0] = num
+ tex = "请输入vtb序号\n"
+ for i, v := range gl.Data[paras[0]].VocalList {
+ tex += fmt.Sprintf("%d. %s\n", i, v.OriginName)
+ }
+ imageBytes, err = text.RenderToBase64(tex, text.FontFile, 400, 20)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+binary.BytesToString(imageBytes))); id.ID() == 0 {
+ ctx.SendChain(message.Text("ERROR: 可能被风控了"))
+ }
+ case 1:
+ if num < 0 || num >= len(gl.Data[paras[0]].VocalList) {
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("序号非法!"))
+ continue
+ }
+ paras[1] = num
+ data, err := web.PostData(getMusicListURL, "application/json", strings.NewReader(fmt.Sprintf(musicListBody, gl.Data[paras[0]].VocalList[paras[1]].ID)))
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ err = json.Unmarshal(data, &ml)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if len(ml.Data) == 0 {
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("无内容, 点歌失败"))
+ return
+ }
+ tex = "请输入歌曲序号\n"
+ for i, v := range ml.Data {
+ tex += fmt.Sprintf("%d. %s\n", i, v.OriginName)
+ }
+ imageBytes, err = text.RenderToBase64(tex, text.FontFile, 400, 20)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+binary.BytesToString(imageBytes))); id.ID() == 0 {
+ ctx.SendChain(message.Text("ERROR: 可能被风控了"))
+ }
+ case 2:
+ if num < 0 || num >= len(ml.Data) {
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("序号非法!"))
+ continue
+ }
+ paras[2] = num
+ // 最后播放歌曲
+ groupName := gl.Data[paras[0]].Name
+ vtbName := gl.Data[paras[0]].VocalList[paras[1]].OriginName
+ musicName := ml.Data[paras[2]].OriginName
+ recURL := fileURL + ml.Data[paras[2]].Music
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("请欣赏", groupName, "-", vtbName, "的《", musicName, "》"))
+ recordFile := storePath + fmt.Sprintf("%d-%d-%d", paras[0], paras[1], paras[2]) + path.Ext(recURL)
+ if file.IsExist(recordFile) {
+ ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
+ return
+ }
+ err = dlrec(recordFile, recURL)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
+ return
+ }
+ i++
+ }
+ }
+ })
+ engine.OnFullMatch(`vtb随机点歌`).SetBlock(true).
+ Handle(func(ctx *zero.Ctx) {
+ var (
+ paras = [3]int{}
+ gl groupsList
+ ml musicList
+ )
+ data, err := web.PostData(getGroupListURL, "application/json", strings.NewReader(`{"PageIndex":1,"PageRows":9999}`))
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ err = json.Unmarshal(data, &gl)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if len(gl.Data) == 0 {
+ ctx.SendChain(message.Text("ERROR: 数组为空"))
+ return
+ }
+ paras[0] = rand.Intn(len(gl.Data))
+ for len(gl.Data[paras[0]].VocalList) == 0 {
+ paras[0] = rand.Intn(len(gl.Data))
+ }
+ paras[1] = rand.Intn(len(gl.Data[paras[0]].VocalList))
+ data, err = web.PostData(getMusicListURL, "application/json", strings.NewReader(fmt.Sprintf(musicListBody, gl.Data[paras[0]].VocalList[paras[1]].ID)))
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ err = json.Unmarshal(data, &ml)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ for len(ml.Data) == 0 {
+ paras[1] = rand.Intn(len(gl.Data[paras[0]].VocalList))
+ data, err = web.PostData(getMusicListURL, "application/json", strings.NewReader(fmt.Sprintf(musicListBody, gl.Data[paras[0]].VocalList[paras[1]].ID)))
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ err = json.Unmarshal(data, &ml)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ }
+ paras[2] = rand.Intn(len(ml.Data))
+ // 最后播放歌曲
+ groupName := gl.Data[paras[0]].Name
+ vtbName := gl.Data[paras[0]].VocalList[paras[1]].OriginName
+ musicName := ml.Data[paras[2]].OriginName
+ recURL := fileURL + ml.Data[paras[2]].Music
+ ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("请欣赏", groupName, "-", vtbName, "的《", musicName, "》"))
+ recordFile := storePath + fmt.Sprintf("%d-%d-%d", paras[0], paras[1], paras[2]) + path.Ext(recURL)
+ if file.IsExist(recordFile) {
+ ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
+ return
+ }
+ err = dlrec(recordFile, recURL)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
+ })
+}
+
+func dlrec(recordFile, recordURL string) error {
+ if file.IsNotExist(recordFile) {
+ data, err := web.RequestDataWithHeaders(web.NewTLS12Client(), recordURL, "GET", func(r *http.Request) error {
+ r.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ r.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0")
+ return nil
+ }, nil)
+ if err != nil {
+ return err
+ }
+ return os.WriteFile(recordFile, data, 0666)
+ }
+ return nil
+}