Compare commits

..

78 Commits

Author SHA1 Message Date
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
fumiama
e1ecea5f79 ✏️ 修正lint 2021-08-27 17:05:17 +08:00
fumiama
b1d1e1e7b9 ✏️ 修正lint 2021-08-27 17:02:25 +08:00
fumiama
fe00ef8cfa ✏️ 修正lint 2021-08-27 16:59:43 +08:00
fumiama
3a3c9e5018 ✏️ 线程安全 2021-08-27 16:54:08 +08:00
github-actions[bot]
bf6714f231 🎨 改进代码样式 2021-08-27 08:37:43 +00:00
fumiama
b4e0e6fa0f 升级lint到1.17 2021-08-27 16:36:29 +08:00
fumiama
332bbfc0bc Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2021-08-27 16:30:30 +08:00
fumiama
ee666601d6 升级golangci到1.17 2021-08-27 16:30:18 +08:00
github-actions[bot]
c7d4c63725 🎨 改进代码样式 2021-08-27 08:24:14 +00:00
fumiama
39141d54a4 升级go.mod到1.17 2021-08-27 16:23:18 +08:00
fumiama
35f9bb3758 尝试修复lint 2021-08-27 16:17:53 +08:00
fumiama
0648c9785c 尝试修复lint 2021-08-27 16:17:03 +08:00
fumiama
b5666ef48e 尝试修复lint 2021-08-27 16:14:10 +08:00
fumiama
f3184bc08d 尝试解决lint失败 2021-08-27 16:09:55 +08:00
源文雨
4804cfa5a2 🎨 解决语言识别错误 2021-08-27 15:58:50 +08:00
42 changed files with 1185 additions and 450 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.pb linguist-language=go

View File

@@ -13,43 +13,43 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: 1.17
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v2 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: Tidy Go modules - name: Cache Go
run: go mod tidy id: cache
uses: actions/cache@v2
- name: Build linux-x64 with:
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64 # A list of files, directories, and wildcard patterns to cache and restore
- name: Build linux-x86 path: ~/go/pkg/mod
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86 key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- 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 - name: Tidy Go modules
uses: svenstaro/upload-release-action@v2 run: go mod tidy
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} - name: Build linux-x64
file: artifacts/zerobot-plugin-* run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
tag: ${{ github.ref }} - name: Build linux-x86
overwrite: true run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
file_glob: true - 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,13 +1,20 @@
name: PullLint name: PullLint
on: [pull_request] on: [ pull_request ]
jobs: jobs:
golangci: golangci:
name: lint name: lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - 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: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@master
with: with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest version: latest
@@ -22,7 +29,7 @@ jobs:
# only-new-issues: true # only-new-issues: true
# Optional: if set to true then the action will use pre-installed Go. # Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true skip-go-installation: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg. # Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true # skip-pkg-cache: true

View File

@@ -1,16 +1,24 @@
name: PushLint name: PushLint
on: [push] on: [ push ]
jobs: jobs:
golangci: golangci:
name: lint_golangci-lint name: lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - 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: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@master
with: with:
version: latest version: latest
args: --issues-exit-code=0 args: --issues-exit-code=0
skip-go-installation: true
- name: Commit back - name: Commit back
continue-on-error: true continue-on-error: true
run: | run: |

View File

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

18
.gitignore vendored
View File

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

View File

@@ -10,6 +10,10 @@ linters-settings:
disabled-checks: disabled-checks:
- exitAfterDefer - exitAfterDefer
gofumpt:
# Select the Go version to target. The default is `1.15`.
lang-version: "1.17"
forbidigo: forbidigo:
# Forbid the following identifiers # Forbid the following identifiers
forbid: forbid:

View File

