diff --git a/README.md b/README.md
index 9ee01c872d..74832bde88 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
-
+
+
ZeroBot-Plugin
@@ -50,7 +51,7 @@
## 命令行参数
> `[]`代表是可选参数
```bash
-zerobot [-h] [-m] [-n nickname] [-t token] [-u url] [-g url] [-p prefix] [-d|w] [-c|s config.json] [-l latency] [-r ringlen] [-x max process time] [qq1 qq2 qq3 ...] [&]
+zerobot [-h] [-m] [-n nickname] [-t token] [-u url] [-g url] [-p prefix] [-d|w] [-c|s config.json] [-l latency] [-r ringlen] [-x max process time] [-mirror] [qq1 qq2 qq3 ...] [&]
```
- **-h**: 显示帮助
- **-m**: 不自动标记消息为已读
@@ -65,6 +66,7 @@ zerobot [-h] [-m] [-n nickname] [-t token] [-u url] [-g url] [-p prefix] [-d|w]
- **-l latency**: 全局处理延时 (ms)
- **-r ringlen**: 接收消息环缓冲区大小,`0`为不设缓冲,并发处理
- **-x max process time**: 最大处理时间 (min)
+- **-mirror**: 直接使用镜像懒加载数据站而不尝试访问源站
- **qqs**: superusers 的 qq 号
- **&**: 驻留在后台,必须放在最后,仅`Linux`下有效
@@ -373,30 +375,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 设置默认限速为每 m [分钟 | 秒] n 次触发
-
-
- ai绘图
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aipaint"`
-
- - [x] [ ai绘图 | 生成色图 | 生成涩图 | ai画图 ] xxx
-
- - [x] [ ai高级绘图 | 高级生成色图 | 高级生成涩图 | ai高级画图 ] xxx
-
- - [x] [ 以图绘图 | 以图生图 | 以图画图 ] xxx [图片]|@xxx|[qq号]
-
- - [x] 设置ai绘图配置 [server] [token]
-
- - [x] 设置ai绘图撤回时间90s
-
- - [x] 查看ai绘图配置
-
- 例: 设置ai绘图配置 http://91.216.169.75:5010 abc
-
- 参考服务器 http://91.217.139.190:5010, http://91.216.169.75:5010, http://185.80.202.180:5010
-
- 通过 http://91.217.139.190:5010/token 获取token
-
AIWife
@@ -435,14 +413,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 用yyy解密xxx
-
-
- 百科
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baidu"`
-
- - [x] 百度/百科/维基/wiki[xxx]
-
百度内容审核
@@ -572,16 +542,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 随机书评
-
-
- 藏头诗
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi"`
-
- - [x] 藏头诗[xxx]
-
- - [x] 藏尾诗[xxx]
-
选择困难症帮手
@@ -680,20 +640,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 删签[gif签名]
-
-
- 女装
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress"`
-
- - [x] 女装
-
- - [x] 男装
-
- - [x] 随机女装
-
- - [x] 随机男装
-
漂流瓶
@@ -817,14 +763,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 下载歌单[网易云歌单链接/ID]到[歌单名称]
- [x] 解除绑定 [歌单名称]
-
-
- 黑丝
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi"`
-
- - [x] 来点黑丝/白丝/jk/巨乳/足控/网红
-
一言
@@ -857,14 +795,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 百人一首之n
-
-
- 关键字搜图
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/image_finder"`
-
- - [x] 来张 [xxx]
-
注入指令
@@ -883,24 +813,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 更新[屌|弔|吊]图
-
-
- 兽语加密(嗷呜~)
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jiami"`
-
- - [x] 兽语加密xxx
-
- - [x] 兽语解密xxx
-
-
-
- 小鸡词典
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jikipedia"`
-
- - [x] [查梗|小鸡词典][梗]
-
日语听力学习材料
@@ -915,14 +827,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 日语歌曲 xxx
-
-
- 绝绝子
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi"`
-
- - [x] 喝奶茶绝绝子 | 绝绝子吃饭
-
疯狂星期四
@@ -1196,18 +1100,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 重置花名册
-
-
- 权重查询
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan"`
-
- - 来看看大家的账号分吧~据说越高越不容易封号哦
-
- - [x] 权重查询+@xxx
-
- - [x] 权重查询+QQ号(为空时匹配触发者QQ)
-
qq空间表白墙
@@ -1382,16 +1274,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 更新vtb
-
-
- vtb点歌
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtbmusic"`
-
- - [x] vtb点歌
-
- - [x] vtb随机点歌
-
钱包
@@ -1402,14 +1284,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 查看钱包排名
-
-
- 网易云音乐热评
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun"`
-
- - [x] 来份网易云热评
-
据意查句
@@ -1437,20 +1311,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/go.mod b/go.mod
index 689d7ca752..e94405f41e 100644
--- a/go.mod
+++ b/go.mod
@@ -4,16 +4,16 @@ go 1.20
require (
github.com/Baidu-AIP/golang-sdk v1.1.1
- github.com/FloatTech/AnimeAPI v1.7.1-0.20240423052513-58ad4b85322a
- github.com/FloatTech/floatbox v0.0.0-20240304064110-78a83f1af9a6
+ github.com/FloatTech/AnimeAPI v1.7.1-0.20240504155718-e1a4844e94a5
+ github.com/FloatTech/floatbox v0.0.0-20240504180219-62f0fa53644e
github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08
github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef
github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9
github.com/FloatTech/sqlite v1.6.3
- github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b
- github.com/FloatTech/zbpctrl v1.6.0
- github.com/FloatTech/zbputils v1.7.1-0.20231107124514-083e678fbfe6
- github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e
+ github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1
+ github.com/FloatTech/zbpctrl v1.6.1
+ github.com/FloatTech/zbputils v1.7.1-0.20240504190435-b7df3713001f
+ github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
github.com/antchfx/htmlquery v1.2.5
github.com/corona10/goimagehash v1.1.0
@@ -25,6 +25,7 @@ require (
github.com/fumiama/go-registry v0.2.6
github.com/fumiama/gotracemoe v0.0.3
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
+ github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8
github.com/fumiama/unibase2n v0.0.0-20221020155353-02876e777430
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/jinzhu/gorm v1.9.16
@@ -35,16 +36,15 @@ require (
github.com/mroth/weightedrand v1.0.0
github.com/notnil/chess v1.9.0
github.com/pkg/errors v0.9.1
- github.com/quic-go/quic-go v0.38.1
github.com/shirou/gopsutil/v3 v3.23.1
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.20240410141841-6970df23ca54
+ github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504170749-c9c0e1fe4915
gitlab.com/gomidi/midi/v2 v2.0.25
golang.org/x/image v0.3.0
- golang.org/x/sys v0.8.0
- golang.org/x/text v0.9.0
+ golang.org/x/sys v0.19.0
+ golang.org/x/text v0.14.0
gopkg.in/yaml.v3 v3.0.1
)
@@ -59,10 +59,7 @@ require (
github.com/fumiama/imgsz v0.0.2 // indirect
github.com/gabriel-vasile/mimetype v1.0.4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
- github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
- github.com/golang/mock v1.6.0 // indirect
- github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hajimehoshi/oto v0.7.1 // indirect
github.com/jfreymuth/oggvorbis v1.0.1 // indirect
@@ -74,12 +71,9 @@ require (
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
- github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pkumza/numcn v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
- github.com/quic-go/qpack v0.4.0 // indirect
- github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/tetratelabs/wazero v1.5.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
@@ -87,13 +81,9 @@ require (
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
- golang.org/x/crypto v0.4.0 // indirect
- golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/exp/shiny v0.0.0-20221126150942-6ab00d035af9 // indirect
golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f // indirect
- golang.org/x/mod v0.10.0 // indirect
- golang.org/x/net v0.10.0 // indirect
- golang.org/x/tools v0.9.1 // indirect
+ golang.org/x/net v0.24.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
modernc.org/libc v1.21.5 // indirect
modernc.org/mathutil v1.5.0 // indirect
diff --git a/go.sum b/go.sum
index c3b72dbb82..f272f861a3 100644
--- a/go.sum
+++ b/go.sum
@@ -2,10 +2,10 @@ github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhv
github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
-github.com/FloatTech/AnimeAPI v1.7.1-0.20240423052513-58ad4b85322a h1:K+1RAkIBb+3kkSxSkSTdTugSIsXJXrjEbwuv/BwUsP8=
-github.com/FloatTech/AnimeAPI v1.7.1-0.20240423052513-58ad4b85322a/go.mod h1:bNHsYcUd1+Y5Al3CR6tdzKxcc0XLivXjmUsL9xG6sSw=
-github.com/FloatTech/floatbox v0.0.0-20240304064110-78a83f1af9a6 h1:Vaj8ulVbN8vTD4W7aj+BYeT6x8iKFneDnkgBCezomDY=
-github.com/FloatTech/floatbox v0.0.0-20240304064110-78a83f1af9a6/go.mod h1:TeTlp+hTxpJti4JSdmUqzxGEr4wUBOVct9YWBepilpc=
+github.com/FloatTech/AnimeAPI v1.7.1-0.20240504155718-e1a4844e94a5 h1:0Xgngi3sWMnnvdl5PZapu4sWP5fp7ftmYMy5eIGKMdM=
+github.com/FloatTech/AnimeAPI v1.7.1-0.20240504155718-e1a4844e94a5/go.mod h1:Ru6q5pZUnfMg1iu0M1Hp73q9N3LNIbDr16kjkzyG6Xk=
+github.com/FloatTech/floatbox v0.0.0-20240504180219-62f0fa53644e h1:XMT7qAq3Chse8XYufQAQXhdla+yS6a+Ny1Rp77MFYQo=
+github.com/FloatTech/floatbox v0.0.0-20240504180219-62f0fa53644e/go.mod h1:OzGLhvmtz1TKIdGaJDd8pQumvD36UqK+dWsiCISmzQQ=
github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08 h1:dPLeoiTVSBlgls+66EB/UJ2e38BaASmBN5nANaycSBU=
github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08/go.mod h1:uzPzAeT35egARdRuu+1oyjU3CmTwCceoq3Vvje7LpcI=
github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef h1:CJbK/2FRwPuZpeb6M4sWK2d7oXDnBEGhpkQuQrgc91A=
@@ -14,15 +14,15 @@ github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 h1:hffajvm
github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9/go.mod h1:NBFPhWae4hqVMeG8ELBBnUQkKce3nDjkljVn6PdiUNs=
github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4M=
github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY=
-github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b h1:tvciXWq2nuvTbFeJGLDNIdRX3BI546D3O7k7vrVueZw=
-github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
-github.com/FloatTech/zbpctrl v1.6.0 h1:BWg9aRR4bUCmNNKj6GPH0TmzFRWYImIi6rQcQTTYRs4=
-github.com/FloatTech/zbpctrl v1.6.0/go.mod h1:i3GGM5K4HiDsXzvmXQSYoH1QT3tsSaAHjRzHwKGsHG0=
-github.com/FloatTech/zbputils v1.7.1-0.20231107124514-083e678fbfe6 h1:EMdvLnt6i5dSFloLD1klOM8bdoFZqTtILcMCciOpcMo=
-github.com/FloatTech/zbputils v1.7.1-0.20231107124514-083e678fbfe6/go.mod h1:4oXgjQ6bGosAF4GbuL/keAhTrGWOV369X5X0ISFebmw=
+github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9NvoRfUvdjDrHz/6QhfN/LoIIpICbo=
+github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
+github.com/FloatTech/zbpctrl v1.6.1 h1:SilK5R2poO8iUT6JPzpgr/BSzxYAaybBYNZkMyZ8STw=
+github.com/FloatTech/zbpctrl v1.6.1/go.mod h1:I+MetM++1sJhNPg3zww1aw04BicYsNohvHC4Jh52XSo=
+github.com/FloatTech/zbputils v1.7.1-0.20240504190435-b7df3713001f h1:QDJPV2kJj7pnINPlQeEpi0XWk+U7DQm08UqAd3fo5MA=
+github.com/FloatTech/zbputils v1.7.1-0.20240504190435-b7df3713001f/go.mod h1:Farh8BUY9p4YSwPWUnoQR2N+dCfl3F4x2TQ4z4ayGEw=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
-github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e h1:wR3MXQ3VbUlPKOOUwLOYgh/QaJThBTYtsl673O3lqSA=
-github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w=
+github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 h1:S/ferNiehVjNaBMNNBxUjLtVmP/YWD6Yh79RfPv4ehU=
+github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w=
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 h1:bBmmB7he0iVN4m5mcehfheeRUEer/Avo4ujnxI3uCqs=
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5/go.mod h1:0UcFaCkhp6vZw6l5Dpq0Dp673CoF9GdvA8lTfst0GiU=
github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:ir/IFJU5xbja5UaBEQLjcvn7aAU01nqU/NUyOBEU+ew=
@@ -34,9 +34,6 @@ github.com/antchfx/htmlquery v1.2.5 h1:1lXnx46/1wtv1E/kzmH8vrfMuUKYgkdDBA9pIdMJn
github.com/antchfx/htmlquery v1.2.5/go.mod h1:2MCVBzYVafPBmKbrmwB9F5xdd+IEgRY61ci2oOsOQVw=
github.com/antchfx/xpath v1.2.1 h1:qhp4EW6aCOVr5XIkT+l6LJ9ck/JsUH/yyauNgTQkBF8=
github.com/antchfx/xpath v1.2.1/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
-github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
-github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
-github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/corona10/goimagehash v1.1.0 h1:teNMX/1e+Wn/AYSbLHX8mj+mF9r60R1kBeqE9MkoYwI=
github.com/corona10/goimagehash v1.1.0/go.mod h1:VkvE0mLn84L4aF8vCb6mafVajEb6QYMHl2ZJLn0mOGI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
@@ -78,6 +75,8 @@ github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565 h1:sQuR2+N5HurnvsZhi
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565/go.mod h1:UUEvyLTJ7yoOA/viKG4wEis4ERydM7+Ny6gZUWgkS80=
github.com/fumiama/sqlite3 v1.20.0-with-win386 h1:ZR1AXGBEtkfq9GAXehOVcwn+aaCG8itrkgEsz4ggx5k=
github.com/fumiama/sqlite3 v1.20.0-with-win386/go.mod h1:Os58MHwYCcYZCy2PGChBrQtBAw5/LS1ZZOkfc+C/I7s=
+github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8 h1:mVOgOhlrF0ra8/BkwVA71ev/1HkzAgDn8gWU2UNbDU8=
+github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI=
github.com/fumiama/unibase2n v0.0.0-20221020155353-02876e777430 h1:XL4SnagpaVHYybnnj6whQxmt8Ps9/kaG6sCNn4X1GGA=
github.com/fumiama/unibase2n v0.0.0-20221020155353-02876e777430/go.mod h1:lEaZsT4FRSqcjnQ5q8y+mkenkzR/r1D3BJmfdp0vqDg=
github.com/gabriel-vasile/mimetype v1.0.4 h1:uBejfH8l3/2f+5vjl1e4xIaSyNEhRBZ5N/ij7ohpNd8=
@@ -87,14 +86,11 @@ github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebK
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
github.com/go-audio/wav v1.0.0/go.mod h1:3yoReyQOsiARkvPl3ERCi8JFjihzG6WhjYpZCf5zAWE=
-github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
-github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
-github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
@@ -102,21 +98,15 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGw
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
-github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
-github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
-github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
-github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hajimehoshi/go-mp3 v0.3.0/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM=
github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI=
github.com/hajimehoshi/oto v0.7.1 h1:I7maFPz5MBCwiutOrz++DLdbr4rTzBsbBuV2VpgU9kk=
github.com/hajimehoshi/oto v0.7.1/go.mod h1:wovJ8WWMfFKvP587mhHgot/MBr4DnNy9m6EepeVGnos=
-github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA=
github.com/jfreymuth/oggvorbis v1.0.1 h1:NT0eXBgE2WHzu6RT/6zcb2H10Kxj6Fm3PccT0LE6bqw=
@@ -166,9 +156,6 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/notnil/chess v1.9.0 h1:YMxR5kUVjtwcuFptGU0/3q7eG3MSHQNbg0VUekvRKV0=
github.com/notnil/chess v1.9.0/go.mod h1:cRuJUIBFq9Xki05TWHJxHYkC+fFpq45IWwk94DdlCrA=
-github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
-github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k=
-github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
@@ -181,12 +168,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
-github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
-github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
-github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM=
-github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
-github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE=
-github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/shirou/gopsutil/v3 v3.23.1 h1:a9KKO+kGLKEvcPIs4W62v0nu3sciVDOOOPUD0Hz7z/4=
@@ -196,7 +177,6 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
-github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@@ -216,9 +196,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.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/wdvxdr1123/ZeroBot v1.7.5-0.20240504170749-c9c0e1fe4915 h1:mBbZc7WDwlLQfYK4lQvsZ5djTVu5YsEOwJaBBk5dDOw=
+github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504170749-c9c0e1fe4915/go.mod h1:J6uHaXS/Am2VsLxF9TcU6il19PbOeC4SvgxHJ1E2jaE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
@@ -230,12 +209,9 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
-golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
+golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
-golang.org/x/exp v0.0.0-20221205204356-47842c84f3db h1:D/cFflL63o2KSLJIwjlcIt8PR064j/xsmdEJL/YvY/o=
-golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp/shiny v0.0.0-20221126150942-6ab00d035af9 h1:tLxpBz7qD8qFkRDC159unetNbxKp4zeqsqw2rLwvdxc=
golang.org/x/exp/shiny v0.0.0-20221126150942-6ab00d035af9/go.mod h1:VjAR7z0ngyATZTELrBSkxOOHhhlnVUxDye4mcjx5h/8=
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
@@ -252,10 +228,7 @@ golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
-golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
-golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -265,12 +238,10 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
-golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
-golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
+golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
+golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -278,12 +249,9 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -291,29 +259,24 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
-golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
+golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
-golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
-golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
-golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
-golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
diff --git a/kanban/banner/banner.go b/kanban/banner/banner.go
index 2ce6cc5485..d7d23bfde9 100644
--- a/kanban/banner/banner.go
+++ b/kanban/banner/banner.go
@@ -3,13 +3,13 @@
package banner
// Version ...
-var Version = "v1.7.7"
+var Version = "v1.7.8"
// Copyright ...
var Copyright = "© 2020 - 2024 FloatTech"
// Banner ...
var Banner = "* OneBot + ZeroBot + Golang\n" +
- "* Version " + Version + " - 2024-04-01 21:34:55 +0900 JST\n" +
+ "* Version " + Version + " - 2024-04-30 17:51:12 +0900 JST\n" +
"* Copyright " + Copyright + ". All Rights Reserved.\n" +
"* Project: https://github.com/FloatTech/ZeroBot-Plugin"
diff --git a/main.go b/main.go
index 66795b91f6..929d8c778c 100644
--- a/main.go
+++ b/main.go
@@ -62,18 +62,15 @@ import (
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ahsai" // ahsai tts
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/aifalse" // 服务器监控
- // _ "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/baidu" // 百度一下
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base16384" // base16384加解密
// _ "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/bookreview" // 哀伤雪刃吧推书记录
- // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi" // 藏头诗
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chess" // 国际象棋
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话
@@ -85,7 +82,6 @@ import (
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dish" // 程序员做饭指南
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签
- // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress" // 女装
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/driftbottle" // 漂流瓶
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理
@@ -96,16 +92,12 @@ import (
// _ "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/hitokoto" // 一言
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首
- // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/imgfinder" // 关键字搜图
// _ "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/lolimi" // 桑帛云 API
@@ -124,7 +116,6 @@ import (
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nwife" // 本地老婆
// _ "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" // 投胎
@@ -140,13 +131,9 @@ import (
// _ "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/vtbmusic" // vtb点歌
- // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtbquotation" // vtb语录
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包
- // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun" // 网易云音乐热评
// _ "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" // 聊天热词
@@ -195,6 +182,7 @@ import (
// //
// //
// -----------------------以下为内置依赖,勿动------------------------ //
+ "github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/process"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
@@ -235,6 +223,7 @@ func init() {
rsz := flag.Uint("r", 4096, "Receiving buffer ring size.")
maxpt := flag.Uint("x", 4, "Max process time (min).")
markmsg := flag.Bool("m", false, "Don't mark message as read automatically")
+ flag.BoolVar(&file.SkipOriginal, "mirror", false, "Use mirrored lazy data at first")
flag.Parse()
diff --git a/plugin/ai_reply/main.go b/plugin/ai_reply/main.go
index 40faff1714..e7e3158ea2 100644
--- a/plugin/ai_reply/main.go
+++ b/plugin/ai_reply/main.go
@@ -37,7 +37,7 @@ func init() { // 插件主体
PrivateDataFolder: "tts",
})
- enr := control.Register("aireply", &ctrl.Options[*zero.Ctx]{
+ enr := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
DisableOnDefault: false,
Brief: "人工智能回复",
Help: "- @Bot 任意文本(任意一句话回复)\n- 设置文字回复模式[婧枫|沫沫|青云客|小爱|ChatGPT]\n- 设置 ChatGPT api key xxx",
@@ -126,7 +126,7 @@ func init() { // 插件主体
}
})
ent.OnPrefix("设置语音回复模式", zero.AdminPermission).SetBlock(true).Handle(setReplyMode)
- ent.OnRegex(`^设置语音模式\s*([\S\D]*)\s+(\d*)$`, zero.AdminPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
+ ent.OnRegex(`^设置语音模式\s*([\S\D]*)\s*(\d*)$`, zero.AdminPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
param := ctx.State["regex_matched"].([]string)[1]
num := ctx.State["regex_matched"].([]string)[2]
n := 0
diff --git a/plugin/aipaint/aipaint.go b/plugin/aipaint/aipaint.go
deleted file mode 100644
index 6e370a644c..0000000000
--- a/plugin/aipaint/aipaint.go
+++ /dev/null
@@ -1,224 +0,0 @@
-// Package aipaint ai绘图
-package aipaint
-
-import (
- "encoding/base64"
- "encoding/json"
- "fmt"
- "net/url"
- "os"
- "regexp"
- "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/ctxext"
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
-)
-
-var (
- datapath string
- predictRe = regexp.MustCompile(`{"steps".+?}`)
- // 参考host http://91.217.139.190:5010 http://91.216.169.75:5010
- aipaintTxt2ImgURL = "/got_image?token=%v&tags=%v"
- aipaintImg2ImgURL = "/got_image2image?token=%v&tags=%v"
- cfg = newServerConfig("data/aipaint/config.json")
-)
-
-type result struct {
- Steps int `json:"steps"`
- Sampler string `json:"sampler"`
- Seed int `json:"seed"`
- Strength float64 `json:"strength"`
- Noise float64 `json:"noise"`
- Scale float64 `json:"scale"`
- Uc string `json:"uc"`
-}
-
-func (r *result) String() string {
- return fmt.Sprintf("steps: %v\nsampler: %v\nseed: %v\nstrength: %v\nnoise: %v\nscale: %v\nuc: %v\n", r.Steps, r.Sampler, r.Seed, r.Strength, r.Noise, r.Scale, r.Uc)
-}
-
-func init() { // 插件主体
- engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "ai绘图",
- Help: "- [ ai绘图 | 生成色图 | 生成涩图 | ai画图 ] xxx\n" +
- "- [ ai高级绘图 | 高级生成色图 | 高级生成涩图 | ai高级画图 ] [prompt]\n" +
- "- 设置ai绘图配置 [server] [token]\n" +
- "- 设置ai绘图撤回时间90s\n" +
- "- 查看ai绘图配置\n" +
- "Tips: 使用前请先前往 http://91.217.139.190:5010/token 按提示获取token" +
- "设置token示例(请确保是主人并且响应): 设置ai绘图配置 http://91.217.139.190:5010 [token] (中括号无需输入)\n" +
- "参考服务器 http://91.217.139.190:5010, http://91.216.169.75:5010, http://185.80.202.180:5010\n" +
- "[prompt]参数如下\n" +
- "tags:tag词条\nntags:ntag词条\nshape:[Portrait|Landscape|Square]\nscale:[6:20]\nseed:种子\nstrength:[0-1] 建议0-0.7\nnoise:[0-1] 建议0-0.15" +
- "参数与参数内容用:连接,每个参数之间用回车分割",
- PrivateDataFolder: "aipaint",
- })
- datapath = file.BOTPATH + "/" + engine.DataFolder()
- if file.IsNotExist(cfg.file) {
- s := serverConfig{}
- data, err := json.Marshal(s)
- if err != nil {
- panic(err)
- }
- err = os.WriteFile(cfg.file, data, 0666)
- if err != nil {
- panic(err)
- }
- }
- engine.OnPrefixGroup([]string{`ai绘图`, `生成色图`, `生成涩图`, `ai画图`}).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- err := cfg.load()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text("少女祈祷中..."))
- args := ctx.State["args"].(string)
- data, err := web.GetData(cfg.BaseURL + fmt.Sprintf(aipaintTxt2ImgURL, cfg.Token, url.QueryEscape(strings.TrimSpace(strings.ReplaceAll(args, " ", "%20")))))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- sendAiImg(ctx, data, cfg.Interval)
- })
- engine.OnPrefixGroup([]string{`ai高级绘图`, `高级生成色图`, `高级生成涩图`, `ai高级画图`}).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- err := cfg.load()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- tags := make(map[string]string)
- args := strings.Split(ctx.State["args"].(string), "\n")
- if len(args) < 1 {
- ctx.SendChain(message.Text("ERROR: 请输入正确的参数"))
- return
- }
- for _, info := range args {
- value := strings.Split(info, ":")
- if len(value) > 1 {
- if value[0] == "R18" && value[1] == "1" {
- value[1] = "0"
- ctx.SendChain(message.Text("不准涩涩! 已将R18设置为0. "))
- }
- tags[value[0]] = strings.Join(value[1:], ":")
- }
- }
- ctx.SendChain(message.Text("少女祈祷中..."))
- apiurl := "/got_image?token=" + cfg.Token
- if _, ok := tags["tags"]; ok {
- apiurl += "&tags=" + url.QueryEscape(strings.ReplaceAll(strings.TrimSpace(tags["tags"]), " ", "%20"))
- }
- if _, ok := tags["ntags"]; ok {
- apiurl += "&ntags=" + url.QueryEscape(strings.ReplaceAll(strings.TrimSpace(tags["ntags"]), " ", "%20"))
- }
- if _, ok := tags["R18"]; ok {
- apiurl += "&R18=" + url.QueryEscape(strings.TrimSpace(tags["R18"]))
- }
- if _, ok := tags["shape"]; ok {
- apiurl += "&shape=" + url.QueryEscape(strings.TrimSpace(tags["shape"]))
- }
- if _, ok := tags["scale"]; ok {
- apiurl += "&scale=" + url.QueryEscape(strings.TrimSpace(tags["scale"]))
- }
- if _, ok := tags["seed"]; ok {
- apiurl += "&seed=" + url.QueryEscape(strings.TrimSpace(tags["seed"]))
- }
- if _, ok := tags["strength"]; ok {
- apiurl += "&strength=" + url.QueryEscape(strings.TrimSpace(tags["strength"]))
- }
- if _, ok := tags["noise"]; ok {
- apiurl += "&noise=" + url.QueryEscape(strings.TrimSpace(tags["noise"]))
- }
- data, err := web.GetData(cfg.BaseURL + apiurl)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- sendAiImg(ctx, data, cfg.Interval)
- })
- engine.OnRegex(`^设置ai绘图配置\s(.*[^\s$])\s(.+)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- regexMatched := ctx.State["regex_matched"].([]string)
- err := cfg.load()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- err = cfg.update(regexMatched[1], regexMatched[2], cfg.Interval)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text("成功设置\nbase_url: ", cfg.BaseURL, "\ntoken: ", cfg.Token, "\ninterval: ", cfg.Interval))
- })
- engine.OnRegex(`^设置ai绘图撤回时间(\d{1,3})s$`, zero.SuperUserPermission).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- regexMatched := ctx.State["regex_matched"].([]string)
- interval, err := strconv.Atoi(regexMatched[1])
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- err = cfg.load()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- err = cfg.update(cfg.BaseURL, cfg.Token, interval)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text("成功设置撤回时间为", cfg.Interval, "s"))
- })
- engine.OnFullMatch(`查看ai绘图配置`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- err := cfg.load()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text("base_url: ", cfg.BaseURL, "\ntoken: ", cfg.Token, "\ninterval: ", cfg.Interval))
- })
-}
-
-func sendAiImg(ctx *zero.Ctx, data []byte, interval int) {
- var loadData string
- if predictRe.MatchString(binary.BytesToString(data)) {
- loadData = predictRe.FindStringSubmatch(binary.BytesToString(data))[0]
- }
- var r result
- if loadData != "" {
- err := json.Unmarshal(binary.StringToBytes(loadData), &r)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- r.Uc, err = url.QueryUnescape(r.Uc)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- }
- encodeStr := base64.StdEncoding.EncodeToString(data)
- m := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Image("base64://"+encodeStr))}
- m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Text(r.String())))
- if mid := ctx.Send(m); mid.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待"))
- } else if interval > 0 {
- go func(i message.MessageID) {
- time.Sleep(time.Duration(interval) * time.Second)
- ctx.DeleteMessage(i)
- }(mid)
- }
-}
diff --git a/plugin/aipaint/config.go b/plugin/aipaint/config.go
deleted file mode 100644
index 12f80967d1..0000000000
--- a/plugin/aipaint/config.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package aipaint
-
-import (
- "encoding/json"
- "errors"
- "os"
-
- "github.com/FloatTech/floatbox/file"
-)
-
-// 配置结构体
-type serverConfig struct {
- BaseURL string `json:"base_url"`
- Token string `json:"token"`
- Interval int `json:"interval"`
- file string
-}
-
-func newServerConfig(file string) *serverConfig {
- return &serverConfig{
- file: file,
- }
-}
-
-func (cfg *serverConfig) update(baseURL, token string, interval int) (err error) {
- if baseURL != "" {
- cfg.BaseURL = baseURL
- }
- if token != "" {
- cfg.Token = token
- }
- cfg.Interval = interval
- reader, err := os.Create(cfg.file)
- if err != nil {
- return err
- }
- defer reader.Close()
- return json.NewEncoder(reader).Encode(cfg)
-}
-
-func (cfg *serverConfig) load() (err error) {
- if cfg.BaseURL != "" && cfg.Token != "" && cfg.Interval != 0 {
- return
- }
- if file.IsNotExist(cfg.file) {
- err = errors.New("no server config")
- return
- }
- reader, err := os.Open(cfg.file)
- if err != nil {
- return
- }
- defer reader.Close()
- err = json.NewDecoder(reader).Decode(cfg)
- return
-}
diff --git a/plugin/aipaint/context.go b/plugin/aipaint/context.go
deleted file mode 100644
index 5e7dbc96db..0000000000
--- a/plugin/aipaint/context.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package aipaint
-
-import (
- "os"
- "strconv"
- "strings"
-
- "github.com/FloatTech/floatbox/file"
- "github.com/FloatTech/floatbox/process"
-)
-
-type context struct {
- usrdir string
- headimgsdir []string
-}
-
-func newContext(user int64) *context {
- c := new(context)
- c.usrdir = datapath + "users/" + strconv.FormatInt(user, 10) + `/`
- _ = os.MkdirAll(c.usrdir, 0755)
- c.headimgsdir = make([]string, 2)
- c.headimgsdir[0] = c.usrdir + "0.gif"
- c.headimgsdir[1] = c.usrdir + "1.gif"
- return c
-}
-
-func (cc *context) prepareLogos(s ...string) error {
- for i, v := range s {
- _, err := strconv.Atoi(v)
- if err != nil {
- err = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif")
- } else {
- err = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif")
- }
- if err != nil {
- return err
- }
- process.SleepAbout1sTo2s()
- }
- return nil
-}
diff --git a/plugin/aipaint/img2img.go b/plugin/aipaint/img2img.go
deleted file mode 100644
index 75c48ba782..0000000000
--- a/plugin/aipaint/img2img.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Package aipaint ai绘图
-package aipaint
-
-import (
- "bytes"
- "fmt"
- "image"
- "net/url"
- "os"
- "strconv"
- "strings"
-
- "github.com/FloatTech/floatbox/file"
- "github.com/FloatTech/floatbox/web"
- "github.com/FloatTech/imgfactory"
- ctrl "github.com/FloatTech/zbpctrl"
- "github.com/FloatTech/zbputils/control"
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
-)
-
-func init() { // 插件主体
- engine := control.Register("img2img", &ctrl.Options[*zero.Ctx]{
- DisableOnDefault: true,
- Brief: "以图绘图",
- Help: "- [ 以图绘图 | 以图生图 | 以图画图 ] xxx [图片]|@xxx|[qq号]\n" +
- "- 官方以图绘图api已失效 需要自建api 其他配置参数同ai绘图",
- PrivateDataFolder: "img2img",
- })
- datapath = file.BOTPATH + "/" + engine.DataFolder()
- engine.OnRegex(`^(以图绘图|以图生图|以图画图)[\s\S]*?(\[CQ:(image\,file=([0-9a-zA-Z]{32}).*|at.+?(\d{5,11}))\].*|(\d+))$`).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- err := cfg.load()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- c := newContext(ctx.Event.UserID)
- list := ctx.State["regex_matched"].([]string)
- err = c.prepareLogos(list[4]+list[5]+list[6], strconv.FormatInt(ctx.Event.UserID, 10))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- args := strings.TrimSuffix(strings.TrimPrefix(list[0], list[1]), list[2])
- if args == "" {
- ctx.SendChain(message.Text("ERROR: 以图绘图必须添加tag"))
- return
- }
- ctx.SendChain(message.Text("少女祈祷中..."))
- postURL := cfg.BaseURL + fmt.Sprintf(aipaintImg2ImgURL, cfg.Token, url.QueryEscape(strings.TrimSpace(strings.ReplaceAll(args, " ", "%20"))))
-
- f, err := os.Open(c.headimgsdir[0])
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- defer f.Close()
-
- img, _, err := image.Decode(f)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- imageShape := ""
- switch {
- case img.Bounds().Dx() > img.Bounds().Dy():
- imageShape = "Landscape"
- case img.Bounds().Dx() == img.Bounds().Dy():
- imageShape = "Square"
- default:
- imageShape = "Portrait"
- }
-
- // 图片转base64
- base64Bytes, err := imgfactory.ToBase64(img)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- data, err := web.PostData(postURL+"&shape="+imageShape, "text/plain", bytes.NewReader(base64Bytes))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- sendAiImg(ctx, data, cfg.Interval)
- })
-}
diff --git a/plugin/atri/atri.go b/plugin/atri/atri.go
index cb0fcfffb7..9367315889 100644
--- a/plugin/atri/atri.go
+++ b/plugin/atri/atri.go
@@ -53,7 +53,7 @@ func init() { // 插件主体
Brief: "atri人格文本回复",
Help: "本插件基于 ATRI ,为 Golang 移植版\n" +
"- ATRI醒醒\n- ATRI睡吧\n- 萝卜子\n- 喜欢 | 爱你 | 爱 | suki | daisuki | すき | 好き | 贴贴 | 老婆 | 亲一个 | mua\n" +
- "- 草你妈 | 操你妈 | 脑瘫 | 废柴 | fw | 废物 | 战斗 | 爬 | 爪巴 | sb | SB | 傻B\n- 早安 | 早哇 | 早上好 | ohayo | 哦哈哟 | お早う | 早好 | 早 | 早早早\n" +
+ "- 草你妈 | 操你妈 | 脑瘫 | 废柴 | fw | 废物 | 战斗 | 爬 | 爪巴 | sb | SB | 傻B\n- 早哇 | 早上好 | ohayo | 哦哈哟 | お早う | 早好 | 早 | 早早早\n" +
"- 中午好 | 午安 | 午好\n- 晚安 | oyasuminasai | おやすみなさい | 晚好 | 晚上好\n- 高性能 | 太棒了 | すごい | sugoi | 斯国一 | よかった\n" +
"- 没事 | 没关系 | 大丈夫 | 还好 | 不要紧 | 没出大问题 | 没伤到哪\n- 好吗 | 是吗 | 行不行 | 能不能 | 可不可以\n- 啊这\n- 我好了\n- ? | ? | ¿\n" +
"- 离谱\n- 答应我",
@@ -84,7 +84,7 @@ func init() { // 插件主体
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(dgtr.randImage("FN.jpg", "WQ.jpg", "WQ1.jpg"))
})
- engine.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早", "早早早"}).SetBlock(true).
+ engine.OnFullMatchGroup([]string{"早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早", "早早早"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
switch {
diff --git a/plugin/baidu/search.go b/plugin/baidu/search.go
deleted file mode 100644
index 91ac83f06a..0000000000
--- a/plugin/baidu/search.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Package baidu 百度百科
-package baidu
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
-
- "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"
-)
-
-const (
- duURL = "https://api.a20safe.com/api.php?api=21&key=%s&text=%s" // api地址
- wikiURL = "https://api.a20safe.com/api.php?api=23&key=%s&text=%s"
- key = "7d06a110e9e20a684e02934549db1d3d"
-)
-
-type result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data []struct {
- Content string `json:"content"`
- } `json:"data"`
-}
-
-func init() { // 主函数
- en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Help: "百科\n" +
- "- 百度/百科/维基/wiki[关键字]",
- })
- en.OnRegex(`^(百度|维基|百科|wiki)\s*(.+)$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
- var es []byte
- var err error
- switch ctx.State["regex_matched"].([]string)[1] {
- case "百度", "百科":
- es, err = web.GetData(fmt.Sprintf(duURL, key, url.QueryEscape(ctx.State["regex_matched"].([]string)[2]))) // 将网站返回结果赋值
- case "wiki", "维基":
- es, err = web.GetData(fmt.Sprintf(wikiURL, key, url.QueryEscape(ctx.State["regex_matched"].([]string)[2]))) // 将网站返回结果赋值
- }
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏:", err))
- return
- }
- var r result // r数组
- err = json.Unmarshal(es, &r) // 填api返回结果,struct地址
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏:", err))
- return
- }
- if r.Code == 0 && len(r.Data) > 0 {
- ctx.SendChain(message.Text(r.Data[0].Content)) // 输出提取后的结果
- } else {
- ctx.SendChain(message.Text("API访问错误"))
- }
- })
-}
diff --git a/plugin/baiduaudit/model.go b/plugin/baiduaudit/model.go
index 34b97fc10a..e5dd8caf77 100644
--- a/plugin/baiduaudit/model.go
+++ b/plugin/baiduaudit/model.go
@@ -31,8 +31,6 @@ func (bdres *baiduRes) audit(ctx *zero.Ctx, configpath string) {
if bdres.ConclusionType != 2 {
return
}
- // 创建消息ID
- mid := message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64))
// 获取群配置
group := config.groupof(ctx.Event.GroupID)
// 检测群配置里的不检测类型白名单, 忽略掉不检测的违规类型
@@ -44,7 +42,7 @@ func (bdres *baiduRes) audit(ctx *zero.Ctx, configpath string) {
// 生成回复文本
res := group.reply(bdres)
// 撤回消息
- ctx.DeleteMessage(mid)
+ ctx.DeleteMessage(ctx.Event.MessageID)
// 查看是否启用撤回后禁言
if group.DMBAN {
// 从历史违规记录中获取指定用户
diff --git a/plugin/bilibili/bilibili_parse.go b/plugin/bilibili/bilibili_parse.go
index 5b28c077a8..ad628edafd 100644
--- a/plugin/bilibili/bilibili_parse.go
+++ b/plugin/bilibili/bilibili_parse.go
@@ -2,10 +2,15 @@
package bilibili
import (
+ "encoding/json"
+ "fmt"
+ "net/http"
"regexp"
+ "strings"
"time"
bz "github.com/FloatTech/AnimeAPI/bilibili"
+ "github.com/FloatTech/floatbox/web"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
@@ -13,6 +18,11 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
)
+const (
+ enableHex = 0x10
+ unableHex = 0x7fffffff_fffffffd
+)
+
var (
limit = ctxext.NewLimiterManager(time.Second*10, 1)
searchVideo = `bilibili.com\\?/video\\?/(?:av(\d+)|([bB][vV][0-9a-zA-Z]+))`
@@ -32,10 +42,11 @@ func init() {
Brief: "b站链接解析",
Help: "例:- t.bilibili.com/642277677329285174\n- bilibili.com/read/cv17134450\n- bilibili.com/video/BV13B4y1x7pS\n- live.bilibili.com/22603245 ",
})
- en.OnRegex(`((b23|acg).tv|bili2233.cn)/[0-9a-zA-Z]+`).SetBlock(true).Limit(limit.LimitByGroup).
+ en.OnRegex(`((b23|acg).tv|bili2233.cn)\\?/[0-9a-zA-Z]+`).SetBlock(true).Limit(limit.LimitByGroup).
Handle(func(ctx *zero.Ctx) {
- url := ctx.State["regex_matched"].([]string)[0]
- realurl, err := bz.GetRealURL("https://" + url)
+ u := ctx.State["regex_matched"].([]string)[0]
+ u = strings.ReplaceAll(u, "\\", "")
+ realurl, err := bz.GetRealURL("https://" + u)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
@@ -55,6 +66,35 @@ func init() {
handleLive(ctx)
}
})
+ en.OnRegex(`^(开启|打开|启用|关闭|关掉|禁用)视频总结$`, zero.AdminPermission).SetBlock(true).
+ Handle(func(ctx *zero.Ctx) {
+ gid := ctx.Event.GroupID
+ if gid <= 0 {
+ // 个人用户设为负数
+ gid = -ctx.Event.UserID
+ }
+ option := ctx.State["regex_matched"].([]string)[1]
+ c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
+ if !ok {
+ ctx.SendChain(message.Text("找不到服务!"))
+ return
+ }
+ data := c.GetData(ctx.Event.GroupID)
+ switch option {
+ case "开启", "打开", "启用":
+ data |= enableHex
+ case "关闭", "关掉", "禁用":
+ data &= unableHex
+ default:
+ return
+ }
+ err := c.SetData(gid, data)
+ if err != nil {
+ ctx.SendChain(message.Text("出错啦: ", err))
+ return
+ }
+ ctx.SendChain(message.Text("已", option, "视频总结"))
+ })
en.OnRegex(searchVideo).SetBlock(true).Limit(limit.LimitByGroup).Handle(handleVideo)
en.OnRegex(searchDynamic).SetBlock(true).Limit(limit.LimitByGroup).Handle(handleDynamic)
en.OnRegex(searchArticle).SetBlock(true).Limit(limit.LimitByGroup).Handle(handleArticle)
@@ -76,12 +116,15 @@ func handleVideo(ctx *zero.Ctx) {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
- summaryMsg, err := getVideoSummary(card)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
+ c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
+ if ok && c.GetData(ctx.Event.GroupID)&enableHex == enableHex {
+ summaryMsg, err := getVideoSummary(cfg, card)
+ if err != nil {
+ msg = append(msg, message.Text("ERROR: ", err))
+ } else {
+ msg = append(msg, summaryMsg...)
+ }
}
- msg = append(msg, summaryMsg...)
ctx.SendChain(msg...)
}
@@ -111,3 +154,38 @@ func handleLive(ctx *zero.Ctx) {
}
ctx.SendChain(liveCard2msg(card)...)
}
+
+// getVideoSummary AI视频总结
+func getVideoSummary(cookiecfg *bz.CookieConfig, card bz.Card) (msg []message.MessageSegment, err error) {
+ var (
+ data []byte
+ videoSummary bz.VideoSummary
+ )
+ data, err = web.RequestDataWithHeaders(web.NewDefaultClient(), bz.SignURL(fmt.Sprintf(bz.VideoSummaryURL, card.BvID, card.CID, card.Owner.Mid)), "GET", func(req *http.Request) error {
+ if cookiecfg != nil {
+ cookie := ""
+ cookie, err = cookiecfg.Load()
+ if err != nil {
+ return err
+ }
+ req.Header.Add("cookie", cookie)
+ }
+ req.Header.Set("User-Agent", ua)
+ return nil
+ }, nil)
+ if err != nil {
+ return
+ }
+ err = json.Unmarshal(data, &videoSummary)
+ msg = make([]message.MessageSegment, 0, 16)
+ msg = append(msg, message.Text("已为你生成视频总结\n\n"))
+ msg = append(msg, message.Text(videoSummary.Data.ModelResult.Summary, "\n\n"))
+ for _, v := range videoSummary.Data.ModelResult.Outline {
+ msg = append(msg, message.Text("● ", v.Title, "\n"))
+ for _, p := range v.PartOutline {
+ msg = append(msg, message.Text(fmt.Sprintf("%d:%d %s\n", p.Timestamp/60, p.Timestamp%60, p.Content)))
+ }
+ msg = append(msg, message.Text("\n"))
+ }
+ return
+}
diff --git a/plugin/bilibili/card2msg.go b/plugin/bilibili/card2msg.go
index 55868a31e0..5d3b2f3fe0 100644
--- a/plugin/bilibili/card2msg.go
+++ b/plugin/bilibili/card2msg.go
@@ -2,12 +2,10 @@ package bilibili
import (
"encoding/json"
- "fmt"
"time"
bz "github.com/FloatTech/AnimeAPI/bilibili"
"github.com/FloatTech/floatbox/binary"
- "github.com/FloatTech/floatbox/web"
"github.com/wdvxdr1123/ZeroBot/message"
)
@@ -326,27 +324,3 @@ func videoCard2msg(card bz.Card) (msg []message.MessageSegment, err error) {
bz.VURL, card.BvID, "\n\n"))
return
}
-
-// getVideoSummary AI视频总结
-func getVideoSummary(card bz.Card) (msg []message.MessageSegment, err error) {
- var (
- data []byte
- videoSummary bz.VideoSummary
- )
- data, err = web.GetData(bz.SignURL(fmt.Sprintf(bz.VideoSummaryURL, card.BvID, card.CID)))
- if err != nil {
- return
- }
- err = json.Unmarshal(data, &videoSummary)
- msg = make([]message.MessageSegment, 0, 16)
- msg = append(msg, message.Text("已为你生成视频总结\n\n"))
- msg = append(msg, message.Text(videoSummary.Data.ModelResult.Summary, "\n\n"))
- for _, v := range videoSummary.Data.ModelResult.Outline {
- msg = append(msg, message.Text("● ", v.Title, "\n"))
- for _, p := range v.PartOutline {
- msg = append(msg, message.Text(fmt.Sprintf("%d:%d %s\n", p.Timestamp/60, p.Timestamp%60, p.Content)))
- }
- msg = append(msg, message.Text("\n"))
- }
- return
-}
diff --git a/plugin/bilibili/card2msg_test.go b/plugin/bilibili/card2msg_test.go
index e56a5c8f3d..5c43c8491c 100644
--- a/plugin/bilibili/card2msg_test.go
+++ b/plugin/bilibili/card2msg_test.go
@@ -46,14 +46,6 @@ func TestVideoInfo(t *testing.T) {
t.Log(videoCard2msg(card))
}
-func TestGetVideoSummary(t *testing.T) {
- card, err := bz.GetVideoInfo("BV1mF411j7iU")
- if err != nil {
- t.Fatal(err)
- }
- t.Log(getVideoSummary(card))
-}
-
func TestLiveRoomInfo(t *testing.T) {
card, err := bz.GetLiveRoomInfo("83171")
if err != nil {
diff --git a/plugin/cangtoushi/cangtoushi.go b/plugin/cangtoushi/cangtoushi.go
deleted file mode 100644
index 74e5455a42..0000000000
--- a/plugin/cangtoushi/cangtoushi.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Package cangtoushi 藏头诗
-package cangtoushi
-
-import (
- "fmt"
- "io"
- "net/http"
- "net/http/cookiejar"
- "net/url"
- "strings"
-
- ctrl "github.com/FloatTech/zbpctrl"
- "github.com/FloatTech/zbputils/control"
- "github.com/antchfx/htmlquery"
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
- "github.com/wdvxdr1123/ZeroBot/utils/helper"
-)
-
-const (
- loginURL = "https://www.shicimingju.com/cangtoushi/"
- searchURL = "https://www.shicimingju.com/cangtoushi/index.html"
- ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
- referer = "https://www.shicimingju.com/cangtoushi/index.html"
-)
-
-var (
- gCurCookieJar *cookiejar.Jar
- csrf string
-)
-
-func init() {
- engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "藏头诗, 藏尾诗",
- Help: "- 藏头诗[xxx]\n- 藏尾诗[xxx]",
- })
- engine.OnRegex(`藏头诗\s?([一-龥]{3,10})$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
- kw := ctx.State["regex_matched"].([]string)[1]
- err := login()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- data, err := search(kw, "7", "0")
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- text, err := dealHTML(helper.BytesToString(data))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text(text))
- })
-
- engine.OnRegex(`藏尾诗\s?([一-龥]{3,10})$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
- kw := ctx.State["regex_matched"].([]string)[1]
- err := login()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- data, err := search(kw, "7", "2")
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- text, err := dealHTML(helper.BytesToString(data))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text(text))
- })
-}
-
-func login() error {
- gCurCookieJar, _ = cookiejar.New(nil)
- client := &http.Client{
- Jar: gCurCookieJar,
- }
- request, err := http.NewRequest("GET", loginURL, nil)
- if err != nil {
- return err
- }
- request.Header.Add("User-Agent", ua)
- response, err := client.Do(request)
- if err != nil {
- return err
- }
- data, err := io.ReadAll(response.Body)
- if err != nil {
- return err
- }
- response.Body.Close()
- doc, err := htmlquery.Parse(strings.NewReader(helper.BytesToString(data)))
- if err != nil {
- return err
- }
- csrf = htmlquery.SelectAttr(htmlquery.FindOne(doc, "//input[@name='_csrf']"), "value")
- return nil
-}
-
-func search(kw, zishu, position string) (data []byte, err error) {
- postStr := fmt.Sprintf("_csrf=%s&kw=%s&zishu=%s&position=%s", url.QueryEscape(csrf), url.QueryEscape(kw), zishu, position)
- client := &http.Client{
- Jar: gCurCookieJar,
- }
- request, err := http.NewRequest("POST", searchURL, strings.NewReader(postStr))
- if err != nil {
- return nil, err
- }
- request.Header.Add("Referer", referer)
- request.Header.Add("User-Agent", ua)
- request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
- response, err := client.Do(request)
- if err != nil {
- return nil, err
- }
- data, err = io.ReadAll(response.Body)
- if err != nil {
- return nil, err
- }
- response.Body.Close()
- return
-}
-
-func dealHTML(data string) (text string, err error) {
- doc, err := htmlquery.Parse(strings.NewReader(data))
- if err != nil {
- return "", err
- }
- text = htmlquery.InnerText(htmlquery.FindOne(doc, "//div[@class='card']/div[@class='card']"))
- text = strings.ReplaceAll(text, " ", "")
- text = strings.Replace(text, "\n", "", 1)
- return text, nil
-}
diff --git a/plugin/coser/coser.go b/plugin/coser/coser.go
index 201099d6f8..62cfd5c05e 100644
--- a/plugin/coser/coser.go
+++ b/plugin/coser/coser.go
@@ -23,7 +23,7 @@ import (
var (
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
- coserURL = "http://ovooa.com/API/cosplay/api.php"
+ coserURL = "https://picture.yinux.workers.dev"
)
func init() {
diff --git a/plugin/dailynews/dailynews.go b/plugin/dailynews/dailynews.go
index a36b635d3b..23fe37d628 100644
--- a/plugin/dailynews/dailynews.go
+++ b/plugin/dailynews/dailynews.go
@@ -24,14 +24,11 @@ func init() {
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
}
+ picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String()
ctx.SendChain(message.Image(picURL))
})
}
diff --git a/plugin/dish/dish.go b/plugin/dish/dish.go
index d6b5e2b002..dd70295e85 100644
--- a/plugin/dish/dish.go
+++ b/plugin/dish/dish.go
@@ -90,7 +90,7 @@ func init() {
))
})
- en.OnPrefixGroup([]string{"随机菜谱", "随便做点菜"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
+ en.OnFullMatchGroup([]string{"随机菜谱", "随便做点菜"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
if !initialized {
ctx.SendChain(message.Text("客官,本店暂未开业"))
return
diff --git a/plugin/drawlots/main.go b/plugin/drawlots/main.go
index 8f3a6ad265..67edaea2a9 100644
--- a/plugin/drawlots/main.go
+++ b/plugin/drawlots/main.go
@@ -5,13 +5,15 @@ import (
"bytes"
"errors"
"image"
- "image/color"
+ "image/draw"
"image/gif"
+ "io"
"math/rand"
"os"
"strconv"
"strings"
+ fcext "github.com/FloatTech/floatbox/ctxext"
"github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/web"
"github.com/FloatTech/imgfactory"
@@ -89,7 +91,7 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("file:///"+picPath))
return
}
- lotsImg, err := randGif(lotsType + "." + fileInfo.lotsType)
+ lotsImg, err := randGif(lotsType+"."+fileInfo.lotsType, ctx.Event.UserID)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
@@ -228,27 +230,48 @@ func randFile(path string, indexMax int) (string, error) {
return "", errors.New("图包[" + path + "]不存在签内容!")
}
-func randGif(gifName string) (image.Image, error) {
+func randGif(gifName string, uid int64) (image.Image, error) {
name := datapath + gifName
file, err := os.Open(name)
if err != nil {
return nil, err
}
im, err := gif.DecodeAll(file)
- _ = file.Close()
if err != nil {
return nil, err
}
- /*
- firstImg, err := imgfactory.Load(name)
- if err != nil {
- return nil, err
+ _, err = file.Seek(0, io.SeekStart)
+ if err != nil {
+ return nil, err
+ }
+ config, err := gif.DecodeConfig(file)
+ if err != nil {
+ return nil, err
+ }
+ _ = file.Close()
+ // https://zhuanlan.zhihu.com/p/27718135
+ rect := image.Rect(0, 0, config.Width, config.Height)
+ if rect.Min == rect.Max {
+ var max image.Point
+ for _, frame := range im.Image {
+ maxF := frame.Bounds().Max
+ if max.X < maxF.X {
+ max.X = maxF.X
+ }
+ if max.Y < maxF.Y {
+ max.Y = maxF.Y
+ }
}
- v := im.Image[rand.Intn(len(im.Image))]
- return imgfactory.Size(firstImg, firstImg.Bounds().Dx(), firstImg.Bounds().Dy()).InsertUpC(v, 0, 0, firstImg.Bounds().Dx()/2, firstImg.Bounds().Dy()/2).Clone().Image(),err
- /*/
- // 如果gif图片出现信息缺失请使用上面注释掉的代码,把下面注释了(上面代码部分图存在bug)
- v := im.Image[rand.Intn(len(im.Image))]
- return imgfactory.NewFactoryBG(v.Rect.Dx(), v.Rect.Dy(), color.NRGBA{0, 0, 0, 255}).InsertUp(v, 0, 0, 0, 0).Clone().Image(), err
- // */
+ rect.Max = max
+ }
+ img := image.NewRGBA(rect)
+ b := fcext.RandSenderPerDayN(uid, len(im.Image)) + 1
+ a := 0
+ if b > 8 {
+ a = b - 8
+ }
+ for _, srcimg := range im.Image[a:b] {
+ draw.Draw(img, srcimg.Bounds(), srcimg, srcimg.Rect.Min, draw.Over)
+ }
+ return img, err
}
diff --git a/plugin/dress/api.go b/plugin/dress/api.go
deleted file mode 100644
index f0ec077511..0000000000
--- a/plugin/dress/api.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package dress
-
-import (
- "fmt"
-
- "github.com/FloatTech/floatbox/web"
- "github.com/tidwall/gjson"
-)
-
-const (
- dressURL = "http://www.yoooooooooo.com/gitdress"
- male = "dress"
- female = "girldress"
- dressListURL = dressURL + "/%v/album/list.json"
- dressDetailURL = dressURL + "/%v/album/%v/info.json"
- dressImageURL = dressURL + "/%v/album/%v/%v-m.webp"
-)
-
-func dressList(sex string) (dressList []string, err error) {
- data, err := web.GetData(fmt.Sprintf(dressListURL, sex))
- if err != nil {
- return
- }
- arr := gjson.ParseBytes(data).Get("@this").Array()
- dressList = make([]string, len(arr))
- for i, v := range arr {
- dressList[i] = v.String()
- }
- return
-}
-
-func detail(sex, name string) (count int, err error) {
- data, err := web.GetData(fmt.Sprintf(dressDetailURL, sex, name))
- if err != nil {
- return
- }
- count = int(gjson.ParseBytes(data).Get("@this.#").Int())
- return
-}
diff --git a/plugin/dress/dress.go b/plugin/dress/dress.go
deleted file mode 100644
index d8f7407b41..0000000000
--- a/plugin/dress/dress.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Package dress 女装
-package dress
-
-import (
- "fmt"
- "math/rand"
- "strconv"
- "strings"
- "time"
-
- "github.com/FloatTech/floatbox/binary"
- ctrl "github.com/FloatTech/zbpctrl"
- "github.com/FloatTech/zbputils/control"
- "github.com/FloatTech/zbputils/ctxext"
- "github.com/FloatTech/zbputils/img/text"
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
-)
-
-func init() { // 插件主体
- engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "女装",
- Help: "女装\n" +
- "- 女装\n" +
- "- 男装\n" +
- "- 随机女装\n" +
- "- 随机男装",
- PrivateDataFolder: "dress",
- })
- engine.OnFullMatchGroup([]string{"女装", "男装"}).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- matched := ctx.State["matched"].(string)
- sex := male
- if matched == "男装" {
- sex = female
- }
- next := zero.NewFutureEvent("message", 999, false, ctx.CheckSession())
- recv, cancel := next.Repeat()
- defer cancel()
- nameList, err := dressList(sex)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- tex := "请输入" + matched + "序号\n"
- for i, v := range nameList {
- tex += fmt.Sprintf("%d. %s\n", i, v)
- }
- base64Str, err := text.RenderToBase64(tex, text.FontFile, 400, 20)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Image("base64://" + binary.BytesToString(base64Str)))
- for {
- select {
- case <-time.After(time.Second * 120):
- ctx.SendChain(message.Text(matched, "指令过期"))
- return
- case c := <-recv:
- msg := c.Event.Message.ExtractPlainText()
- num, err := strconv.Atoi(msg)
- if err != nil {
- ctx.SendChain(message.Text("请输入数字!"))
- continue
- }
- if num < 0 || num >= len(nameList) {
- ctx.SendChain(message.Text("序号非法!"))
- continue
- }
- name := nameList[num]
- sendImage(ctx, sex, matched, name)
- return
- }
- }
- })
- engine.OnFullMatchGroup([]string{"随机女装", "随机男装"}).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- matched := strings.TrimPrefix(ctx.State["matched"].(string), "随机")
- sex := male
- if matched == "男装" {
- sex = female
- }
- nameList, err := dressList(sex)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- name := nameList[rand.Intn(len(nameList))]
- sendImage(ctx, sex, matched, name)
- })
-}
-
-func sendImage(ctx *zero.Ctx, sex, matched, name string) {
- ctx.SendChain(message.Text("请欣赏", matched, ": ", name))
- count, err := detail(sex, name)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- imageList := make([]string, count)
- for i := range imageList {
- imageList[i] = fmt.Sprintf(dressImageURL, sex, name, i+1)
- }
- m := message.Message{}
- for _, v := range imageList {
- m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Image(v)))
- }
- if id := ctx.Send(m).ID(); id == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待"))
- }
-}
diff --git a/plugin/emojimix/emoji.go b/plugin/emojimix/emoji.go
index 487ff3ba6f..b892153b25 100644
--- a/plugin/emojimix/emoji.go
+++ b/plugin/emojimix/emoji.go
@@ -195,55 +195,3 @@ var emojis = map[rune]int64{
127819: 20210521, // 🍋 lemon
127818: 20211115, // 🍊 tangerine orange
}
-
-var qqface = map[int]rune{
- 0: 128558, // 😮 face exhaling
- 1: 128556, // 😬 grimacing face
- 2: 128525, // 😍 smiling face with heart-eyes
- 4: 128526, // 😎 smiling face with sunglasses
- 5: 128557, // 😭 loudly crying face
- 6: 129402, // 🥺 pleading face
- 7: 129296, // 🤐 zipper-mouth face
- 8: 128554, // 😪 sleepy face
- 11: 128545, // 😡 pouting face
- 12: 128539, // 😛 face with tongue
- 13: 128513, // 😁 beaming face with smiling eyes
- 14: 128578, // 🙂 slightly smiling face
- 15: 128577, // 🙁 slightly frowning face
- 16: 128526, // 😎 smiling face with sunglasses
- 19: 129326, // 🤮 face vomiting throw
- 20: 129325, // 🤭 face with hand over mouth embarrassed
- 21: 128522, // 😊 smiling face with smiling eyes
- 23: 128533, // 😕 confused face
- 24: 128523, // 😋 face savoring food
- 27: 128531, // 😓 downcast face with sweat
- 28: 128516, // 😄 grinning face with smiling eyes
- 31: 129324, // 🤬 face with symbols on mouth
- 32: 129300, // 🤔 thinking face question hmmm
- 33: 129323, // 🤫 shushing face quiet whisper
- 34: 128565, // 😵 face with crossed-out eyes
- 35: 128547, // 😣 persevering face
- 37: 128128, // 💀 skull
- 46: 128055, // 🐷 pig face
- 53: 127874, // 🎂 birthday cake
- 59: 128169, // 💩 pile of poo
- 60: 9749, // ☕ hot beverage coffee cup tea
- 63: 127801, // 🌹 rose flower
- 66: 10084, // ❤ mending heart
- 67: 128148, // 💔 broken heart
- 69: 127873, // 🎁 wrapped-gift
- 74: 127774, // 🌞 sun with face
- 75: 127772, // 🌜 last quarter moon face
- 96: 128517, // 😅 grinning face with sweat
- 104: 129393, // 🥱 yawning face
- 109: 128535, // 😗 kissing face
- 110: 128562, // 😲 astonished face
- 111: 129402, // 🥺 pleading face
- 172: 128539, // 😛 face with tongue
- 182: 128514, // 😂 face with tears of joy
- 187: 128123, // 👻 ghost
- 247: 128567, // 😷 face with medical mask
- 272: 128579, // 🙃 upside-down face
- 320: 129395, // 🥳 partying face
- 325: 128561, // 😱 face screaming in fear
-}
diff --git a/plugin/emojimix/mix.go b/plugin/emojimix/mix.go
index eef35e72ee..a73df488af 100644
--- a/plugin/emojimix/mix.go
+++ b/plugin/emojimix/mix.go
@@ -2,13 +2,18 @@
package emojimix
import (
+ "bytes"
+ "encoding/base64"
"fmt"
+ "io"
"net/http"
"strconv"
+ "github.com/FloatTech/floatbox/binary"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
+ "github.com/fumiama/terasu/http2"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -30,22 +35,36 @@ func init() {
u2 := fmt.Sprintf(bed, emojis[r2], r2, r2, r1)
logrus.Debugln("[emojimix] u1:", u1)
logrus.Debugln("[emojimix] u2:", u2)
- resp1, err := http.Head(u1)
- if err == nil {
- resp1.Body.Close()
- if resp1.StatusCode == http.StatusOK {
- ctx.SendChain(message.Image(u1))
+ send := func(resp *http.Response) {
+ buf := bytes.NewBuffer(make([]byte, 0, 65536))
+ buf.WriteString("base64://")
+ enc := base64.NewEncoder(base64.StdEncoding, buf)
+ _, err := io.Copy(enc, resp.Body)
+ if err != nil {
+ logrus.Warnln("[emojimix] copy err:", err)
return
}
- }
- resp2, err := http.Head(u2)
- if err == nil {
- resp2.Body.Close()
- if resp2.StatusCode == http.StatusOK {
- ctx.SendChain(message.Image(u2))
+ err = enc.Close()
+ if err != nil {
+ logrus.Warnln("[emojimix] close enc err:", err)
return
}
+ ctx.SendChain(message.Image(binary.BytesToString(buf.Bytes()), ctx.Event.Message.String()))
+ }
+ resp, err := http2.Get(u1)
+ if err == nil {
+ send(resp)
+ _ = resp.Body.Close()
+ return
+ }
+ logrus.Warnln("[emojimix] http get u1 err:", err)
+ resp, err = http2.Get(u2)
+ if err == nil {
+ send(resp)
+ _ = resp.Body.Close()
+ return
}
+ logrus.Warnln("[emojimix] http get u2 err:", err)
})
}
@@ -94,7 +113,7 @@ func face2emoji(face message.MessageSegment) rune {
if err != nil {
return 0
}
- if r, ok := qqface[id]; ok {
+ if r, ok := message.Emoji[id]; ok {
return r
}
return 0
diff --git a/plugin/github/repo_searcher.go b/plugin/github/repo_searcher.go
index 9821c30e15..bc7352a461 100644
--- a/plugin/github/repo_searcher.go
+++ b/plugin/github/repo_searcher.go
@@ -2,15 +2,14 @@
package github
import (
- "errors"
- "fmt"
- "io"
"net/http"
"net/url"
"strings"
+ "github.com/FloatTech/floatbox/web"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
+ "github.com/fumiama/terasu/http2"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -26,14 +25,14 @@ func init() { // 插件主体
}).OnRegex(`^>github\s(-.{1,10}? )?(.*)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 发送请求
- header := http.Header{
- "User-Agent": []string{"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"},
- }
api, _ := url.Parse("https://api.github.com/search/repositories")
api.RawQuery = url.Values{
"q": []string{ctx.State["regex_matched"].([]string)[2]},
}.Encode()
- body, err := netGet(api.String(), header)
+ body, err := web.RequestDataWithHeaders(&http2.DefaultClient, api.String(), "GET", func(r *http.Request) error {
+ r.Header.Set("User-Agent", web.RandUA())
+ return nil
+ }, nil)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
}
@@ -96,36 +95,9 @@ func init() { // 插件主体
}
// notnull 如果传入文本为空,则返回默认值
-
func notnull(text string) string {
if text == "" {
return "None"
}
return text
}
-
-// netGet 返回请求结果
-func netGet(dest string, header http.Header) ([]byte, error) {
- client := &http.Client{}
-
- req, err := http.NewRequest("GET", dest, nil)
- if err != nil {
- return nil, err
- }
- req.Header = header
- resp, err := client.Do(req)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
- if code := resp.StatusCode; code != 200 {
- // 如果返回不是200则立刻抛出错误
- errmsg := fmt.Sprintf("code %d", code)
- return nil, errors.New(errmsg)
- }
- return body, nil
-}
diff --git a/plugin/heisi/heisi.go b/plugin/heisi/heisi.go
deleted file mode 100644
index 3d9b5548a5..0000000000
--- a/plugin/heisi/heisi.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Package heisi 黑丝
-package heisi
-
-import (
- "errors"
- "math/rand"
- "os"
- "strconv"
- "time"
- "unsafe"
-
- "github.com/FloatTech/AnimeAPI/setu"
- fbctxext "github.com/FloatTech/floatbox/ctxext"
- "github.com/FloatTech/floatbox/file"
- "github.com/FloatTech/floatbox/web"
- 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"
-)
-
-var (
- heisiPic []item
- baisiPic []item
- jkPic []item
- jurPic []item
- zukPic []item
- mcnPic []item
- fileList = [...]string{"heisi.bin", "baisi.bin", "jk.bin", "jur.bin", "zuk.bin", "mcn.bin"}
-)
-
-func init() { // 插件主体
- p, err := setu.NewPool(setu.DefaultPoolDir,
- func(s string) (string, error) {
- if s != "黑丝" && s != "白丝" && s != "jk" && s != "巨乳" && s != "足控" && s != "网红" {
- return "", errors.New("invalid call")
- }
- typ := setu.DefaultPoolDir + "/" + s
- if file.IsNotExist(typ) {
- err := os.MkdirAll(typ, 0755)
- if err != nil {
- return "", err
- }
- }
- var pic item
- switch s {
- case "黑丝":
- pic = heisiPic[rand.Intn(len(heisiPic))]
- case "白丝":
- pic = baisiPic[rand.Intn(len(baisiPic))]
- case "jk":
- pic = jkPic[rand.Intn(len(jkPic))]
- case "巨乳":
- pic = jurPic[rand.Intn(len(jurPic))]
- case "足控":
- pic = zukPic[rand.Intn(len(zukPic))]
- case "网红":
- pic = mcnPic[rand.Intn(len(mcnPic))]
- }
- return pic.String(), nil
- }, func(s string) ([]byte, error) {
- return web.RequestDataWith(web.NewTLS12Client(), s, "GET", "http://hs.heisiwu.com/", web.RandUA(), nil)
- }, time.Minute)
- if err != nil {
- panic(err)
- }
-
- engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "黑丝",
- Help: "- 来点黑丝\n- 来点白丝\n- 来点jk\n- 来点巨乳\n- 来点足控\n- 来点网红",
- PublicDataFolder: "Heisi",
- })
-
- engine.OnFullMatchGroup([]string{"来点黑丝", "来点白丝", "来点jk", "来点巨乳", "来点足控", "来点网红"}, zero.OnlyGroup, fbctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
- for i, filePath := range fileList {
- data, err := engine.GetLazyData(filePath, true)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return false
- }
- if len(data)%10 != 0 {
- ctx.SendChain(message.Text("ERROR: invalid data " + strconv.Itoa(i)))
- return false
- }
- s := (*slice)(unsafe.Pointer(&data))
- s.len /= 10
- s.cap /= 10
- switch i {
- case 0:
- heisiPic = *(*[]item)(unsafe.Pointer(s))
- case 1:
- baisiPic = *(*[]item)(unsafe.Pointer(s))
- case 2:
- jkPic = *(*[]item)(unsafe.Pointer(s))
- case 3:
- jurPic = *(*[]item)(unsafe.Pointer(s))
- case 4:
- zukPic = *(*[]item)(unsafe.Pointer(s))
- case 5:
- mcnPic = *(*[]item)(unsafe.Pointer(s))
- }
- }
- return true
- })).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- matched := ctx.State["matched"].(string)
- pic, err := p.Roll(matched[3*2:])
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- m := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Image("file:///"+file.BOTPATH+"/"+pic))}
- if id := ctx.Send(m).ID(); id == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待"))
- }
- })
-}
diff --git a/plugin/heisi/packer.go b/plugin/heisi/packer.go
deleted file mode 100644
index f6024a4799..0000000000
--- a/plugin/heisi/packer.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package heisi
-
-import (
- "encoding/binary"
- "encoding/hex"
- "fmt"
- "math/bits"
-)
-
-const (
- template2021 = "http://hs.heisiwu.com/wp-content/uploads/%4d/%02d/%4d%02d16%06d-611a3%8s.jpg"
- templategeneral = "http://hs.heisiwu.com/wp-content/uploads/%4d/%02d/%015x"
-)
-
-type item [10]byte
-
-// String item to url
-func (it item) String() string {
- year, month := int((it[0]>>4)&0x0f), int(it[0]&0x0f)
- year += 2021
- if year == 2021 {
- num := binary.BigEndian.Uint32(it[1:5])
- dstr := hex.EncodeToString(it[5:9])
- return fmt.Sprintf(template2021, year, month, year, month, num, dstr)
- }
- d := binary.BigEndian.Uint64(it[1:9])
- isscaled := it[9]&0x80 > 0
- num := int(it[9] & 0x7f)
- trestore := fmt.Sprintf(templategeneral, year, month, d&0x0fffffff_ffffffff)
- if num > 0 {
- trestore += fmt.Sprintf("-%d", num)
- }
- if isscaled {
- trestore += "-scaled"
- }
- d = bits.RotateLeft64(d, 4) & 0x0f
- switch d {
- case 0:
- trestore += ".jpg"
- case 1:
- trestore += ".png"
- case 2:
- trestore += ".webp"
- default:
- return "invalid ext"
- }
- return trestore
-}
diff --git a/plugin/heisi/slice.go b/plugin/heisi/slice.go
deleted file mode 100644
index 8aafbdfc7f..0000000000
--- a/plugin/heisi/slice.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package heisi
-
-import "unsafe"
-
-// slice is the runtime representation of a slice.
-// It cannot be used safely or portably and its representation may
-// change in a later release.
-//
-// Unlike reflect.SliceHeader, its Data field is sufficient to guarantee the
-// data it references will not be garbage collected.
-type slice struct {
- data unsafe.Pointer
- len int
- cap int
-}
diff --git a/plugin/imgfinder/keyword.go b/plugin/imgfinder/keyword.go
deleted file mode 100644
index ce8b25a3f7..0000000000
--- a/plugin/imgfinder/keyword.go
+++ /dev/null
@@ -1,150 +0,0 @@
-// Package imagefinder 关键字搜图
-package imagefinder
-
-import (
- "encoding/json"
- "errors"
- "math/rand"
- "net/http"
- "net/url"
- "reflect"
- "regexp"
- "strings"
-
- "github.com/quic-go/quic-go/http3"
-
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
-
- "github.com/FloatTech/AnimeAPI/pixiv"
-
- "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/FloatTech/zbputils/img/pool"
-)
-
-type resultjson struct {
- Error bool `json:"error"`
- Message string `json:"message"`
- Data struct {
- Illusts []struct {
- ID int64 `json:"id"`
- Title string `json:"title"`
- AltTitle string `json:"altTitle"`
- Description string `json:"description"`
- Type int64 `json:"type"`
- CreateDate string `json:"createDate"`
- UploadDate string `json:"uploadDate"`
- Sanity int64 `json:"sanity"`
- Width int64 `json:"width"`
- Height int64 `json:"height"`
- PageCount int64 `json:"pageCount"`
- Tags []struct {
- Name string `json:"name"`
- Translation string `json:"translation"`
- } `json:"tags"`
- Statistic struct {
- Bookmarks int64 `json:"bookmarks"`
- Likes int64 `json:"likes"`
- Comments int64 `json:"comments"`
- Views int64 `json:"views"`
- } `json:"statistic"`
- Image string `json:"image"`
- } `json:"illusts"`
- Scores []float64 `json:"scores"`
- HasNext bool `json:"has_next"`
- } `json:"data"`
-}
-
-var hrefre = regexp.MustCompile(``)
-
-func init() {
- control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "关键字搜图",
- Help: "- 来张 [xxx]",
- }).OnRegex(`^来张\s?(.*)$`, zero.AdminPermission).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- keyword := ctx.State["regex_matched"].([]string)[1]
- soutujson, err := soutuapi(keyword)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- rannum := rand.Intn(len(soutujson.Data.Illusts))
- il := soutujson.Data.Illusts[rannum]
- illust, err := pixiv.Works(il.ID)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- if len(illust.ImageUrls) == 0 {
- ctx.SendChain(message.Text("ERROR: nil image url"))
- return
- }
- u := illust.ImageUrls[0]
- n := u[strings.LastIndex(u, "/")+1 : len(u)-4]
- f := illust.Path(0)
-
- err = pool.SendImageFromPool(n, f, func() error {
- // 下载图片
- return illust.DownloadToCache(0)
- }, ctxext.SendFakeForwardToGroup(ctx,
- message.Text(
- il.Width, "x", il.Height, "\n",
- "标题: ", il.Title, "\n",
- "副标题: ", il.AltTitle, "\n",
- "ID: ", il.ID, "\n",
- "画师: ", illust.UserName, " (", illust.UserID, ")", "\n",
- "分级:", il.Sanity, "\n",
- hrefre.ReplaceAllString(strings.ReplaceAll(strings.ReplaceAll(il.Description, "
", "\n"), "", ""), ""),
- printtags(reflect.ValueOf(&il.Tags)),
- ),
- ), ctxext.GetFirstMessageInForward(ctx))
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- })
-}
-
-// soutuapi 请求api
-func soutuapi(keyword string) (r resultjson, err error) {
- var data []byte
- data, err = web.RequestDataWith(&http.Client{Transport: &http3.RoundTripper{}},
- "https://api.pixivel.moe/v2/pixiv/illust/search/"+url.QueryEscape(keyword)+"?page=0",
- "GET",
- "https://pixivel.moe/",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
- nil,
- )
- if err != nil {
- return
- }
- err = json.Unmarshal(data, &r)
- if err == nil && r.Error {
- err = errors.New(r.Message)
- }
- return
-}
-
-func printtags(r reflect.Value) string {
- tags := r.Elem()
- s := binary.BytesToString(binary.NewWriterF(func(w *binary.Writer) {
- for i := 0; i < tags.Len(); i++ {
- _ = w.WriteByte('\n')
- tag := tags.Index(i)
- _ = w.WriteByte('#')
- w.WriteString(tag.Field(0).String())
- if !tag.Field(1).IsZero() {
- w.WriteString(" (")
- w.WriteString(tag.Field(1).String())
- w.WriteString(")")
- }
- }
- }))
- return s
-}
diff --git a/plugin/jiami/jiami.go b/plugin/jiami/jiami.go
deleted file mode 100644
index 4cb05b96f7..0000000000
--- a/plugin/jiami/jiami.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Package jiami 兽语加密与解密
-package jiami
-
-import (
- "encoding/json"
- "fmt"
-
- "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"
-)
-
-const (
- jiami1 = "http://ovooa.caonm.net/API/sho_u/?msg=%v" // 加密api地址
- jiami2 = "http://ovooa.caonm.net/API/sho_u/?format=1&msg=%v" // 解密api地址
-
-)
-
-type nmd struct { // struct解析格式大概是
- Data struct {
- Message string
- } `json:"data"`
-}
-
-func init() { // 主函数
- en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "兽语加解密",
- Help: "兽语加解密\n" +
- "- 兽语加密xxx\n- 兽语解密xxx",
- })
- en.OnRegex(`^兽语加密\s*(.+)$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
- str := ctx.State["regex_matched"].([]string)[1]
- es, err := web.GetData(fmt.Sprintf(jiami1, str)) // 将网站返回结果赋值
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏:", err))
- return
- }
- var r nmd // r数组
- err = json.Unmarshal(es, &r) // 填api返回结果,struct地址
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏:", err))
- return
- }
- ctx.SendChain(message.Text(r.Data.Message)) // 输出提取后的结果
- })
-
- en.OnRegex(`^兽语解密\s*(.+)$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
- str := ctx.State["regex_matched"].([]string)[1]
- es, err := web.GetData(fmt.Sprintf(jiami2, str)) // 将网站返回结果赋值
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏:", err))
- return
- }
- var n nmd // r数组
- err = json.Unmarshal(es, &n) // 填api返回结果,struct地址
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏:", err))
- return
- }
- ctx.SendChain(message.Text(n.Data.Message)) // 输出提取后的结果
- })
-}
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
-}
diff --git a/plugin/manager/manager.go b/plugin/manager/manager.go
index fa676aba58..866ac586fa 100644
--- a/plugin/manager/manager.go
+++ b/plugin/manager/manager.go
@@ -4,6 +4,7 @@ package manager
import (
"fmt"
"math/rand"
+ "regexp"
"sort"
"strconv"
"strings"
@@ -35,6 +36,7 @@ const (
"- 修改名片@QQ XXX\n" +
"- 修改头衔@QQ XXX\n" +
"- 申请头衔 XXX\n" +
+ "- 对信息回复: 撤回\n" +
"- 踢出群聊@QQ\n" +
"- 退出群聊 1234@bot\n" +
"- 群聊转发 1234 XXX\n" +
@@ -48,12 +50,13 @@ const (
"- 列出所有提醒\n" +
"- 翻牌\n" +
"- 赞我\n" +
+ "- 对信息回复: 回应表情 [表情]\n" +
"- 设置欢迎语XXX 可选添加 [{at}] [{nickname}] [{avatar}] [{uid}] [{gid}] [{groupname}]\n" +
"- 测试欢迎语\n" +
"- 设置告别辞 参数同设置欢迎语\n" +
"- 测试告别辞\n" +
"- [开启 | 关闭]入群验证\n" +
- "- 对信息回复:[设置 | 取消]精华\n" +
+ "- 对信息回复: [设置 | 取消]精华\n" +
"- 取消精华 [信息ID]\n" +
"- /精华列表\n" +
"Tips: {at}可在发送时艾特被欢迎者 {nickname}是被欢迎者名字 {avatar}是被欢迎者头像 {uid}是被欢迎者QQ号 {gid}是当前群群号 {groupname} 是当前群群名"
@@ -260,9 +263,7 @@ func init() { // 插件主体
engine.OnRegex(`^\[CQ:reply,id=(-?\d+)\].*撤回$`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 删除需要撤回的消息ID
- ctx.DeleteMessage(message.NewMessageIDFromString(ctx.State["regex_matched"].([]string)[1]))
- // 删除请求撤回的消息ID
- // ctx.DeleteMessage(message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64)))
+ ctx.DeleteMessage(ctx.State["regex_matched"].([]string)[1])
})
// 群聊转发
engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).
@@ -397,12 +398,45 @@ func init() { // 插件主体
}
}
if !flag {
- ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("不加好友不给赞!"))
+ // 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下哦,记得回我~"))
})
+ facere := regexp.MustCompile(`\[CQ:face,id=(\d+)\]`)
+ // 给消息回应表情
+ engine.OnRegex(`^\[CQ:reply,id=(-?\d+)\].*回应表情\s*(.+)\s*$`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
+ Handle(func(ctx *zero.Ctx) {
+ msgid := ctx.State["regex_matched"].([]string)[1]
+ face := ctx.State["regex_matched"].([]string)[2]
+ if len(face) == 0 {
+ ctx.SendChain(message.Text("ERROR: 表情长度为 0"))
+ return
+ }
+ ids := facere.FindStringSubmatch(face)
+ id := rune(0)
+ if len(ids) == 2 && len(ids[1]) > 0 {
+ idi, err := strconv.Atoi(ids[1])
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ id = rune(idi)
+ } else {
+ x := []rune(face)
+ if len(x) == 0 {
+ ctx.SendChain(message.Text("ERROR: 解析后表情长度为 0"))
+ return
+ }
+ id = x[0]
+ }
+ err := ctx.SetMessageEmojiLike(msgid, id)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ })
// 入群欢迎
engine.OnNotice().SetBlock(false).
Handle(func(ctx *zero.Ctx) {
@@ -639,7 +673,7 @@ func init() { // 插件主体
time.Unix(info.Get("operator_time").Int(), 0).Format("2006/01/02 15:04:05"),
))),
)
- msgData := ctx.GetMessage(message.NewMessageIDFromInteger(info.Get("message_id").Int())).Elements
+ msgData := ctx.GetMessage(info.Get("message_id").Int()).Elements
if msgData != nil {
msg = append(msg,
message.CustomNode(info.Get("sender_nick").String(), info.Get("sender_id").Int(), msgData),
diff --git a/plugin/quan/quan.go b/plugin/quan/quan.go
deleted file mode 100644
index 9cd35ede5c..0000000000
--- a/plugin/quan/quan.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Package quan qq权重查询
-package quan
-
-import (
- "encoding/json"
- "strconv"
- "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"
-)
-
-const (
- quan = "http://tfapi.top/API/qqqz.php?type=json&qq=" // api
-)
-
-type result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Qz string `json:"qz"`
-}
-
-func init() { // 主函数
- en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "QQ权重查询",
- Help: "权重查询方式\n" +
- "- 权重查询+@xxx" +
- "- 权重查询+QQ号(可以不写,默认本人)",
- })
- en.OnRegex(`^权重查询\s*(\[CQ:at,qq=)?(\d+)?`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
- str := ctx.State["regex_matched"].([]string)[2] // 获取uid
- if str == "" { // user
- str = strconv.FormatInt(ctx.Event.UserID, 10)
- }
- es, err := web.GetData(quan + str) // 将网站返回结果赋值
- if err != nil {
- ctx.SendChain(message.Text("出现错误捏: ", err))
- return
- }
- var data result
- err = json.Unmarshal(es, &data)
- if err != nil {
- ctx.SendChain(message.Text("解析json错误: ", err))
- return
- }
- var msg strings.Builder
- msg.WriteString("查询账号: ")
- msg.WriteString(str)
- msg.WriteString("\n")
- msg.WriteString("查询状态: ")
- msg.WriteString(data.Msg)
- msg.WriteString("\n您的权重为: ")
- msg.WriteString(data.Qz)
- ctx.SendChain(message.Text(msg.String())) // 输出结果
- })
-}
diff --git a/plugin/saucenao/searcher.go b/plugin/saucenao/searcher.go
index 843a16eba3..9afb04bad4 100644
--- a/plugin/saucenao/searcher.go
+++ b/plugin/saucenao/searcher.go
@@ -8,6 +8,7 @@ import (
"reflect"
"strconv"
+ "github.com/fumiama/terasu/http2"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -24,6 +25,11 @@ import (
"github.com/FloatTech/zbputils/img/pool"
)
+const (
+ enableHex = 0x10
+ unableHex = 0x7fffffff_fffffffd
+)
+
var (
saucenaocli *gophersauce.Client
)
@@ -110,10 +116,15 @@ func init() { // 插件主体
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
pics, ok := ctx.State["image_url"].([]string)
+ showPic := false
if !ok {
ctx.SendChain(message.Text("ERROR: 未获取到图片链接"))
return
}
+ c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
+ if ok && c.GetData(ctx.Event.GroupID)&enableHex == enableHex {
+ showPic = true
+ }
ctx.SendChain(message.Text("少女祈祷中..."))
for _, pic := range pics {
if saucenaocli != nil {
@@ -134,22 +145,24 @@ func init() { // 插件主体
}
}
})
- resp, err := http.Head(result.Header.Thumbnail)
+ resp, err := http2.Head(result.Header.Thumbnail)
msg := make(message.Message, 0, 3)
if s > 80.0 {
msg = append(msg, message.Text("我有把握是这个!"))
} else {
msg = append(msg, message.Text("也许是这个?"))
}
- if err == nil {
- _ = resp.Body.Close()
- if resp.StatusCode == http.StatusOK {
- msg = append(msg, message.Image(result.Header.Thumbnail))
+ if showPic {
+ if err == nil {
+ _ = resp.Body.Close()
+ if resp.StatusCode == http.StatusOK {
+ msg = append(msg, message.Image(result.Header.Thumbnail))
+ } else {
+ msg = append(msg, message.Image(pic))
+ }
} else {
msg = append(msg, message.Image(pic))
}
- } else {
- msg = append(msg, message.Image(pic))
}
msg = append(msg, message.Text("\n图源: ", result.Header.IndexName, binary.BytesToString(b)))
ctx.Send(message.Message{ctxext.FakeSenderForwardNode(ctx, msg...)})
@@ -169,17 +182,19 @@ func init() { // 插件主体
}
msg := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Text("ascii2d搜图结果"))}
for i := 0; i < len(result) && i < 5; i++ {
- msg = append(msg, ctxext.FakeSenderForwardNode(ctx,
- message.Image(result[i].Thumb),
- message.Text(fmt.Sprintf(
- "标题: %s\n图源: %s\n画师: %s\n画师链接: %s\n图片链接: %s",
- result[i].Name,
- result[i].Type,
- result[i].AuthNm,
- result[i].Author,
- result[i].Link,
- ))),
- )
+ var resultMsgs message.Message
+ if showPic {
+ resultMsgs = append(resultMsgs, message.Image(result[i].Thumb))
+ }
+ resultMsgs = append(resultMsgs, message.Text(fmt.Sprintf(
+ "标题: %s\n图源: %s\n画师: %s\n画师链接: %s\n图片链接: %s",
+ result[i].Name,
+ result[i].Type,
+ result[i].AuthNm,
+ result[i].Author,
+ result[i].Link,
+ )))
+ msg = append(msg, ctxext.FakeSenderForwardNode(ctx, resultMsgs...))
}
if id := ctx.Send(msg).ID(); id == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
@@ -204,4 +219,33 @@ func init() { // 插件主体
}
ctx.SendChain(message.Text("成功!"))
})
+ engine.OnRegex(`^(开启|打开|启用|关闭|关掉|禁用)搜图显示图片$`, zero.AdminPermission).SetBlock(true).
+ Handle(func(ctx *zero.Ctx) {
+ gid := ctx.Event.GroupID
+ if gid <= 0 {
+ // 个人用户设为负数
+ gid = -ctx.Event.UserID
+ }
+ option := ctx.State["regex_matched"].([]string)[1]
+ c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
+ if !ok {
+ ctx.SendChain(message.Text("找不到服务!"))
+ return
+ }
+ data := c.GetData(ctx.Event.GroupID)
+ switch option {
+ case "开启", "打开", "启用":
+ data |= enableHex
+ case "关闭", "关掉", "禁用":
+ data &= unableHex
+ default:
+ return
+ }
+ err := c.SetData(gid, data)
+ if err != nil {
+ ctx.SendChain(message.Text("出错啦: ", err))
+ return
+ }
+ ctx.SendChain(message.Text("已", option, "搜图显示图片"))
+ })
}
diff --git a/plugin/vtbmusic/vtbmusic.go b/plugin/vtbmusic/vtbmusic.go
deleted file mode 100644
index 835ff56738..0000000000
--- a/plugin/vtbmusic/vtbmusic.go
+++ /dev/null
@@ -1,321 +0,0 @@
-// 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.AutoRegister(&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
-}
diff --git a/plugin/vtbquotation/model/model.go b/plugin/vtbquotation/model/model.go
deleted file mode 100644
index 01b86c727f..0000000000
--- a/plugin/vtbquotation/model/model.go
+++ /dev/null
@@ -1,325 +0,0 @@
-// Package model vtb数据库操作
-package model
-
-import (
- "io"
- "math/rand"
- "net/http"
- "os"
- "strconv"
- "strings"
-
- "github.com/FloatTech/floatbox/web"
- "github.com/jinzhu/gorm"
- log "github.com/sirupsen/logrus"
- "github.com/tidwall/gjson"
-)
-
-// VtbDB vtb 数据库
-type VtbDB gorm.DB
-
-// Initialize ...
-func Initialize(dbpath string) *VtbDB {
- var err error
- if _, err = os.Stat(dbpath); err != nil || os.IsNotExist(err) {
- // 生成文件
- f, err := os.Create(dbpath)
- if err != nil {
- return nil
- }
- defer f.Close()
- }
- gdb, err := gorm.Open("sqlite3", dbpath)
- if err != nil {
- panic(err)
- }
- gdb.AutoMigrate(FirstCategory{}).AutoMigrate(SecondCategory{}).AutoMigrate(ThirdCategory{})
- return (*VtbDB)(gdb)
-}
-
-// Open ...
-func Open(dbpath string) (*VtbDB, error) {
- db, err := gorm.Open("sqlite3", dbpath)
- if err != nil {
- return nil, err
- }
- return (*VtbDB)(db), nil
-}
-
-// FirstCategory 第一品类
-type FirstCategory struct {
- gorm.Model
- FirstCategoryIndex int64 `gorm:"column:first_category_index"`
- FirstCategoryName string `gorm:"column:first_category_name"`
- FirstCategoryUID string `gorm:"column:first_category_uid"`
- FirstCategoryDescription string `gorm:"column:first_category_description;type:varchar(1024)"`
- FirstCategoryIconPath string `gorm:"column:first_category_icon_path"`
-}
-
-// TableName ...
-func (FirstCategory) TableName() string {
- return "first_category"
-}
-
-// SecondCategory 第二品类
-type SecondCategory struct {
- gorm.Model
- SecondCategoryIndex int64 `gorm:"column:second_category_index"`
- FirstCategoryUID string `gorm:"column:first_category_uid;association_foreignkey:first_category_uid"`
- SecondCategoryName string `gorm:"column:second_category_name"`
- SecondCategoryAuthor string `gorm:"column:second_category_author"`
- SecondCategoryDescription string `gorm:"column:second_category_description"`
-}
-
-// TableName ...
-func (SecondCategory) TableName() string {
- return "second_category"
-}
-
-// ThirdCategory 第三品类
-type ThirdCategory struct {
- gorm.Model
- ThirdCategoryIndex int64 `gorm:"column:third_category_index"`
- SecondCategoryIndex int64 `gorm:"column:second_category_index"`
- FirstCategoryUID string `gorm:"column:first_category_uid"`
- ThirdCategoryName string `gorm:"column:third_category_name"`
- ThirdCategoryPath string `gorm:"column:third_category_path"`
- ThirdCategoryAuthor string `gorm:"column:third_category_author"`
- ThirdCategoryDescription string `gorm:"column:third_category_description"`
-}
-
-// TableName ...
-func (ThirdCategory) TableName() string {
- return "third_category"
-}
-
-// GetAllFirstCategoryMessage 取出所有vtb
-func (vdb *VtbDB) GetAllFirstCategoryMessage() (string, error) {
- db := (*gorm.DB)(vdb)
- firstStepMessage := "请选择一个vtb并发送序号:\n"
- var fcl []FirstCategory
- err := db.Model(&FirstCategory{}).Find(&fcl).Error
- if err != nil {
- return "", err
- }
- for _, v := range fcl {
- firstStepMessage += strconv.FormatInt(v.FirstCategoryIndex, 10) + ". " + v.FirstCategoryName + "\n"
- }
- return firstStepMessage, nil
-}
-
-// GetAllSecondCategoryMessageByFirstIndex 取得同一个vtb所有语录类别
-func (vdb *VtbDB) GetAllSecondCategoryMessageByFirstIndex(firstIndex int) (string, error) {
- db := (*gorm.DB)(vdb)
- secondStepMessage := "请选择一个语录类别并发送序号:\n"
- var scl []SecondCategory
- var fc FirstCategory
- db.Model(FirstCategory{}).Where("first_category_index = ?", firstIndex).First(&fc)
- err := db.Model(&SecondCategory{}).Find(&scl, "first_category_uid = ?", fc.FirstCategoryUID).Error
- if err != nil || len(scl) == 0 {
- return "", err
- }
- for _, v := range scl {
- secondStepMessage += strconv.FormatInt(v.SecondCategoryIndex, 10) + ". " + v.SecondCategoryName + "\n"
- }
- return secondStepMessage, nil
-}
-
-// GetAllThirdCategoryMessageByFirstIndexAndSecondIndex 取得同一个vtb同个类别的所有语录
-func (vdb *VtbDB) GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(firstIndex, secondIndex int) (string, error) {
- db := (*gorm.DB)(vdb)
- thirdStepMessage := "请选择一个语录并发送序号:\n"
- var fc FirstCategory
- db.Model(FirstCategory{}).Where("first_category_index = ?", firstIndex).First(&fc)
- var tcl []ThirdCategory
- err := db.Model(&ThirdCategory{}).Find(&tcl, "first_category_uid = ? and second_category_index = ?", fc.FirstCategoryUID, secondIndex).Error
- if err != nil || len(tcl) == 0 {
- return "", err
- }
- for _, v := range tcl {
- thirdStepMessage = thirdStepMessage + strconv.FormatInt(v.ThirdCategoryIndex, 10) + ". " + v.ThirdCategoryName + "\n"
- }
- return thirdStepMessage, nil
-}
-
-// GetThirdCategory ...
-func (vdb *VtbDB) GetThirdCategory(firstIndex, secondIndex, thirdIndex int) ThirdCategory {
- db := (*gorm.DB)(vdb)
- var fc FirstCategory
- db.Model(FirstCategory{}).Where("first_category_index = ?", firstIndex).First(&fc)
- var tc ThirdCategory
- db.Model(&ThirdCategory{}).Where("first_category_uid = ? and second_category_index = ? and third_category_index = ?", fc.FirstCategoryUID, secondIndex, thirdIndex).Take(&tc)
- return tc
-}
-
-// RandomVtb ...
-func (vdb *VtbDB) RandomVtb() ThirdCategory {
- db := (*gorm.DB)(vdb)
- var count int
- var tc ThirdCategory
- db.Model(&ThirdCategory{}).Count(&count).Offset(rand.Intn(count)).Take(&tc)
- return tc
-}
-
-// GetFirstCategoryByFirstUID ...
-func (vdb *VtbDB) GetFirstCategoryByFirstUID(firstUID string) FirstCategory {
- db := (*gorm.DB)(vdb)
- var fc FirstCategory
- db.Model(FirstCategory{}).Take(&fc, "first_category_uid = ?", firstUID)
- return fc
-}
-
-// Close ...
-func (vdb *VtbDB) Close() error {
- db := (*gorm.DB)(vdb)
- return db.Close()
-}
-
-const vtbURL = "https://vtbkeyboard.moe/api/get_vtb_list"
-
-// GetVtbList ...
-func (vdb *VtbDB) GetVtbList() (uidList []string, err error) {
- db := (*gorm.DB)(vdb)
- client := &http.Client{}
- req, err := http.NewRequest("GET", vtbURL, nil)
- if err != nil {
- return
- }
- // 自定义Header
- req.Header.Set("User-Agent", web.RandUA())
- resp, err := client.Do(req)
- if err != nil {
- return
- }
-
- defer resp.Body.Close()
- bytes, err := io.ReadAll(resp.Body)
- if err != nil {
- return
- }
-
- vtbListStr, err := strconv.Unquote(strings.ReplaceAll(strconv.Quote(string(bytes)), `\\u`, `\u`))
- if err != nil {
- return
- }
-
- count := gjson.Get(vtbListStr, "#").Int()
- for i := int64(0); i < count; i++ {
- item := gjson.Get(vtbListStr, strconv.FormatInt(i, 10))
- log.Debugln(item)
- fc := FirstCategory{
- FirstCategoryIndex: i,
- FirstCategoryName: item.Get("name").String(),
- FirstCategoryDescription: item.Get("description").String(),
- FirstCategoryIconPath: item.Get("icon_path").String(),
- FirstCategoryUID: item.Get("uid").String(),
- }
- log.Debugln(fc)
-
- if err := db.Model(&FirstCategory{}).First(&fc, "first_category_uid = ?", fc.FirstCategoryUID).Error; err != nil {
- if gorm.IsRecordNotFoundError(err) {
- db.Model(&FirstCategory{}).Create(&fc) // newUser not user
- }
- } else {
- db.Model(&FirstCategory{}).Where("first_category_uid = ?", fc.FirstCategoryUID).Update(
- map[string]any{
- "first_category_index": i,
- "first_category_name": item.Get("name").String(),
- "first_category_description": item.Get("description").String(),
- "first_category_icon_path": item.Get("icon_path").String(),
- })
- }
- uidList = append(uidList, fc.FirstCategoryUID)
- }
-
- return
-}
-
-// StoreVtb ...
-func (vdb *VtbDB) StoreVtb(uid string) (err error) {
- db := (*gorm.DB)(vdb)
- vtbURL := "https://vtbkeyboard.moe/api/get_vtb_page?uid=" + uid
- client := &http.Client{}
- req, err := http.NewRequest("GET", vtbURL, nil)
- if err != nil {
- return
- }
- // 自定义Header
- req.Header.Set("User-Agent", web.RandUA())
- resp, err := client.Do(req)
- if err != nil {
- return
- }
-
- defer resp.Body.Close()
- bytes, err := io.ReadAll(resp.Body)
- if err != nil {
- return
- }
-
- vtbStr, err := strconv.Unquote(strings.ReplaceAll(strconv.Quote(string(bytes)), `\\u`, `\u`))
- if err != nil {
- return
- }
-
- secondCount := gjson.Get(vtbStr, "data.voices.#").Int()
- log.Debugln("二级品类一共有", secondCount)
- for secondIndex := int64(0); secondIndex < secondCount; secondIndex++ {
- secondItem := gjson.Get(vtbStr, "data.voices."+strconv.FormatInt(secondIndex, 10))
- log.Debugln(secondItem)
- sc := SecondCategory{
- SecondCategoryName: secondItem.Get("categoryName").String(),
- SecondCategoryIndex: secondIndex,
- SecondCategoryAuthor: secondItem.Get("author").String(),
- SecondCategoryDescription: secondItem.Get("categoryDescription.zh-CN").String(),
- FirstCategoryUID: uid,
- }
-
- if err := db.Model(&SecondCategory{}).First(&sc, "first_category_uid = ? and second_category_index = ?", uid, secondIndex).Error; err != nil {
- // error handling...
- if gorm.IsRecordNotFoundError(err) {
- db.Model(&SecondCategory{}).Create(&sc) // newUser not user
- }
- } else {
- db.Model(&SecondCategory{}).Where("first_category_uid = ? and second_category_index = ?", uid, secondIndex).Update(
- map[string]any{
- "second_category_name": secondItem.Get("categoryName").String(),
- "second_category_author": secondItem.Get("author").String(),
- "second_category_description": secondItem.Get("categoryDescription.zh-CN").String(),
- })
- }
- thirdCount := secondItem.Get("voiceList.#").Int()
- log.Debugln("三级品类一共有", thirdCount)
- for thirdIndex := int64(0); thirdIndex < thirdCount; thirdIndex++ {
- thirdItem := secondItem.Get("voiceList." + strconv.FormatInt(thirdIndex, 10))
- log.Debugln(thirdItem)
- tc := ThirdCategory{
- ThirdCategoryName: thirdItem.Get("name").String(),
- ThirdCategoryIndex: thirdIndex,
- ThirdCategoryDescription: thirdItem.Get("description.zh-CN").String(),
- FirstCategoryUID: uid,
- SecondCategoryIndex: secondIndex,
- ThirdCategoryPath: thirdItem.Get("path").String(),
- ThirdCategoryAuthor: thirdItem.Get("author").String(),
- }
- log.Debugln(tc)
-
- if err := db.Model(&ThirdCategory{}).First(&tc, "first_category_uid = ? and second_category_index = ? and third_category_index = ?",
- uid, secondIndex, thirdIndex).Error; err != nil {
- if gorm.IsRecordNotFoundError(err) {
- db.Model(&ThirdCategory{}).Create(&tc) // newUser not user
- }
- } else {
- db.Model(&ThirdCategory{}).Where("first_category_uid = ? and second_category_index = ? and third_category_index = ?",
- uid, secondIndex, thirdIndex).Update(
- map[string]any{
- "third_category_name": thirdItem.Get("name").String(),
- "third_category_description": thirdItem.Get("description.zh-CN").String(),
- "third_category_path": thirdItem.Get("path").String(),
- "third_category_author": thirdItem.Get("author").String(),
- })
- }
- }
- }
- return
-}
diff --git a/plugin/vtbquotation/vtb_quotation.go b/plugin/vtbquotation/vtb_quotation.go
deleted file mode 100644
index 4aa3e6b720..0000000000
--- a/plugin/vtbquotation/vtb_quotation.go
+++ /dev/null
@@ -1,297 +0,0 @@
-// Package vtbquotation vtb经典语录
-package vtbquotation
-
-import (
- "fmt"
- "io"
- "net/http"
- "net/url"
- "os"
- "path"
- "regexp"
- "strconv"
- "strings"
- "time"
-
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
- "github.com/wdvxdr1123/ZeroBot/utils/helper"
-
- fcext "github.com/FloatTech/floatbox/ctxext"
- "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"
-
- "github.com/FloatTech/ZeroBot-Plugin/plugin/vtbquotation/model"
-)
-
-var reg = regexp.MustCompile(".*/(.*)")
-
-func init() {
- engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "vtb语录",
- Help: "- vtb语录\n- 随机vtb\n- 更新vtb\n来源: vtbkeyboard.moe",
- PublicDataFolder: "VtbQuotation",
- })
- dbfile := engine.DataFolder() + "vtb.db"
- storePath := engine.DataFolder() + "store/"
- getdb := fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
- err := os.MkdirAll(storePath, 0755)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return false
- }
- _, err = engine.GetLazyData("vtb.db", false)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return false
- }
- return true
- })
-
- engine.OnFullMatch("vtb语录", getdb).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- indexs := [3]int{}
- echo, cancel := ctx.FutureEvent("message",
- ctx.CheckSession()). // 只复读开启复读模式的人的消息
- Repeat() // 不断监听复读
- db, err := model.Open(dbfile)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- defer db.Close()
- defer cancel()
- r, err := db.GetAllFirstCategoryMessage()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- firstStepImageBytes, err := text.RenderToBase64(r, 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://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控了"))
- }
- // 步骤0,1,2,依次选择3个类别
- step := 0
- // 错误次数
- errorCount := 0
- for {
- select {
- case c := <-echo: // 接收到需要复读的消息
- // 错误次数达到3次,结束命令
- if errorCount >= 3 {
- ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("输入错误太多,请重新发指令"))
- return
- }
- msg := c.Event.Message.ExtractPlainText()
- num, err := strconv.Atoi(msg)
- if err != nil {
- ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
- errorCount++
- continue
- }
- switch step {
- case 0:
- indexs[0] = num
- secondStepMessage, err := db.GetAllSecondCategoryMessageByFirstIndex(indexs[0])
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- if secondStepMessage == "" {
- ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
- r, err := db.GetAllFirstCategoryMessage()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- firstStepImageBytes, err := text.RenderToBase64(r, 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://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控了"))
- }
- errorCount++
- } else {
- secondStepMessageBytes, err := text.RenderToBase64(secondStepMessage, 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://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控了"))
- }
- step++
- }
-
- case 1:
- indexs[1] = num
- thirdStepMessage, err := db.GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(indexs[0], indexs[1])
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- if thirdStepMessage == "" {
- ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
- r, err := db.GetAllSecondCategoryMessageByFirstIndex(indexs[0])
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- secondStepMessageBytes, err := text.RenderToBase64(r, 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://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控了"))
- }
- errorCount++
- } else {
- thirdStepMessageBytes, err := text.RenderToBase64(thirdStepMessage, 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://"+helper.BytesToString(thirdStepMessageBytes))); id.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控了"))
- }
- step++
- }
- case 2:
- indexs[2] = num
- tc := db.GetThirdCategory(indexs[0], indexs[1], indexs[2])
- recURL := tc.ThirdCategoryPath
- if recURL == "" {
- ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("没有内容请重新选择,三次输入错误,指令可退出重输"))
- r, err := db.GetAllFirstCategoryMessage()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- firstStepImageBytes, err := text.RenderToBase64(r, 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://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
- ctx.SendChain(message.Text("ERROR: 可能被风控了"))
- }
- errorCount++
- step = 1
- } else {
- if reg.MatchString(recURL) {
- recURL = strings.ReplaceAll(recURL, reg.FindStringSubmatch(recURL)[1], url.QueryEscape(reg.FindStringSubmatch(recURL)[1]))
- recURL = strings.ReplaceAll(recURL, "+", "%20")
- }
- ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请欣赏《"+tc.ThirdCategoryName+"》"))
- recordFile := storePath + fmt.Sprintf("%d-%d-%d", indexs[0], indexs[1], indexs[2]) + path.Ext(recURL)
- if file.IsExist(recordFile) {
- ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
- return
- }
- err = initRecord(recordFile, recURL)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
- return
- }
- default:
- return
- }
- case <-time.After(time.Second * 60):
- ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("vtb语录指令过期"))
- return
- }
- }
- })
- engine.OnFullMatch("随机vtb", getdb).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- db, err := model.Open(dbfile)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- defer db.Close()
- tc := db.RandomVtb()
- fc := db.GetFirstCategoryByFirstUID(tc.FirstCategoryUID)
- if (tc != model.ThirdCategory{}) && (fc != model.FirstCategory{}) {
- recURL := tc.ThirdCategoryPath
- if reg.MatchString(recURL) {
- recURL = strings.ReplaceAll(recURL, reg.FindStringSubmatch(recURL)[1], url.QueryEscape(reg.FindStringSubmatch(recURL)[1]))
- recURL = strings.ReplaceAll(recURL, "+", "%20")
- }
- ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("请欣赏"+fc.FirstCategoryName+"的《"+tc.ThirdCategoryName+"》"))
- recordFile := storePath + fmt.Sprintf("%d-%d-%d", fc.FirstCategoryIndex, tc.SecondCategoryIndex, tc.ThirdCategoryIndex) + path.Ext(recURL)
- if file.IsExist(recordFile) {
- ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
- return
- }
- err = initRecord(recordFile, recURL)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
- }
- })
- engine.OnFullMatch("更新vtb", zero.SuperUserPermission, getdb).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- ctx.Send("少女祈祷中......")
- db := model.Initialize(dbfile)
- if db != nil {
- vl, err := db.GetVtbList()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- for _, v := range vl {
- err = db.StoreVtb(v)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- }
- err = db.Close()
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- }
- ctx.Send("vtb数据库已更新")
- })
-}
-
-func initRecord(recordFile, recordURL string) error {
- if file.IsNotExist(recordFile) {
- client := web.NewTLS12Client()
- req, _ := http.NewRequest("GET", recordURL, nil)
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0")
- resp, err := client.Do(req)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
- data, err := io.ReadAll(resp.Body)
- if err != nil {
- return err
- }
- err = os.WriteFile(recordFile, data, 0666)
- if err != nil {
- return err
- }
- }
- return nil
-}
diff --git a/plugin/wangyiyun/main.go b/plugin/wangyiyun/main.go
deleted file mode 100644
index 5c56d1d6d3..0000000000
--- a/plugin/wangyiyun/main.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Package wangyiyun 网易云音乐热评
-package wangyiyun
-
-import (
- "github.com/FloatTech/floatbox/web"
- 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"
- "github.com/wdvxdr1123/ZeroBot/utils/helper"
-)
-
-const (
- wangyiyunURL = "https://api.gmit.vip/Api/HotComments?format=text"
- wangyiyunReferer = "https://api.gmit.vip/"
- 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: "- 来份网易云热评",
- }).OnFullMatch("来份网易云热评").SetBlock(true).Limit(ctxext.LimitByUser).
- Handle(func(ctx *zero.Ctx) {
- data, err := web.RequestDataWith(web.NewDefaultClient(), wangyiyunURL, "GET", wangyiyunReferer, ua, nil)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- ctx.SendChain(message.Text(helper.BytesToString(data)))
- })
-}
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()))
- })
-}
diff --git a/winres/winres.json b/winres/winres.json
index 41e9fe6431..2896c17d3f 100644
--- a/winres/winres.json
+++ b/winres/winres.json
@@ -12,7 +12,7 @@
"0409": {
"identity": {
"name": "ZeroBot-Plugin",
- "version": "1.7.7.1918"
+ "version": "1.7.8.1926"
},
"description": "",
"minimum-os": "vista",
@@ -36,23 +36,23 @@
"#1": {
"0000": {
"fixed": {
- "file_version": "1.7.7.1918",
- "product_version": "v1.7.7",
- "timestamp": "2024-04-01T21:35:17+08:00"
+ "file_version": "1.7.8.1926",
+ "product_version": "v1.7.8",
+ "timestamp": "2024-04-30T17:51:25+08:00"
},
"info": {
"0409": {
"Comments": "OneBot plugins based on ZeroBot",
"CompanyName": "FloatTech",
"FileDescription": "https://github.com/FloatTech/ZeroBot-Plugin",
- "FileVersion": "1.7.7.1918",
+ "FileVersion": "1.7.8.1926",
"InternalName": "",
"LegalCopyright": "© 2020 - 2024 FloatTech. All Rights Reserved.",
"LegalTrademarks": "",
"OriginalFilename": "ZBP.EXE",
"PrivateBuild": "",
"ProductName": "ZeroBot-Plugin",
- "ProductVersion": "v1.7.7",
+ "ProductVersion": "v1.7.8",
"SpecialBuild": ""
}
}