Compare commits

..

131 Commits

Author SHA1 Message Date
fumiama
0817e6233d 更新时间 2021-10-09 12:51:05 +08:00
fumiama
aa4f428194 更新依赖 2021-10-09 12:50:06 +08:00
fumiama
73717dec73 更新帮助 2021-10-09 12:48:58 +08:00
github-actions[bot]
57e2ef3bab 🎨 改进代码样式 2021-10-09 04:36:26 +00:00
fumiama
a5d0b8db8e fortune 增加设置底图并加速base64 和下载 2021-10-09 12:30:59 +08:00
fumiama
3faec79371 ✏️ 解决hs cache问题 2021-10-07 12:23:59 +08:00
散无友纪
c3e0520aec 修改了搜索结果样式 (#68)
* Update run.go

* Update run.go

* Update run.go

* Update run.go

Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
2021-10-07 12:21:39 +08:00
源文雨
76db0b6fb4 Update keyword.go 2021-10-07 12:21:20 +08:00
Kanri
40a8473ce0 Merge pull request #67 from Yiwen-Chan/master
改进 fortune 插件
2021-10-06 13:15:04 +08:00
Kanri
21c1d104b8 Merge branch 'master' of github.com:Yiwen-Chan/ZeroBot-Plugin 2021-10-06 10:35:36 +08:00
Kanri
0dda861863 🎨 改进 fortune 2021-10-06 10:33:22 +08:00
Kanri
b21f2f7166 Merge pull request #66 from Yiwen-Chan/master
 增加运势图片插件
2021-10-05 12:17:44 +08:00
Kanri
e533170160 🎨 make lint happy 2021-10-05 12:16:36 +08:00
Kanri
8236874779 🎨 make lint happy 2021-10-05 12:10:45 +08:00
Kanri
4cc1dc2d1b 增加 fortune 插件 2021-10-05 12:03:31 +08:00
Kanri
18424bea7c 🙈 增加 fortune 素材文件忽略 2021-10-05 12:02:49 +08:00
Kanri
0cc6251c0d 增加 gg 绘图库直接依赖 2021-10-05 12:02:22 +08:00
Kanri
63d87be789 增加运势图片插件 2021-10-05 00:57:22 +08:00
Kanri
7e3b898383 Merge pull request #65 from starim00/forup
搜图增加浏览器标头
2021-09-30 14:47:05 +08:00
hutiance
217fa62004 用结果数组的长度作为随机数最大值、防止越界 2021-09-30 14:42:09 +08:00
hutiance
e667fb8708 搜图增加浏览器标头 2021-09-30 14:24:56 +08:00
fumiama
2fef6f51b5 ✏️ fix plugin gif 2021-09-27 22:38:24 +08:00
fumiama
81bba8595a Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-09-27 22:10:55 +08:00
fumiama
96aefc3938 ✏️ 调整 log 格式 2021-09-27 22:10:47 +08:00
github-actions[bot]
5bb0493f02 🎨 改进代码样式 2021-09-27 14:10:29 +00:00
fumiama
e8fa6b8b07 ✏️ 增加命令行参数说明 2021-09-27 22:09:51 +08:00
fumiama
ec15178ba7 ✏️ 修正命令行参数 2021-09-27 22:06:46 +08:00
fumiama
1d469a40d5 aifalse 增加 清理缓存 2021-09-27 21:51:05 +08:00
fumiama
4df30a56a3 ✏️ 修复 panic 2021-09-27 21:37:55 +08:00
fumiama
6bc1e407d5 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-09-27 21:31:54 +08:00
fumiama
48442330c1 ✏️ 美化 log & 更新 banner 2021-09-27 21:31:38 +08:00
fumiama
3623a88b16 ✏️ 调整 log 格式 2021-09-27 21:27:30 +08:00
github-actions[bot]
ffca19edab 🎨 改进代码样式 2021-09-27 13:20:16 +00:00
fumiama
52a8a9de6f 增加插件 reborn 2021-09-27 21:19:37 +08:00
fumiama
b9e303196f ✏️ gif插件增加缓存 2021-09-27 20:23:15 +08:00
fumiama
da3a7e12bd update ZeroBot-Plugin-Gif to v0.1.6 2021-09-26 10:39:43 +08:00
huoxue1
21013bde98 feat: 添加webui的初步支持 (#63)
* feat: 添加webui的初步支持

使用gin监听server,前端使用vuecli
目前已支持:
   前端发送信息
   前端获取信息
   获取插件列表
预计实现功能:

改变插件状态
  获取日志
  获取配置信息
  改变配置信息
  获取好友请求列表以及群请求列表
  手动同意申请列表

* feat: 继续实现webui功能

改变插件状态
  获取日志
  获取配置信息
  前端仓库位置更改

* fix: 修复golangLint的提示信息

* 🎨 改进代码样式

* Update gui.go

* fix: 修复golangLint的提示信息

* fix: 修复golangLint的提示信息

* feat: 支持通过命令行参数禁用gui

* fix: 设置gin在非debug模式下禁用日志

* Update gui.go

* Update gui.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
2021-09-26 10:35:07 +08:00
fumiama
ae6d83c675 mlh 2021-09-26 10:26:23 +08:00
fumiama
f932e24573 mlh 2021-09-26 10:25:26 +08:00
fumiama
a588ec9d18 mlh 2021-09-26 10:24:46 +08:00
fumiama
bc23211f23 make lint happy 2021-09-26 10:23:52 +08:00
源文雨
78ebf39624 Update choose.go 2021-09-26 10:21:41 +08:00
源文雨
bbc2ab5f17 Update register.go 2021-09-26 10:20:57 +08:00
源文雨
2ffe1e9112 Update rule.go 2021-09-26 10:20:40 +08:00
源文雨
1036733fcb Update register.go 2021-09-26 10:19:10 +08:00
源文雨
ebd5555955 Update text.go 2021-09-26 10:18:21 +08:00
源文雨
83199cf3aa Update nbnhhsh.go 2021-09-26 10:15:22 +08:00
源文雨
c724be743d Update sqlite.go 2021-09-26 10:09:04 +08:00
源文雨
42ba65e21b Update nbnhhsh.go 2021-09-26 10:07:57 +08:00
Kanri
3405c1c45a 翻牌改为抽取最近发言的人 2021-09-25 18:11:53 +08:00
Kanri
5cb6608e17 🗃️🍱 更新数据库 2021-09-25 18:03:11 +08:00
fumiama
aa891ad3fa ✏️ 修复某些 gif 制作失败 2021-09-19 19:44:45 +08:00
fumiama
158bda52a8 ✏️ 升级gif 2021-09-19 19:10:49 +08:00
fumiama
57e5ea87d8 ✏️ 修正制图小错误 2021-09-19 18:07:08 +08:00
fumiama
74486f65cf ✏️ 简化&美化日志输出 2021-09-19 17:06:24 +08:00
fumiama
27fcb63601 ✏️ 制图增加 control 2021-09-19 16:48:41 +08:00
github-actions[bot]
8d83d6be2f 🎨 改进代码样式 2021-09-12 10:43:19 +00:00
Kanri
d31e67e598 Merge pull request #61 from DiheChen/master
Introduce new feature: choose
2021-09-12 18:42:53 +08:00
Chendihe4975
629d3c1fa8 帮助选择困难症 2021-09-12 17:52:30 +08:00
Kanri
193d6efa67 Merge pull request #60 from DiheChen/master
Introduce new feature: 拼音首字母缩写释义工具
2021-09-12 15:44:30 +08:00
Chendihe4975
c70dbd219c Update README 2021-09-12 15:37:54 +08:00
Chendihe4975
da289073e2 拼音首字母缩写释义工具 2021-09-12 15:34:38 +08:00
fumiama
5aad22f254 ✏️ 更新README 2021-09-12 14:43:17 +08:00
fumiama
815c8f97d0 ✏️ 更新README 2021-09-12 14:41:25 +08:00
fumiama
7123fc7e37 ✏️ 更新README 2021-09-12 14:38:43 +08:00
github-actions[bot]
fee3d9c145 🎨 改进代码样式 2021-09-12 01:50:01 +00:00
Kanri
6808e6e1b4 更新依赖 2021-09-12 09:48:43 +08:00
Kanri
12f25a308a 增加制图插件 2021-09-12 09:48:29 +08:00
fumiama
7fe401faa8 ✏️ 缩小青云客匹配范围 2021-09-10 15:05:15 +08:00
fumiama
182fb7c783 ✏️ 缩小青云客匹配范围 2021-09-10 15:04:37 +08:00
fumiama
c06b53afef ✏️ 缩小青云客匹配范围 2021-09-10 15:00:05 +08:00
fumiama
65a5b53b88 ✏️ 缩小青云客匹配范围 2021-09-10 14:52:36 +08:00
fumiama
e8503e97e3 ✏️ 修复帮助冲突 2021-09-10 14:43:44 +08:00
fumiama
f9a914926e ✏️ 美化格式 2021-09-10 14:31:44 +08:00
fumiama
8d4d6c7e5e ✏️ 美化格式 2021-09-10 14:31:10 +08:00
fumiama
dbb681e8a6 ✏️ 插件控制 增加当前群开启状态显示 2021-09-10 14:29:03 +08:00
fumiama
f0d7b38a73 ✏️ 避免重复调用 2021-09-10 14:16:33 +08:00
fumiama
70da534bfb Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-09-10 14:00:56 +08:00
fumiama
308ec05405 ✏️ 修复首次启动可能 panic 2021-09-10 14:00:46 +08:00
Kanri
5fe5e8a304 Update README.md 2021-09-09 23:58:44 +08:00
fumiama
b02789b560 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-09-09 20:58:10 +08:00
fumiama
7e98064e09 ✏️ banner 更新版本与时间 2021-09-09 20:58:01 +08:00
github-actions[bot]
eaada5667e 🎨 改进代码样式 2021-09-09 12:51:27 +00:00
fumiama
b83ca94d98 ✏️ 优化排版 2021-09-09 20:50:48 +08:00
fumiama
bd88c68208 ✏️ 增加 setblock 避免冲突 2021-09-09 12:31:57 +08:00
fumiama
6e0b754a66 ✏️ 优化control 2021-09-09 12:21:48 +08:00
github-actions[bot]
94abf34466 🎨 改进代码样式 2021-09-09 03:14:09 +00:00
fumiama
91396c8885 应用插件控制到大部分插件 2021-09-09 11:13:23 +08:00
fumiama
cb3cfa054b ✏️ 取消部分 @ 以免多次匹配 2021-09-09 00:45:49 +08:00
fumiama
ebf58d4b73 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-09-09 00:38:04 +08:00
fumiama
f704cddae8 修正 2021-09-09 00:37:49 +08:00
github-actions[bot]
f03d2f3940 🎨 改进代码样式 2021-09-08 16:20:47 +00:00
fumiama
087c6c0298 新增插件控制 2021-09-09 00:20:04 +08:00
fumiama
be49ba83b3 ✏️ 根据 PID 搜图增加删图判断 2021-09-08 18:40:41 +08:00
fumiama
843c77e9ba Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-09-08 13:50:16 +08:00
fumiama
6cd117ded0 🎨 屏蔽冗余文件夹 2021-09-08 13:50:06 +08:00
github-actions[bot]
6c1da554f0 🎨 改进代码样式 2021-09-08 05:49:03 +00:00
fumiama
bbc96a83d7 ✏️ 增加 Diana 插件保存反馈 2021-09-08 13:48:13 +08:00
fumiama
0bffc38be4 ✏️ Diana 插件实装教你一篇小作文 2021-09-08 13:45:23 +08:00
fumiama
4bce4b2dd1 ✏️ 升级依赖 2021-09-08 12:57:33 +08:00
源文雨
95fa96e883 Update README.md 2021-09-08 12:45:14 +08:00
Kanri
99a5960794 ✏️ 修复我好了 2021-09-08 09:40:45 +08:00
Kanri
aab28717c6 ✏️ 小修改 2021-09-06 15:58:41 +08:00
Kanri
763b0a0a47 🔨 易风控功能,删除 2021-09-06 15:55:29 +08:00
Kanri
3b1bef9c3d 🎨 优化青云客 2021-09-06 15:54:57 +08:00
Kanri
c83c4079cf Merge branch 'master' of github.com:FloatTech/ZeroBot-Plugin 2021-09-06 15:12:12 +08:00
Kanri
ae46b57ea1 ✏️ 修改了延时逻辑 2021-09-06 15:09:30 +08:00
github-actions[bot]
0529dcf0ef 🎨 改进代码样式 2021-09-06 06:59:32 +00:00
Kanri
3ae333e047 ✏️ 修复碧油鸡 2021-09-06 14:58:04 +08:00
Kanri
bc7b84115a ⬇️ 回退到 Go 1.16 2021-09-06 14:56:39 +08:00
Kanri
f3ddff720f ✏️ 暂时不使用 1.17 新特性 2021-09-06 14:56:00 +08:00
github-actions[bot]
8233950bad 🎨 改进代码样式 2021-09-05 08:42:56 +00:00
Kanri
2f902837f6 Merge pull request #59 from guohuiyuan/master
添加自动回复
2021-09-05 16:41:45 +08:00
haibaraguo
6bd80b8ebd 晚上好 2021-09-05 15:31:25 +08:00
haibaraguo
733529cf78 修改readme 2021-09-05 15:09:34 +08:00
haibaraguo
b36cd30987 修改readme 2021-09-05 15:04:18 +08:00
haibaraguo
5a9a566694 添加自动加群,加好友 2021-09-05 14:39:42 +08:00
haibaraguo
9665f6cb3f 优化atri.go匹配逻辑 2021-09-05 12:04:18 +08:00
haibaraguo
f790165358 fix:解决套娃 2021-09-05 10:27:28 +08:00
haibaraguo
7e2912d5d1 fix:修改格式 2021-09-05 02:35:07 +08:00
haibaraguo
c8e7e19934 feat:添加定时早安 2021-09-05 02:14:25 +08:00
haibaraguo
d7f3e3ed79 feat:添加斗图 2021-09-04 17:33:05 +08:00
haibaraguo
6dfa1efa5d fix:减少nohup 2021-09-04 01:43:37 +08:00
haibaraguo
3d5f72a64c fix:减少nohup 2021-09-04 01:41:25 +08:00
haibaraguo
a32658ea61 fix:减少nohup 2021-09-04 01:40:21 +08:00
haibaraguo
d142234af4 fix:减少nohup 2021-09-04 01:38:01 +08:00
haibaraguo
b60a6c7d0c fix:修改了atri.go的匹配逻辑 2021-09-04 01:26:55 +08:00
haibaraguo
3077f3c053 fix:减少多余文件 2021-09-04 00:40:50 +08:00
haibaraguo
f762d5ea00 fix:减少多余文件 2021-09-04 00:33:24 +08:00
haibaraguo
060e167dc7 feat:添加青云客接口 2021-09-02 09:48:18 +08:00
fumiama
47aa6213bf ✏️ 更新编译说明 2021-08-27 17:14:27 +08:00
55 changed files with 3642 additions and 490 deletions

View File

@@ -13,43 +13,43 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
- name: Build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
- name: Build armv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
- name: Build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
- name: Build armv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true

View File

@@ -1,5 +1,5 @@
name: PullLint
on: [pull_request]
on: [ pull_request ]
jobs:
golangci:
name: lint
@@ -9,7 +9,7 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2

View File

@@ -1,5 +1,5 @@
name: PushLint
on: [push]
on: [ push ]
jobs:
golangci:
name: lint
@@ -9,7 +9,7 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2

View File

@@ -13,43 +13,43 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
- name: Build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
- name: Build armv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
- name: Build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
- name: Build armv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true

19
.gitignore vendored
View File

@@ -1,7 +1,12 @@
data/SetuTime/cache
data/SetuTime/search
data/manager
data/acgimage
.idea/
.DS_Store
.vscode
data/SetuTime/cache
data/control
data/SetuTime/search
data/manager
data/acgimage
data/fortune
data/hs
.idea/
.DS_Store
.vscode
go-zero*
nohup.out

View File

@@ -12,14 +12,26 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/Yiwen-Chan/ZeroBot-Plugin?style=flat-square&logo=go)](https://goreportcard.com/report/github.com/github.com/Yiwen-Chan/ZeroBot-Plugin)
[![Badge](https://img.shields.io/badge/onebot-v11-black?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAMAAADxPgR5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAxQTFRF////29vbr6+vAAAAk1hCcwAAAAR0Uk5T////AEAqqfQAAAKcSURBVHja7NrbctswDATQXfD//zlpO7FlmwAWIOnOtNaTM5JwDMa8E+PNFz7g3waJ24fviyDPgfhz8fHP39cBcBL9KoJbQUxjA2iYqHL3FAnvzhL4GtVNUcoSZe6eSHizBcK5LL7dBr2AUZlev1ARRHCljzRALIEog6H3U6bCIyqIZdAT0eBuJYaGiJaHSjmkYIZd+qSGWAQnIaz2OArVnX6vrItQvbhZJtVGB5qX9wKqCMkb9W7aexfCO/rwQRBzsDIsYx4AOz0nhAtWu7bqkEQBO0Pr+Ftjt5fFCUEbm0Sbgdu8WSgJ5NgH2iu46R/o1UcBXJsFusWF/QUaz3RwJMEgngfaGGdSxJkE/Yg4lOBryBiMwvAhZrVMUUvwqU7F05b5WLaUIN4M4hRocQQRnEedgsn7TZB3UCpRrIJwQfqvGwsg18EnI2uSVNC8t+0QmMXogvbPg/xk+Mnw/6kW/rraUlvqgmFreAA09xW5t0AFlHrQZ3CsgvZm0FbHNKyBmheBKIF2cCA8A600aHPmFtRB1XvMsJAiza7LpPog0UJwccKdzw8rdf8MyN2ePYF896LC5hTzdZqxb6VNXInaupARLDNBWgI8spq4T0Qb5H4vWfPmHo8OyB1ito+AysNNz0oglj1U955sjUN9d41LnrX2D/u7eRwxyOaOpfyevCWbTgDEoilsOnu7zsKhjRCsnD/QzhdkYLBLXjiK4f3UWmcx2M7PO21CKVTH84638NTplt6JIQH0ZwCNuiWAfvuLhdrcOYPVO9eW3A67l7hZtgaY9GZo9AFc6cryjoeFBIWeU+npnk/nLE0OxCHL1eQsc1IciehjpJv5mqCsjeopaH6r15/MrxNnVhu7tmcslay2gO2Z1QfcfX0JMACG41/u0RrI9QAAAABJRU5ErkJggg==)](https://github.com/howmanybots/onebot)
[![Badge](https://img.shields.io/badge/zerobot-v1.2.2-black?style=flat-square&logo=go)](https://github.com/wdvxdr1123/ZeroBot)
[![Badge](https://img.shields.io/badge/zerobot-v1.2.3-black?style=flat-square&logo=go)](https://github.com/wdvxdr1123/ZeroBot)
[![License](https://img.shields.io/github/license/Yiwen-Chan/OneBot-YaYa.svg?style=flat-square&logo=gnu)](https://raw.githubusercontent.com/FloatTech/ZeroBot-Plugin/master/LICENSE)
[![qq group](https://img.shields.io/badge/group-1048452984-red?style=flat-square&logo=tencent-qq)](https://jq.qq.com/?_wv=1027&k=QMb7x1mM)
</div>
## 命令行参数
```bash
zerobot [-d] [-g] qq1 qq2 qq3 ...
```
- **-d**: 开启 debug 级别日志输出
- **-g**: 开启 [webgui](https://github.com/FloatTech/bot-manager)
- **qqs**: superusers 的 qq 号
## 功能
- **插件控制**
- [x] /启用 xxx
- [x] /禁用 xxx
- [x] /用法 xxx
- [x] /服务列表
- **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat"`
- [x] [BOT名字]
- [x] [戳一戳BOT]
@@ -46,10 +58,10 @@
- [x] *入群欢迎
- [x] *退群通知
- [x] 设置欢迎语[欢迎~]
- [x] 在MMdd日的hhmm分时(用http://url)提醒大家xxx
- [x] 在MM月[每周|周几]的hhmm分时(用http://url)提醒大家xxx
- [x] 取消在MMdd日的hhmm分的提醒
- [x] 取消在MM月[每周|周几]的hhmm分的提醒
- [x][MM]月[dd]日的[hh]点[mm]分时(用[url])提醒大家[xxx]
- [x][MM]月[每周|周几]的[hh]点[mm]分时(用[url])提醒大家[xxx]
- [x] 取消在[MM]月[dd]日的[hh]点[mm]分的提醒
- [x] 取消在[MM]月[每周|周几]的[hh]点[mm]分的提醒
- [x] 列出所有提醒
- [x] 翻牌
- [x] [开启|关闭]入群验证
@@ -62,9 +74,8 @@
- [x] >github [xxx]
- [x] >github -p [xxx]
- **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode"`
- [x] >runcode help
- [x] >runcode [on/off]
- [x] >runcode [language] [code block]
- [x] > runcode [language] help
- [x] > runcode [language] [code block]
- **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music"`
- [x] 点歌[xxx]
- [x] 网易点歌[xxx]
@@ -81,12 +92,12 @@
- [x] 爬[@xxx]
- [x] 摸[@xxx]
- [x] 搓[@xxx]
- 注:`main.go`中并未import该插件。详情见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif
- 注:更多指令见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif
- **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"`
- [x] 来份[涩图/二次元/风景/车万]
- [x] 添加[涩图/二次元/风景/车万][P站图片ID]
- [x] 删除[涩图/二次元/风景/车万][P站图片ID]
- [x] >setu status
- [x] > setu status
- **lolicon** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon"`
- [x] 来份萝莉
- **搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"`
@@ -98,26 +109,45 @@
- [x] 设置随机图片网址[url]
- [x] 太涩了(撤回最近发的图)
- [x] 评价图片(发送一张图片让bot评分)
- **每日运势** `github.com/FloatTech/ZeroBot-Plugin/plugin_fortune`
- [x] 运势|抽签
- [x] 设置底图[车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师]
- **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji`
- 本插件要求`Go`版本大于等于`1.17`
- [x] @BOT 求签|运势|占卜
- [x] 求签|占卜
- **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"`
- [x] >bili info [名字]
- [x] >vup info [名字|uid]
- [x] >user info [名字|uid]
- [x] /开启粉丝日报
- **嘉然** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana"`
- [x] @BOT 小作文
- [x] @BOT 发大病
- [x] @BOT 教你一篇小作文[作文]
- [x] 小作文
- [x] 发大病
- [x] 教你一篇小作文[作文]
- [x] [回复]查重
- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"`
- [x] 查询计算机当前活跃度 [身体检查]
- [x] 清理缓存
- [ ] 简易语音
- [ ] 爬图合成 [@xxx]
- **minecraft** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft"`
- [x] 具体指令看代码
- [x] /mcstart xxx
- [x] /mcstop xxx
- [x] /mclist servername
- 注:此功能实现依赖[MCSManager](https://github.com/Suwings/MCSManager)项目对服务器的管理apimc服务器如果没有在该管理平台部署此功能无效
- **炉石** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs"`
- [x] 搜卡[xxxx]
- [x] [卡组代码xxx]
- **炉石** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs"`
- [x] 搜卡[xxxx]
- [x] [卡组代码xxx]
-更多搜卡指令参数https://hs.fbigame.com/misc/searchhelp
- **青云客** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke"`
- [x] @Bot 任意文本(任意一句话回复)
- **关键字搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_image_finder"`
- [x] 来张 [xxx]
- **拼音首字母释义工具** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_nbnhhsh"`
- [x] ?? [缩写]
- **选择困难症帮手** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_choose"`
- [x] 选择[选择项1]还是[选项2]还是[更多选项]
- **投胎** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_reborn"`
- [x] reborn
- 注:本插件来源于[tgbot](https://github.com/YukariChiba/tgbot/blob/main/modules/Reborn.py)
- **TODO...**
## 使用方法
@@ -125,16 +155,17 @@
本项目符合 [OneBot](https://github.com/howmanybots/onebot) 标准,可基于以下项目与机器人框架/平台进行交互
| 项目地址 | 平台 | 核心作者 | 备注 |
| --- | --- | --- | --- |
| [Yiwen-Chan/OneBot-YaYa](https://github.com/Yiwen-Chan/OneBot-YaYa) | [先驱](https://www.xianqubot.com/) | kanri | |
| [richardchien/coolq-http-api](https://github.com/richardchien/coolq-http-api) | CKYU | richardchien | 可在 Mirai 平台使用 [mirai-native](https://github.com/iTXTech/mirai-native) 加载 |
| [Mrs4s/go-cqhttp](https://github.com/Mrs4s/go-cqhttp) | [MiraiGo](https://github.com/Mrs4s/MiraiGo) | Mrs4s | |
| [yyuueexxiinngg/cqhttp-mirai](https://github.com/yyuueexxiinngg/cqhttp-mirai) | [Mirai](https://github.com/mamoe/mirai) | yyuueexxiinngg | |
| [takayama-lily/onebot](https://github.com/takayama-lily/onebot) | [OICQ](https://github.com/takayama-lily/oicq) | takayama | |
### 使用稳定版/测试版
### 使用稳定版/测试版 (推荐)
可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。
### 本地运行
1. 下载安装 [Go](https://studygolang.com/dl) 环境
2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压
3. 编辑 main.go 文件,内容按需修改
@@ -143,17 +174,21 @@
### 编译运行
#### 利用 Actions 在线编译 (推荐)
#### 利用 Actions 在线编译
1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库
2. 点击仓库上方的 Actions 按钮,确认使用 Actions
3. 编辑 main.go 文件,内容按需修改,提交修改后 Actions 自动执行
4. 点击 Actions 按钮,等待编译完成,在 Actions 里下载编译好的文件
5. 运行 OneBot 框架,并同时运行本插
6. 啾咪~
3. 编辑 main.go 文件,内容按需修改
4. 前往 Release 页面发布一个 Release`tag`形如`vx.y.z`,以触发稳定版编译流程
5. 点击 Actions 按钮,等待编译完成,回到 Release 页面下载编译好的文
6. 运行 OneBot 框架,并同时运行本插件
7. 啾咪~
#### 本地编译/交叉编译
1. 下载安装 [Go](https://studygolang.com/dl) 环境
2. clone 并进入本项目,下载所需包
```bash
git clone --depth=1 https://github.com/FloatTech/ZeroBot-Plugin.git
cd ZeroBot-Plugin
@@ -162,8 +197,10 @@ go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=auto
go mod tidy
```
3. 编辑 main.go 文件,内容按需修改
4. 按照平台输入命令编译,下面举了两个不太常见的例子
```bash
# 本机平台
go build -ldflags "-s -w" -o zerobot
@@ -172,12 +209,14 @@ GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot
# mips Linux 平台 如 路由器 wndr4300
GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot
```
5. 运行 OneBot 框架,并同时运行本插件
## 特别感谢
- [ZeroBot](https://github.com/wdvxdr1123/ZeroBot)
- [ATRI](https://github.com/Kyomotoi/ATRI)
## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FYiwen-Chan%2FZeroBot-Plugin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FYiwen-Chan%2FZeroBot-Plugin?ref=badge_large)

479
control/gui.go Normal file
View File

@@ -0,0 +1,479 @@
package control
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strconv"
manager "github.com/FloatTech/bot-manager"
// 依赖gin监听server
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
// 前端静态文件
log "github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
var (
// 向前端推送消息的ws链接
conn *websocket.Conn
// 向前端推送日志的ws链接
logConn *websocket.Conn
l logWriter
)
// logWriter
// @Description:
//
type logWriter struct {
}
// InitGui 初始化gui
func InitGui() {
// 将日志重定向到前端hook
writer := io.MultiWriter(l, os.Stderr)
log.SetOutput(writer)
// 监听后端
go controller()
// 注册消息handle
messageHandle()
}
// websocket的协议升级
var upGrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
func controller() {
defer func() {
err := recover()
if err != nil {
log.Errorln("[gui]" + "bot-manager出现不可恢复的错误")
log.Errorln("[gui]", err)
}
}()
engine := gin.New()
// 支持跨域
engine.Use(cors())
// 注册静态文件
engine.StaticFS("/dist", http.FS(manager.Dist))
engine.POST("/get_bots", getBots)
engine.POST("/get_group_list", getGroupList)
engine.POST("/get_friend_list", getFriendList)
// 注册主路径路由,使其跳转到主页面
engine.GET("/", func(context *gin.Context) {
context.Redirect(http.StatusMovedPermanently, "/dist/dist/default.html")
})
// 更改某个插件状态
engine.POST("/update_plugin_status", updatePluginStatus)
// 更改某一个插件在所有群的状态
engine.POST("/update_plugin_all_group_status", updatePluginAllGroupStatus)
// 更改所有插件状态
engine.POST("/update_all_plugin_status", updateAllPluginStatus)
// 获取所有插件状态
engine.POST("/get_plugins_status", getPluginsStatus)
// 获取一个插件状态
engine.POST("/get_plugin_status", getPluginStatus)
// 获取插件列表
engine.POST("/get_plugins", func(context *gin.Context) {
var datas []map[string]interface{}
forEach(func(key string, manager *Control) bool {
datas = append(datas, map[string]interface{}{"id": 1, "handle_type": "", "name": key, "enable": manager.isEnabledIn(0)})
return true
})
context.JSON(200, datas)
})
// 链接日志
engine.GET("/get_log", getLogs)
// 获取前端标签
engine.GET("/get_label", func(context *gin.Context) {
context.JSON(200, "ZeroBot-Plugin")
})
// 发送信息
engine.POST("/send_msg", sendMsg)
engine.GET("/data", upgrade)
log.Infoln("[gui] the webui is running http://127.0.0.1:3000")
log.Infoln("[gui] ", "you input the `ZeroBot-Plugin.exe -g` can disable the gui")
if err := engine.Run("127.0.0.1:3000"); err != nil {
log.Debugln("[gui] ", err.Error())
}
}
// updateAllPluginStatus
/**
* @Description: 改变所有插件的状态
* @param context
* example
*/
func updateAllPluginStatus(context *gin.Context) {
enable, err := strconv.ParseBool(context.PostForm("enable"))
if err != nil {
var parse map[string]interface{}
err := context.BindJSON(&parse)
if err != nil {
log.Errorln("[gui] " + err.Error())
return
}
enable = parse["enable"].(bool)
}
var groups []int64
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, group := range ctx.GetGroupList().Array() {
groups = append(groups, group.Get("group_id").Int())
}
return true
})
forEach(func(key string, manager *Control) bool {
if enable {
for _, group := range groups {
manager.enable(group)
}
} else {
for _, group := range groups {
manager.disable(group)
}
}
return true
})
context.JSON(200, nil)
}
// updatePluginAllGroupStatus
/**
* @Description: 改变插件在所有群的状态
* @param context
* example
*/
func updatePluginAllGroupStatus(context *gin.Context) {
name := context.PostForm("name")
enable, err := strconv.ParseBool(context.PostForm("enable"))
if err != nil {
var parse map[string]interface{}
err := context.BindJSON(&parse)
if err != nil {
log.Errorln("[gui]" + err.Error())
return
}
name = parse["name"].(string)
enable = parse["enable"].(bool)
}
control, b := lookup(name)
if !b {
context.JSON(404, nil)
return
}
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, group := range ctx.GetGroupList().Array() {
if enable {
control.enable(group.Get("group_id").Int())
} else {
control.disable(group.Get("group_id").Int())
}
}
return true
})
context.JSON(200, nil)
}
// updatePluginStatus
/**
* @Description: 更改某一个插件状态
* @param context
* example
*/
func updatePluginStatus(context *gin.Context) {
var parse map[string]interface{}
err := context.BindJSON(&parse)
if err != nil {
log.Errorln("[gui] ", err)
return
}
groupID := int64(parse["group_id"].(float64))
name := parse["name"].(string)
enable := parse["enable"].(bool)
fmt.Println(name)
control, b := lookup(name)
if !b {
context.JSON(404, "服务不存在")
return
}
if enable {
control.enable(groupID)
} else {
control.disable(groupID)
}
context.JSON(200, nil)
}
// getPluginStatus
/**
* @Description: 获取一个插件的状态
* @param context
* example
*/
func getPluginStatus(context *gin.Context) {
groupID, err := strconv.ParseInt(context.PostForm("group_id"), 10, 64)
name := context.PostForm("name")
if err != nil {
var parse map[string]interface{}
err := context.BindJSON(&parse)
if err != nil {
log.Errorln("[gui]" + err.Error())
return
}
groupID = int64(parse["group_id"].(float64))
name = parse["name"].(string)
}
control, b := lookup(name)
if !b {
context.JSON(404, "服务不存在")
return
}
context.JSON(200, gin.H{"enable": control.isEnabledIn(groupID)})
}
// getPluginsStatus
/**
* @Description: 获取所有插件的状态
* @param context
* example
*/
func getPluginsStatus(context *gin.Context) {
groupID, err := strconv.ParseInt(context.PostForm("group_id"), 10, 64)
if err != nil {
var parse map[string]interface{}
err := context.BindJSON(&parse)
if err != nil {
log.Errorln("[gui]" + err.Error())
return
}
groupID = int64(parse["group_id"].(float64))
}
var datas []map[string]interface{}
forEach(func(key string, manager *Control) bool {
enable := manager.isEnabledIn(groupID)
datas = append(datas, map[string]interface{}{"name": key, "enable": enable})
return true
})
context.JSON(200, datas)
}
// getLogs
/**
* @Description: 连接日志
* @param context
* example
*/
func getLogs(context *gin.Context) {
con1, err := upGrader.Upgrade(context.Writer, context.Request, nil)
if err != nil {
return
}
logConn = con1
}
// getFriendList
/**
* @Description: 获取好友列表
* @param context
* example
*/
func getFriendList(context *gin.Context) {
selfID, err := strconv.Atoi(context.PostForm("self_id"))
if err != nil {
log.Errorln("[gui]" + err.Error())
var data map[string]interface{}
err := context.BindJSON(&data)
if err != nil {
log.Errorln("[gui]" + err.Error())
log.Errorln("[gui]" + "绑定错误")
return
}
selfID = int(data["self_id"].(float64))
}
bot := zero.GetBot(int64(selfID))
var resp []interface{}
list := bot.GetFriendList().String()
err = json.Unmarshal([]byte(list), &resp)
if err != nil {
log.Errorln("[gui]" + err.Error())
log.Errorln("[gui]" + "解析json错误")
}
context.JSON(200, resp)
}
// getGroupList
/**
* @Description: 获取群列表
* @param context
* example
*/
func getGroupList(context *gin.Context) {
selfID, err := strconv.Atoi(context.PostForm("self_id"))
if err != nil {
var data map[string]interface{}
err := context.BindJSON(&data)
if err != nil {
log.Errorln("[gui]" + err.Error())
return
}
selfID = int(data["self_id"].(float64))
}
bot := zero.GetBot(int64(selfID))
var resp []interface{}
list := bot.GetGroupList().String()
err = json.Unmarshal([]byte(list), &resp)
if err != nil {
log.Errorln("[gui]" + err.Error())
}
context.JSON(200, resp)
}
// getBots
/**
* @Description: 获取机器人qq号
* @param context
* example
*/
func getBots(context *gin.Context) {
var bots []int64
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
bots = append(bots, id)
return true
})
context.JSON(200, bots)
}
// MessageHandle
/**
* @Description: 定义一个向前端发送信息的handle
* example
*/
func messageHandle() {
defer func() {
err := recover()
if err != nil {
log.Errorln("[gui]" + "bot-manager出现不可恢复的错误")
log.Errorln("[gui] ", err)
}
}()
matcher := zero.OnMessage().SetBlock(false).SetPriority(1)
matcher.Handle(func(ctx *zero.Ctx) {
if conn != nil {
err := conn.WriteJSON(ctx.Event)
if err != nil {
log.Debugln("[gui] " + "向发送错误")
return
}
}
})
}
// upgrade
/**
* @Description: 连接ws向前端推送message
* @param context
* example
*/
func upgrade(context *gin.Context) {
con, err := upGrader.Upgrade(context.Writer, context.Request, nil)
if err != nil {
return
}
conn = con
}
// sendMsg
/**
* @Description: 前端调用发送信息
* @param context
* example
*/
func sendMsg(context *gin.Context) {
var data map[string]interface{}
err := context.BindJSON(&data)
if err != nil {
context.JSON(404, nil)
return
}
selfID := int64(data["self_id"].(float64))
id := int64(data["id"].(float64))
message1 := data["message"].(string)
messageType := data["message_type"].(string)
bot := zero.GetBot(selfID)
var msgID int64
if messageType == "group" {
msgID = bot.SendGroupMessage(id, message.ParseMessageFromString(message1))
} else {
msgID = bot.SendPrivateMessage(id, message.ParseMessageFromString(message1))
}
context.JSON(200, msgID)
}
// cors
/**
* @Description: 支持跨域访问
* @return gin.HandlerFunc
* example
*/
func cors() gin.HandlerFunc {
return func(c *gin.Context) {
method := c.Request.Method
origin := c.Request.Header.Get("Origin") // 请求头部
if origin != "" {
// 接收客户端发送的origin (重要!)
c.Writer.Header().Set("Access-Control-Allow-Origin", origin)
// 服务器支持的所有跨域请求的方法
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE,UPDATE")
// 允许跨域设置可以返回其他子段,可以自定义字段
c.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, X-CSRF-Token, Token,session, Content-Type")
// 允许浏览器(客户端)可以解析的头部 (重要)
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers")
// 设置缓存时间
c.Header("Access-Control-Max-Age", "172800")
// 允许客户端传递校验信息比如 cookie (重要)
c.Header("Access-Control-Allow-Credentials", "true")
}
// 允许类型校验
if method == "OPTIONS" {
c.JSON(http.StatusOK, "ok!")
}
defer func() {
if err := recover(); err != nil {
log.Printf("Panic info is: %v", err)
}
}()
c.Next()
}
}
func (l logWriter) Write(p []byte) (n int, err error) {
if logConn != nil {
err := logConn.WriteMessage(websocket.TextMessage, p)
if err != nil {
return len(p), nil
}
}
return len(p), nil
}

12
control/register.go Normal file
View File

@@ -0,0 +1,12 @@
package control
import (
zero "github.com/wdvxdr1123/ZeroBot"
)
// Register 注册插件控制器
func Register(service string, o *Options) *zero.Engine {
engine := zero.New()
engine.UsePreHandler(newctrl(service, o).Handler())
return engine
}

196
control/rule.go Normal file
View File

@@ -0,0 +1,196 @@
// Package control 控制插件的启用与优先级等
package control
import (
"os"
"strconv"
"sync"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/data"
)
var (
db = &data.Sqlite{DBPath: "data/control/plugins.db"}
// managers 每个插件对应的管理
managers = map[string]*Control{}
mu = sync.RWMutex{}
hasinit bool
)
// Control is to control the plugins.
type Control struct {
sync.RWMutex
service string
options Options
}
// newctrl returns Manager with settings.
func newctrl(service string, o *Options) *Control {
m := &Control{service: service,
options: func() Options {
if o == nil {
return Options{}
}
return *o
}(),
}
mu.Lock()
defer mu.Unlock()
managers[service] = m
err := db.Create(service, &grpcfg{})
if err != nil {
panic(err)
}
return m
}
// enable enables a group to pass the Manager.
func (m *Control) enable(groupID int64) {
m.Lock()
err := db.Insert(m.service, &grpcfg{groupID, 0})
if err != nil {
logrus.Errorf("[control] %v", err)
}
m.Unlock()
}
// disable disables a group to pass the Manager.
func (m *Control) disable(groupID int64) {
m.Lock()
err := db.Insert(m.service, &grpcfg{groupID, 1})
if err != nil {
logrus.Errorf("[control] %v", err)
}
m.Unlock()
}
func (m *Control) isEnabledIn(gid int64) bool {
m.RLock()
var c grpcfg
err := db.Find(m.service, &c, "WHERE gid = "+strconv.FormatInt(gid, 10))
if err == nil {
m.RUnlock()
logrus.Debugf("[control] plugin %s of grp %d : %d", m.service, c.GroupID, c.Disable)
return c.Disable == 0
}
logrus.Errorf("[control] %v", err)
m.RUnlock()
if m.options.DisableOnDefault {
m.disable(gid)
} else {
m.enable(gid)
}
return !m.options.DisableOnDefault
}
// Handler 返回 预处理器
func (m *Control) Handler() zero.Rule {
return func(ctx *zero.Ctx) bool {
ctx.State["manager"] = m
return m.isEnabledIn(ctx.Event.GroupID)
}
}
// lookup returns a Manager by the service name, if
// not exist, it will returns nil.
func lookup(service string) (*Control, bool) {
mu.RLock()
defer mu.RUnlock()
m, ok := managers[service]
return m, ok
}
// forEach iterates through managers.
func forEach(iterator func(key string, manager *Control) bool) {
mu.RLock()
m := copyMap(managers)
mu.RUnlock()
for k, v := range m {
if !iterator(k, v) {
return
}
}
}
func copyMap(m map[string]*Control) map[string]*Control {
ret := make(map[string]*Control, len(m))
for k, v := range m {
ret[k] = v
}
return ret
}
func init() {
if !hasinit {
mu.Lock()
if !hasinit {
err := os.MkdirAll("data/control", 0755)
if err != nil {
panic(err)
} else {
hasinit = true
zero.OnCommandGroup([]string{"启用", "enable"}, zero.AdminPermission, zero.OnlyGroup).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
service, ok := lookup(model.Args)
if !ok {
ctx.Send("没有找到指定服务!")
}
service.enable(ctx.Event.GroupID)
ctx.Send(message.Text("已启用服务: " + model.Args))
})
zero.OnCommandGroup([]string{"禁用", "disable"}, zero.AdminPermission, zero.OnlyGroup).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
service, ok := lookup(model.Args)
if !ok {
ctx.Send("没有找到指定服务!")
}
service.disable(ctx.Event.GroupID)
ctx.Send(message.Text("已关闭服务: " + model.Args))
})
zero.OnCommandGroup([]string{"用法", "usage"}, zero.AdminPermission, zero.OnlyGroup).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
service, ok := lookup(model.Args)
if !ok {
ctx.Send("没有找到指定服务!")
}
if service.options.Help != "" {
ctx.Send(service.options.Help)
} else {
ctx.Send("该服务无帮助!")
}
})
zero.OnCommandGroup([]string{"服务列表", "service_list"}, zero.AdminPermission, zero.OnlyGroup).
Handle(func(ctx *zero.Ctx) {
msg := `---服务列表---`
i := 0
forEach(func(key string, manager *Control) bool {
i++
msg += "\n" + strconv.Itoa(i) + `: `
if manager.isEnabledIn(ctx.Event.GroupID) {
msg += "●" + key
} else {
msg += "○" + key
}
return true
})
ctx.Send(message.Text(msg))
})
}
}
mu.Unlock()
}
}

13
control/tables.go Normal file
View File

@@ -0,0 +1,13 @@
package control
// grpcfg holds the group config for the Manager.
type grpcfg struct {
GroupID int64 `db:"gid"` // GroupID 群号
Disable int64 `db:"disable"` // Disable 默认启用该插件
}
// Options holds the optional parameters for the Manager.
type Options struct {
DisableOnDefault bool
Help string // 帮助文本信息
}

906
data/Reborn/rate.json Normal file
View File

@@ -0,0 +1,906 @@
[
{
"name": "印度",
"weight": 0.179369185
},
{
"weight": 0.116660088,
"name": "中华人民共和国"
},
{
"name": "尼日利亚",
"weight": 0.052104876
},
{
"weight": 0.04490831,
"name": "巴基斯坦"
},
{
"weight": 0.029767875,
"name": "印尼"
},
{
"weight": 0.02917347,
"name": "美国"
},
{
"name": "刚果民主共和国",
"weight": 0.026980482
},
{
"weight": 0.02653533,
"name": "埃塞俄比亚"
},
{
"name": "孟加拉国",
"weight": 0.022001723
},
{
"name": "巴西",
"weight": 0.020641351
},
{
"name": "埃及",
"weight": 0.019722924
},
{
"name": "菲律宾",
"weight": 0.017944256
},
{
"name": "墨西哥",
"weight": 0.015798468
},
{
"weight": 0.015156998,
"name": "坦桑尼亚"
},
{
"weight": 0.013686862,
"name": "乌干达"
},
{
"weight": 0.010405389,
"name": "俄罗斯"
},
{
"weight": 0.010217107,
"name": "苏丹"
},
{
"weight": 0.010079201,
"name": "越南"
},
{
"name": "阿富汗",
"weight": 0.009796745
},
{
"name": "伊朗",
"weight": 0.009789926
},
{
"name": "肯尼亚",
"weight": 0.009216044
},
{
"weight": 0.008870993,
"name": "安哥拉"
},
{
"name": "土耳其",
"weight": 0.008815318
},
{
"weight": 0.008267509,
"name": "莫桑比克"
},
{
"name": "南非",
"weight": 0.007826801
},
{
"weight": 0.00755071,
"name": "尼日尔"
},
{
"name": "伊拉克",
"weight": 0.007350484
},
{
"name": "喀麦隆",
"weight": 0.006786572
},
{
"weight": 0.006782117,
"name": "缅甸"
},
{
"name": "日本",
"weight": 0.006518972
},
{
"weight": 0.006384764,
"name": "加纳"
},
{
"weight": 0.006183538,
"name": "阿尔及利亚"
},
{
"weight": 0.006075416,
"name": "马里"
},
{
"name": "法国",
"weight": 0.00571344
},
{
"name": "英国",
"weight": 0.005662409
},
{
"name": "马达加斯加",
"weight": 0.00559132
},
{
"weight": 0.005562893,
"name": "也门"
},
{
"name": "哥伦比亚",
"weight": 0.005525953
},
{
"name": "布基纳法索",
"weight": 0.005378297
},
{
"name": "科特迪瓦",
"weight": 0.005352997
},
{
"name": "阿根廷",
"weight": 0.005171935
},
{
"name": "赞比亚",
"weight": 0.005147159
},
{
"name": "德国",
"weight": 0.005096501
},
{
"weight": 0.005067552,
"name": "泰国"
},
{
"name": "马拉维",
"weight": 0.005017242
},
{
"name": "乍得",
"weight": 0.004825619
},
{
"name": "摩洛哥",
"weight": 0.004571552
},
{
"weight": 0.004266592,
"name": "马来西亚"
},
{
"weight": 0.004130712,
"name": "南苏丹"
},
{
"name": "委内瑞拉",
"weight": 0.00410843
},
{
"weight": 0.003903682,
"name": "乌兹别克斯坦"
},
{
"weight": 0.003891083,
"name": "秘鲁"
},
{
"weight": 0.003854943,
"name": "尼泊尔"
},
{
"name": "沙特阿拉伯",
"weight": 0.003683713
},
{
"name": "塞内加尔",
"weight": 0.003671814
},
{
"name": "津巴布韦",
"weight": 0.003628572
},
{
"name": "意大利",
"weight": 0.003591173
},
{
"weight": 0.003564036,
"name": "贝宁"
},
{
"weight": 0.003318383,
"name": "索马里"
},
{
"name": "几内亚",
"weight": 0.003229938
},
{
"name": "韩国",
"weight": 0.00302709
},
{
"name": "危地马拉",
"weight": 0.002989448
},
{
"weight": 0.002933277,
"name": "西班牙"
},
{
"name": "布隆迪",
"weight": 0.002916273
},
{
"name": "乌克兰",
"weight": 0.002865519
},
{
"name": "叙利亚",
"weight": 0.002803866
},
{
"name": "加拿大",
"weight": 0.002769376
},
{
"name": "朝鲜",
"weight": 0.002663995
},
{
"name": "柬埔寨",
"weight": 0.002507218
},
{
"weight": 0.002459301,
"name": "卢旺达"
},
{
"weight": 0.002433661,
"name": "波兰"
},
{
"weight": 0.002264484,
"name": "澳大利亚"
},
{
"name": "斯里兰卡",
"weight": 0.002205474
},
{
"weight": 0.00217928,
"name": "哈萨克斯坦"
},
{
"name": "厄瓜多尔",
"weight": 0.002114416
},
{
"name": "塞拉利昂",
"weight": 0.002042686
},
{
"name": "海地",
"weight": 0.001815248
},
{
"name": "智利",
"weight": 0.001761297
},
{
"name": "多哥",
"weight": 0.001756614
},
{
"name": "约旦",
"weight": 0.001738363
},
{
"weight": 0.001716995,
"name": "玻利维亚"
},
{
"weight": 0.001432103,
"name": "巴布亚新几内亚"
},
{
"weight": 0.001424043,
"name": "塔吉克斯坦"
},
{
"name": "多米尼加",
"weight": 0.001376899
},
{
"name": "荷兰",
"weight": 0.001365722
},
{
"name": "罗马尼亚",
"weight": 0.001342703
},
{
"weight": 0.001340039,
"name": "台湾"
},
{
"name": "突尼斯",
"weight": 0.001327688
},
{
"name": "中非",
"weight": 0.001269639
},
{
"name": "洪都拉斯",
"weight": 0.001219191
},
{
"name": "刚果共和国",
"weight": 0.001209073
},
{
"weight": 0.001189154,
"name": "利比里亚"
},
{
"weight": 0.001150376,
"name": "以色列"
},
{
"weight": 0.001149654,
"name": "厄立特里亚"
},
{
"weight": 0.001119049,
"name": "老挝"
},
{
"name": "阿塞拜疆",
"weight": 0.001039837
},
{
"name": "利比亚",
"weight": 0.001029222
},
{
"name": "巴勒斯坦",
"weight": 0.000992651
},
{
"name": "吉尔吉斯斯坦",
"weight": 0.000957294
},
{
"weight": 0.000907425,
"name": "比利时"
},
{
"name": "瑞典",
"weight": 0.000890654
},
{
"name": "巴拉圭",
"weight": 0.00085764
},
{
"name": "毛里塔尼亚",
"weight": 0.000842302
},
{
"weight": 0.000830493,
"name": "古巴"
},
{
"name": "萨尔瓦多",
"weight": 0.000822881
},
{
"name": "尼加拉瓜",
"weight": 0.000782782
},
{
"weight": 0.000764766,
"name": "阿曼"
},
{
"name": "黎巴嫩",
"weight": 0.000751395
},
{
"name": "土库曼斯坦",
"weight": 0.000743841
},
{
"weight": 0.000680867,
"name": "阿联酋"
},
{
"weight": 0.000677997,
"name": "捷克"
},
{
"weight": 0.000643037,
"name": "白俄罗斯"
},
{
"weight": 0.000642255,
"name": "瑞士"
},
{
"name": "匈牙利",
"weight": 0.000612393
},
{
"name": "奥地利",
"weight": 0.000602473
},
{
"name": "希腊",
"weight": 0.000595922
},
{
"weight": 0.000592992,
"name": "葡萄牙"
},
{
"weight": 0.000566764,
"name": "科威特"
},
{
"weight": 0.000538867,
"name": "哥斯达黎加"
},
{
"name": "巴拿马",
"weight": 0.000513904
},
{
"name": "挪威",
"weight": 0.000466485
},
{
"name": "丹麦",
"weight": 0.000460789
},
{
"name": "爱尔兰",
"weight": 0.000455762
},
{
"name": "新西兰",
"weight": 0.000451486
},
{
"name": "纳米比亚",
"weight": 0.000450165
},
{
"name": "香港",
"weight": 0.000448826
},
{
"weight": 0.000441931,
"name": "冈比亚"
},
{
"weight": 0.000436542,
"name": "塞尔维亚"
},
{
"name": "芬兰",
"weight": 0.000417327
},
{
"weight": 0.00041658,
"name": "几内亚比绍"
},
{
"weight": 0.000410456,
"name": "保加利亚"
},
{
"weight": 0.000382945,
"name": "蒙古"
},
{
"name": "莱索托",
"weight": 0.00037228
},
{
"weight": 0.000361607,
"name": "新加坡"
},
{
"name": "斯洛伐克",
"weight": 0.000361482
},
{
"weight": 0.00035722,
"name": "加蓬"
},
{
"name": "博茨瓦纳",
"weight": 0.000348221
},
{
"weight": 0.000323338,
"name": "乌拉圭"
},
{
"name": "赤道几内亚",
"weight": 0.000318155
},
{
"name": "东帝汶",
"weight": 0.000316195
},
{
"name": "牙买加",
"weight": 0.000312724
},
{
"name": "格鲁吉亚",
"weight": 0.000307685
},
{
"weight": 0.000265076,
"name": "阿尔巴尼亚"
},
{
"weight": 0.000252622,
"name": "克罗地亚"
},
{
"weight": 0.000250708,
"name": "亚美尼亚"
},
{
"name": "波黑",
"weight": 0.000232069
},
{
"name": "摩尔多瓦",
"weight": 0.000204405
},
{
"name": "科索沃",
"weight": 0.000196993
},
{
"weight": 0.000189047,
"name": "立陶宛"
},
{
"weight": 0.000182006,
"name": "卡塔尔"
},
{
"name": "波多黎各",
"weight": 0.000182004
},
{
"name": "吉布提",
"weight": 0.000174383
},
{
"name": "北马其顿",
"weight": 0.000158321
},
{
"weight": 0.000146886,
"name": "科摩罗"
},
{
"weight": 0.000144027,
"name": "巴林"
},
{
"weight": 0.000129782,
"name": "斯洛文尼亚"
},
{
"weight": 0.000126232,
"name": "西撒哈拉"
},
{
"name": "拉脱维亚",
"weight": 0.000124966
},
{
"name": "所罗门群岛",
"weight": 0.000120169
},
{
"name": "斐济",
"weight": 0.000110985
},
{
"weight": 0.000110769,
"name": "特立尼达和多巴哥"
},
{
"weight": 0.000109656,
"name": "毛里求斯"
},
{
"weight": 8.8e-5,
"name": "爱沙尼亚"
},
{
"weight": 8.61e-5,
"name": "圭亚那"
},
{
"name": "不丹",
"weight": 8.61e-5
},
{
"weight": 7.49e-5,
"name": "佛得角"
},
{
"name": "塞浦路斯",
"weight": 6.8e-5
},
{
"name": "伯利兹",
"weight": 6.4e-5
},
{
"weight": 6.01e-5,
"name": "苏里南"
},
{
"name": "文莱",
"weight": 5.2e-5
},
{
"weight": 5.1e-5,
"name": "黑山"
},
{
"name": "瓦努阿图",
"weight": 5.1e-5
},
{
"name": "卢森堡",
"weight": 5.07e-5
},
{
"name": "马尔代夫",
"weight": 4.27e-5
},
{
"name": "巴哈马",
"weight": 4.06e-5
},
{
"weight": 3.82e-5,
"name": "澳门"
},
{
"weight": 3.48e-5,
"name": "马耳他"
},
{
"name": "冰岛",
"weight": 3.45e-5
},
{
"weight": 3.03e-5,
"name": "新喀里多尼亚"
},
{
"name": "萨摩亚",
"weight": 2.83e-5
},
{
"weight": 2.8e-5,
"name": "法属波利尼西亚"
},
{
"name": "关岛",
"weight": 2.36e-5
},
{
"weight": 2.32e-5,
"name": "巴巴多斯"
},
{
"name": "基里巴斯",
"weight": 1.83e-5
},
{
"weight": 1.71e-5,
"name": "圣卢西亚"
},
{
"name": "库拉索",
"weight": 1.51e-5
},
{
"weight": 1.5e-5,
"name": "汤加"
},
{
"weight": 1.42e-5,
"name": "密克罗尼西亚联邦"
},
{
"weight": 1.13e-5,
"name": "格林纳达"
},
{
"name": "安提瓜和巴布达",
"weight": 1.05e-5
},
{
"weight": 9.93e-6,
"name": "圣文森特和格林纳丁斯"
},
{
"name": "泽西",
"weight": 9.66e-6
},
{
"weight": 9.64e-6,
"name": "阿鲁巴"
},
{
"weight": 9.15e-6,
"name": "美属维尔京群岛"
},
{
"weight": 9.08e-6,
"name": "马绍尔群岛"
},
{
"weight": 8.9e-6,
"name": "塞舌尔"
},
{
"name": "美属萨摩亚",
"weight": 7.97e-6
},
{
"name": "多米尼克",
"weight": 7.57e-6
},
{
"weight": 6.41e-6,
"name": "马恩岛"
},
{
"weight": 6.09e-6,
"name": "北马里亚纳群岛"
},
{
"name": "开曼群岛",
"weight": 5.77e-6
},
{
"name": "格陵兰",
"weight": 5.63e-6
},
{
"weight": 5.54e-6,
"name": "法罗群岛"
},
{
"weight": 5.17e-6,
"name": "圣基茨和尼维斯"
},
{
"weight": 5.11e-6,
"name": "百慕大"
},
{
"weight": 4.38e-6,
"name": "根西"
},
{
"weight": 4.31e-6,
"name": "特克斯和凯科斯群岛"
},
{
"name": "荷属圣马丁",
"weight": 4.14e-6
},
{
"weight": 3.87e-6,
"name": "安道尔"
},
{
"name": "法国(法属圣马丁)",
"weight": 3.6e-6
},
{
"name": "直布罗陀",
"weight": 3.2e-6
},
{
"weight": 2.87e-6,
"name": "列支敦士登"
},
{
"name": "英属维尔京群岛",
"weight": 2.57e-6
},
{
"weight": 2.1e-6,
"name": "圣马力诺"
},
{
"weight": 1.75e-6,
"name": "瑙鲁"
},
{
"name": "摩纳哥",
"weight": 1.75e-6
},
{
"name": "图瓦卢",
"weight": 1.72e-6
},
{
"name": "库克群岛",
"weight": 1.44e-6
},
{
"name": "帕劳",
"weight": 1.44e-6
},
{
"weight": 1.41e-6,
"name": "安圭拉"
},
{
"weight": 1.05e-6,
"name": "法国(瓦利斯和富图纳)"
},
{
"weight": 6.6e-7,
"name": "法国(圣巴泰勒米)"
},
{
"name": "蒙特塞拉特",
"weight": 4.35e-7
},
{
"weight": 3.77e-7,
"name": "圣赫勒拿、阿森松和特里斯坦-达库尼亚"
},
{
"name": "法国(圣皮埃尔和密克隆)",
"weight": 2.86e-7
},
{
"name": "福克兰群岛",
"weight": 2.48e-7
}
]

Binary file not shown.

21
data/dl.go Normal file
View File

@@ -0,0 +1,21 @@
package data
import (
"io"
"net/http"
"os"
)
func DownloadTo(url, file string) error {
resp, err := http.Get(url)
if err == nil {
var f *os.File
f, err = os.Create(file)
if err == nil {
_, err = io.Copy(f, resp.Body)
resp.Body.Close()
f.Close()
}
}
return err
}

15
data/mem.go Normal file
View File

@@ -0,0 +1,15 @@
package data
import "unsafe"
// Str2bytes Fast convert
func Str2bytes(s string) []byte {
x := (*[2]uintptr)(unsafe.Pointer(&s))
h := [3]uintptr{x[0], x[1], x[1]}
return *(*[]byte)(unsafe.Pointer(&h))
}
// Bytes2str Fast convert
func Bytes2str(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}

View File

@@ -1,4 +1,5 @@
package setutime
// Package data 数据库/数据处理相关工具
package data
import (
"database/sql"
@@ -8,16 +9,16 @@ import (
_ "modernc.org/sqlite" // 引入sqlite
)
// sqlite 数据库对象
type sqlite struct {
// Sqlite 数据库对象
type Sqlite struct {
DB *sql.DB
DBPath string
}
// create 生成数据库
// Create 生成数据库
// 默认结构体的第一个元素为主键
// 返回错误
func (db *sqlite) create(table string, objptr interface{}) (err error) {
func (db *Sqlite) Create(table string, objptr interface{}) (err error) {
if db.DB == nil {
database, err := sql.Open("sqlite", db.DBPath)
if err != nil {
@@ -53,10 +54,10 @@ func (db *sqlite) create(table string, objptr interface{}) (err error) {
return nil
}
// insert 插入数据集
// Insert 插入数据集
// 默认结构体的第一个元素为主键
// 返回错误
func (db *sqlite) insert(table string, objptr interface{}) (err error) {
func (db *Sqlite) Insert(table string, objptr interface{}) (err error) {
rows, err := db.DB.Query("SELECT * FROM " + table)
if err != nil {
return err
@@ -71,7 +72,7 @@ func (db *sqlite) insert(table string, objptr interface{}) (err error) {
top = len(tags) - 1
cmd = []string{}
)
cmd = append(cmd, "INSERT INTO")
cmd = append(cmd, "REPLACE INTO")
cmd = append(cmd, table)
for i := range tags {
switch i {
@@ -112,11 +113,11 @@ func (db *sqlite) insert(table string, objptr interface{}) (err error) {
return nil
}
// find 查询数据库
// Find 查询数据库
// condition 可为"WHERE id = 0"
// 默认字段与结构体元素顺序一致
// 返回错误
func (db *sqlite) find(table string, objptr interface{}, condition string) (err error) {
func (db *Sqlite) Find(table string, objptr interface{}, condition string) (err error) {
var cmd = []string{}
cmd = append(cmd, "SELECT * FROM ")
cmd = append(cmd, table)
@@ -142,10 +143,35 @@ func (db *sqlite) find(table string, objptr interface{}, condition string) (err
return nil
}
// del 删除数据库
// ListTables 列出所有表名
// 返回所有表名+错误
func (db *Sqlite) ListTables() (s []string, err error) {
rows, err := db.DB.Query("SELECT name FROM sqlite_master where type='table' order by name;")
if err != nil {
return
}
if rows.Err() != nil {
return nil, rows.Err()
}
defer rows.Close()
for rows.Next() {
if err != nil {
return
}
objptr := new(string)
err = rows.Scan(objptr)
if err == nil {
s = append(s, *objptr)
}
}
return
}
// Del 删除数据库
// condition 可为"WHERE id = 0"
// 返回错误
func (db *sqlite) del(table string, condition string) (err error) {
func (db *Sqlite) Del(table string, condition string) (err error) {
var cmd = []string{}
cmd = append(cmd, "DELETE FROM")
cmd = append(cmd, table)
@@ -161,9 +187,9 @@ func (db *sqlite) del(table string, condition string) (err error) {
return nil
}
// count 查询数据库行数
// Count 查询数据库行数
// 返回行数以及错误
func (db *sqlite) count(table string) (num int, err error) {
func (db *Sqlite) Count(table string) (num int, err error) {
var cmd = []string{}
cmd = append(cmd, "SELECT * FROM")
cmd = append(cmd, table)

52
go.mod
View File

@@ -1,52 +1,22 @@
module github.com/FloatTech/ZeroBot-Plugin
go 1.17
go 1.16
require (
github.com/FloatTech/AnimeAPI v1.1.9
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.3
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3
github.com/FloatTech/bot-manager v1.0.0
github.com/fogleman/gg v1.3.0
github.com/gin-gonic/gin v1.7.4
github.com/golang/protobuf v1.5.2
github.com/gorilla/websocket v1.4.2
github.com/imroc/req v0.3.0
github.com/mroth/weightedrand v0.4.1
github.com/robfig/cron v1.2.0
github.com/shirou/gopsutil v3.21.7+incompatible
github.com/shirou/gopsutil v3.21.9+incompatible
github.com/sirupsen/logrus v1.8.1
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
github.com/tidwall/gjson v1.8.1
github.com/wdvxdr1123/ZeroBot v1.2.2
modernc.org/sqlite v1.12.0
)
require (
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/antchfx/htmlquery v1.2.3 // indirect
github.com/antchfx/xpath v1.2.0 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2-0.20210109003243-333559e1834b // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/tidwall/match v1.0.3 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.8 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
golang.org/x/mod v0.5.0 // indirect
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
lukechampine.com/uint128 v1.1.1 // indirect
modernc.org/cc/v3 v3.33.11 // indirect
modernc.org/ccgo/v3 v3.10.1 // indirect
modernc.org/libc v1.10.0 // indirect
modernc.org/mathutil v1.4.1 // indirect
modernc.org/memory v1.0.5 // indirect
modernc.org/opt v0.1.1 // indirect
modernc.org/strutil v1.1.1 // indirect
modernc.org/token v1.0.0 // indirect
github.com/tidwall/gjson v1.9.3
github.com/wdvxdr1123/ZeroBot v1.2.4
modernc.org/sqlite v1.13.1
)

138
go.sum
View File

@@ -1,28 +1,52 @@
github.com/FloatTech/AnimeAPI v1.1.9 h1:H1hZmgwZPNHdx39K9JvY3awT8TTsCl9kKA1uVMyCjRg=
github.com/FloatTech/AnimeAPI v1.1.9/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
github.com/FloatTech/ZeroBot-Plugin v1.1.5/go.mod h1:kWuUARvU7gs4xLggi8Sy37ja2GRL6k0X6kewe5TiZRs=
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.3 h1:TGQHhiPR/XIxYYoB6IxOzgMhsZs2tDYQlaJHT04gkQ8=
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.3/go.mod h1:W7ag6hml1pZTNzRXKU74OMr6rS8awQKSU+o2g7Gj4O0=
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk=
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc=
github.com/FloatTech/bot-manager v1.0.0 h1:d63J5htLhVBc2ITG09WBJI+qAB0ubPjYhfXl6hljBNk=
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
github.com/FloatTech/imgfactory v0.1.1 h1:ooL2+fV8yrMhv1ShGGKsN0Rm/flWoKnvqXaUD+dC3DQ=
github.com/FloatTech/imgfactory v0.1.1/go.mod h1:ThDALab8aOuU6KVYESVWFqmjcqtm03e0SvGlTw6s+aw=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M=
github.com/antchfx/htmlquery v1.2.3/go.mod h1:B0ABL+F5irhhMWg54ymEZinzMSi0Kt3I2if0BLYa3V0=
github.com/antchfx/xpath v1.1.6 h1:6sVh6hB5T6phw1pFpHRQ+C4bd8sNI+O58flqtg7h0R0=
github.com/antchfx/xpath v1.1.6/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 h1:BBade+JlV/f7JstZ4pitd4tHhpN+w+6I+LyOS7B4fyU=
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4/go.mod h1:H7chHJglrhPPzetLdzBleF8d22WYOv7UM/lEKYiwlKM=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM=
github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
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/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
@@ -36,24 +60,25 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imroc/req v0.3.0 h1:3EioagmlSG+z+KySToa+Ylo3pTFZs+jh3Brl7ngU12U=
github.com/imroc/req v0.3.0/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2-0.20210109003243-333559e1834b h1:6Xjqolv/0DDdUqlpnsTomXQvjvvkz7Ux7TcMALvozEw=
github.com/modern-go/reflect2 v1.0.2-0.20210109003243-333559e1834b/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mroth/weightedrand v0.4.1 h1:rHcbUBopmi/3x4nnrvwGJBhX9d0vk+KgoLUZeDP6YyI=
github.com/mroth/weightedrand v0.4.1/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -63,8 +88,10 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6O
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/shirou/gopsutil v3.21.7+incompatible h1:g/wcPHcuCQvHSePVofjQljd2vX4ty0+J6VoMB+NPcdk=
github.com/shirou/gopsutil v3.21.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.8+incompatible h1:sh0foI8tMRlCidUJR+KzqWYWxrkuuPIGiO6Vp+KXdCU=
github.com/shirou/gopsutil v3.21.8+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.9+incompatible h1:LTLpUnfX81MkHeCtSrwNKZwuW5Id6kCa7/P43NdcNn4=
github.com/shirou/gopsutil v3.21.9+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
@@ -72,46 +99,54 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 h1:J6v8awz+me+xeb/cUTotKgceAYouhIB3pjzgRd6IlGk=
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
github.com/tdf1939/ZeroBot-Plugin-Gif v0.0.0-20210828060956-389b1dc33652/go.mod h1:bkxKi7un9gCDvUUZAiIJF6k90pyj8rmxiXLJkiHcsMY=
github.com/tdf1939/img v0.0.0-20210827153520-90cb4e9580a3/go.mod h1:FgTEOcosTWrkOr7++gbtPSj1rX5loRWrf/AL+hm3Cnw=
github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU=
github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
github.com/tidwall/gjson v1.9.0 h1:+Od7AE26jAaMgVC31cQV/Ope5iKXulNMflrlB7k+F9E=
github.com/tidwall/gjson v1.9.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E=
github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8=
github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.8 h1:41Nq9J+pxKud4IQ830J5LlS5nl67dVQC7AuisUooaOU=
github.com/tklauser/go-sysconf v0.3.8/go.mod h1:z4zYWRS+X53WUKtBcmDg1comV3fPhdQnzasnIHUoLDU=
github.com/tklauser/numcpus v0.2.3 h1:nQ0QYpiritP6ViFhrKYsiv6VVxOpum2Gks5GhnJbS/8=
github.com/tklauser/numcpus v0.2.3/go.mod h1:vpEPS/JC+oZGGQ/My/vJnNsvMDQL6PwOqt8dsCw5j+E=
github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/wdvxdr1123/ZeroBot v1.2.2 h1:BKEy3l80BMrQWpFWaII0AfFMyf9bqrB0TxfWhTdoV58=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/wdvxdr1123/ZeroBot v1.2.2/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc=
github.com/wdvxdr1123/ZeroBot v1.2.3/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc=
github.com/wdvxdr1123/ZeroBot v1.2.4 h1:eC/41Tlkj1jxXW91x4K+qjUlaQXKGgUeLhxw7C6+qkM=
github.com/wdvxdr1123/ZeroBot v1.2.4/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -125,25 +160,18 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 h1:ikCpsnYR+Ew0vu99XlDp55lGgDJdIMx3f4a18jfse/s=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf h1:2ucpDCmfkl8Bd/FsLtiD653Wf96cW37s+iGx93zsu4k=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b h1:S7hKs0Flbq0bbc9xgYt4stIEG1zNDFqyrPwAX2Wj/sE=
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
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=
@@ -152,54 +180,56 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.7 h1:Rvxffgx6LHSpGS6IO8bffSYN1wpPsWHEWY9CV95vpro=
modernc.org/cc/v3 v3.33.7/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.11 h1:Fc7goiKCzfHvGR4WZbVLWIh/4VhJE2Z31Jkg36Ezp7Q=
modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.34.0 h1:dFhZc/HKR3qp92sYQxKRRaDMz+sr1bwcFD+m7LSCrAs=
modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
modernc.org/ccgo/v3 v3.9.6 h1:rCjLgu6iRxK2bqq8A0CCOnDP+tdA81LfbBUlM1L6ZIY=
modernc.org/ccgo/v3 v3.9.6/go.mod h1:KGOi0NhaT6CO19xeSXcpXBl0OkoD6T1U4dPd633G9Sg=
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
modernc.org/ccgo/v3 v3.10.1 h1:iS/P/unYVUpy7aAxy4Xj8BTy8afdyN1P54Ez2LlUmFI=
modernc.org/ccgo/v3 v3.10.1/go.mod h1:Z+DnGxGOZEvVjdehbO78XHAIWGxyTxzuz668w3SgiiQ=
modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI=
modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag=
modernc.org/ccgo/v3 v3.11.2 h1:gqa8PQ2v7SjrhHCgxUO5dzoAJWSLAveJqZTNkPCN0kc=
modernc.org/ccgo/v3 v3.11.2/go.mod h1:6kii3AptTDI+nUrM9RFBoIEUEisSWCbdczD9ZwQH2FE=
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
modernc.org/libc v1.9.11 h1:QUxZMs48Ahg2F7SN41aERvMfGLY2HU/ADnB9DC4Yts8=
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
modernc.org/libc v1.10.0 h1:VY0vRYW7BMx9vhF3ZvdgmjFOdRrV3EpjUFlRu+5O9FM=
modernc.org/libc v1.10.0/go.mod h1:0/Nct1oFfLhjihlkmiJvALxOyV2rlkJ7/OZk1ni+WDQ=
modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg=
modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M=
modernc.org/libc v1.11.3 h1:q//spBhqp23lC/if8/o8hlyET57P8mCZqrqftzT2WmY=
modernc.org/libc v1.11.3/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.0.4 h1:utMBrFcpnQDdNsmM6asmyH/FM9TqLPS7XF7otpJmrwM=
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14=
modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM=
modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.12.0 h1:AMAOgk4CkblRJc6YLKSYtz3pZ6DW5wjQ1uYH/rN7/Kk=
modernc.org/sqlite v1.12.0/go.mod h1:ppqJ4cQ+R09YLzl9haEL9AYgj6wX8FcfwDTOI0nYykU=
modernc.org/sqlite v1.13.0 h1:cwhUj0jTBgPjk/demWheV+T6xi6ifTfsGIFKFq0g3Ck=
modernc.org/sqlite v1.13.0/go.mod h1:2qO/6jZJrcQaxFUHxOwa6Q6WfiGSsiVj6GXX0Ker+Jg=
modernc.org/sqlite v1.13.1 h1:s/qk6VTTVyQIyhVNWa50whBBcI3+2oREbx85t227iOo=
modernc.org/sqlite v1.13.1/go.mod h1:2qO/6jZJrcQaxFUHxOwa6Q6WfiGSsiVj6GXX0Ker+Jg=
modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
modernc.org/tcl v1.5.5 h1:N03RwthgTR/l/eQvz3UjfYnvVVj1G2sZqzFGfoD4HE4=
modernc.org/tcl v1.5.5/go.mod h1:ADkaTUuwukkrlhqwERyq0SM8OvyXo7+TjFz7yAF56EI=
modernc.org/tcl v1.5.9 h1:DZMfR+RDJRhcrmMEMTJgVIX+Wf5qhfVX0llI0rsc20w=
modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE=
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.0.1 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc=
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
modernc.org/z v1.1.2 h1:IjjzDsIFbl0wuF2KfwvdyUAJVwxD4iwZ6akLNiDoClM=
modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js=

49
main.go
View File

@@ -1,27 +1,35 @@
package main
import (
"flag"
"fmt"
"os"
"strings"
// 注:以下插件均可通过前面加 // 注释,注释后停用并不加载插件
// 下列插件可与 wdvxdr1123/ZeroBot v1.1.2 以上配合单独使用
// 词库类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
"github.com/sirupsen/logrus"
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke" // 青云客
// 实用类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_github" // 搜索GitHub仓库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_manager" // 群管
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nbnhhsh" // 拼音首字母缩写释义工具
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode" // 在线运行代码
// 娱乐类
_ "github.com/FloatTech/ZeroBot-Plugin-Gif" // 制图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_choose" // 选择困难症帮手
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_fortune" // 运势
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_reborn" // 投胎
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
// b站相关
@@ -37,28 +45,37 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图
// 以下为内置依赖,勿动
log "github.com/sirupsen/logrus"
easy "github.com/t-tomalak/logrus-easy-formatter"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/driver"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
var (
contents = []string{
"* OneBot + ZeroBot + Golang ",
"* Version 1.1.0 - 2021-08-06 23:36:29 +0800 CST",
"* Copyright © 2020 - 2021 Kanri, DawnNights, Fumiama, Suika",
"* OneBot + ZeroBot + Golang",
"* Version 1.1.6 - 2021-10-09 12:50:23 +0800 CST",
"* Copyright © 2020 - 2021 Kanri, DawnNights, Fumiama, Suika",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}
banner = strings.Join(contents, "\n")
)
func init() {
log.SetFormatter(&easy.Formatter{
TimestampFormat: "2006-01-02 15:04:05",
LogFormat: "[zero][%time%][%lvl%]: %msg% \n",
})
log.SetLevel(log.DebugLevel)
var en bool
var debg bool
// 解析命令行参数,输入 `-g` 即可启用 gui
flag.BoolVar(&en, "g", false, "Enable web gui.")
// 解析命令行参数,输入 `-d` 即可开启 debug log
flag.BoolVar(&debg, "d", false, "Enable debug log.")
flag.Parse()
if en {
control.InitGui()
}
if debg {
logrus.SetLevel(logrus.DebugLevel)
}
}
func main() {
@@ -73,8 +90,8 @@ func main() {
// SuperUsers 某些功能需要主人权限,可通过以下两种方式修改
// []string{}:通过代码写死的方式添加主人账号
// os.Args[1:]:通过命令行参数的方式添加主人账号
SuperUsers: append([]string{"12345678", "87654321"}, os.Args[1:]...),
// flag.Args():通过命令行参数的方式添加主人账号
SuperUsers: append([]string{"12345678", "87654321"}, flag.Args()...),
Driver: []zero.Driver{
&driver.WSClient{
@@ -86,7 +103,7 @@ func main() {
})
// 帮助
zero.OnFullMatchGroup([]string{"help", "/help", ".help", "菜单", "帮助"}, zero.OnlyToMe).SetBlock(true).SetPriority(999).
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
ctx.Send(banner)
})

View File

@@ -11,6 +11,8 @@ import (
"github.com/FloatTech/AnimeAPI/picture"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
const (
@@ -31,7 +33,16 @@ var (
func init() { // 插件主体
// 初始化 classify
classify.Init(datapath)
zero.OnRegex(`^设置随机图片网址(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).SetPriority(20).
engine := control.Register("acgimage", &control.Options{
DisableOnDefault: false,
Help: "随机图片与AI点评\n" +
"- 随机图片(评级大于6的图将私发)\n" +
"- 直接随机(无r18检测务必小心仅管理可用)\n" +
"- 设置随机图片网址[url]\n" +
"- 太涩了(撤回最近发的图)\n" +
"- 评价图片(发送一张图片让bot评分)",
})
engine.OnRegex(`^设置随机图片网址(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).SetPriority(20).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["regex_matched"].([]string)[1]
if !strings.HasPrefix(url, "http") {
@@ -42,7 +53,7 @@ func init() { // 插件主体
}
})
// 有保护的随机图片
zero.OnFullMatch("随机图片", zero.OnlyGroup).SetBlock(true).SetPriority(24).
engine.OnFullMatch("随机图片", zero.OnlyGroup).SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) {
if classify.CanVisit(5) {
go func() {
@@ -54,7 +65,7 @@ func init() { // 插件主体
}
})
// 直接随机图片无r18保护后果自负。如果出r18图可尽快通过发送"太涩了"撤回
zero.OnFullMatch("直接随机", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(24).
engine.OnFullMatch("直接随机", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) {
if block {
ctx.Send("请稍后再试哦")
@@ -71,12 +82,12 @@ func init() { // 插件主体
}
})
// 撤回最后的直接随机图片
zero.OnFullMatch("太涩了").SetBlock(true).SetPriority(24).
engine.OnFullMatch("太涩了").SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) {
go cancel(ctx)
})
// 上传一张图进行评价
zero.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).SetPriority(24).
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) {
ctx.Send("少女祈祷中...")
for _, url := range ctx.State["image_url"].([]string) {
@@ -86,7 +97,7 @@ func init() { // 插件主体
}(url)
}
})
zero.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).SetPriority(20).
engine.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).SetPriority(20).
Handle(func(ctx *zero.Ctx) {
dhash := ctx.State["regex_matched"].([]string)[1]
if len(dhash) == 5*3 {

View File

@@ -3,18 +3,26 @@ package aifalse
import (
"math"
"os"
"time"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
"github.com/FloatTech/ZeroBot-Plugin/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() { // 插件主体
zero.OnFullMatchGroup([]string{"检查身体", "自检", "启动自检", "系统状态"}, zero.AdminPermission).
engine := control.Register("aifalse", &control.Options{
DisableOnDefault: false,
Help: "AIfalse\n" +
"- 查询计算机当前活跃度[检查身体|自检|启动自检|系统状态",
})
engine.OnFullMatchGroup([]string{"检查身体", "自检", "启动自检", "系统状态"}, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(
"* CPU占用率: ", cpuPercent(), "%\n",
@@ -23,6 +31,15 @@ func init() { // 插件主体
),
)
})
engine.OnFullMatch("清理缓存", zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
err := os.RemoveAll("data/cache/*")
if err != nil {
ctx.Send("错误: " + err.Error())
} else {
ctx.Send("成功!")
}
})
}
func cpuPercent() float64 {

View File

@@ -8,6 +8,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
const (
@@ -15,8 +17,14 @@ const (
)
func init() { // 插件主体
rand.Seed(time.Now().UnixMicro())
zero.OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetPriority(10).
// TODO: 1.17 特性暂不增加
// rand.Seed(time.Now().UnixMicro())
rand.Seed(time.Now().UnixNano())
control.Register("aiwife", &control.Options{
DisableOnDefault: false,
Help: "AIWife\n" +
"- waifu|随机waifu",
}).OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetPriority(10).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
miku := rand.Intn(100000) + 1
ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku)))

View File

@@ -15,7 +15,7 @@ import (
var (
// ATRI 所有命令的优先级
prio = -1
prio = 2
// ATRI 表情的 codechina 镜像
res = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/plugin_atri/"
// ATRI 的总开关
@@ -26,15 +26,18 @@ func init() { // 插件主体
zero.OnFullMatch("ATRI醒醒", zero.AdminPermission).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
enable = true
time.Sleep(time.Second * 1)
ctx.SendChain(randText("嗯呜呜……夏生先生……?"))
})
zero.OnFullMatch("ATRI睡吧", zero.AdminPermission).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
enable = false
time.Sleep(time.Second * 1)
ctx.SendChain(randText("Zzz……Zzz……"))
})
zero.OnFullMatch("萝卜子", atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
switch rand.Intn(2) {
case 0:
ctx.SendChain(randText("萝卜子是对机器人的蔑称!", "是亚托莉......萝卜子可是对机器人的蔑称"))
@@ -42,22 +45,23 @@ func init() { // 插件主体
ctx.SendChain(randRecord("RocketPunch.amr"))
}
})
zero.OnKeywordGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
zero.OnFullMatchGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
if rand.Intn(10) == 0 {
ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
}
time.Sleep(time.Second * 1)
ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
})
zero.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio - 1).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
ctx.SendChain(randImage("FN.jpg", "WQ.jpg", "WQ1.jpg"))
})
zero.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う"}, atriSwitch()).SetBlock(true).SetPriority(prio).
zero.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早"}, atriSwitch()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
time.Sleep(time.Second * 1)
switch {
case now < 6: // 凌晨
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"zzzz......",
"zzzzzzzz......",
"zzz...好涩哦..zzz....",
@@ -66,7 +70,7 @@ func init() { // 插件主体
"...zzz....哧溜哧溜....",
))
case now >= 6 && now < 9:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"啊......早上好...(哈欠)",
"唔......吧唧...早上...哈啊啊~~~\n早上好......",
"早上好......",
@@ -78,24 +82,25 @@ func init() { // 插件主体
"早上好......欸~~~脸好近呢",
))
case now >= 9 && now < 18:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"哼!这个点还早啥,昨晚干啥去了!?",
"熬夜了对吧熬夜了对吧熬夜了对吧???!",
"是不是熬夜是不是熬夜是不是熬夜?!",
))
case now >= 18 && now < 24:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"早个啥?哼唧!我都准备洗洗睡了!",
"不是...你看看几点了,哼!",
"晚上好哇",
))
}
})
zero.OnFullMatchGroup([]string{"中午好", "午安"}, atriSwitch()).SetBlock(true).SetPriority(prio).
zero.OnFullMatchGroup([]string{"中午好", "午安", "午好"}, atriSwitch()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
if now > 11 && now < 15 { // 中午
ctx.SendChain(randText(
time.Sleep(time.Second * 1)
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"午安w",
"午觉要好好睡哦ATRI会陪伴在你身旁的w",
"嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o",
@@ -103,12 +108,13 @@ func init() { // 插件主体
))
}
})
zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい"}, atriSwitch()).SetBlock(true).SetPriority(prio).
zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好", "晚上好"}, atriSwitch()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
time.Sleep(time.Second * 1)
switch {
case now < 6: // 凌晨
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"zzzz......",
"zzzzzzzz......",
"zzz...好涩哦..zzz....",
@@ -117,27 +123,27 @@ func init() { // 插件主体
"...zzz....哧溜哧溜....",
))
case now >= 6 && now < 11:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"你可猝死算了吧!",
"?啊这",
"亲,这边建议赶快去睡觉呢~~~",
"不可忍不可忍不可忍!!为何这还不猝死!!",
))
case now >= 11 && now < 15:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"午安w",
"午觉要好好睡哦ATRI会陪伴在你身旁的w",
"嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o",
"睡你午觉去!哼唧!!",
))
case now >= 15 && now < 19:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"难不成??晚上不想睡觉??现在休息",
"就......挺离谱的...现在睡觉",
"现在还是白天哦,睡觉还太早了",
))
case now >= 19 && now < 24:
ctx.SendChain(randText(
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
"嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o",
"......(打瞌睡)",
"呼...呼...已经睡着了哦~...呼......",
@@ -147,6 +153,7 @@ func init() { // 插件主体
})
zero.OnKeywordGroup([]string{"高性能", "太棒了", "すごい", "sugoi", "斯国一", "よかった"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
ctx.SendChain(randText(
"当然,我是高性能的嘛~",
"小事一桩,我是高性能的嘛",
@@ -167,6 +174,7 @@ func init() { // 插件主体
})
zero.OnKeywordGroup([]string{"没事", "没关系", "大丈夫", "还好", "不要紧", "没出大问题", "没伤到哪"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
ctx.SendChain(randText(
"当然,我是高性能的嘛~",
"没事没事,因为我是高性能的嘛!嗯哼!",
@@ -181,22 +189,26 @@ func init() { // 插件主体
zero.OnKeywordGroup([]string{"好吗", "是吗", "行不行", "能不能", "可不可以"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
if rand.Intn(2) == 0 {
ctx.SendChain(randImage("YES.png", "NO.jpg"))
}
})
zero.OnFullMatchGroup([]string{"啊这"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
zero.OnKeywordGroup([]string{"啊这"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
if rand.Intn(2) == 0 {
ctx.SendChain(randImage("AZ.jpg", "AZ1.jpg"))
}
})
zero.OnFullMatchGroup([]string{"我好了"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
zero.OnKeywordGroup([]string{"我好了"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(randText("不许好!", "憋回去!"))
time.Sleep(time.Second * 1)
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText("不许好!", "憋回去!"))
})
zero.OnFullMatchGroup([]string{"", "?", "¿"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
switch rand.Intn(5) {
case 0:
ctx.SendChain(randText("?", "", "嗯?", "(。´・ω・)ん?", "ん?"))
@@ -215,6 +227,7 @@ func init() { // 插件主体
})
zero.OnKeyword("答应我", atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1)
ctx.SendChain(randText("我无法回应你的请求"))
})
}

View File

@@ -23,9 +23,9 @@ type follower struct {
// 开启日报推送
func init() {
zero.OnFullMatch("/开启粉丝日报", zero.AdminPermission).
engine.OnFullMatch("/开启粉丝日报", zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
fansDaily(130591566) // 群号传进去给下面发信息的函数
fansDaily(ctx.Event.GroupID) // 群号传进去给下面发信息的函数
})
}

View File

@@ -8,11 +8,22 @@ import (
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
var engine *zero.Engine
// 查成分的
func init() {
zero.OnRegex(`^>user info\s(.{1,25})$`).
engine = control.Register("bilibili", &control.Options{
DisableOnDefault: false,
Help: "bilibili\n" +
"- >vup info [名字|uid]\n" +
"- >user info [名字|uid]\n" +
"- /开启粉丝日报",
})
engine.OnRegex(`^>user info\s(.{1,25})$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1]
rest, err := uid(keyword)

View File

@@ -13,7 +13,7 @@ import (
// 查vup粉丝数据
func init() {
zero.OnRegex(`^>vup info\s?(.{1,25})$`).
engine.OnRegex(`^>vup info\s?(.{1,25})$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1]
res, err := uid(keyword)

37
plugin_choose/choose.go Normal file
View File

@@ -0,0 +1,37 @@
// Package choose 选择困难症帮手
package choose
import (
"math/rand"
"strconv"
"strings"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
func init() {
engine := control.Register("choose", &control.Options{
DisableOnDefault: false,
Help: "choose\n" +
"- 选择可口可乐还是百事可乐\n" +
"- 选择肯德基还是麦当劳还是必胜客\n",
})
engine.OnPrefix("选择").SetBlock(true).FirstPriority().Handle(handle)
}
func handle(ctx *zero.Ctx) {
rawOptions := strings.Split(ctx.State["args"].(string), "还是")
var options = make([]string, 0)
for count, option := range rawOptions {
options = append(options, strconv.Itoa(count+1)+", "+option)
}
result := rawOptions[rand.Intn(len(rawOptions))]
name := ctx.Event.Sender.NickName
ctx.SendChain(message.Text("> ", name, "\n",
"你的选项有:", "\n",
strings.Join(options, "\n"), "\n",
"你最终会选: ", result,
))
}

View File

@@ -7,31 +7,43 @@ import (
"time"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
)
var engine *zero.Engine
func init() {
engine = control.Register("diana", &control.Options{
DisableOnDefault: false,
Help: "嘉然\n" +
"- 小作文\n" +
"- 发大病\n" +
"- 教你一篇小作文[作文]\n" +
"- [回复]查重",
})
// 随机发送一篇上面的小作文
zero.OnFullMatch("小作文", zero.OnlyToMe).
engine.OnFullMatch("小作文").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
rand.Seed(time.Now().UnixNano())
// 绕过第一行发病
ctx.SendChain(message.Text((*data.Array)[rand.Intn(len(*data.Array)-1)+1]))
ctx.Send((*data.Array)[rand.Intn(len(*data.Array)-1)+1])
})
// 逆天
zero.OnFullMatch("发大病", zero.OnlyToMe).
engine.OnFullMatch("发大病").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 第一行是发病
ctx.Send((*data.Array)[0])
})
// 增加小作文
zero.OnRegex(`^教你一篇小作文(.*)$`, zero.AdminPermission).
engine.OnRegex(`^教你一篇小作文(.*)$`, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
err := data.AddText(ctx.State["regex_matched"].([]string)[1])
if err != nil {
ctx.Send(fmt.Sprintf("ERROR: %v", err))
} else {
ctx.Send("记住啦!")
}
})
}

View File

@@ -2,24 +2,32 @@
package data
import (
"crypto/md5"
"io"
"net/http"
"os"
"sync"
"time"
log "github.com/sirupsen/logrus"
"github.com/FloatTech/ZeroBot-Plugin/data"
)
const (
datapath = "data/Diana"
pbfile = datapath + "/text.pb"
pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/Diana/text.pb"
pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/" + pbfile
)
var (
compo Composition
// Array 小作文数组指针
Array = &compo.Array
// m 小作文保存锁
m sync.Mutex
// md5s 验证重复
md5s []*[16]byte
)
func init() {
@@ -31,7 +39,13 @@ func init() {
}
err1 := LoadText()
if err1 == nil {
log.Printf("[Diana]读取%d条小作文", len(*Array))
arrl := len(*Array)
log.Printf("[Diana]读取%d条小作文", arrl)
md5s = make([]*[16]byte, arrl)
for i, t := range *Array {
m := md5.Sum(data.Str2bytes(t))
md5s[i] = &m
}
} else {
log.Printf("[Diana]读取小作文错误:%v", err1)
}
@@ -79,21 +93,39 @@ func LoadText() error {
// AddText 添加小作文
func AddText(txt string) error {
if txt != "" {
sum := md5.Sum(data.Str2bytes(txt))
if txt != "" && !isin(&sum) {
m.Lock()
defer m.Unlock()
compo.Array = append(compo.Array, txt)
data, err := compo.Marshal()
if err == nil {
if _, err := os.Stat(datapath); err == nil || os.IsExist(err) {
f, err1 := os.OpenFile(pbfile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
if err1 == nil {
defer f.Close()
_, err2 := f.Write(data)
return err2
}
return err1
}
}
return err
md5s = append(md5s, &sum)
return savecompo()
}
return nil
}
func isin(sum *[16]byte) bool {
for _, t := range md5s {
if *t == *sum {
return true
}
}
return false
}
// savecompo 同步保存作文
func savecompo() error {
data, err := compo.Marshal()
if err == nil {
if _, err := os.Stat(datapath); err == nil || os.IsExist(err) {
f, err1 := os.OpenFile(pbfile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
if err1 == nil {
_, err2 := f.Write(data)
f.Close()
return err2
}
return err1
}
}
return err
}

View File

@@ -2,5 +2,5 @@ syntax = "proto3";
package data;
message composition {
repeated string array = 1;
repeated string array = 1;
}

View File

@@ -28,7 +28,7 @@ type zhiwang struct {
// 小作文查重: 回复要查的消息 查重
func init() {
zero.OnMessage(fullmatch("查重")).
engine.OnMessage(fullmatch("查重")).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
msg := ctx.Event.Message
if msg[0].Type == "reply" {

405
plugin_fortune/cfg.pb.go Normal file
View File

@@ -0,0 +1,405 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cfg.proto
package fortune
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Conf struct {
Kind map[int64]uint32 `protobuf:"bytes,1,rep,name=kind,proto3" json:"kind,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Conf) Reset() { *m = Conf{} }
func (m *Conf) String() string { return proto.CompactTextString(m) }
func (*Conf) ProtoMessage() {}
func (*Conf) Descriptor() ([]byte, []int) {
return fileDescriptor_f81ba022997f8a9d, []int{0}
}
func (m *Conf) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Conf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Conf.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Conf) XXX_Merge(src proto.Message) {
xxx_messageInfo_Conf.Merge(m, src)
}
func (m *Conf) XXX_Size() int {
return m.Size()
}
func (m *Conf) XXX_DiscardUnknown() {
xxx_messageInfo_Conf.DiscardUnknown(m)
}
var xxx_messageInfo_Conf proto.InternalMessageInfo
func (m *Conf) GetKind() map[int64]uint32 {
if m != nil {
return m.Kind
}
return nil
}
func init() {
proto.RegisterType((*Conf)(nil), "fortune.conf")
proto.RegisterMapType((map[int64]uint32)(nil), "fortune.conf.KindEntry")
}
func init() { proto.RegisterFile("cfg.proto", fileDescriptor_f81ba022997f8a9d) }
var fileDescriptor_f81ba022997f8a9d = []byte{
// 154 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0x4e, 0x4b, 0xd7,
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4f, 0xcb, 0x2f, 0x2a, 0x29, 0xcd, 0x4b, 0x55, 0xca,
0xe1, 0x62, 0x49, 0xce, 0xcf, 0x4b, 0x13, 0xd2, 0xe6, 0x62, 0xc9, 0xce, 0xcc, 0x4b, 0x91, 0x60,
0x54, 0x60, 0xd6, 0xe0, 0x36, 0x12, 0xd7, 0x83, 0xca, 0xeb, 0x81, 0x24, 0xf5, 0xbc, 0x33, 0xf3,
0x52, 0x5c, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0xc0, 0x8a, 0xa4, 0xcc, 0xb9, 0x38, 0xe1, 0x42, 0x42,
0x02, 0x5c, 0xcc, 0xd9, 0xa9, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x20, 0xa6, 0x90,
0x08, 0x17, 0x6b, 0x59, 0x62, 0x4e, 0x69, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6f, 0x10, 0x84,
0x63, 0xc5, 0x64, 0xc1, 0xe8, 0x24, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f,
0x1e, 0xc9, 0x31, 0xce, 0x78, 0x2c, 0xc7, 0x90, 0xc4, 0x06, 0x76, 0x8f, 0x31, 0x20, 0x00, 0x00,
0xff, 0xff, 0x8a, 0xa2, 0xbe, 0x9e, 0x9c, 0x00, 0x00, 0x00,
}
func (m *Conf) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Conf) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Conf) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Kind) > 0 {
for k := range m.Kind {
v := m.Kind[k]
baseI := i
i = encodeVarintCfg(dAtA, i, uint64(v))
i--
dAtA[i] = 0x10
i = encodeVarintCfg(dAtA, i, uint64(k))
i--
dAtA[i] = 0x8
i = encodeVarintCfg(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintCfg(dAtA []byte, offset int, v uint64) int {
offset -= sovCfg(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Conf) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Kind) > 0 {
for k, v := range m.Kind {
_ = k
_ = v
mapEntrySize := 1 + sovCfg(uint64(k)) + 1 + sovCfg(uint64(v))
n += mapEntrySize + 1 + sovCfg(uint64(mapEntrySize))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovCfg(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozCfg(x uint64) (n int) {
return sovCfg(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Conf) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCfg
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: conf: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: conf: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCfg
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCfg
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCfg
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Kind == nil {
m.Kind = make(map[int64]uint32)
}
var mapkey int64
var mapvalue uint32
for iNdEx < postIndex {
entryPreIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCfg
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
if fieldNum == 1 {
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCfg
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
mapkey |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
} else if fieldNum == 2 {
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCfg
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
mapvalue |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
} else {
iNdEx = entryPreIndex
skippy, err := skipCfg(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCfg
}
if (iNdEx + skippy) > postIndex {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
m.Kind[mapkey] = mapvalue
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCfg(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCfg
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipCfg(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCfg
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCfg
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCfg
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthCfg
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupCfg
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthCfg
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthCfg = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCfg = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupCfg = fmt.Errorf("proto: unexpected end of group")
)

6
plugin_fortune/cfg.proto Normal file
View File

@@ -0,0 +1,6 @@
syntax = "proto3";
package fortune;
message conf {
map<int64, uint32> kind = 1;
}

51
plugin_fortune/data.go Normal file
View File

@@ -0,0 +1,51 @@
package fortune
import (
io "io"
"os"
"sync"
)
var (
conf Conf
mu sync.Mutex
)
func loadcfg(name string) error {
name = base + name
if _, err := os.Stat(name); err == nil || os.IsExist(err) {
f, err := os.Open(name)
if err == nil {
defer f.Close()
data, err1 := io.ReadAll(f)
if err1 == nil {
if len(data) > 0 {
return conf.Unmarshal(data)
}
}
return err1
}
} else { // 如果没有 cfg则使用空 map
conf.Kind = make(map[int64]uint32)
}
return nil
}
func savecfg(name string) error {
name = base + name
data, err := conf.Marshal()
if err == nil {
if _, err := os.Stat(base); err == nil || os.IsExist(err) {
f, err1 := os.OpenFile(name, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
if err1 == nil {
mu.Lock()
_, err2 := f.Write(data)
f.Close()
mu.Unlock()
return err2
}
return err1
}
}
return err
}

294
plugin_fortune/fortune.go Normal file
View File

@@ -0,0 +1,294 @@
// Package fortune 每日运势
package fortune
import (
"archive/zip"
"bytes"
"encoding/base64"
"encoding/json"
"image/jpeg"
"io"
"io/ioutil"
"math/rand"
"os"
"strconv"
"time"
"github.com/fogleman/gg"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/FloatTech/ZeroBot-Plugin/data"
)
var (
// 底图缓存位置
base = "data/fortune/"
// 素材下载网站
site = "https://pan.dihe.moe/fortune/"
// 底图类型列表:车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌
// 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹", "李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想", "战双", "阴阳师"}
// 映射底图与 index
index = make(map[string]uint32)
)
func init() {
err := loadcfg("cfg.pb")
if err != nil {
panic(err)
}
for i, s := range table {
index[s] = uint32(i)
}
err = os.MkdirAll(base, 0755)
if err != nil {
panic(err)
}
// 插件主体
en := control.Register("fortune", &control.Options{
DisableOnDefault: false,
Help: "每日运势: \n" +
"- 运势|抽签\n" +
"- 设置底图[车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师]",
})
en.OnRegex(`^设置底图(.*)`, zero.OnlyGroup).SetBlock(true).SecondPriority().
Handle(func(ctx *zero.Ctx) {
i, ok := index[ctx.State["regex_matched"].([]string)[1]]
if ok {
conf.Kind[ctx.Event.GroupID] = i
savecfg("cfg.pb")
} else {
ctx.Send("没有这个底图哦~")
}
})
en.OnFullMatchGroup([]string{"运势", "抽签"}).SetBlock(true).SecondPriority().
Handle(func(ctx *zero.Ctx) {
// 检查签文文件是否存在
mikuji := base + "运势签文.json"
if _, err := os.Stat(mikuji); err != nil && !os.IsExist(err) {
ctx.SendChain(message.Text("正在下载签文文件,请稍后..."))
err := data.DownloadTo(site+"运势签文.json", mikuji)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Text("下载签文文件完毕"))
}
// 检查字体文件是否存在
ttf := base + "sakura.ttf"
if _, err := os.Stat(ttf); err != nil && !os.IsExist(err) {
ctx.SendChain(message.Text("正在下载字体文件,请稍后..."))
err := data.DownloadTo(site+"sakura.ttf", ttf)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Text("下载字体文件完毕"))
}
// 获取该群背景类型,默认车万
kind := "车万"
if v, ok := conf.Kind[ctx.Event.GroupID]; ok {
kind = table[v]
}
// 检查背景图片是否存在
folder := base + kind
if _, err := os.Stat(folder); err != nil && !os.IsExist(err) {
ctx.SendChain(message.Text("正在下载背景图片,请稍后..."))
zipfile := kind + ".zip"
err := data.DownloadTo(site+zipfile, zipfile)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Text("下载背景图片完毕"))
err = unpack(zipfile, folder+"/")
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Text("解压背景图片完毕"))
// 释放空间
os.Remove(zipfile)
}
// 生成种子
t, _ := strconv.ParseInt(time.Now().Format("20060102"), 10, 64)
seed := ctx.Event.UserID + t
// 随机获取背景
background, err := randimage(base+kind+"/", seed)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
// 随机获取签文
title, text, err := randtext(base+"运势签文.json", seed)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
// 绘制背景
d, err := draw(background, title, text)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
// 发送图片
ctx.SendChain(message.Image("base64://" + data.Bytes2str(d)))
})
}
// @function unpack 解压资源包
// @param tgt 压缩文件位置
// @param dest 解压位置
// @return 错误信息
func unpack(tgt, dest string) error {
// 路径目录不存在则创建目录
if _, err := os.Stat(dest); err != nil && !os.IsExist(err) {
if err := os.MkdirAll(dest, 0755); err != nil {
panic(err)
}
}
reader, err := zip.OpenReader(tgt)
if err != nil {
return err
}
defer reader.Close()
// 遍历解压到文件
for _, file := range reader.File {
// 打开解压文件
rc, err := file.Open()
if err != nil {
return err
}
// 打开目标文件
w, err := os.OpenFile(dest+file.Name, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
if err != nil {
rc.Close()
return err
}
// 复制到文件
_, err = io.Copy(w, rc)
rc.Close()
w.Close()
if err != nil {
return err
}
}
return nil
}
// @function randimage 随机选取文件夹下的文件
// @param path 文件夹路径
// @param seed 随机数种子
// @return 文件路径 & 错误信息
func randimage(path string, seed int64) (string, error) {
rd, err := ioutil.ReadDir(path)
if err != nil {
return "", err
}
rand.Seed(seed)
return path + rd[rand.Intn(len(rd))].Name(), nil
}
// @function randtext 随机选取签文
// @param file 文件路径
// @param seed 随机数种子
// @return 签名 & 签文 & 错误信息
func randtext(file string, seed int64) (string, string, error) {
data, err := ioutil.ReadFile(file)
if err != nil {
return "", "", err
}
temp := []map[string]string{}
if err := json.Unmarshal(data, &temp); err != nil {
return "", "", err
}
rand.Seed(seed)
r := rand.Intn(len(temp))
return temp[r]["title"], temp[r]["content"], nil
}
// @function draw 绘制运势图
// @param background 背景图片路径
// @param seed 随机数种子
// @param title 签名
// @param text 签文
// @return 错误信息
func draw(background, title, text string) ([]byte, error) {
// 加载背景
back, err := gg.LoadImage(background)
if err != nil {
return nil, err
}
canvas := gg.NewContext(back.Bounds().Size().Y, back.Bounds().Size().X)
canvas.DrawImage(back, 0, 0)
// 写标题
canvas.SetRGB(1, 1, 1)
if err := canvas.LoadFontFace(base+"sakura.ttf", 45); err != nil {
return nil, err
}
sw, _ := canvas.MeasureString(title)
canvas.DrawString(title, 140-sw/2, 112)
// 写正文
canvas.SetRGB(0, 0, 0)
if err := canvas.LoadFontFace(base+"sakura.ttf", 23); err != nil {
return nil, err
}
offest := func(total, now int, distance float64) float64 {
if total%2 == 0 {
return (float64(now-total/2) - 1) * distance
}
return (float64(now-total/2) - 1.5) * distance
}
rowsnum := func(total, div int) int {
temp := total / div
if total%div != 0 {
temp++
}
return temp
}
min := func(a, b int) int {
if a < b {
return a
}
return b
}
tw, th := canvas.MeasureString("测")
tw, th = tw+10, th+10
r := []rune(text)
xsum := rowsnum(len(r), 9)
switch xsum {
default:
for i, o := range r {
xnow := rowsnum(i+1, 9)
ysum := min(len(r)-(xnow-1)*9, 9)
ynow := i%9 + 1
canvas.DrawString(string(o), -offest(xsum, xnow, tw)+115, offest(ysum, ynow, th)+320.0)
}
case 2:
div := rowsnum(len(r), 2)
for i, o := range r {
xnow := rowsnum(i+1, div)
ysum := min(len(r)-(xnow-1)*div, div)
ynow := i%div + 1
switch xnow {
case 1:
canvas.DrawString(string(o), -offest(xsum, xnow, tw)+115, offest(9, ynow, th)+320.0)
case 2:
canvas.DrawString(string(o), -offest(xsum, xnow, tw)+115, offest(9, ynow+(9-ysum), th)+320.0)
}
}
}
// 转成 base64
buffer := new(bytes.Buffer)
encoder := base64.NewEncoder(base64.StdEncoding, buffer)
var opt jpeg.Options
opt.Quality = 70
err = jpeg.Encode(encoder, canvas.Image(), &opt)
if err != nil {
return nil, err
}
encoder.Close()
return buffer.Bytes(), nil
}

View File

@@ -12,11 +12,18 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/tidwall/gjson"
)
func init() { // 插件主体
zero.OnRegex(`^>github\s(-.{1,10}? )?(.*)$`).SetBlock(true).FirstPriority().
control.Register("github", &control.Options{
DisableOnDefault: false,
Help: "GitHub仓库搜索\n" +
"- >github [xxx]\n" +
"- >github -p [xxx]",
}).OnRegex(`^>github\s(-.{1,10}? )?(.*)$`).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
// 发送请求
header := http.Header{

View File

@@ -3,18 +3,21 @@ package hs
import (
"fmt"
"io"
"os"
"strconv"
"strings"
"time"
"github.com/imroc/req"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
const cachedir = "data/hs/"
var botpath, _ = os.Getwd()
var cachedir = botpath + "/data/hs/"
var header = req.Header{
"user-agent": `Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36`,
@@ -27,47 +30,63 @@ func init() {
if err != nil {
panic(err)
}
zero.OnRegex(`^搜卡(.+)$`).
engine := control.Register("hs", &control.Options{
DisableOnDefault: false,
Help: "炉石\n" +
"- 搜卡[xxxx]\n" +
"- [卡组代码xxx]\n" +
"- 更多搜卡指令参数https://hs.fbigame.com/misc/searchhelp",
})
engine.OnRegex(`^搜卡(.+)$`).
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
List := ctx.State["regex_matched"].([]string)[1]
g := sh(List)
im, _ := req.Get(`https://res.fbigame.com/hs/v13/`+
gjson.Get(g, `list.0.CardID`).String()+
`.png?auth_key=`+
gjson.Get(g, `list.0.auth_key`).String(), header)
cachefile := cachedir + strconv.Itoa(int(time.Now().Unix()))
err := im.ToFile(cachefile)
if err == nil {
file, err := os.Open(cachefile)
if err == nil {
defer file.Close()
sg, _ := req.Post("https://pic.sogou.com/pic/upload_pic.jsp", req.FileUpload{
File: file,
FieldName: "image", // FieldName 是表单字段名
FileName: "avatar.png", // Filename 是要上传的文件的名称我们使用它来猜测mimetype并将其上传到服务器上
})
var tx string
t := int(gjson.Get(g, `list.#`).Int())
if t == 0 {
ctx.Send("查询为空!")
return
}
for i := 0; i < t && i < 10; i++ {
tx += strconv.Itoa(i+1) + ". 法力:" +
gjson.Get(g, `list.`+strconv.Itoa(i)+`.COST`).String() +
" " +
gjson.Get(g, `list.`+strconv.Itoa(i)+`.CARDNAME`).String() +
"\n"
}
ctx.SendChain(
message.Image(sg.String()),
message.Text(tx),
)
}
t := int(gjson.Get(g, `list.#`).Int())
if t == 0 {
ctx.SendChain(message.Text("查询为空!"))
return
}
var sk message.Message
var data []byte
for i := 0; i < t && i < 5; i++ {
cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String()
cachefile := cachedir + cid
imgcq := `[CQ:image,file=` + "file:///" + cachefile + `]`
if _, err := os.Stat(cachefile); err != nil {
im, err := req.Get(`https://res.fbigame.com/hs/v13/`+cid+
`.png?auth_key=`+gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(),
header,
)
if err == nil {
data, err = io.ReadAll(im.Response().Body)
if err == nil {
err = im.Response().Body.Close()
if err == nil {
err = os.WriteFile(cachefile, data, 0644)
}
}
}
if err != nil {
imgcq = err.Error()
}
}
sk = append(
sk,
message.CustomNode(
ctx.Event.Sender.NickName,
ctx.Event.UserID,
imgcq, // 图片
),
)
}
ctx.SendGroupForwardMessage(
ctx.Event.GroupID,
sk,
)
})
// 卡组
zero.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
engine.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
fmt.Print("成功")
List := ctx.State["regex_matched"].([]string)[1]

View File

@@ -10,6 +10,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
type resultjson struct {
@@ -59,12 +61,16 @@ type resultjson struct {
}
func init() {
zero.OnRegex(`^来张 (.*)$`, zero.AdminPermission).
control.Register("imgfinder", &control.Options{
DisableOnDefault: false,
Help: "关键字搜图\n" +
"- 来张 [xxx]",
}).OnRegex(`^来张 (.*)$`, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1]
soutujson := soutuapi(keyword)
pom1 := "https://i.pixiv.cat"
rannum := randint()
rannum := randintn(len(soutujson.Illusts))
pom2 := soutujson.Illusts[rannum].ImageUrls.Large[19:]
ctx.SendChain(message.Image(pom1 + pom2))
})
@@ -82,7 +88,7 @@ func soutuapi(keyword string) *resultjson {
fmt.Println(err)
}
req.Header.Add("accept", "application/json, text/plain, */*")
req.Header.Add("User-Agent", "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")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
@@ -96,8 +102,8 @@ func soutuapi(keyword string) *resultjson {
return result
}
// randint 从json里的30条数据中随机获取一条返回
func randint() int {
// randintn 从json里的30条数据中随机获取一条返回
func randintn(len int) int {
rand.Seed(time.Now().UnixNano())
return rand.Intn(30)
return rand.Intn(len)
}

View File

@@ -9,6 +9,8 @@ import (
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
const (
@@ -21,7 +23,11 @@ var (
)
func init() {
zero.OnFullMatch("来份萝莉").
control.Register("lolicon", &control.Options{
DisableOnDefault: false,
Help: "lolicon\n" +
"- 来份萝莉",
}).OnFullMatch("来份萝莉").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
go func() {
for i := 0; i < min(cap(queue)-len(queue), 2); i++ {

View File

@@ -6,11 +6,13 @@ import (
"io"
"math/rand"
"os"
"sort"
"strconv"
"strings"
"time"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
timer "github.com/FloatTech/ZeroBot-Plugin-Timer"
@@ -46,6 +48,7 @@ const (
var (
config Config
limit = rate.NewManager(time.Minute*5, 2)
)
func init() { // 插件主体
@@ -282,18 +285,48 @@ func init() { // 插件主体
}
})
// 随机点名
zero.OnFullMatchGroup([]string{"翻牌"}).SetBlock(true).SetPriority(40).
zero.OnFullMatchGroup([]string{"翻牌"}, zero.OnlyGroup).SetBlock(true).SetPriority(40).
Handle(func(ctx *zero.Ctx) {
if ctx.Event.GroupID > 0 {
list := ctx.GetGroupMemberList(ctx.Event.GroupID)
rand.Seed(time.Now().UnixNano())
randIndex := fmt.Sprint(rand.Intn(int(list.Get("#").Int())))
randCard := list.Get(randIndex + ".card").String()
if randCard == "" {
randCard = list.Get(randIndex + ".nickname").String()
}
ctx.Send(randCard + ",就是你啦!")
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("少女祈祷中......"))
return
}
// 无缓存获取群员列表
list := ctx.CallAction("get_group_member_list", zero.Params{
"group_id": ctx.Event.GroupID,
"no_cache": true,
}).Data
temp := list.Array()
sort.SliceStable(temp, func(i, j int) bool {
return temp[i].Get("last_sent_time").Int() < temp[j].Get("last_sent_time").Int()
})
max := func(a, b int) int {
if a > b {
return a
}
return b
}
temp = temp[max(0, len(temp)-10):]
rand.Seed(time.Now().UnixNano())
who := temp[rand.Intn(len(temp))]
if who.Get("user_id").Int() == ctx.Event.SelfID {
ctx.SendChain(message.Text("幸运儿居然是我自己"))
return
}
if who.Get("user_id").Int() == ctx.Event.UserID {
ctx.SendChain(message.Text("哎呀,就是你自己了"))
return
}
nick := who.Get("card").Str
if nick == "" {
nick = who.Get("nickname").Str
}
ctx.SendChain(
message.Text(
nick,
" 就是你啦!",
),
)
})
// 入群欢迎
zero.OnNotice().SetBlock(false).FirstPriority().

View File

@@ -2,6 +2,6 @@ syntax = "proto3";
package manager;
message config {
map<uint64, bool> checkin = 1;
map<uint64, string> welcome = 2;
map<uint64, bool> checkin = 1;
map<uint64, string> welcome = 2;
}

View File

@@ -7,6 +7,7 @@ import (
"strings"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
"github.com/wdvxdr1123/ZeroBot/message"
)
@@ -36,30 +37,28 @@ type resultjson struct {
} `json:"players"`
}
var (
servers = make(map[string]string)
)
func init() {
zero.OnRegex(`^/list (.*)$`).
// 这里填对应mc服务器的登录地址
servers["ftbi"] = "115.28.186.22:25710"
servers["ges"] = "115.28.186.22:25701"
engine.OnCommand("mclist").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
// 支持多个服务器
switch ctx.State["regex_matched"].([]string)[1] {
case "ftbi": // 这里对应触发指令里的服务器名称
ftbijson := infoapi("115.28.186.22:25710") // 这里填对应mc服务器的登录地址
var str = ftbijson.Players.List
cs := strings.Join(str, "\n")
ctx.SendChain(message.Text(
"服务器名字: ", ftbijson.Motd.Raw[0], "\n",
"在线人数: ", ftbijson.Players.Online, "/", ftbijson.Players.Max, "\n",
"以下为玩家名字: ", "\n", cs,
))
case "ges": // 这里对应触发指令里的服务器名称
gesjson := infoapi("115.28.186.22:25701") // 这里填对应mc服务器的登录地址
var str = gesjson.Players.List
cs := strings.Join(str, "\n")
ctx.SendChain(message.Text(
"服务器名字: ", gesjson.Motd.Raw[0], "\n",
"在线人数: ", gesjson.Players.Online, "/", gesjson.Players.Max, "\n",
"以下为玩家名字: ", "\n", cs,
))
}
gesjson := infoapi(servers[model.Args])
var str = gesjson.Players.List
cs := strings.Join(str, "\n")
ctx.SendChain(message.Text(
"服务器名字: ", gesjson.Motd.Raw[0], "\n",
"在线人数: ", gesjson.Players.Online, "/", gesjson.Players.Max, "\n",
"以下为玩家名字: ", "\n", cs,
))
})
}

View File

@@ -7,36 +7,50 @@ import (
"net/http"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
// 此功能实现依赖MCSManager项目对服务器的管理apimc服务器如果没有在该管理平台部署此功能无效
// 项目地址: https://github.com/Suwings/MCSManager
// 项目的api文档: https://github.com/Suwings/MCSManager/wiki/API-Documentation
func init() {
zero.OnRegex(`^/start (.*)$`).
Handle(func(ctx *zero.Ctx) {
name := ctx.State["regex_matched"].([]string)[1]
ctx.SendChain(message.Text("开启服务器: ", name, "....."))
result := start(name)
ctx.Send(result)
})
}
const api = "http://your.addr:23333/api/start_server/%s/?apikey=apikey"
var engine *zero.Engine
func init() {
zero.OnRegex(`^/stop (.*)$`).
engine = control.Register("minecraft", &control.Options{
DisableOnDefault: false,
Help: "minecraft\n" +
"- /mcstart xxx\n" +
"- /mcstop xxx\n" +
"- /mclist servername\n" +
"- https://github.com/Suwings/MCSManager",
})
engine.OnCommand("mcstart").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
name := ctx.State["regex_matched"].([]string)[1]
ctx.SendChain(message.Text("关闭服务器: ", name, "....."))
result := stop(name)
model := extension.CommandModel{}
_ = ctx.Parse(&model)
ctx.SendChain(message.Text("开启服务器: ", model.Args, "....."))
result := start(model.Args)
ctx.Send(result)
})
engine.OnCommand("mcstop").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
ctx.SendChain(message.Text("开启服务器: ", model.Args, "....."))
result := stop(model.Args)
ctx.Send(result)
})
}
// 开启服务器的api请求
func start(name string) string {
url := fmt.Sprintf("http://your.addr:23333/api/start_server/%s/?apikey=apikey", name)
url := fmt.Sprintf(api, name)
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
@@ -57,7 +71,7 @@ func start(name string) string {
// 关闭服务器的api请求
func stop(name string) string {
url := fmt.Sprintf("http://your.addr:23333/api/stop_server/%s/?apikey=apikey", name)
url := fmt.Sprintf(api, name)
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {

View File

@@ -15,12 +15,21 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
var limit = rate.NewManager(time.Minute*3, 5)
func init() {
zero.OnRegex("^(.{0,2})点歌(.{1,25})$").SetBlock(true).FirstPriority().
control.Register("music", &control.Options{
DisableOnDefault: false,
Help: "点歌\n" +
"- 点歌[xxx]\n" +
"- 网易点歌[xxx]\n" +
"- 酷我点歌[xxx]\n" +
"- 酷狗点歌[xxx]",
}).OnRegex("^(.{0,2})点歌(.{1,25})$").SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.Send("请稍后重试0x0...")

47
plugin_nbnhhsh/nbnhhsh.go Normal file
View File

@@ -0,0 +1,47 @@
// Package nbnhhsh 能不能好好说话
package nbnhhsh
import (
"io/ioutil"
"net/http"
"net/url"
"strings"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() {
zero.OnRegex(`^[?]{1,2} ?([a-z0-9]+)$`).SetBlock(false).
Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1]
ctx.SendChain(message.Text(keyword + ": " + strings.Join(getValue(keyword), ", ")))
})
}
func getValue(text string) []string {
urlValues := url.Values{}
urlValues.Add("text", text)
resp, err := http.PostForm("https://lab.magiconch.com/api/nbnhhsh/guess", urlValues)
if err == nil {
body, err := ioutil.ReadAll(resp.Body)
if err == nil {
resp.Body.Close()
json := gjson.ParseBytes(body)
res := make([]string, 0)
var jsonPath string
if json.Get("0.trans").Exists() {
jsonPath = "0.trans"
} else {
jsonPath = "0.inputting"
}
for _, value := range json.Get(jsonPath).Array() {
res = append(res, value.String())
}
return res
}
return []string{err.Error()}
}
return []string{err.Error()}
}

View File

@@ -8,6 +8,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
const (
@@ -15,10 +17,18 @@ const (
)
func init() { // 插件主体
rand.Seed(time.Now().UnixMicro())
zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10).
rand.Seed(time.Now().UnixNano())
control.Register("omikuji", &control.Options{
DisableOnDefault: false,
Help: "浅草寺求签\n" +
"- 求签|占卜",
}).OnFullMatchGroup([]string{"求签", "占卜"}).SetPriority(10).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
miku := rand.Intn(100) + 1
ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku, 0)), message.Image(fmt.Sprintf(bed, miku, 1)))
ctx.SendChain(
message.At(ctx.Event.UserID),
message.Image(fmt.Sprintf(bed, miku, 0)),
message.Image(fmt.Sprintf(bed, miku, 1)),
)
})
}

View File

@@ -0,0 +1,61 @@
package qingyunke
// TODO: 待优化
/*
import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"regexp"
)
var (
reImg = `https?://[^"]+?(\.((jpg)|(png)|(jpeg)|(gif)|(bmp)))`
)
//取图片
func getPicture() string {
prefix := "https://fabiaoqing.com/tag/detail/id/5682/page"
url := fmt.Sprintf("%d.html", rand.Intn(11)+1)
url = prefix + url
log.Println("正在" + url + "寻找图片")
urls := getImgs(url)
fmt.Println(urls)
imageURL := urls[rand.Intn(len(urls))]
log.Println("取到" + imageURL)
return imageURL
}
func HandleError(err error, why string) {
if err != nil {
fmt.Println(why, err)
}
}
func getImgs(url string) (urls []string) {
pageStr := GetPageStr(url)
re := regexp.MustCompile(reImg)
results := re.FindAllStringSubmatch(pageStr, -1)
fmt.Printf("共找到%d条结果\n", len(results))
for _, result := range results {
url := result[0]
urls = append(urls, url)
}
return
}
func GetPageStr(url string) (pageStr string) {
resp, err := http.Get(url)
HandleError(err, "http.Get url")
defer resp.Body.Close()
// 2.读取页面内容
pageBytes, err := ioutil.ReadAll(resp.Body)
HandleError(err, "ioutil.ReadAll")
// 字节转字符串
pageStr = string(pageBytes)
return pageStr
}
*/

View File

@@ -0,0 +1,149 @@
// Package qingyunke 基于青云客接口的聊天对话功能
package qingyunke
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"regexp"
"strconv"
"strings"
"time"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
var (
prio = 100
bucket = rate.NewManager(time.Minute, 20) // 青云客接口回复
engine *zero.Engine
)
func init() { // 插件主体
engine = control.Register("qingyunke", &control.Options{
DisableOnDefault: false,
Help: "青云客\n" +
"- @Bot 任意文本(任意一句话回复)",
})
// 回复 匹配中文、英文、数字、空格但不包括下划线等符号
engine.OnRegex("^([\u4E00-\u9FA5A-Za-z0-9\\s]{1,30})", zero.OnlyToMe).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
if !bucket.Load(ctx.Event.UserID).Acquire() {
// 频繁触发,不回复
return
}
msg := ctx.State["regex_matched"].([]string)[1]
// 调用青云客接口
reply, err := getMessage(msg)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
// 挑出 face 表情
reg := regexp.MustCompile(`\{face:(\d+)\}(.*)`)
faceReply := -1
var textReply string
if reg.MatchString(reply) {
faceReply, _ = strconv.Atoi(reg.FindStringSubmatch(reply)[1])
textReply = reg.FindStringSubmatch(reply)[2]
} else {
textReply = reply
}
textReply = strings.ReplaceAll(textReply, "菲菲", zero.BotConfig.NickName[0])
textReply = strings.ReplaceAll(textReply, "{br}", "\n")
// 回复
time.Sleep(time.Second * 1)
if ctx.Event.MessageType == "group" {
if faceReply != -1 {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(textReply), message.Face(faceReply))
} else {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(textReply))
}
}
if ctx.Event.MessageType == "private" {
if faceReply != -1 {
ctx.SendChain(message.Text(textReply), message.Face(faceReply))
} else {
ctx.SendChain(message.Text(textReply))
}
}
})
// TODO: 待优化
/*
zero.OnRegex("CQ:image,file=|CQ:face,id=", zero.OnlyToMe, switchQYK()).SetBlock(false).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
imageURL := getPicture()
time.Sleep(time.Second * 1)
if ctx.Event.MessageType == "group" {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image(imageURL))
}
if ctx.Event.MessageType == "private" {
ctx.SendChain(message.Image(imageURL))
}
})
*/
}
// 青云客数据
type dataQYK struct {
Result int `json:"result"`
Content string `json:"content"`
}
// 青云客取消息
func getMessage(msg string) (string, error) {
url := "http://api.qingyunke.com/api.php"
key := "free"
appid := "0"
url = fmt.Sprintf(url+"?key=%s&appid=%s&msg=%s", key, appid, msg)
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return "", err
}
// 自定义Header
req.Header.Set("User-Agent", getAgent())
req.Header.Set("Connection", "keep-alive")
req.Header.Set("Host", "api.qingyunke.com")
resp, err := client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
fmt.Println(string(bytes))
var dataQYK dataQYK
if err := json.Unmarshal(bytes, &dataQYK); err != nil {
return "", err
}
return dataQYK.Content, nil
}
func getAgent() string {
agent := [...]string{
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0",
"Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11",
"Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)",
"Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; The World)",
"User-Agent,Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
"User-Agent, Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)",
"User-Agent,Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
}
r := rand.New(rand.NewSource(time.Now().UnixNano()))
len1 := len(agent)
return agent[r.Intn(len1)]
}

View File

@@ -0,0 +1,21 @@
package qingyunke
// TODO: 移动到 manager 搭配自动验证使用
/*
import (
zero "github.com/wdvxdr1123/ZeroBot"
)
//自动同意加群,加好友
func init() {
zero.OnRequest().SetBlock(false).FirstPriority().Handle(func(ctx *zero.Ctx) {
if ctx.Event.RequestType == "friend" {
ctx.SetFriendAddRequest(ctx.Event.Flag, true, "")
}
if ctx.Event.RequestType == "group" && ctx.Event.SubType == "invite" {
ctx.SetGroupAddRequest(ctx.Event.Flag, "invite", true, "我爱你mua~")
}
})
}
*/

21
plugin_reborn/born.go Normal file
View File

@@ -0,0 +1,21 @@
package reborn
import (
wr "github.com/mroth/weightedrand"
)
var (
gender, _ = wr.NewChooser(
wr.Choice{Item: "男孩子", Weight: 50707},
wr.Choice{Item: "女孩子", Weight: 48292},
wr.Choice{Item: "雌雄同体", Weight: 1001},
)
)
func randcoun() string {
return areac.Pick().(string)
}
func randgen() string {
return gender.Pick().(string)
}

91
plugin_reborn/load.go Normal file
View File

@@ -0,0 +1,91 @@
package reborn
import (
"encoding/json"
"io"
"net/http"
"os"
"time"
wr "github.com/mroth/weightedrand"
log "github.com/sirupsen/logrus"
)
const (
datapath = "data/Reborn"
jsonfile = datapath + "/rate.json"
pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/" + jsonfile
)
type rate []struct {
Name string `json:"name"`
Weight float64 `json:"weight"`
}
var (
areac *wr.Chooser
)
func init() {
go func() {
time.Sleep(time.Second)
err := os.MkdirAll(datapath, 0755)
if err != nil {
panic(err)
}
area := make(rate, 226)
err = load(&area)
if err != nil {
panic(err)
}
choices := make([]wr.Choice, len(area))
for i, a := range area {
choices[i].Item = a.Name
choices[i].Weight = uint(a.Weight * 1e9)
}
areac, err = wr.NewChooser(choices...)
if err != nil {
panic(err)
}
log.Printf("[Reborn]读取%d个国家/地区", len(area))
}()
}
// load 加载rate数据
func load(area *rate) error {
if _, err := os.Stat(jsonfile); err == nil || os.IsExist(err) {
f, err := os.Open(jsonfile)
if err == nil {
defer f.Close()
data, err1 := io.ReadAll(f)
if err1 == nil {
if len(data) > 0 {
return json.Unmarshal(data, area)
}
}
return err1
}
} else { // 如果没有小作文,则从 url 下载
f, err := os.Create(jsonfile)
if err != nil {
return err
}
defer f.Close()
resp, err := http.Get(pburl)
if err == nil {
defer resp.Body.Close()
if resp.ContentLength > 0 {
log.Printf("[Reborn]从镜像下载国家和地区%d字节...", resp.ContentLength)
data, err := io.ReadAll(resp.Body)
if err == nil && len(data) > 0 {
_, _ = f.Write(data)
return json.Unmarshal(data, area)
}
return err
}
return nil
}
return err
}
return nil
}

28
plugin_reborn/main.go Normal file
View File

@@ -0,0 +1,28 @@
// Package reborn 投胎 来自 https://github.com/YukariChiba/tgbot/blob/main/modules/Reborn.py
package reborn
import (
"fmt"
"math/rand"
"time"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
func init() {
rand.Seed(time.Now().UnixNano())
control.Register("reborn", &control.Options{
DisableOnDefault: false,
Help: "投胎\n- reborn",
}).OnFullMatch("reborn").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if rand.Int31() > 1<<27 {
ctx.SendChain(message.At(ctx.Event.UserID), message.Text(fmt.Sprintf("投胎成功!\n您出生在 %s, 是 %s。", randcoun(), randgen())))
} else {
ctx.SendChain(message.At(ctx.Event.UserID), message.Text("投胎失败!\n您没能活到出生祝您下次好运"))
}
})
}

View File

@@ -13,11 +13,12 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/tidwall/gjson"
)
var (
enable = true
limit = rate.NewManager(time.Minute*3, 5)
templates = map[string]string{
"py2": "print 'Hello World!'",
@@ -92,40 +93,18 @@ var (
)
func init() {
zero.OnFullMatch(">runcode help").SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(
"使用说明: ", "\n",
">runcode [language] [code block]", "\n",
"模板查看: ", "\n",
">runcode [language] help", "\n",
"支持语种: ", "\n",
"Go || Python || C/C++ || C# || Java || Lua ", "\n",
"JavaScript || TypeScript || PHP || Shell ", "\n",
"Kotlin || Rust || Erlang || Ruby || Swift ", "\n",
"R || VB || Py2 || Perl || Pascal || Scala ", "\n",
))
})
zero.OnFullMatch(">runcode on", zero.AdminPermission).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
enable = true
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text("在线运行代码功能已启用"),
)
})
zero.OnFullMatch(">runcode off", zero.AdminPermission).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
enable = false
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text("在线运行代码功能已禁用"),
)
})
zero.OnRegex(`^>runcode\s(.+?)\s([\s\S]+)$`).SetBlock(true).SecondPriority().
control.Register("runcode", &control.Options{
DisableOnDefault: false,
Help: "在线代码运行: \n" +
">runcode [language] [code block]\n" +
"模板查看: \n" +
">runcode [language] help\n" +
"支持语种: \n" +
"Go || Python || C/C++ || C# || Java || Lua \n" +
"JavaScript || TypeScript || PHP || Shell \n" +
"Kotlin || Rust || Erlang || Ruby || Swift \n" +
"R || VB || Py2 || Perl || Pascal || Scala",
}).OnRegex(`^>runcode\s(.+?)\s([\s\S]+)$`).SetBlock(true).SecondPriority().
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.Send("请稍后重试0x0...")
@@ -139,39 +118,31 @@ func init() {
message.Text("语言不是受支持的编程语种呢~"),
)
} else {
if !enable {
// 运行代码被禁用
// 执行运行
block := ctx.State["regex_matched"].([]string)[2]
block = message.UnescapeCQCodeText(block)
if block == "help" {
// 输出模板
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text("在线运行代码功能已被禁用"),
message.Text("> ", ctx.Event.Sender.NickName, " ", language, "-template:\n"),
message.Text(
">runcode ", language, "\n",
templates[language],
),
)
} else {
// 执行运行
block := ctx.State["regex_matched"].([]string)[2]
block = message.UnescapeCQCodeText(block)
if block == "help" {
// 输出模板
if output, err := runCode(block, runType); err != nil {
// 运行失败
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, " ", language, "-template:\n"),
message.Text(
">runcode ", language, "\n",
templates[language],
),
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text("ERROR: ", err),
)
} else {
if output, err := runCode(block, runType); err != nil {
// 运行失败
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text("ERROR: ", err),
)
} else {
// 运行成功
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text(output),
)
}
// 运行成功
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text(output),
)
}
}
}

View File

@@ -6,18 +6,25 @@ import (
"strconv"
"strings"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/AnimeAPI/ascii2d"
"github.com/FloatTech/AnimeAPI/picture"
"github.com/FloatTech/AnimeAPI/pixiv"
"github.com/FloatTech/AnimeAPI/saucenao"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
func init() { // 插件主体
engine := control.Register("saucenao", &control.Options{
DisableOnDefault: false,
Help: "搜图\n" +
"- 以图搜图|搜索图片|以图识图[图片]\n" +
"- 搜图[P站图片ID]",
})
// 根据 PID 搜图
zero.OnRegex(`^搜图(\d+)$`).SetBlock(true).FirstPriority().
engine.OnRegex(`^搜图(\d+)$`).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
id, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
ctx.Send("少女祈祷中......")
@@ -27,24 +34,28 @@ func init() { // 插件主体
ctx.SendChain(message.Text("ERROR: ", err))
return
}
// 改用 i.pixiv.cat 镜像站
link := illust.ImageUrls
link = strings.ReplaceAll(link, "i.pximg.net", "i.pixiv.cat")
// 发送搜索结果
ctx.SendChain(
message.Image(link),
message.Text(
"\n",
"标题:", illust.Title, "\n",
"插画ID", illust.Pid, "\n",
"画师", illust.UserName, "\n",
"画师ID", illust.UserId, "\n",
"直链", "https://pixivel.moe/detail?id=", illust.Pid,
),
)
if illust.Pid > 0 {
// 改用 i.pixiv.cat 镜像站
link := illust.ImageUrls
link = strings.ReplaceAll(link, "i.pximg.net", "i.pixiv.cat")
// 发送搜索结果
ctx.SendChain(
message.Image(link),
message.Text(
"\n",
"标题", illust.Title, "\n",
"插画ID", illust.Pid, "\n",
"画师:", illust.UserName, "\n",
"画师ID", illust.UserId, "\n",
"直链:", "https://pixivel.moe/detail?id=", illust.Pid,
),
)
} else {
ctx.Send("图片不存在!")
}
})
// 以图搜图
zero.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).FirstPriority().
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.Send("少女祈祷中......")

View File

@@ -16,12 +16,15 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/FloatTech/ZeroBot-Plugin/data"
)
// Pools 图片缓冲池
type imgpool struct {
Lock sync.Mutex
DB *sqlite
DB *data.Sqlite
Path string
Group int64
List []string
@@ -37,7 +40,7 @@ const (
// NewPoolsCache 返回一个缓冲池对象
func newPools() *imgpool {
cache := &imgpool{
DB: &sqlite{DBPath: "data/SetuTime/SetuTime.db"},
DB: &data.Sqlite{DBPath: "data/SetuTime/SetuTime.db"},
Path: "data/SetuTime/cache/",
Group: 0,
List: []string{"涩图", "二次元", "风景", "车万"}, // 可以自己加类别,得自己加图片进数据库
@@ -45,6 +48,8 @@ func newPools() *imgpool {
Pool: map[string][]*pixiv.Illust{},
Form: 0,
}
// 每次启动清理缓存
os.RemoveAll(cache.Path)
err := os.MkdirAll(cache.Path, 0755)
if err != nil {
panic(err)
@@ -71,7 +76,7 @@ func newPools() *imgpool {
}
}
for i := range cache.List {
if err := cache.DB.create(cache.List[i], &pixiv.Illust{}); err != nil {
if err := cache.DB.Create(cache.List[i], &pixiv.Illust{}); err != nil {
panic(err)
}
}
@@ -84,7 +89,15 @@ var (
)
func init() { // 插件主体
zero.OnRegex(`^来份(.*)$`, firstValueInList(pool.List)).SetBlock(true).SetPriority(20).
engine := control.Register("setutime", &control.Options{
DisableOnDefault: false,
Help: "涩图\n" +
"- 来份[涩图/二次元/风景/车万]\n" +
"- 添加[涩图/二次元/风景/车万][P站图片ID]\n" +
"- 删除[涩图/二次元/风景/车万][P站图片ID]\n" +
"- >setu status",
})
engine.OnRegex(`^来份(.*)$`, firstValueInList(pool.List)).SetBlock(true).SetPriority(20).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0..."))
@@ -97,7 +110,7 @@ func init() { // 插件主体
for i := 0; i < times; i++ {
illust := &pixiv.Illust{}
// 查询出一张图片
if err := pool.DB.find(imgtype, illust, "ORDER BY RANDOM() limit 1"); err != nil {
if err := pool.DB.Find(imgtype, illust, "ORDER BY RANDOM() limit 1"); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
continue
}
@@ -128,7 +141,7 @@ func init() { // 插件主体
}
})
zero.OnRegex(`^添加(.*?)(\d+)$`, firstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).SetPriority(21).
engine.OnRegex(`^添加(.*?)(\d+)$`, firstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).SetPriority(21).
Handle(func(ctx *zero.Ctx) {
var (
imgtype = ctx.State["regex_matched"].([]string)[1]
@@ -152,21 +165,21 @@ func init() { // 插件主体
return
}
// 添加插画到对应的数据库table
if err := pool.DB.insert(imgtype, illust); err != nil {
if err := pool.DB.Insert(imgtype, illust); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.Send("添加成功")
})
zero.OnRegex(`^删除(.*?)(\d+)$`, firstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).SetPriority(22).
engine.OnRegex(`^删除(.*?)(\d+)$`, firstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).SetPriority(22).
Handle(func(ctx *zero.Ctx) {
var (
imgtype = ctx.State["regex_matched"].([]string)[1]
id, _ = strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
)
// 查询数据库
if err := pool.DB.del(imgtype, fmt.Sprintf("WHERE pid=%d", id)); err != nil {
if err := pool.DB.Del(imgtype, fmt.Sprintf("WHERE pid=%d", id)); err != nil {
ctx.Send(fmt.Sprintf("ERROR: %v", err))
return
}
@@ -174,11 +187,11 @@ func init() { // 插件主体
})
// 查询数据库涩图数量
zero.OnFullMatchGroup([]string{">setu status"}).SetBlock(true).SetPriority(23).
engine.OnFullMatchGroup([]string{">setu status"}).SetBlock(true).SetPriority(23).
Handle(func(ctx *zero.Ctx) {
state := []string{"[SetuTime]"}
for i := range pool.List {
num, err := pool.DB.count(pool.List[i])
num, err := pool.DB.Count(pool.List[i])
if err != nil {
num = 0
}

View File

@@ -9,6 +9,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
var (
@@ -17,10 +19,18 @@ var (
)
func init() {
zero.OnPrefix("异世界转生", number(587874)).SetBlock(true).FirstPriority().Handle(handle)
zero.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).FirstPriority().Handle(handle)
zero.OnPrefix("卖萌", number(360578)).SetBlock(true).FirstPriority().Handle(handle)
zero.OnPrefix("抽老婆", number(1075116)).SetBlock(true).FirstPriority().Handle(handle)
engine := control.Register("shindan", &control.Options{
DisableOnDefault: false,
Help: "shindan\n" +
"- 今天是什么少女[@xxx]\n" +
"- 异世界转生[@xxx]\n" +
"- 卖萌[@xxx]\n" +
"- 抽老婆[@xxx]",
})
engine.OnPrefix("异世界转生", number(587874)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("卖萌", number(360578)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("抽老婆", number(1075116)).SetBlock(true).FirstPriority().Handle(handle)
}
// shindanmaker 处理函数