@@ -12,14 +12,18 @@
[![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) [![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/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) [![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) [![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> </div>
## 功能 ## 功能
- **插件控制**
- [x] /启用 xxx
- [x] /禁用 xxx
- [x] /用法 xxx
- [x] /服务列表
- **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat"` - **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat"`
- [x] [BOT名字] - [x] [BOT名字]
- [x] [戳一戳BOT] - [x] [戳一戳BOT]
@@ -62,9 +66,8 @@
- [x] >github [xxx] - [x] >github [xxx]
- [x] >github -p [xxx] - [x] >github -p [xxx]
- **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode"` - **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode"`
- [x] >runcode help - [x] > runcode [language] help
- [x] >runcode [on/off] - [x] > runcode [language] [code block]
- [x] >runcode [language] [code block]
- **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music"` - **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music"`
- [x] 点歌[xxx] - [x] 点歌[xxx]
- [x] 网易点歌[xxx] - [x] 网易点歌[xxx]
@@ -86,7 +89,7 @@
- [x] 来份[涩图/二次元/风景/车万] - [x] 来份[涩图/二次元/风景/车万]
- [x] 添加[涩图/二次元/风景/车万][P站图片ID] - [x] 添加[涩图/二次元/风景/车万][P站图片ID]
- [x] 删除[涩图/二次元/风景/车万][P站图片ID] - [x] 删除[涩图/二次元/风景/车万][P站图片ID]
- [x] >setu status - [x] > setu status
- **lolicon** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon"` - **lolicon** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon"`
- [x] 来份萝莉 - [x] 来份萝莉
- **搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"` - **搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"`
@@ -99,25 +102,33 @@
- [x] 太涩了(撤回最近发的图) - [x] 太涩了(撤回最近发的图)
- [x] 评价图片(发送一张图片让bot评分) - [x] 评价图片(发送一张图片让bot评分)
- **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji` - **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji`
- 本插件要求`Go`版本大于等于`1.17` - [x] 求签|运势|占卜
- [x] @BOT 求签|运势|占卜
- **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"` - **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"` - **嘉然** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana"`
- [x] @BOT 小作文 - [x] 小作文
- [x] @BOT 发大病 - [x] 发大病
- [x] @BOT 教你一篇小作文[作文] - [x] 教你一篇小作文[作文]
- [x] [回复]查重
- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"` - **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"`
- [x] 查询计算机当前活跃度 [身体检查] - [x] 查询计算机当前活跃度 [身体检查]
- [ ] 简易语音 - [ ] 简易语音
- [ ] 爬图合成 [@xxx] - [ ] 爬图合成 [@xxx]
- **minecraft** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft"` - **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服务器如果没有在该管理平台部署此功能无效 - 注:此功能实现依赖[MCSManager](https://github.com/Suwings/MCSManager)项目对服务器的管理apimc服务器如果没有在该管理平台部署此功能无效
- **炉石** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs"` - **炉石** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs"`
- [x] 搜卡[xxxx] - [x] 搜卡[xxxx]
- [x] [卡组代码xxx] - [x] [卡组代码xxx]
-更多搜卡指令参数https://hs.fbigame.com/misc/searchhelp -更多搜卡指令参数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]
- **TODO...** - **TODO...**
## 使用方法 ## 使用方法
@@ -125,16 +136,17 @@
本项目符合 [OneBot](https://github.com/howmanybots/onebot) 标准,可基于以下项目与机器人框架/平台进行交互 本项目符合 [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 | | | [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 | | | [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 | | | [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)页面下载对应系统版本可执行文件,编译时开启了全部插件。 可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。
### 本地运行 ### 本地运行
1. 下载安装 [Go](https://studygolang.com/dl) 环境 1. 下载安装 [Go](https://studygolang.com/dl) 环境
2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压 2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压
3. 编辑 main.go 文件,内容按需修改 3. 编辑 main.go 文件,内容按需修改
@@ -143,17 +155,21 @@
### 编译运行 ### 编译运行
#### 利用 Actions 在线编译 (推荐) #### 利用 Actions 在线编译
1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库 1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库
2. 点击仓库上方的 Actions 按钮,确认使用 Actions 2. 点击仓库上方的 Actions 按钮,确认使用 Actions
3. 编辑 main.go 文件,内容按需修改,提交修改后 Actions 自动执行 3. 编辑 main.go 文件,内容按需修改
4. 点击 Actions 按钮,等待编译完成,在 Actions 里下载编译好的文件 4. 前往 Release 页面发布一个 Release`tag`形如`vx.y.z`,以触发稳定版编译流程
5. 运行 OneBot 框架,并同时运行本插 5. 点击 Actions 按钮,等待编译完成,回到 Release 页面下载编译好的文
6. 啾咪~ 6. 运行 OneBot 框架,并同时运行本插件
7. 啾咪~
#### 本地编译/交叉编译 #### 本地编译/交叉编译
1. 下载安装 [Go](https://studygolang.com/dl) 环境 1. 下载安装 [Go](https://studygolang.com/dl) 环境
2. clone 并进入本项目,下载所需包 2. clone 并进入本项目,下载所需包
```bash ```bash
git clone --depth=1 https://github.com/FloatTech/ZeroBot-Plugin.git git clone --depth=1 https://github.com/FloatTech/ZeroBot-Plugin.git
cd ZeroBot-Plugin cd ZeroBot-Plugin
@@ -162,8 +178,10 @@ go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=auto go env -w GO111MODULE=auto
go mod tidy go mod tidy
``` ```
3. 编辑 main.go 文件,内容按需修改 3. 编辑 main.go 文件,内容按需修改
4. 按照平台输入命令编译,下面举了两个不太常见的例子 4. 按照平台输入命令编译,下面举了两个不太常见的例子
```bash ```bash
# 本机平台 # 本机平台
go build -ldflags "-s -w" -o zerobot go build -ldflags "-s -w" -o zerobot
@@ -172,12 +190,14 @@ GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot
# mips Linux 平台 如 路由器 wndr4300 # mips Linux 平台 如 路由器 wndr4300
GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot
``` ```
5. 运行 OneBot 框架,并同时运行本插件 5. 运行 OneBot 框架,并同时运行本插件
## 特别感谢 ## 特别感谢
- [ZeroBot](https://github.com/wdvxdr1123/ZeroBot) - [ZeroBot](https://github.com/wdvxdr1123/ZeroBot)
- [ATRI](https://github.com/Kyomotoi/ATRI) - [ATRI](https://github.com/Kyomotoi/ATRI)
## License ## 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) [![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)

11
control/register.go Normal file
View File

@@ -0,0 +1,11 @@
package control
import (
zero "github.com/wdvxdr1123/ZeroBot"
)
func Register(service string, o *Options) *zero.Engine {
engine := zero.New()
engine.UsePreHandler(new(service, o).Handler())
return engine
}

197
control/rule.go Normal file
View File

@@ -0,0 +1,197 @@
// 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 = &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
}
// new returns Manager with settings.
func new(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
} else {
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 // 帮助文本信息
}

View File

@@ -1,4 +1,4 @@
package setutime package data
import ( import (
"database/sql" "database/sql"
@@ -8,16 +8,16 @@ import (
_ "modernc.org/sqlite" // 引入sqlite _ "modernc.org/sqlite" // 引入sqlite
) )
// sqlite 数据库对象 // Sqlite 数据库对象
type sqlite struct { type Sqlite struct {
DB *sql.DB DB *sql.DB
DBPath string 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 { if db.DB == nil {
database, err := sql.Open("sqlite", db.DBPath) database, err := sql.Open("sqlite", db.DBPath)
if err != nil { if err != nil {
@@ -53,10 +53,10 @@ func (db *sqlite) create(table string, objptr interface{}) (err error) {
return nil 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) rows, err := db.DB.Query("SELECT * FROM " + table)
if err != nil { if err != nil {
return err return err
@@ -71,7 +71,7 @@ func (db *sqlite) insert(table string, objptr interface{}) (err error) {
top = len(tags) - 1 top = len(tags) - 1
cmd = []string{} cmd = []string{}
) )
cmd = append(cmd, "INSERT INTO") cmd = append(cmd, "REPLACE INTO")
cmd = append(cmd, table) cmd = append(cmd, table)
for i := range tags { for i := range tags {
switch i { switch i {
@@ -112,11 +112,11 @@ func (db *sqlite) insert(table string, objptr interface{}) (err error) {
return nil return nil
} }
// find 查询数据库 // Find 查询数据库
// condition 可为"WHERE id = 0" // 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{} var cmd = []string{}
cmd = append(cmd, "SELECT * FROM ") cmd = append(cmd, "SELECT * FROM ")
cmd = append(cmd, table) cmd = append(cmd, table)
@@ -142,10 +142,35 @@ func (db *sqlite) find(table string, objptr interface{}, condition string) (err
return nil 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" // 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{} var cmd = []string{}
cmd = append(cmd, "DELETE FROM") cmd = append(cmd, "DELETE FROM")
cmd = append(cmd, table) cmd = append(cmd, table)
@@ -161,9 +186,9 @@ func (db *sqlite) del(table string, condition string) (err error) {
return nil 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{} var cmd = []string{}
cmd = append(cmd, "SELECT * FROM") cmd = append(cmd, "SELECT * FROM")
cmd = append(cmd, table) cmd = append(cmd, table)

12
go.mod
View File

@@ -7,13 +7,13 @@ require (
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3
github.com/StackExchange/wmi v1.2.1 // indirect github.com/StackExchange/wmi v1.2.1 // indirect
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/imroc/req v0.3.0
github.com/robfig/cron v1.2.0 github.com/robfig/cron v1.2.0
github.com/shirou/gopsutil v3.21.7+incompatible github.com/shirou/gopsutil v3.21.8+incompatible
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
github.com/tidwall/gjson v1.8.1 github.com/tidwall/gjson v1.9.0
github.com/tidwall/pretty v1.2.0 // indirect github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/go-sysconf v0.3.7 // indirect github.com/wdvxdr1123/ZeroBot v1.2.3
github.com/wdvxdr1123/ZeroBot v1.2.2 modernc.org/sqlite v1.13.0
modernc.org/sqlite v1.12.0
) )

46
go.sum
View File

@@ -22,6 +22,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 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 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
@@ -30,6 +31,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 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.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= 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/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 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
@@ -55,6 +58,8 @@ github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= 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 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.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/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 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 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
@@ -64,23 +69,27 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= 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 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/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= 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 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU=
github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= 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/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= 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.0.3/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.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
github.com/tklauser/go-sysconf v0.3.7 h1:HT7h4+536gjqeq1ZIJPgOl1rg1XFatQGVZWp7Py53eg= github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
github.com/tklauser/go-sysconf v0.3.7/go.mod h1:JZIdXh4RmBvZDBZ41ld2bGxRV3n4daiiqA3skYhAoQ4= github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
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/wdvxdr1123/ZeroBot v1.2.2 h1:BKEy3l80BMrQWpFWaII0AfFMyf9bqrB0TxfWhTdoV58= github.com/wdvxdr1123/ZeroBot v1.2.2 h1:BKEy3l80BMrQWpFWaII0AfFMyf9bqrB0TxfWhTdoV58=
github.com/wdvxdr1123/ZeroBot v1.2.2/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc= github.com/wdvxdr1123/ZeroBot v1.2.2/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc=
github.com/wdvxdr1123/ZeroBot v1.2.3 h1:Fu6aHr+91NRN48G9szJwyR0MhnTjG5lNMS0Wy0QX1Uo=
github.com/wdvxdr1123/ZeroBot v1.2.3/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 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-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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -107,8 +116,10 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/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-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-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 h1:ikCpsnYR+Ew0vu99XlDp55lGgDJdIMx3f4a18jfse/s=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/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.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -135,15 +146,28 @@ lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= 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 h1:Rvxffgx6LHSpGS6IO8bffSYN1wpPsWHEWY9CV95vpro=
modernc.org/cc/v3 v3.33.7/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= 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/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.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
modernc.org/ccgo/v3 v3.9.6 h1:rCjLgu6iRxK2bqq8A0CCOnDP+tdA81LfbBUlM1L6ZIY= 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.9.6/go.mod h1:KGOi0NhaT6CO19xeSXcpXBl0OkoD6T1U4dPd633G9Sg=
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
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 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= 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.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.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
modernc.org/libc v1.9.11 h1:QUxZMs48Ahg2F7SN41aERvMfGLY2HU/ADnB9DC4Yts8= modernc.org/libc v1.9.11 h1:QUxZMs48Ahg2F7SN41aERvMfGLY2HU/ADnB9DC4Yts8=
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q= modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
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.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.2.2/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.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
@@ -151,15 +175,21 @@ modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= 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 h1:utMBrFcpnQDdNsmM6asmyH/FM9TqLPS7XF7otpJmrwM=
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= 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 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= 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 h1:AMAOgk4CkblRJc6YLKSYtz3pZ6DW5wjQ1uYH/rN7/Kk=
modernc.org/sqlite v1.12.0/go.mod h1:ppqJ4cQ+R09YLzl9haEL9AYgj6wX8FcfwDTOI0nYykU= 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/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= 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 h1:N03RwthgTR/l/eQvz3UjfYnvVVj1G2sZqzFGfoD4HE4=
modernc.org/tcl v1.5.5/go.mod h1:ADkaTUuwukkrlhqwERyq0SM8OvyXo7+TjFz7yAF56EI= modernc.org/tcl v1.5.5/go.mod h1:ADkaTUuwukkrlhqwERyq0SM8OvyXo7+TjFz7yAF56EI=
modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE=
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= 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 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc=
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js=

15
main.go
View File

@@ -8,8 +8,9 @@ import (
// 注:以下插件均可通过前面加 // 注释,注释后停用并不加载插件 // 注:以下插件均可通过前面加 // 注释,注释后停用并不加载插件
// 下列插件可与 wdvxdr1123/ZeroBot v1.1.2 以上配合单独使用 // 下列插件可与 wdvxdr1123/ZeroBot v1.1.2 以上配合单独使用
// 词库类 // 词库类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库 _ "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_github" // 搜索GitHub仓库
@@ -18,11 +19,11 @@ import (
// 娱乐类 // 娱乐类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
// b站相关 // b站相关
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili" // 查询b站用户信息 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili" // 查询b站用户信息
@@ -45,9 +46,9 @@ import (
var ( var (
contents = []string{ contents = []string{
"* OneBot + ZeroBot + Golang ", "* OneBot + ZeroBot + Golang",
"* Version 1.1.0 - 2021-08-06 23:36:29 +0800 CST", "* Version 1.1.5 - 2021-09-09 20:52:33 +0800 CST",
"* Copyright © 2020 - 2021 Kanri, DawnNights, Fumiama, Suika", "* Copyright © 2020 - 2021 Kanri, DawnNights, Fumiama, Suika",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin", "* Project: https://github.com/FloatTech/ZeroBot-Plugin",
} }
banner = strings.Join(contents, "\n") banner = strings.Join(contents, "\n")
@@ -86,7 +87,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) { Handle(func(ctx *zero.Ctx) {
ctx.Send(banner) ctx.Send(banner)
}) })

View File

@@ -11,6 +11,8 @@ import (
"github.com/FloatTech/AnimeAPI/picture" "github.com/FloatTech/AnimeAPI/picture"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
) )
const ( const (
@@ -31,7 +33,16 @@ var (
func init() { // 插件主体 func init() { // 插件主体
// 初始化 classify // 初始化 classify
classify.Init(datapath) 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) { Handle(func(ctx *zero.Ctx) {
url := ctx.State["regex_matched"].([]string)[1] url := ctx.State["regex_matched"].([]string)[1]
if !strings.HasPrefix(url, "http") { 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) { Handle(func(ctx *zero.Ctx) {
if classify.CanVisit(5) { if classify.CanVisit(5) {
go func() { go func() {
@@ -54,7 +65,7 @@ func init() { // 插件主体
} }
}) })
// 直接随机图片无r18保护后果自负。如果出r18图可尽快通过发送"太涩了"撤回 // 直接随机图片无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) { Handle(func(ctx *zero.Ctx) {
if block { if block {
ctx.Send("请稍后再试哦") 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) { Handle(func(ctx *zero.Ctx) {
go cancel(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) { Handle(func(ctx *zero.Ctx) {
ctx.Send("少女祈祷中...") ctx.Send("少女祈祷中...")
for _, url := range ctx.State["image_url"].([]string) { for _, url := range ctx.State["image_url"].([]string) {
@@ -86,7 +97,7 @@ func init() { // 插件主体
}(url) }(url)
} }
}) })
zero.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).SetPriority(20). engine.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).SetPriority(20).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
dhash := ctx.State["regex_matched"].([]string)[1] dhash := ctx.State["regex_matched"].([]string)[1]
if len(dhash) == 5*3 { if len(dhash) == 5*3 {

View File

@@ -9,12 +9,19 @@ import (
"github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem" "github.com/shirou/gopsutil/mem"
"github.com/FloatTech/ZeroBot-Plugin/control"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
) )
func init() { // 插件主体 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) { Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text( ctx.SendChain(message.Text(
"* CPU占用率: ", cpuPercent(), "%\n", "* CPU占用率: ", cpuPercent(), "%\n",

View File

@@ -8,6 +8,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
) )
const ( const (
@@ -15,8 +17,14 @@ const (
) )
func init() { // 插件主体 func init() { // 插件主体
rand.Seed(time.Now().UnixMicro()) // TODO: 1.17 特性暂不增加
zero.OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetPriority(10). // 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) { Handle(func(ctx *zero.Ctx) {
miku := rand.Intn(100000) + 1 miku := rand.Intn(100000) + 1
ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku))) ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku)))

View File

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

View File

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

View File

@@ -8,11 +8,22 @@ import (
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
) )
var engine *zero.Engine
// 查成分的 // 查成分的
func init() { 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) { Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1] keyword := ctx.State["regex_matched"].([]string)[1]
rest, err := uid(keyword) rest, err := uid(keyword)

View File

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

View File

@@ -7,31 +7,43 @@ import (
"time" "time"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data" "github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
) )
var engine *zero.Engine
func init() { 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) { Handle(func(ctx *zero.Ctx) {
rand.Seed(time.Now().UnixNano()) 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) { Handle(func(ctx *zero.Ctx) {
// 第一行是发病 // 第一行是发病
ctx.Send((*data.Array)[0]) ctx.Send((*data.Array)[0])
}) })
// 增加小作文 // 增加小作文
zero.OnRegex(`^教你一篇小作文(.*)$`, zero.AdminPermission). engine.OnRegex(`^教你一篇小作文(.*)$`, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
err := data.AddText(ctx.State["regex_matched"].([]string)[1]) err := data.AddText(ctx.State["regex_matched"].([]string)[1])
if err != nil { if err != nil {
ctx.Send(fmt.Sprintf("ERROR: %v", err)) ctx.Send(fmt.Sprintf("ERROR: %v", err))
} else {
ctx.Send("记住啦!")
} }
}) })
} }

View File

@@ -2,10 +2,13 @@
package data package data
import ( import (
"crypto/md5"
"io" "io"
"net/http" "net/http"
"os" "os"
"sync"
"time" "time"
"unsafe"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@@ -20,6 +23,10 @@ var (
compo Composition compo Composition
// Array 小作文数组指针 // Array 小作文数组指针
Array = &compo.Array Array = &compo.Array
// m 小作文保存锁
m sync.Mutex
// md5s 验证重复
md5s [][16]byte
) )
func init() { func init() {
@@ -31,7 +38,12 @@ func init() {
} }
err1 := LoadText() err1 := LoadText()
if err1 == nil { 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 {
md5s[i] = md5.Sum(str2bytes(t))
}
} else { } else {
log.Printf("[Diana]读取小作文错误:%v", err1) log.Printf("[Diana]读取小作文错误:%v", err1)
} }
@@ -65,7 +77,7 @@ func LoadText() error {
log.Printf("[Diana]从镜像下载小作文%d字节...", resp.ContentLength) log.Printf("[Diana]从镜像下载小作文%d字节...", resp.ContentLength)
data, err := io.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err == nil && len(data) > 0 { if err == nil && len(data) > 0 {
f.Write(data) _, _ = f.Write(data)
return compo.Unmarshal(data) return compo.Unmarshal(data)
} }
return err return err
@@ -79,21 +91,46 @@ func LoadText() error {
// AddText 添加小作文 // AddText 添加小作文
func AddText(txt string) error { func AddText(txt string) error {
if txt != "" { sum := md5.Sum(str2bytes(txt))
if txt != "" && !isin(sum) {
m.Lock()
defer m.Unlock()
compo.Array = append(compo.Array, txt) compo.Array = append(compo.Array, txt)
data, err := compo.Marshal() md5s = append(md5s, sum)
if err == nil { return savecompo()
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
} }
return nil 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
}
// 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))
}

View File

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

View File

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

View File

@@ -12,11 +12,18 @@ import (
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
) )
func init() { // 插件主体 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) { Handle(func(ctx *zero.Ctx) {
// 发送请求 // 发送请求
header := http.Header{ header := http.Header{

View File

@@ -1,101 +1,126 @@
package hs // Package hs 炉石
package hs
import (
"fmt" import (
"os" "fmt"
"strconv" "os"
"strings" "strconv"
"strings"
"github.com/imroc/req" "time"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot" "github.com/imroc/req"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/tidwall/gjson"
) zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
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`, "github.com/FloatTech/ZeroBot-Plugin/control"
"referer": `https://hs.fbigame.com`, )
}
const cachedir = "data/hs/"
func init() {
zero.OnRegex(`^搜卡(.+)$`). var header = req.Header{
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) { "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`,
List := ctx.State["regex_matched"].([]string)[1] "referer": `https://hs.fbigame.com`,
g := sh(List) }
im, _ := req.Get(`https://res.fbigame.com/hs/v13/`+
gjson.Get(g, `list.0.CardID`).String()+ func init() {
`.png?auth_key=`+ os.RemoveAll(cachedir)
gjson.Get(g, `list.0.auth_key`).String(), header) err := os.MkdirAll(cachedir, 0755)
im.ToFile("data/image/1.png") if err != nil {
file, _ := os.Open("data/image/1.png") panic(err)
sg, _ := req.Post("https://pic.sogou.com/pic/upload_pic.jsp", req.FileUpload{ }
File: file,
FieldName: "image", // FieldName 是表单字段名 engine := control.Register("hs", &control.Options{
FileName: "avatar.png", // Filename 是要上传的文件的名称我们使用它来猜测mimetype并将其上传到服务器上 DisableOnDefault: false,
}) Help: "炉石\n" +
var tx string "- 搜卡[xxxx]\n" +
t := int(gjson.Get(g, `list.#`).Int()) "- [卡组代码xxx]\n" +
if t == 0 { "- 更多搜卡指令参数https://hs.fbigame.com/misc/searchhelp",
ctx.SendChain(message.Text("查询为空!")) })
return engine.OnRegex(`^搜卡(.+)$`).
} SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
for i := 0; i < t && i < 10; i++ { List := ctx.State["regex_matched"].([]string)[1]
tx += strconv.Itoa(i+1) + ". 法力:" + g := sh(List)
gjson.Get(g, `list.`+strconv.Itoa(i)+`.COST`).String() + im, _ := req.Get(`https://res.fbigame.com/hs/v13/`+
" " + gjson.Get(g, `list.0.CardID`).String()+
gjson.Get(g, `list.`+strconv.Itoa(i)+`.CARDNAME`).String() + `.png?auth_key=`+
"\n" gjson.Get(g, `list.0.auth_key`).String(), header)
} cachefile := cachedir + strconv.Itoa(int(time.Now().Unix()))
ctx.SendChain( err := im.ToFile(cachefile)
message.Image(sg.String()), if err == nil {
message.Text(tx), file, err := os.Open(cachefile)
) if err == nil {
}) defer file.Close()
//卡组 sg, _ := req.Post("https://pic.sogou.com/pic/upload_pic.jsp", req.FileUpload{
zero.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`). File: file,
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) { FieldName: "image", // FieldName 是表单字段名
fmt.Print("成功") FileName: "avatar.png", // Filename 是要上传的文件的名称我们使用它来猜测mimetype并将其上传到服务器上
List := ctx.State["regex_matched"].([]string)[1] })
ctx.SendChain( var tx string
message.Image(kz(List)), t := int(gjson.Get(g, `list.#`).Int())
) if t == 0 {
}) ctx.Send("查询为空!")
} return
}
func sh(s string) string { for i := 0; i < t && i < 10; i++ {
var hs = `https://hs.fbigame.com/ajax.php` tx += strconv.Itoa(i+1) + ". 法力:" +
h, _ := req.Get("https://hs.fbigame.com", header) gjson.Get(g, `list.`+strconv.Itoa(i)+`.COST`).String() +
var param = req.Param{ " " +
"mod": `get_cards_list`, gjson.Get(g, `list.`+strconv.Itoa(i)+`.CARDNAME`).String() +
"mode": `-1`, "\n"
"extend": `-1`, }
"mutil_extend": ``, ctx.SendChain(
"hero": `-1`, message.Image(sg.String()),
"rarity": `-1`, message.Text(tx),
"cost": `-1`, )
"mutil_cost": ``, }
"techlevel": `-1`, }
"type": `-1`, })
"collectible": `-1`, // 卡组
"isbacon": `-1`, engine.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
"page": `1`, SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
"search_type": `1`, fmt.Print("成功")
"deckmode": "normal", List := ctx.State["regex_matched"].([]string)[1]
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0], ctx.SendChain(
} message.Image(kz(List)),
r, _ := req.Get(hs, header, param, req.Param{"search": s}) )
return r.String() })
} }
func kz(s string) string { func sh(s string) string {
h, _ := req.Get("https://hs.fbigame.com") var hs = `https://hs.fbigame.com/ajax.php`
param := req.Param{ h, _ := req.Get("https://hs.fbigame.com", header)
"mod": `general_deck_image`, var param = req.Param{
"deck_code": s, "mod": `get_cards_list`,
"deck_text": ``, "mode": `-1`,
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0], "extend": `-1`,
} "mutil_extend": ``,
r, _ := req.Get(`https://hs.fbigame.com/ajax.php`, param, h.Request().Header) "hero": `-1`,
im := gjson.Get(r.String(), "img").String() "rarity": `-1`,
return `base64://` + im "cost": `-1`,
} "mutil_cost": ``,
"techlevel": `-1`,
"type": `-1`,
"collectible": `-1`,
"isbacon": `-1`,
"page": `1`,
"search_type": `1`,
"deckmode": "normal",
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0],
}
r, _ := req.Get(hs, header, param, req.Param{"search": s})
return r.String()
}
func kz(s string) string {
h, _ := req.Get("https://hs.fbigame.com")
param := req.Param{
"mod": `general_deck_image`,
"deck_code": s,
"deck_text": ``,
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0],
}
r, _ := req.Get(`https://hs.fbigame.com/ajax.php`, param, h.Request().Header)
im := gjson.Get(r.String(), "img").String()
return `base64://` + im
}

