mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 23:30:20 +00:00
Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
843c77e9ba | ||
|
|
6cd117ded0 | ||
|
|
6c1da554f0 | ||
|
|
bbc96a83d7 | ||
|
|
0bffc38be4 | ||
|
|
4bce4b2dd1 | ||
|
|
95fa96e883 | ||
|
|
99a5960794 | ||
|
|
aab28717c6 | ||
|
|
763b0a0a47 | ||
|
|
3b1bef9c3d | ||
|
|
c83c4079cf | ||
|
|
ae46b57ea1 | ||
|
|
0529dcf0ef | ||
|
|
3ae333e047 | ||
|
|
bc7b84115a | ||
|
|
f3ddff720f | ||
|
|
8233950bad | ||
|
|
2f902837f6 | ||
|
|
6bd80b8ebd | ||
|
|
733529cf78 | ||
|
|
b36cd30987 | ||
|
|
5a9a566694 | ||
|
|
9665f6cb3f | ||
|
|
f790165358 | ||
|
|
7e2912d5d1 | ||
|
|
c8e7e19934 | ||
|
|
d7f3e3ed79 | ||
|
|
6dfa1efa5d | ||
|
|
3d5f72a64c | ||
|
|
a32658ea61 | ||
|
|
d142234af4 | ||
|
|
b60a6c7d0c | ||
|
|
3077f3c053 | ||
|
|
f762d5ea00 | ||
|
|
060e167dc7 | ||
|
|
47aa6213bf | ||
|
|
e1ecea5f79 | ||
|
|
b1d1e1e7b9 | ||
|
|
fe00ef8cfa | ||
|
|
3a3c9e5018 | ||
|
|
bf6714f231 | ||
|
|
b4e0e6fa0f | ||
|
|
332bbfc0bc | ||
|
|
ee666601d6 | ||
|
|
c7d4c63725 | ||
|
|
39141d54a4 | ||
|
|
35f9bb3758 | ||
|
|
0648c9785c | ||
|
|
b5666ef48e | ||
|
|
f3184bc08d | ||
|
|
4804cfa5a2 | ||
|
|
820daa7b1e | ||
|
|
529345da9c | ||
|
|
c251a7bf53 | ||
|
|
06d7804fe7 | ||
|
|
d31dc14271 | ||
|
|
adceba0d86 | ||
|
|
fb8ba1d66b | ||
|
|
e61ecd683c | ||
|
|
77bc391f6e | ||
|
|
ebeac37f21 | ||
|
|
ac4d8429d4 | ||
|
|
ceb9455250 | ||
|
|
736f645e9d | ||
|
|
5c8aa92792 | ||
|
|
7ac9d34cc4 | ||
|
|
5b8fd14d09 | ||
|
|
4776da4584 | ||
|
|
c10cb49c30 | ||
|
|
9f0d93bca2 | ||
|
|
59c6fe593a | ||
|
|
63f3b3861e | ||
|
|
433b0ae4c1 | ||
|
|
452b39075b | ||
|
|
1001a52a53 | ||
|
|
10c79456a5 | ||
|
|
d0b55bb9dd | ||
|
|
bf4aa59467 | ||
|
|
a402d91367 | ||
|
|
928719f5a1 | ||
|
|
33b00f369f | ||
|
|
6994b27656 | ||
|
|
d46a474364 | ||
|
|
0a5178e0a4 | ||
|
|
34e6cde781 | ||
|
|
9ea8e46a56 | ||
|
|
0e47191b65 | ||
|
|
c875d2beea | ||
|
|
997393bd27 | ||
|
|
f2fdad9f5a | ||
|
|
2552f7dbf4 | ||
|
|
0568a5da10 | ||
|
|
98a92afb95 | ||
|
|
c7d2a06147 | ||
|
|
ab7e86218d | ||
|
|
3005ee5b02 | ||
|
|
60c29b2d12 | ||
|
|
bf5feae717 | ||
|
|
f0fd1eaf22 | ||
|
|
1d2960a51c | ||
|
|
a094d1c2ba | ||
|
|
72fa62622f | ||
|
|
cd6534097e | ||
|
|
c3ad22ab27 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.pb linguist-language=go
|
||||
52
.github/workflows/latest.yml
vendored
52
.github/workflows/latest.yml
vendored
@@ -1,52 +0,0 @@
|
||||
name: 最新版
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
my-job:
|
||||
name: Build ZeroBot-Plugin on Push 🚀
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache Go
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# A list of files, directories, and wildcard patterns to cache and restore
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- name: Tidy Go modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Build linux-x64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
|
||||
- name: Build linux-x86
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
|
||||
- name: Build windows-x64
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
|
||||
- name: Build windows-x86
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
|
||||
- name: Build arm64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
|
||||
- name: Build armv6
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
|
||||
|
||||
- name: Upload Build Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: zerobot-plugin-all.zip
|
||||
path: ./artifacts/zerobot-plugin-*
|
||||
55
.github/workflows/prerelease.yml
vendored
Normal file
55
.github/workflows/prerelease.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: 测试版
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- p*
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
my-job:
|
||||
name: Build ZeroBot-Plugin on Push Tag 🚀
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache Go
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# A list of files, directories, and wildcard patterns to cache and restore
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- name: Tidy Go modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Build linux-x64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
|
||||
- name: Build linux-x86
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
|
||||
- name: Build windows-x64
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
|
||||
- name: Build windows-x86
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
|
||||
- name: Build arm64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
|
||||
- name: Build armv6
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
|
||||
|
||||
- name: Upload binaries to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: artifacts/zerobot-plugin-*
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
15
.github/workflows/pull.yml
vendored
15
.github/workflows/pull.yml
vendored
@@ -1,13 +1,20 @@
|
||||
name: PullLint
|
||||
on: [pull_request]
|
||||
on: [ pull_request ]
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
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
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
uses: golangci/golangci-lint-action@master
|
||||
with:
|
||||
# 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
|
||||
@@ -22,7 +29,7 @@ jobs:
|
||||
# only-new-issues: true
|
||||
|
||||
# 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.
|
||||
# skip-pkg-cache: true
|
||||
|
||||
17
.github/workflows/push.yml
vendored
17
.github/workflows/push.yml
vendored
@@ -1,15 +1,24 @@
|
||||
name: PushLint
|
||||
on: [push]
|
||||
on: [ push ]
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint_golangci-lint
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- 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
|
||||
uses: golangci/golangci-lint-action@v2.5.2
|
||||
uses: golangci/golangci-lint-action@master
|
||||
with:
|
||||
version: latest
|
||||
args: --issues-exit-code=0
|
||||
skip-go-installation: true
|
||||
- name: Commit back
|
||||
continue-on-error: true
|
||||
run: |
|
||||
|
||||
74
.github/workflows/release.yml
vendored
74
.github/workflows/release.yml
vendored
@@ -13,43 +13,43 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache Go
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# A list of files, directories, and wildcard patterns to cache and restore
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Tidy Go modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Build linux-x64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
|
||||
- name: Build linux-x86
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
|
||||
- name: Build windows-x64
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
|
||||
- name: Build windows-x86
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
|
||||
- name: Build arm64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
|
||||
- name: Build armv6
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
|
||||
- name: Cache Go
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# A list of files, directories, and wildcard patterns to cache and restore
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- name: Upload binaries to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: artifacts/zerobot-plugin-*
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
- name: Tidy Go modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Build linux-x64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
|
||||
- name: Build linux-x86
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
|
||||
- name: Build windows-x64
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
|
||||
- name: Build windows-x86
|
||||
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
|
||||
- name: Build arm64
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
|
||||
- name: Build armv6
|
||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
|
||||
|
||||
- name: Upload binaries to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: artifacts/zerobot-plugin-*
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
|
||||
16
.gitignore
vendored
16
.gitignore
vendored
@@ -1,6 +1,10 @@
|
||||
data/SetuTime/cache
|
||||
data/SetuTime/search
|
||||
data/manager
|
||||
.idea/
|
||||
.DS_Store
|
||||
.vscode
|
||||
data/SetuTime/cache
|
||||
data/SetuTime/search
|
||||
data/manager
|
||||
data/acgimage
|
||||
data/hs
|
||||
.idea/
|
||||
.DS_Store
|
||||
.vscode
|
||||
go-zero*
|
||||
nohup.out
|
||||
|
||||
@@ -10,6 +10,10 @@ linters-settings:
|
||||
disabled-checks:
|
||||
- exitAfterDefer
|
||||
|
||||
gofumpt:
|
||||
# Select the Go version to target. The default is `1.15`.
|
||||
lang-version: "1.17"
|
||||
|
||||
forbidigo:
|
||||
# Forbid the following identifiers
|
||||
forbid:
|
||||
|
||||
95
README.md
95
README.md
@@ -12,14 +12,14 @@
|
||||
|
||||
[](https://goreportcard.com/report/github.com/github.com/Yiwen-Chan/ZeroBot-Plugin)
|
||||
[](https://github.com/howmanybots/onebot)
|
||||
[](https://github.com/wdvxdr1123/ZeroBot)
|
||||
[](https://github.com/wdvxdr1123/ZeroBot)
|
||||
[](https://raw.githubusercontent.com/FloatTech/ZeroBot-Plugin/master/LICENSE)
|
||||
[](https://jq.qq.com/?_wv=1027&k=QMb7x1mM)
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
## 功能
|
||||
|
||||
- **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat"`
|
||||
- [x] [BOT名字]
|
||||
- [x] [戳一戳BOT]
|
||||
@@ -45,62 +45,83 @@
|
||||
- [x] 退出群聊[群号]
|
||||
- [x] *入群欢迎
|
||||
- [x] *退群通知
|
||||
- [x] 在[月份]月[日期]日的[小时]点[分钟]分时(用[url])提醒大家[消息]
|
||||
- [x] 在[月份]月[每周or周几]的[小时]点[分钟]分时(用[url])提醒大家[消息]
|
||||
- [x] 取消在[月份]月[日期]日的[小时]点[分钟]分的提醒
|
||||
- [x] 取消在[月份]月[每周or周几]的[小时]点[分钟]分的提醒
|
||||
- [x] 设置欢迎语[欢迎~]
|
||||
- [x] 在MM月dd日的hh点mm分时(用http://url)提醒大家xxx
|
||||
- [x] 在MM月[每周|周几]的hh点mm分时(用http://url)提醒大家xxx
|
||||
- [x] 取消在MM月dd日的hh点mm分的提醒
|
||||
- [x] 取消在MM月[每周|周几]的hh点mm分的提醒
|
||||
- [x] 列出所有提醒
|
||||
- [x] 翻牌
|
||||
- [x] [开启|关闭]入群验证
|
||||
- [ ] 同意入群请求
|
||||
- [ ] 同意好友请求
|
||||
- [ ] 撤回[@xxx] [xxx]
|
||||
- [ ] 警告[@xxx]
|
||||
- [x] run[xxx]
|
||||
- **GitHub仓库搜索** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_github"`
|
||||
- [x] >github [xxx]
|
||||
- [x] >github -p [xxx]
|
||||
- [x] > github [xxx]
|
||||
- [x] > github -p [xxx]
|
||||
- **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode"`
|
||||
- [x] >runcode help
|
||||
- [x] >runcode [on/off]
|
||||
- [x] >runcode [language] [code block]
|
||||
- [x] > runcode help
|
||||
- [x] > runcode [on/off]
|
||||
- [x] > runcode [language] [code block]
|
||||
- **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music"`
|
||||
- [x] 点歌[xxx]
|
||||
- [x] 网易点歌[xxx]
|
||||
- [x] 酷我点歌[xxx]
|
||||
- [x] 酷狗点歌[xxx]
|
||||
- **shindan** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan"`
|
||||
- [x] 今天是什么少女[@xxx]
|
||||
- [x] 异世界转生[@xxx]
|
||||
- [x] 卖萌[@xxx]
|
||||
- [x] 今天是什么少女[@xxx]
|
||||
- [x] 异世界转生[@xxx]
|
||||
- [x] 卖萌[@xxx]
|
||||
- [x] 抽老婆[@xxx]
|
||||
- **AIWife** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_aiwife"`
|
||||
- [x] waifu|随机waifu(从[100000个AI生成的waifu](https://www.thiswaifudoesnotexist.net/)中随机一位)
|
||||
- **gif** `import _ "github.com/tdf1939/ZeroBot-Plugin-Gif/plugin_gif"`
|
||||
- [x] 爬[@xxx]
|
||||
- [x] 摸[@xxx]
|
||||
- [x] 搓[@xxx]
|
||||
- 注:`main.go`中并未import该插件。详情见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif
|
||||
- **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"`
|
||||
- [x] 来份[涩图/二次元/风景/车万]
|
||||
- [x] 添加[涩图/二次元/风景/车万][P站图片ID]
|
||||
- [x] 删除[涩图/二次元/风景/车万][P站图片ID]
|
||||
- [x] >setu status
|
||||
- [x] > setu status
|
||||
- **lolicon** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon"`
|
||||
- [x] 来份萝莉
|
||||
- **搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"`
|
||||
- [x] 以图搜图|搜索图片|以图识图[图片]
|
||||
- [x] 搜图[P站图片ID]
|
||||
- **随机图片与AI点评** `github.com/FloatTech/ZeroBot-ACGImage`
|
||||
- **随机图片与AI点评** `github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage`
|
||||
- [x] 随机图片(评级大于6的图将私发)
|
||||
- [x] 直接随机(无r18检测,务必小心,仅管理可用)
|
||||
- [x] 设置随机图片网址[url]
|
||||
- [x] 太涩了(撤回最近发的图)
|
||||
- [x] 评价图片(发送一张图片让bot评分)
|
||||
- **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji`
|
||||
- 本插件要求`Go`版本大于等于`1.17`
|
||||
- [x] @BOT 求签|运势|占卜
|
||||
- **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"`
|
||||
- [x] >bili info [名字]
|
||||
- [x] > bili info [名字]
|
||||
- **嘉然** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana"`
|
||||
- [x] @BOT 小作文
|
||||
- [x] @BOT 发大病
|
||||
- [x] @BOT 教你一篇小作文[作文]
|
||||
- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_AIfalse"`
|
||||
- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"`
|
||||
- [x] 查询计算机当前活跃度 [身体检查]
|
||||
- [ ] 简易语音
|
||||
- [ ] 爬图合成 [@xxx]
|
||||
- **minecraft** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft"`
|
||||
- [x] 具体指令看代码
|
||||
- 注:此功能实现依赖[MCSManager](https://github.com/Suwings/MCSManager)项目对服务器的管理api,mc服务器如果没有在该管理平台部署此功能无效
|
||||
- **炉石** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs"`
|
||||
- [x] 搜卡[xxxx]
|
||||
- [x] [卡组代码xxx]
|
||||
- 注:更多搜卡指令参数:https://hs.fbigame.com/misc/searchhelp
|
||||
- **青云客** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke"`
|
||||
- [x] @Bot 任意文本(任意一句话回复)
|
||||
- [x] 关闭自动回复
|
||||
- [x] 启动自动回复
|
||||
- **TODO...**
|
||||
|
||||
## 使用方法
|
||||
@@ -114,30 +135,36 @@
|
||||
| [yyuueexxiinngg/cqhttp-mirai](https://github.com/yyuueexxiinngg/cqhttp-mirai) | [Mirai](https://github.com/mamoe/mirai) | yyuueexxiinngg | |
|
||||
| [takayama-lily/onebot](https://github.com/takayama-lily/onebot) | [OICQ](https://github.com/takayama-lily/oicq) | takayama | |
|
||||
|
||||
### 使用稳定版
|
||||
可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统的稳定版,默认开启全部插件。
|
||||
|
||||
### 使用稳定版/测试版 (推荐)
|
||||
|
||||
可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。
|
||||
|
||||
### 本地运行
|
||||
1. 下载安装 [Go](https://studygolang.com/dl/golang/go1.16.2.windows-amd64.msi) 环境
|
||||
|
||||
1. 下载安装 [Go](https://studygolang.com/dl) 环境
|
||||
2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压
|
||||
3. 编辑 main.go 文件,内容按需修改
|
||||
4. 双击 build.bat 文件 或 直接双击 run.bat 文件
|
||||
5. 运行 OneBot 框架,并同时运行本插件
|
||||
|
||||
### 编译运行
|
||||
> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。
|
||||
|
||||
#### 利用 Actions 在线编译 (推荐)
|
||||
#### 利用 Actions 在线编译
|
||||
|
||||
1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库
|
||||
2. 点击仓库上方的 Actions 按钮,确认使用 Actions
|
||||
3. 编辑 main.go 文件,内容按需修改,提交修改后 Actions 自动执行
|
||||
4. 点击 Actions 按钮,等待编译完成,在 Actions 里下载编译好的文件
|
||||
5. 运行 OneBot 框架,并同时运行本插件
|
||||
6. 啾咪~
|
||||
3. 编辑 main.go 文件,内容按需修改
|
||||
4. 前往 Release 页面发布一个 Release,`tag`形如`vx.y.z`,以触发稳定版编译流程
|
||||
5. 点击 Actions 按钮,等待编译完成,回到 Release 页面下载编译好的文件
|
||||
6. 运行 OneBot 框架,并同时运行本插件
|
||||
7. 啾咪~
|
||||
|
||||
#### 本地编译/交叉编译
|
||||
1. 下载安装 [Go](https://studygolang.com/dl/golang/go1.16.2.windows-amd64.msi) 环境
|
||||
|
||||
1. 下载安装 [Go](https://studygolang.com/dl) 环境
|
||||
2. clone 并进入本项目,下载所需包
|
||||
|
||||
```bash
|
||||
git clone --depth=1 https://github.com/FloatTech/ZeroBot-Plugin.git
|
||||
cd ZeroBot-Plugin
|
||||
@@ -146,22 +173,26 @@ go env -w GOPROXY=https://goproxy.cn,direct
|
||||
go env -w GO111MODULE=auto
|
||||
go mod tidy
|
||||
```
|
||||
|
||||
3. 编辑 main.go 文件,内容按需修改
|
||||
4. 按照平台输入命令编译,下面举了两个不太常见的例子
|
||||
|
||||
```bash
|
||||
# 本机平台
|
||||
go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot
|
||||
go build -ldflags "-s -w" -o zerobot
|
||||
# armv6 Linux 平台 如树莓派 zero W
|
||||
GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot
|
||||
GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot
|
||||
# mips Linux 平台 如 路由器 wndr4300
|
||||
GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot
|
||||
GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot
|
||||
```
|
||||
|
||||
5. 运行 OneBot 框架,并同时运行本插件
|
||||
|
||||
## 特别感谢
|
||||
|
||||
- [ZeroBot](https://github.com/wdvxdr1123/ZeroBot)
|
||||
- [ATRI](https://github.com/Kyomotoi/ATRI)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2FYiwen-Chan%2FZeroBot-Plugin?ref=badge_large)
|
||||
|
||||
19
go.mod
19
go.mod
@@ -3,20 +3,17 @@ module github.com/FloatTech/ZeroBot-Plugin
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v1.1.2
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2
|
||||
github.com/FloatTech/AnimeAPI v1.1.9
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/imroc/req v0.3.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/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
||||
github.com/tidwall/gjson v1.8.1
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.7 // indirect
|
||||
github.com/wdvxdr1123/ZeroBot v1.2.2
|
||||
golang.org/x/text v0.3.6 // indirect
|
||||
golang.org/x/tools v0.1.5 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
modernc.org/sqlite v1.12.0
|
||||
github.com/tidwall/gjson v1.9.0
|
||||
github.com/tklauser/go-sysconf v0.3.9 // indirect
|
||||
github.com/wdvxdr1123/ZeroBot v1.2.3
|
||||
modernc.org/sqlite v1.13.0
|
||||
)
|
||||
|
||||
77
go.sum
77
go.sum
@@ -1,11 +1,7 @@
|
||||
github.com/FloatTech/AnimeAPI v1.1.0 h1:X6UMkl6eC8NHHeInt40x0AHb8a3GiQSmE1HigyTG/Qg=
|
||||
github.com/FloatTech/AnimeAPI v1.1.0/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/AnimeAPI v1.1.1 h1:SPyrVlqRVQHfYOm9x8eGBJWlT+3gj1wtFsbH1bCgkXs=
|
||||
github.com/FloatTech/AnimeAPI v1.1.1/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/AnimeAPI v1.1.2 h1:u+aVY1HlRi6jCvOQ9dePNGtCv71ESt79SG1Y4JZNx38=
|
||||
github.com/FloatTech/AnimeAPI v1.1.2/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2 h1:w/JerL8DwdyoxZYB4HRMaHANRV2j+r5XxaQhVB0sjBw=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc=
|
||||
github.com/FloatTech/AnimeAPI v1.1.9 h1:H1hZmgwZPNHdx39K9JvY3awT8TTsCl9kKA1uVMyCjRg=
|
||||
github.com/FloatTech/AnimeAPI v1.1.9/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc=
|
||||
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
|
||||
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
|
||||
github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M=
|
||||
@@ -34,6 +30,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/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
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/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
@@ -59,6 +57,8 @@ github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
|
||||
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
github.com/shirou/gopsutil v3.21.7+incompatible h1:g/wcPHcuCQvHSePVofjQljd2vX4ty0+J6VoMB+NPcdk=
|
||||
github.com/shirou/gopsutil v3.21.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shirou/gopsutil v3.21.8+incompatible h1:sh0foI8tMRlCidUJR+KzqWYWxrkuuPIGiO6Vp+KXdCU=
|
||||
github.com/shirou/gopsutil v3.21.8+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
@@ -74,36 +74,35 @@ github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go
|
||||
github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
|
||||
github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU=
|
||||
github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
|
||||
github.com/tidwall/gjson v1.9.0 h1:+Od7AE26jAaMgVC31cQV/Ope5iKXulNMflrlB7k+F9E=
|
||||
github.com/tidwall/gjson v1.9.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
|
||||
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||
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.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tklauser/go-sysconf v0.3.7 h1:HT7h4+536gjqeq1ZIJPgOl1rg1XFatQGVZWp7Py53eg=
|
||||
github.com/tklauser/go-sysconf v0.3.7/go.mod h1:JZIdXh4RmBvZDBZ41ld2bGxRV3n4daiiqA3skYhAoQ4=
|
||||
github.com/tklauser/numcpus v0.2.3 h1:nQ0QYpiritP6ViFhrKYsiv6VVxOpum2Gks5GhnJbS/8=
|
||||
github.com/tklauser/numcpus v0.2.3/go.mod h1:vpEPS/JC+oZGGQ/My/vJnNsvMDQL6PwOqt8dsCw5j+E=
|
||||
github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
|
||||
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
|
||||
github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
|
||||
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
|
||||
github.com/wdvxdr1123/ZeroBot v1.2.2 h1:BKEy3l80BMrQWpFWaII0AfFMyf9bqrB0TxfWhTdoV58=
|
||||
github.com/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.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -113,32 +112,27 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/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-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 h1:ikCpsnYR+Ew0vu99XlDp55lGgDJdIMx3f4a18jfse/s=
|
||||
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b h1:S7hKs0Flbq0bbc9xgYt4stIEG1zNDFqyrPwAX2Wj/sE=
|
||||
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs=
|
||||
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
@@ -150,15 +144,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.7 h1:Rvxffgx6LHSpGS6IO8bffSYN1wpPsWHEWY9CV95vpro=
|
||||
modernc.org/cc/v3 v3.33.7/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.34.0 h1:dFhZc/HKR3qp92sYQxKRRaDMz+sr1bwcFD+m7LSCrAs=
|
||||
modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
|
||||
modernc.org/ccgo/v3 v3.9.6 h1:rCjLgu6iRxK2bqq8A0CCOnDP+tdA81LfbBUlM1L6ZIY=
|
||||
modernc.org/ccgo/v3 v3.9.6/go.mod h1:KGOi0NhaT6CO19xeSXcpXBl0OkoD6T1U4dPd633G9Sg=
|
||||
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
|
||||
modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI=
|
||||
modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag=
|
||||
modernc.org/ccgo/v3 v3.11.2 h1:gqa8PQ2v7SjrhHCgxUO5dzoAJWSLAveJqZTNkPCN0kc=
|
||||
modernc.org/ccgo/v3 v3.11.2/go.mod h1:6kii3AptTDI+nUrM9RFBoIEUEisSWCbdczD9ZwQH2FE=
|
||||
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
|
||||
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
|
||||
modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/libc v1.9.11 h1:QUxZMs48Ahg2F7SN41aERvMfGLY2HU/ADnB9DC4Yts8=
|
||||
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
|
||||
modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg=
|
||||
modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M=
|
||||
modernc.org/libc v1.11.3 h1:q//spBhqp23lC/if8/o8hlyET57P8mCZqrqftzT2WmY=
|
||||
modernc.org/libc v1.11.3/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU=
|
||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
@@ -166,15 +173,21 @@ modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
|
||||
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/memory v1.0.4 h1:utMBrFcpnQDdNsmM6asmyH/FM9TqLPS7XF7otpJmrwM=
|
||||
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
|
||||
modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14=
|
||||
modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM=
|
||||
modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
|
||||
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/sqlite v1.12.0 h1:AMAOgk4CkblRJc6YLKSYtz3pZ6DW5wjQ1uYH/rN7/Kk=
|
||||
modernc.org/sqlite v1.12.0/go.mod h1:ppqJ4cQ+R09YLzl9haEL9AYgj6wX8FcfwDTOI0nYykU=
|
||||
modernc.org/sqlite v1.13.0 h1:cwhUj0jTBgPjk/demWheV+T6xi6ifTfsGIFKFq0g3Ck=
|
||||
modernc.org/sqlite v1.13.0/go.mod h1:2qO/6jZJrcQaxFUHxOwa6Q6WfiGSsiVj6GXX0Ker+Jg=
|
||||
modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
|
||||
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
|
||||
modernc.org/tcl v1.5.5 h1:N03RwthgTR/l/eQvz3UjfYnvVVj1G2sZqzFGfoD4HE4=
|
||||
modernc.org/tcl v1.5.5/go.mod h1:ADkaTUuwukkrlhqwERyq0SM8OvyXo7+TjFz7yAF56EI=
|
||||
modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE=
|
||||
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
|
||||
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
modernc.org/z v1.0.1 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc=
|
||||
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
||||
modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js=
|
||||
|
||||
10
main.go
10
main.go
@@ -8,8 +8,9 @@ import (
|
||||
// 注:以下插件均可通过前面加 // 注释,注释后停用并不加载插件
|
||||
// 下列插件可与 wdvxdr1123/ZeroBot v1.1.2 以上配合单独使用
|
||||
// 词库类
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke" //青云客
|
||||
|
||||
// 实用类
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_github" // 搜索GitHub仓库
|
||||
@@ -18,8 +19,10 @@ import (
|
||||
|
||||
// 娱乐类
|
||||
_ "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_music" // 点歌
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
|
||||
|
||||
// b站相关
|
||||
@@ -28,6 +31,7 @@ import (
|
||||
|
||||
// 二次元图片
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage" // 随机图片与AI点评
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_aiwife" // 随机老婆
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_image_finder" // 关键字搜图
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon" // lolicon 随机图片
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图
|
||||
@@ -60,7 +64,7 @@ func init() {
|
||||
|
||||
func main() {
|
||||
fmt.Print(
|
||||
"======================[ZeroBot-Plugin]======================",
|
||||
"\n======================[ZeroBot-Plugin]======================",
|
||||
"\n", banner, "\n",
|
||||
"============================================================\n",
|
||||
) // 启动打印
|
||||
|
||||
@@ -14,7 +14,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
lolipxy = "http://sayuri.fumiama.top:62002/dice?class=0&loli=true&r18=true"
|
||||
lolipxy = "https://sayuri.fumiama.top/dice?class=0&loli=true&r18=true"
|
||||
apihead = "https://sayuri.fumiama.top/img?path="
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -30,46 +31,43 @@ var (
|
||||
func init() { // 插件主体
|
||||
// 初始化 classify
|
||||
classify.Init(datapath)
|
||||
zero.OnRegex(`^设置随机图片网址(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(20).
|
||||
zero.OnRegex(`^设置随机图片网址(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).SetPriority(20).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
url := ctx.State["regex_matched"].([]string)[1]
|
||||
if !strings.HasPrefix(url, "http") {
|
||||
ctx.Send("URL非法!")
|
||||
} else {
|
||||
randapi = url
|
||||
ctx.Send("设置好啦")
|
||||
}
|
||||
})
|
||||
// 有保护的随机图片
|
||||
zero.OnFullMatch("随机图片").SetBlock(true).SetPriority(24).
|
||||
zero.OnFullMatch("随机图片", zero.OnlyGroup).SetBlock(true).SetPriority(24).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
if classify.CanVisit(5) {
|
||||
go func() {
|
||||
class, lastvisit, dhash, comment := classify.Classify(randapi, false)
|
||||
replyClass(ctx, dhash, class, false, lastvisit, comment)
|
||||
}()
|
||||
} else {
|
||||
ctx.Send("你太快啦!")
|
||||
}
|
||||
if classify.CanVisit(5) {
|
||||
go func() {
|
||||
class, lastvisit, dhash, comment := classify.Classify(randapi, false)
|
||||
replyClass(ctx, dhash, class, false, lastvisit, comment)
|
||||
}()
|
||||
} else {
|
||||
ctx.Send("你太快啦!")
|
||||
}
|
||||
})
|
||||
// 直接随机图片,无r18保护,后果自负。如果出r18图可尽快通过发送"太涩了"撤回
|
||||
zero.OnFullMatch("直接随机", zero.AdminPermission).SetBlock(true).SetPriority(24).
|
||||
zero.OnFullMatch("直接随机", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(24).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
if block {
|
||||
ctx.Send("请稍后再试哦")
|
||||
} else if randapi != "" {
|
||||
block = true
|
||||
var url string
|
||||
if randapi[0] == '&' {
|
||||
url = lolipxy
|
||||
} else {
|
||||
url = randapi
|
||||
}
|
||||
setLastMsg(ctx.Event.GroupID, ctx.Send(message.Image(url).Add("cache", "0")))
|
||||
block = false
|
||||
if block {
|
||||
ctx.Send("请稍后再试哦")
|
||||
} else if randapi != "" {
|
||||
block = true
|
||||
var url string
|
||||
if randapi[0] == '&' {
|
||||
url = lolipxy
|
||||
} else {
|
||||
url = randapi
|
||||
}
|
||||
setLastMsg(ctx.Event.GroupID, ctx.Send(message.Image(url).Add("cache", "0")))
|
||||
block = false
|
||||
}
|
||||
})
|
||||
// 撤回最后的直接随机图片
|
||||
@@ -78,16 +76,21 @@ func init() { // 插件主体
|
||||
go cancel(ctx)
|
||||
})
|
||||
// 上传一张图进行评价
|
||||
zero.OnKeywordGroup([]string{"评价图片"}, picture.CmdMatch(), picture.MustGiven()).SetBlock(true).SetPriority(24).
|
||||
zero.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).SetPriority(24).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
ctx.Send("少女祈祷中...")
|
||||
for _, url := range ctx.State["image_url"].([]string) {
|
||||
go func(target string) {
|
||||
class, lastvisit, dhash, comment := classify.Classify(target, true)
|
||||
replyClass(ctx, dhash, class, true, lastvisit, comment)
|
||||
}(url)
|
||||
}
|
||||
ctx.Send("少女祈祷中...")
|
||||
for _, url := range ctx.State["image_url"].([]string) {
|
||||
go func(target string) {
|
||||
class, lastvisit, dhash, comment := classify.Classify(target, true)
|
||||
replyClass(ctx, dhash, class, true, lastvisit, comment)
|
||||
}(url)
|
||||
}
|
||||
})
|
||||
zero.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).SetPriority(20).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
dhash := ctx.State["regex_matched"].([]string)[1]
|
||||
if len(dhash) == 5*3 {
|
||||
ctx.Send(message.Image(apihead + dhash))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
26
plugin_aiwife/non-existent.go
Normal file
26
plugin_aiwife/non-existent.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Package aiwife 随机老婆
|
||||
package aiwife
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
bed = "https://www.thiswaifudoesnotexist.net/example-%d.jpg"
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
// TODO: 1.17 特性暂不增加
|
||||
// rand.Seed(time.Now().UnixMicro())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
zero.OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetPriority(10).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
miku := rand.Intn(100000) + 1
|
||||
ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku)))
|
||||
})
|
||||
}
|
||||
@@ -15,9 +15,9 @@ import (
|
||||
|
||||
var (
|
||||
// ATRI 所有命令的优先级
|
||||
prio = -1
|
||||
// ATRI 表情的 GitHub 镜像位置
|
||||
res = "https://raw.dihe.moe/Yiwen-Chan/ZeroBot-Plugin/master/plugin_atri/"
|
||||
prio = 2
|
||||
// ATRI 表情的 codechina 镜像
|
||||
res = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/plugin_atri/"
|
||||
// ATRI 的总开关
|
||||
enable = true
|
||||
)
|
||||
@@ -26,15 +26,18 @@ func init() { // 插件主体
|
||||
zero.OnFullMatch("ATRI醒醒", zero.AdminPermission).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
enable = true
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randText("嗯呜呜……夏生先生……?"))
|
||||
})
|
||||
zero.OnFullMatch("ATRI睡吧", zero.AdminPermission).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
enable = false
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randText("Zzz……Zzz……"))
|
||||
})
|
||||
zero.OnFullMatch("萝卜子", atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
switch rand.Intn(2) {
|
||||
case 0:
|
||||
ctx.SendChain(randText("萝卜子是对机器人的蔑称!", "是亚托莉......萝卜子可是对机器人的蔑称"))
|
||||
@@ -42,22 +45,23 @@ func init() { // 插件主体
|
||||
ctx.SendChain(randRecord("RocketPunch.amr"))
|
||||
}
|
||||
})
|
||||
zero.OnKeywordGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
zero.OnFullMatchGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if rand.Intn(10) == 0 {
|
||||
ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
|
||||
}
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
|
||||
})
|
||||
zero.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio - 1).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randImage("FN.jpg", "WQ.jpg", "WQ1.jpg"))
|
||||
})
|
||||
zero.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う"}, atriSwitch()).SetBlock(true).SetPriority(prio).
|
||||
zero.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早"}, atriSwitch()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
now := time.Now().Hour()
|
||||
time.Sleep(time.Second * 1)
|
||||
switch {
|
||||
case now < 6: // 凌晨
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"zzzz......",
|
||||
"zzzzzzzz......",
|
||||
"zzz...好涩哦..zzz....",
|
||||
@@ -66,7 +70,7 @@ func init() { // 插件主体
|
||||
"...zzz....哧溜哧溜....",
|
||||
))
|
||||
case now >= 6 && now < 9:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"啊......早上好...(哈欠)",
|
||||
"唔......吧唧...早上...哈啊啊~~~\n早上好......",
|
||||
"早上好......",
|
||||
@@ -78,24 +82,25 @@ func init() { // 插件主体
|
||||
"早上好......欸~~~脸好近呢",
|
||||
))
|
||||
case now >= 9 && now < 18:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"哼!这个点还早啥,昨晚干啥去了!?",
|
||||
"熬夜了对吧熬夜了对吧熬夜了对吧???!",
|
||||
"是不是熬夜是不是熬夜是不是熬夜?!",
|
||||
))
|
||||
case now >= 18 && now < 24:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"早个啥?哼唧!我都准备洗洗睡了!",
|
||||
"不是...你看看几点了,哼!",
|
||||
"晚上好哇",
|
||||
))
|
||||
}
|
||||
})
|
||||
zero.OnFullMatchGroup([]string{"中午好", "午安"}, atriSwitch()).SetBlock(true).SetPriority(prio).
|
||||
zero.OnFullMatchGroup([]string{"中午好", "午安", "午好"}, atriSwitch()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
now := time.Now().Hour()
|
||||
if now > 11 && now < 15 { // 中午
|
||||
ctx.SendChain(randText(
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"午安w",
|
||||
"午觉要好好睡哦,ATRI会陪伴在你身旁的w",
|
||||
"嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o",
|
||||
@@ -103,12 +108,13 @@ func init() { // 插件主体
|
||||
))
|
||||
}
|
||||
})
|
||||
zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい"}, atriSwitch()).SetBlock(true).SetPriority(prio).
|
||||
zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好", "晚上好"}, atriSwitch()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
now := time.Now().Hour()
|
||||
time.Sleep(time.Second * 1)
|
||||
switch {
|
||||
case now < 6: // 凌晨
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"zzzz......",
|
||||
"zzzzzzzz......",
|
||||
"zzz...好涩哦..zzz....",
|
||||
@@ -117,27 +123,27 @@ func init() { // 插件主体
|
||||
"...zzz....哧溜哧溜....",
|
||||
))
|
||||
case now >= 6 && now < 11:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"你可猝死算了吧!",
|
||||
"?啊这",
|
||||
"亲,这边建议赶快去睡觉呢~~~",
|
||||
"不可忍不可忍不可忍!!为何这还不猝死!!",
|
||||
))
|
||||
case now >= 11 && now < 15:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"午安w",
|
||||
"午觉要好好睡哦,ATRI会陪伴在你身旁的w",
|
||||
"嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o",
|
||||
"睡你午觉去!哼唧!!",
|
||||
))
|
||||
case now >= 15 && now < 19:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"难不成??晚上不想睡觉??现在休息",
|
||||
"就......挺离谱的...现在睡觉",
|
||||
"现在还是白天哦,睡觉还太早了",
|
||||
))
|
||||
case now >= 19 && now < 24:
|
||||
ctx.SendChain(randText(
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText(
|
||||
"嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o",
|
||||
"......(打瞌睡)",
|
||||
"呼...呼...已经睡着了哦~...呼......",
|
||||
@@ -147,6 +153,7 @@ func init() { // 插件主体
|
||||
})
|
||||
zero.OnKeywordGroup([]string{"高性能", "太棒了", "すごい", "sugoi", "斯国一", "よかった"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randText(
|
||||
"当然,我是高性能的嘛~!",
|
||||
"小事一桩,我是高性能的嘛",
|
||||
@@ -167,6 +174,7 @@ func init() { // 插件主体
|
||||
})
|
||||
zero.OnKeywordGroup([]string{"没事", "没关系", "大丈夫", "还好", "不要紧", "没出大问题", "没伤到哪"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randText(
|
||||
"当然,我是高性能的嘛~!",
|
||||
"没事没事,因为我是高性能的嘛!嗯哼!",
|
||||
@@ -181,22 +189,26 @@ func init() { // 插件主体
|
||||
|
||||
zero.OnKeywordGroup([]string{"好吗", "是吗", "行不行", "能不能", "可不可以"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
if rand.Intn(2) == 0 {
|
||||
ctx.SendChain(randImage("YES.png", "NO.jpg"))
|
||||
}
|
||||
})
|
||||
zero.OnFullMatchGroup([]string{"啊这"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
zero.OnKeywordGroup([]string{"啊这"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
if rand.Intn(2) == 0 {
|
||||
ctx.SendChain(randImage("AZ.jpg", "AZ1.jpg"))
|
||||
}
|
||||
})
|
||||
zero.OnFullMatchGroup([]string{"我好了"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
zero.OnKeywordGroup([]string{"我好了"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(randText("不许好!", "憋回去!"))
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText("不许好!", "憋回去!"))
|
||||
})
|
||||
zero.OnFullMatchGroup([]string{"?", "?", "¿"}, atriSwitch(), atriSleep()).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
switch rand.Intn(5) {
|
||||
case 0:
|
||||
ctx.SendChain(randText("?", "?", "嗯?", "(。´・ω・)ん?", "ん?"))
|
||||
@@ -215,6 +227,7 @@ func init() { // 插件主体
|
||||
})
|
||||
zero.OnKeyword("答应我", atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(randText("我无法回应你的请求"))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type follower struct {
|
||||
func init() {
|
||||
zero.OnFullMatch("/开启粉丝日报", zero.AdminPermission).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
fansDaily(130591566) // 群号传进去给下面发信息的函数
|
||||
fansDaily(ctx.Event.GroupID) // 群号传进去给下面发信息的函数
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"time"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
|
||||
)
|
||||
@@ -18,7 +17,7 @@ func init() {
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
// 绕过第一行发病
|
||||
ctx.SendChain(message.Text((*data.Array)[rand.Intn(len(*data.Array)-1)+1]))
|
||||
ctx.Send((*data.Array)[rand.Intn(len(*data.Array)-1)+1])
|
||||
})
|
||||
// 逆天
|
||||
zero.OnFullMatch("发大病", zero.OnlyToMe).
|
||||
@@ -32,6 +31,8 @@ func init() {
|
||||
err := data.AddText(ctx.State["regex_matched"].([]string)[1])
|
||||
if err != nil {
|
||||
ctx.Send(fmt.Sprintf("ERROR: %v", err))
|
||||
} else {
|
||||
ctx.Send("记住啦!")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -12,12 +16,17 @@ import (
|
||||
const (
|
||||
datapath = "data/Diana"
|
||||
pbfile = datapath + "/text.pb"
|
||||
pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/Diana/text.pb"
|
||||
)
|
||||
|
||||
var (
|
||||
compo Composition
|
||||
// Array 小作文数组指针
|
||||
Array = &compo.Array
|
||||
// m 小作文保存锁
|
||||
m sync.Mutex
|
||||
// md5s 验证重复
|
||||
md5s [][16]byte
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -29,7 +38,12 @@ func init() {
|
||||
}
|
||||
err1 := LoadText()
|
||||
if err1 == nil {
|
||||
log.Printf("[Diana]读取%d条小作文", len(*Array))
|
||||
arrl := len(*Array)
|
||||
log.Printf("[Diana]读取%d条小作文", arrl)
|
||||
md5s = make([][16]byte, arrl)
|
||||
for i, t := range *Array {
|
||||
md5s[i] = md5.Sum(str2bytes(t))
|
||||
}
|
||||
} else {
|
||||
log.Printf("[Diana]读取小作文错误:%v", err1)
|
||||
}
|
||||
@@ -41,6 +55,7 @@ func LoadText() error {
|
||||
if _, err := os.Stat(pbfile); err == nil || os.IsExist(err) {
|
||||
f, err := os.Open(pbfile)
|
||||
if err == nil {
|
||||
defer f.Close()
|
||||
data, err1 := io.ReadAll(f)
|
||||
if err1 == nil {
|
||||
if len(data) > 0 {
|
||||
@@ -49,6 +64,26 @@ func LoadText() error {
|
||||
}
|
||||
return err1
|
||||
}
|
||||
} else { // 如果没有小作文,则从 url 下载
|
||||
f, err := os.Create(pbfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
resp, err := http.Get(pburl)
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
if resp.ContentLength > 0 {
|
||||
log.Printf("[Diana]从镜像下载小作文%d字节...", resp.ContentLength)
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err == nil && len(data) > 0 {
|
||||
_, _ = f.Write(data)
|
||||
return compo.Unmarshal(data)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -56,21 +91,47 @@ func LoadText() error {
|
||||
|
||||
// AddText 添加小作文
|
||||
func AddText(txt string) error {
|
||||
if txt != "" {
|
||||
sum := md5.Sum(str2bytes(txt))
|
||||
if txt != "" && !isin(sum) {
|
||||
compo.Array = append(compo.Array, txt)
|
||||
data, err := compo.Marshal()
|
||||
if err == nil {
|
||||
if _, err := os.Stat(datapath); err == nil || os.IsExist(err) {
|
||||
f, err1 := os.OpenFile(pbfile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
|
||||
if err1 == nil {
|
||||
defer f.Close()
|
||||
_, err2 := f.Write(data)
|
||||
return err2
|
||||
}
|
||||
return err1
|
||||
}
|
||||
}
|
||||
return err
|
||||
md5s = append(md5s, sum)
|
||||
return savecompo()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isin(sum [16]byte) bool {
|
||||
for _, t := range md5s {
|
||||
if t == sum {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// savecompo 同步保存作文
|
||||
func savecompo() error {
|
||||
data, err := compo.Marshal()
|
||||
if err == nil {
|
||||
if _, err := os.Stat(datapath); err == nil || os.IsExist(err) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
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))
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ syntax = "proto3";
|
||||
package data;
|
||||
|
||||
message composition {
|
||||
repeated string array = 1;
|
||||
repeated string array = 1;
|
||||
}
|
||||
|
||||
116
plugin_hs/run.go
Normal file
116
plugin_hs/run.go
Normal file
@@ -0,0 +1,116 @@
|
||||
// Package hs 炉石
|
||||
package hs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/imroc/req"
|
||||
"github.com/tidwall/gjson"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const cachedir = "data/hs/"
|
||||
|
||||
var header = req.Header{
|
||||
"user-agent": `Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36`,
|
||||
"referer": `https://hs.fbigame.com`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
os.RemoveAll(cachedir)
|
||||
err := os.MkdirAll(cachedir, 0755)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
zero.OnRegex(`^搜卡(.+)$`).
|
||||
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
|
||||
List := ctx.State["regex_matched"].([]string)[1]
|
||||
g := sh(List)
|
||||
im, _ := req.Get(`https://res.fbigame.com/hs/v13/`+
|
||||
gjson.Get(g, `list.0.CardID`).String()+
|
||||
`.png?auth_key=`+
|
||||
gjson.Get(g, `list.0.auth_key`).String(), header)
|
||||
cachefile := cachedir + strconv.Itoa(int(time.Now().Unix()))
|
||||
err := im.ToFile(cachefile)
|
||||
if err == nil {
|
||||
file, err := os.Open(cachefile)
|
||||
if err == nil {
|
||||
defer file.Close()
|
||||
sg, _ := req.Post("https://pic.sogou.com/pic/upload_pic.jsp", req.FileUpload{
|
||||
File: file,
|
||||
FieldName: "image", // FieldName 是表单字段名
|
||||
FileName: "avatar.png", // Filename 是要上传的文件的名称,我们使用它来猜测mimetype,并将其上传到服务器上
|
||||
})
|
||||
var tx string
|
||||
t := int(gjson.Get(g, `list.#`).Int())
|
||||
if t == 0 {
|
||||
ctx.Send("查询为空!")
|
||||
return
|
||||
}
|
||||
for i := 0; i < t && i < 10; i++ {
|
||||
tx += strconv.Itoa(i+1) + ". 法力:" +
|
||||
gjson.Get(g, `list.`+strconv.Itoa(i)+`.COST`).String() +
|
||||
" " +
|
||||
gjson.Get(g, `list.`+strconv.Itoa(i)+`.CARDNAME`).String() +
|
||||
"\n"
|
||||
}
|
||||
ctx.SendChain(
|
||||
message.Image(sg.String()),
|
||||
message.Text(tx),
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
// 卡组
|
||||
zero.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
|
||||
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
|
||||
fmt.Print("成功")
|
||||
List := ctx.State["regex_matched"].([]string)[1]
|
||||
ctx.SendChain(
|
||||
message.Image(kz(List)),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
func sh(s string) string {
|
||||
var hs = `https://hs.fbigame.com/ajax.php`
|
||||
h, _ := req.Get("https://hs.fbigame.com", header)
|
||||
var param = req.Param{
|
||||
"mod": `get_cards_list`,
|
||||
"mode": `-1`,
|
||||
"extend": `-1`,
|
||||
"mutil_extend": ``,
|
||||
"hero": `-1`,
|
||||
"rarity": `-1`,
|
||||
"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
|
||||
}
|
||||
@@ -3,7 +3,9 @@ package manager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -14,27 +16,44 @@ import (
|
||||
timer "github.com/FloatTech/ZeroBot-Plugin-Timer"
|
||||
)
|
||||
|
||||
const (
|
||||
datapath = "data/manager/"
|
||||
confile = datapath + "config.pb"
|
||||
hint = "====群管====\n" +
|
||||
"- 禁言@QQ 1分钟\n" +
|
||||
"- 解除禁言 @QQ\n" +
|
||||
"- 我要自闭 1分钟\n" +
|
||||
"- 开启全员禁言\n" +
|
||||
"- 解除全员禁言\n" +
|
||||
"- 升为管理@QQ\n" +
|
||||
"- 取消管理@QQ\n" +
|
||||
"- 修改名片@QQ XXX\n" +
|
||||
"- 修改头衔@QQ XXX\n" +
|
||||
"- 申请头衔 XXX\n" +
|
||||
"- 踢出群聊@QQ\n" +
|
||||
"- 退出群聊 1234\n" +
|
||||
"- 群聊转发 1234 XXX\n" +
|
||||
"- 私聊转发 0000 XXX\n" +
|
||||
"- 在MM月dd日的hh点mm分时(用http://url)提醒大家XXX\n" +
|
||||
"- 在MM月[每周|周几]的hh点mm分时(用http://url)提醒大家XXX\n" +
|
||||
"- 取消在MM月dd日的hh点mm分的提醒\n" +
|
||||
"- 取消在MM月[每周|周几]的hh点mm分的提醒\n" +
|
||||
"- 列出所有提醒\n" +
|
||||
"- 翻牌\n" +
|
||||
"- 设置欢迎语XXX\n" +
|
||||
"- [开启|关闭]入群验证"
|
||||
)
|
||||
|
||||
var (
|
||||
config Config
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
loadConfig()
|
||||
// 菜单
|
||||
zero.OnFullMatch("群管系统", zero.AdminPermission).SetBlock(true).FirstPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text(
|
||||
"====群管====", "\n",
|
||||
"- 禁言@QQ 1分钟", "\n",
|
||||
"- 解除禁言 @QQ", "\n",
|
||||
"- 我要自闭 1分钟", "\n",
|
||||
"- 开启全员禁言", "\n",
|
||||
"- 解除全员禁言", "\n",
|
||||
"- 升为管理@QQ", "\n",
|
||||
"- 取消管理@QQ", "\n",
|
||||
"- 修改名片@QQ XXX", "\n",
|
||||
"- 修改头衔@QQ XXX", "\n",
|
||||
"- 申请头衔 XXX", "\n",
|
||||
"- 踢出群聊@QQ", "\n",
|
||||
"- 退出群聊 1234", "\n",
|
||||
"- 群聊转发 1234 XXX", "\n",
|
||||
"- 私聊转发 0000 XXX",
|
||||
))
|
||||
ctx.Send(hint)
|
||||
})
|
||||
// 升为管理
|
||||
zero.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
|
||||
@@ -222,7 +241,7 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Text("📧 --> " + ctx.State["regex_matched"].([]string)[1]))
|
||||
})
|
||||
// 定时提醒
|
||||
zero.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
|
||||
zero.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.AdminPermission).SetBlock(true).SetPriority(40).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
dateStrs := ctx.State["regex_matched"].([]string)
|
||||
@@ -237,7 +256,7 @@ func init() { // 插件主体
|
||||
}
|
||||
})
|
||||
// 取消定时
|
||||
zero.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
|
||||
zero.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.AdminPermission).SetBlock(true).SetPriority(40).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
dateStrs := ctx.State["regex_matched"].([]string)
|
||||
@@ -256,7 +275,7 @@ func init() { // 插件主体
|
||||
}
|
||||
})
|
||||
// 列出本群所有定时
|
||||
zero.OnFullMatch("列出所有提醒", zero.SuperUserPermission).SetBlock(true).SetPriority(40).
|
||||
zero.OnFullMatch("列出所有提醒", zero.AdminPermission).SetBlock(true).SetPriority(40).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
ctx.Send(fmt.Sprint(timer.ListTimers(uint64(ctx.Event.GroupID))))
|
||||
@@ -277,10 +296,51 @@ func init() { // 插件主体
|
||||
}
|
||||
})
|
||||
// 入群欢迎
|
||||
zero.OnNotice().SetBlock(false).SetPriority(40).
|
||||
zero.OnNotice().SetBlock(false).FirstPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.NoticeType == "group_increase" {
|
||||
ctx.SendChain(message.Text("欢迎~"))
|
||||
word, ok := config.Welcome[uint64(ctx.Event.GroupID)]
|
||||
if ok {
|
||||
ctx.Send(word)
|
||||
} else {
|
||||
ctx.Send("欢迎~")
|
||||
}
|
||||
enable, ok1 := config.Checkin[uint64(ctx.Event.GroupID)]
|
||||
if ok1 && enable {
|
||||
uid := ctx.Event.UserID
|
||||
a := rand.Intn(100)
|
||||
b := rand.Intn(100)
|
||||
r := a + b
|
||||
ctx.SendChain(message.At(uid), message.Text(fmt.Sprintf("考你一道题:%d+%d=?\n如果60秒之内答不上来,%s就要把你踢出去了哦~", a, b, zero.BotConfig.NickName[0])))
|
||||
// 匹配发送者进行验证
|
||||
rule := func(ctx *zero.Ctx) bool {
|
||||
for _, elem := range ctx.Event.Message {
|
||||
if elem.Type == "text" {
|
||||
text := strings.ReplaceAll(elem.Data["text"], " ", "")
|
||||
ans, err := strconv.Atoi(text)
|
||||
if err == nil {
|
||||
if ans != r {
|
||||
ctx.Send("答案不对哦,再想想吧~")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID), rule)
|
||||
recv, cancel := next.Repeat()
|
||||
select {
|
||||
case <-time.After(time.Minute):
|
||||
ctx.Send("拜拜啦~")
|
||||
ctx.SetGroupKick(ctx.Event.GroupID, uid, false)
|
||||
cancel()
|
||||
case <-recv:
|
||||
cancel()
|
||||
ctx.Send("答对啦~")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// 退群提醒
|
||||
@@ -290,6 +350,34 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Text("有人跑路了~"))
|
||||
}
|
||||
})
|
||||
// 设置欢迎语
|
||||
zero.OnRegex(`^设置欢迎语([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
config.Welcome[uint64(ctx.Event.GroupID)] = ctx.State["regex_matched"].([]string)[1]
|
||||
if saveConfig() == nil {
|
||||
ctx.Send("记住啦!")
|
||||
} else {
|
||||
ctx.Send("出错啦!")
|
||||
}
|
||||
})
|
||||
// 入群验证开关
|
||||
zero.OnRegex(`^(.*)入群验证$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
option := ctx.State["regex_matched"].([]string)[1]
|
||||
switch option {
|
||||
case "开启":
|
||||
config.Checkin[uint64(ctx.Event.GroupID)] = true
|
||||
case "关闭":
|
||||
config.Checkin[uint64(ctx.Event.GroupID)] = false
|
||||
default:
|
||||
return
|
||||
}
|
||||
if saveConfig() == nil {
|
||||
ctx.Send("已" + option)
|
||||
} else {
|
||||
ctx.Send("出错啦!")
|
||||
}
|
||||
})
|
||||
// 运行 CQ 码
|
||||
zero.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(0).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
@@ -304,3 +392,44 @@ func strToInt(str string) int64 {
|
||||
val, _ := strconv.ParseInt(str, 10, 64)
|
||||
return val
|
||||
}
|
||||
|
||||
// loadConfig 加载设置,没有则手动初始化
|
||||
func loadConfig() {
|
||||
mkdirerr := os.MkdirAll(datapath, 0755)
|
||||
if mkdirerr == nil {
|
||||
if _, err := os.Stat(confile); err == nil || os.IsExist(err) {
|
||||
f, err := os.Open(confile)
|
||||
if err == nil {
|
||||
data, err1 := io.ReadAll(f)
|
||||
if err1 == nil {
|
||||
if len(data) > 0 {
|
||||
if config.Unmarshal(data) == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
config.Checkin = make(map[uint64]bool)
|
||||
config.Welcome = make(map[uint64]string)
|
||||
} else {
|
||||
panic(mkdirerr)
|
||||
}
|
||||
}
|
||||
|
||||
// saveConfig 保存设置,无此文件则新建
|
||||
func saveConfig() error {
|
||||
data, err := config.Marshal()
|
||||
if err != nil {
|
||||
return err
|
||||
} else if _, err := os.Stat(datapath); err == nil || os.IsExist(err) {
|
||||
f, err1 := os.OpenFile(confile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
|
||||
if err1 != nil {
|
||||
return err1
|
||||
}
|
||||
defer f.Close()
|
||||
_, err2 := f.Write(data)
|
||||
return err2
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
561
plugin_manager/manager.pb.go
Normal file
561
plugin_manager/manager.pb.go
Normal file
@@ -0,0 +1,561 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: manager.proto
|
||||
|
||||
package manager
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Config struct {
|
||||
Checkin map[uint64]bool `protobuf:"bytes,1,rep,name=checkin,proto3" json:"checkin,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
Welcome map[uint64]string `protobuf:"bytes,2,rep,name=welcome,proto3" json:"welcome,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Config) Reset() { *m = Config{} }
|
||||
func (m *Config) String() string { return proto.CompactTextString(m) }
|
||||
func (*Config) ProtoMessage() {}
|
||||
func (*Config) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_cde9ec64f0d2c859, []int{0}
|
||||
}
|
||||
func (m *Config) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Config.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Config) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Config.Merge(m, src)
|
||||
}
|
||||
func (m *Config) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Config) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Config.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Config proto.InternalMessageInfo
|
||||
|
||||
func (m *Config) GetCheckin() map[uint64]bool {
|
||||
if m != nil {
|
||||
return m.Checkin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Config) GetWelcome() map[uint64]string {
|
||||
if m != nil {
|
||||
return m.Welcome
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Config)(nil), "manager.config")
|
||||
proto.RegisterMapType((map[uint64]bool)(nil), "manager.config.CheckinEntry")
|
||||
proto.RegisterMapType((map[uint64]string)(nil), "manager.config.WelcomeEntry")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("manager.proto", fileDescriptor_cde9ec64f0d2c859) }
|
||||
|
||||
var fileDescriptor_cde9ec64f0d2c859 = []byte{
|
||||
// 186 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x4d, 0xcc, 0x4b,
|
||||
0x4c, 0x4f, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0x95, 0x3e, 0x30,
|
||||
0x72, 0xb1, 0x25, 0xe7, 0xe7, 0xa5, 0x65, 0xa6, 0x0b, 0x99, 0x71, 0xb1, 0x27, 0x67, 0xa4, 0x26,
|
||||
0x67, 0x67, 0xe6, 0x49, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0xc9, 0xe8, 0xc1, 0x34, 0x41, 0x54,
|
||||
0xe8, 0x39, 0x43, 0xa4, 0x5d, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0x60, 0x8a, 0x41, 0xfa, 0xca, 0x53,
|
||||
0x73, 0x92, 0xf3, 0x73, 0x53, 0x25, 0x98, 0xb0, 0xeb, 0x0b, 0x87, 0x48, 0x43, 0xf5, 0x41, 0x15,
|
||||
0x4b, 0x59, 0x71, 0xf1, 0x20, 0x1b, 0x28, 0x24, 0xc0, 0xc5, 0x9c, 0x9d, 0x5a, 0x29, 0xc1, 0xa8,
|
||||
0xc0, 0xa8, 0xc1, 0x12, 0x04, 0x62, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0x82, 0xcc,
|
||||
0x65, 0xd4, 0xe0, 0x08, 0x82, 0x70, 0xac, 0x98, 0x2c, 0x18, 0x41, 0x7a, 0x91, 0x0d, 0x25, 0xa4,
|
||||
0x97, 0x13, 0x49, 0xaf, 0x93, 0xc0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78,
|
||||
0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, 0x43, 0x12, 0x1b, 0x38, 0x50, 0x8c, 0x01, 0x01, 0x00, 0x00,
|
||||
0xff, 0xff, 0x2a, 0xe6, 0x90, 0x6e, 0x25, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Config) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Config) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Config) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if len(m.Welcome) > 0 {
|
||||
for k := range m.Welcome {
|
||||
v := m.Welcome[k]
|
||||
baseI := i
|
||||
i -= len(v)
|
||||
copy(dAtA[i:], v)
|
||||
i = encodeVarintManager(dAtA, i, uint64(len(v)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
i = encodeVarintManager(dAtA, i, uint64(k))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
i = encodeVarintManager(dAtA, i, uint64(baseI-i))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
}
|
||||
if len(m.Checkin) > 0 {
|
||||
for k := range m.Checkin {
|
||||
v := m.Checkin[k]
|
||||
baseI := i
|
||||
i--
|
||||
if v {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
i = encodeVarintManager(dAtA, i, uint64(k))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
i = encodeVarintManager(dAtA, i, uint64(baseI-i))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintManager(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovManager(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *Config) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Checkin) > 0 {
|
||||
for k, v := range m.Checkin {
|
||||
_ = k
|
||||
_ = v
|
||||
mapEntrySize := 1 + sovManager(uint64(k)) + 1 + 1
|
||||
n += mapEntrySize + 1 + sovManager(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
if len(m.Welcome) > 0 {
|
||||
for k, v := range m.Welcome {
|
||||
_ = k
|
||||
_ = v
|
||||
mapEntrySize := 1 + sovManager(uint64(k)) + 1 + len(v) + sovManager(uint64(len(v)))
|
||||
n += mapEntrySize + 1 + sovManager(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovManager(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozManager(x uint64) (n int) {
|
||||
return sovManager(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Config) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: config: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: config: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Checkin", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Checkin == nil {
|
||||
m.Checkin = make(map[uint64]bool)
|
||||
}
|
||||
var mapkey uint64
|
||||
var mapvalue bool
|
||||
for iNdEx < postIndex {
|
||||
entryPreIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
if fieldNum == 1 {
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
mapkey |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if fieldNum == 2 {
|
||||
var mapvaluetemp int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
mapvaluetemp |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
mapvalue = bool(mapvaluetemp != 0)
|
||||
} else {
|
||||
iNdEx = entryPreIndex
|
||||
skippy, err := skipManager(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
if (iNdEx + skippy) > postIndex {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
m.Checkin[mapkey] = mapvalue
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Welcome", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Welcome == nil {
|
||||
m.Welcome = make(map[uint64]string)
|
||||
}
|
||||
var mapkey uint64
|
||||
var mapvalue string
|
||||
for iNdEx < postIndex {
|
||||
entryPreIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
if fieldNum == 1 {
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
mapkey |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if fieldNum == 2 {
|
||||
var stringLenmapvalue uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapvalue |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapvalue := int(stringLenmapvalue)
|
||||
if intStringLenmapvalue < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
|
||||
if postStringIndexmapvalue < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
if postStringIndexmapvalue > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue])
|
||||
iNdEx = postStringIndexmapvalue
|
||||
} else {
|
||||
iNdEx = entryPreIndex
|
||||
skippy, err := skipManager(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
if (iNdEx + skippy) > postIndex {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
m.Welcome[mapkey] = mapvalue
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipManager(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthManager
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipManager(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowManager
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthManager
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupManager
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthManager
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthManager = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowManager = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupManager = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
7
plugin_manager/manager.proto
Normal file
7
plugin_manager/manager.proto
Normal file
@@ -0,0 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package manager;
|
||||
|
||||
message config {
|
||||
map<uint64, bool> checkin = 1;
|
||||
map<uint64, string> welcome = 2;
|
||||
}
|
||||
@@ -177,9 +177,9 @@ func qqmusic(keyword string) message.MessageSegment {
|
||||
}.Encode()
|
||||
audio := gjson.ParseBytes(netGet(music.String(), h2))
|
||||
// 获得音乐封面
|
||||
image := "https://y.gtimg.cn/music/photo_new" +
|
||||
image := "https://y.gtimg.cn/music/photo_new/" +
|
||||
find(
|
||||
"src=\"//y.gtimg.cn/music/photo_new",
|
||||
`photo_new\u002F`,
|
||||
"?max_age",
|
||||
string(
|
||||
netGet("https://y.qq.com/n/yqq/song/"+info.Get("songmid").Str+".html", nil),
|
||||
|
||||
30
plugin_omikuji/sensou.go
Normal file
30
plugin_omikuji/sensou.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Package omikuji 浅草寺求签
|
||||
package omikuji
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
bed = "https://codechina.csdn.net/u011570312/senso-ji-omikuji/-/raw/main/%d_%d.jpg"
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
// TODO: 1.17 特性暂不增加
|
||||
// rand.Seed(time.Now().UnixMicro())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
miku := rand.Intn(100) + 1
|
||||
ctx.SendChain(
|
||||
message.At(ctx.Event.UserID),
|
||||
message.Image(fmt.Sprintf(bed, miku, 0)),
|
||||
message.Image(fmt.Sprintf(bed, miku, 1)),
|
||||
)
|
||||
})
|
||||
}
|
||||
60
plugin_qingyunke/picture.go
Normal file
60
plugin_qingyunke/picture.go
Normal 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
|
||||
}
|
||||
*/
|
||||
160
plugin_qingyunke/qingyunke.go
Normal file
160
plugin_qingyunke/qingyunke.go
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
基于青云客接口的聊天对话功能
|
||||
*/
|
||||
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"
|
||||
)
|
||||
|
||||
var (
|
||||
prio = 3
|
||||
bucket = rate.NewManager(time.Minute, 20) // 青云客接口回复
|
||||
enable = true
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
// 开关
|
||||
zero.OnFullMatch("开启自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
enable = true
|
||||
ctx.SendChain(message.Text("自动回复开启"))
|
||||
})
|
||||
zero.OnFullMatch("关闭自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
enable = false
|
||||
ctx.SendChain(message.Text("自动回复关闭"))
|
||||
})
|
||||
// 回复
|
||||
zero.OnRegex("(^.{1,30}$)", zero.OnlyToMe, switchQYK()).SetBlock(false).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])
|
||||
// 回复
|
||||
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)]
|
||||
}
|
||||
|
||||
func switchQYK() zero.Rule {
|
||||
return func(ctx *zero.Ctx) bool {
|
||||
return enable
|
||||
}
|
||||
}
|
||||
20
plugin_qingyunke/request.go
Normal file
20
plugin_qingyunke/request.go
Normal 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~")
|
||||
}
|
||||
})
|
||||
}
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ func init() { // 插件主体
|
||||
)
|
||||
})
|
||||
// 以图搜图
|
||||
zero.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, picture.CmdMatch(), picture.MustGiven()).SetBlock(true).FirstPriority().
|
||||
zero.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).FirstPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
// 开始搜索图片
|
||||
ctx.Send("少女祈祷中......")
|
||||
|
||||
@@ -3,17 +3,19 @@ package setutime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/pixiv"
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/pixiv"
|
||||
)
|
||||
|
||||
// Pools 图片缓冲池
|
||||
@@ -28,6 +30,10 @@ type imgpool struct {
|
||||
Form int64
|
||||
}
|
||||
|
||||
const (
|
||||
dburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/SetuTime/SetuTime.db"
|
||||
)
|
||||
|
||||
// NewPoolsCache 返回一个缓冲池对象
|
||||
func newPools() *imgpool {
|
||||
cache := &imgpool{
|
||||
@@ -43,6 +49,27 @@ func newPools() *imgpool {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// 如果数据库不存在则下载
|
||||
if _, err := os.Stat(cache.DB.DBPath); err != nil || os.IsNotExist(err) {
|
||||
f, err := os.Create(cache.DB.DBPath)
|
||||
if err == nil {
|
||||
resp, err := http.Get(dburl)
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
if resp.ContentLength > 0 {
|
||||
logrus.Printf("[Setu]从镜像下载数据库%d字节...", resp.ContentLength)
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err == nil && len(data) > 0 {
|
||||
_, err = f.Write(data)
|
||||
if err != nil {
|
||||
logrus.Errorf("[Setu]写入数据库失败: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
for i := range cache.List {
|
||||
if err := cache.DB.create(cache.List[i], &pixiv.Illust{}); err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -5,11 +5,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/shindanmaker"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/shindanmaker"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -21,10 +20,11 @@ func init() {
|
||||
zero.OnPrefix("异世界转生", number(587874)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
zero.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
zero.OnPrefix("卖萌", number(360578)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
zero.OnPrefix("抽老婆", number(1075116)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
}
|
||||
|
||||
// shindanmaker 处理函数
|
||||
var handle = func(ctx *zero.Ctx) {
|
||||
func handle(ctx *zero.Ctx) {
|
||||
if !limit.Load(ctx.Event.UserID).Acquire() {
|
||||
ctx.SendChain(message.Text("请稍后重试0x0..."))
|
||||
return
|
||||
@@ -42,11 +42,11 @@ var handle = func(ctx *zero.Ctx) {
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
}
|
||||
ctx.SendChain(message.Text(text))
|
||||
ctx.Send(text)
|
||||
}
|
||||
|
||||
// 传入 shindanmaker id
|
||||
var number = func(id int64) func(ctx *zero.Ctx) bool {
|
||||
func number(id int64) func(ctx *zero.Ctx) bool {
|
||||
return func(ctx *zero.Ctx) bool {
|
||||
ctx.State["id"] = id
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user