View File

@@ -10,6 +10,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
) )
type resultjson struct { type resultjson struct {
@@ -59,7 +61,11 @@ type resultjson struct {
} }
func init() { 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) { Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1] keyword := ctx.State["regex_matched"].([]string)[1]
soutujson := soutuapi(keyword) soutujson := soutuapi(keyword)

View File

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

View File

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

View File

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

View File

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

View File

@@ -15,12 +15,21 @@ import (
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
) )
var limit = rate.NewManager(time.Minute*3, 5) var limit = rate.NewManager(time.Minute*3, 5)
func init() { 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) { Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() { if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.Send("请稍后重试0x0...") ctx.Send("请稍后重试0x0...")

View File

@@ -8,6 +8,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/control"
) )
const ( const (
@@ -15,10 +17,20 @@ const (
) )
func init() { // 插件主体 func init() { // 插件主体
rand.Seed(time.Now().UnixMicro()) // TODO: 1.17 特性暂不增加
zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10). // rand.Seed(time.Now().UnixMicro())
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) { Handle(func(ctx *zero.Ctx) {
miku := rand.Intn(100) + 1 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,60 @@
// TODO: 待优化
package qingyunke
/*
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,151 @@
/*
基于青云客接口的聊天对话功能
*/
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,20 @@
// TODO: 移动到 manager 搭配自动验证使用
package qingyunke
/*
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~")
}
})
}
*/

View File

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

View File

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

View File

@@ -4,7 +4,6 @@ package setutime
import ( import (
"fmt" "fmt"
"io" "io"
"log"
"net/http" "net/http"
"os" "os"
"strconv" "strconv"
@@ -12,17 +11,20 @@ import (
"sync" "sync"
"time" "time"
"github.com/FloatTech/AnimeAPI/pixiv"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/AnimeAPI/pixiv" "github.com/FloatTech/ZeroBot-Plugin/control"
. "github.com/FloatTech/ZeroBot-Plugin/data"
) )
// Pools 图片缓冲池 // Pools 图片缓冲池
type imgpool struct { type imgpool struct {
Lock sync.Mutex Lock sync.Mutex
DB *sqlite DB *Sqlite
Path string Path string
Group int64 Group int64
List []string List []string
@@ -38,7 +40,7 @@ const (
// NewPoolsCache 返回一个缓冲池对象 // NewPoolsCache 返回一个缓冲池对象
func newPools() *imgpool { func newPools() *imgpool {
cache := &imgpool{ cache := &imgpool{
DB: &sqlite{DBPath: "data/SetuTime/SetuTime.db"}, DB: &Sqlite{DBPath: "data/SetuTime/SetuTime.db"},
Path: "data/SetuTime/cache/", Path: "data/SetuTime/cache/",
Group: 0, Group: 0,
List: []string{"涩图", "二次元", "风景", "车万"}, // 可以自己加类别,得自己加图片进数据库 List: []string{"涩图", "二次元", "风景", "车万"}, // 可以自己加类别,得自己加图片进数据库
@@ -58,10 +60,13 @@ func newPools() *imgpool {
if err == nil { if err == nil {
defer resp.Body.Close() defer resp.Body.Close()
if resp.ContentLength > 0 { if resp.ContentLength > 0 {
log.Printf("[Setu]从镜像下载数据库%d字节...", resp.ContentLength) logrus.Printf("[Setu]从镜像下载数据库%d字节...", resp.ContentLength)
data, err := io.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err == nil && len(data) > 0 { if err == nil && len(data) > 0 {
f.Write(data) _, err = f.Write(data)
if err != nil {
logrus.Errorf("[Setu]写入数据库失败: %v", err)
}
} }
} }
} }
@@ -69,7 +74,7 @@ func newPools() *imgpool {
} }
} }
for i := range cache.List { 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) panic(err)
} }
} }
@@ -82,7 +87,15 @@ var (
) )
func init() { // 插件主体 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) { Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() { if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0...")) ctx.SendChain(message.Text("请稍后重试0x0..."))
@@ -95,7 +108,7 @@ func init() { // 插件主体
for i := 0; i < times; i++ { for i := 0; i < times; i++ {
illust := &pixiv.Illust{} 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)) ctx.SendChain(message.Text("ERROR: ", err))
continue continue
} }
@@ -126,7 +139,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) { Handle(func(ctx *zero.Ctx) {
var ( var (
imgtype = ctx.State["regex_matched"].([]string)[1] imgtype = ctx.State["regex_matched"].([]string)[1]
@@ -150,21 +163,21 @@ func init() { // 插件主体
return return
} }
// 添加插画到对应的数据库table // 添加插画到对应的数据库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)) ctx.SendChain(message.Text("ERROR: ", err))
return return
} }
ctx.Send("添加成功") 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) { Handle(func(ctx *zero.Ctx) {
var ( var (
imgtype = ctx.State["regex_matched"].([]string)[1] imgtype = ctx.State["regex_matched"].([]string)[1]
id, _ = strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64) 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)) ctx.Send(fmt.Sprintf("ERROR: %v", err))
return return
} }
@@ -172,11 +185,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) { Handle(func(ctx *zero.Ctx) {
state := []string{"[SetuTime]"} state := []string{"[SetuTime]"}
for i := range pool.List { for i := range pool.List {
num, err := pool.DB.count(pool.List[i]) num, err := pool.DB.Count(pool.List[i])
if err != nil { if err != nil {
num = 0 num = 0
} }

View File

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