Compare commits

..

93 Commits

Author SHA1 Message Date
源文雨
636f14c450 🐛 md5 只能连接一次 2022-03-27 14:35:48 +08:00
源文雨
b066bc37b3 #150 缩减coser发图数 2022-03-27 14:26:28 +08:00
源文雨
9ac43fecf8 fix #151 2022-03-27 14:22:34 +08:00
源文雨
d6ff14167d add plugin 渲染任意文字到图片 2022-03-27 14:00:21 +08:00
源文雨
5837a765f1 add plugin 渲染任意文字到图片 2022-03-27 13:54:26 +08:00
源文雨
1bfb76a4b3 📝 edit readme 2022-03-27 12:59:08 +08:00
源文雨
2a78a602e2 shindan add 黄油角色 2022-03-27 12:56:57 +08:00
源文雨
884b0e4226 💩👌 make lint happy 2022-03-27 12:48:12 +08:00
源文雨
4e819eb5d9 fix ci 2022-03-27 12:44:02 +08:00
源文雨
e3a50cc014 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2022-03-27 00:24:56 +08:00
源文雨
25ab8c9234 fix: FutureEvent 2022-03-27 00:24:46 +08:00
github-actions[bot]
901e680fa4 🎨 改进代码样式 2022-03-26 14:03:46 +00:00
源文雨
82768fff59 fix b14 & cd 2022-03-26 22:01:50 +08:00
莫思潋
87e3297904 定制退群提醒+调整煎蛋网无聊图触发 (#166)
* 优化在两个命令中使用空格分隔的体验
- fortune的设置底图功能
- b14的加密功能

* 优化四个插件中使用空格分隔的体验
- 加密
- 哔哩哔哩推送
- 藏头诗
- 运势

* 优化并修正了上一个commit
- 加上了因为复制粘贴疏忽又没有注意测试遗漏的`?`
- 调整藏头诗和加密的正则触发,使其不必多此一举
- 删去了未被发现的测试代码

* - 删去了遗漏的Trim

* 优化了更多插件中使用空格的体验
- 优化了music bilibili image_finder 中使用空格的体验
- 补上了plugin_bilibili中未实现的vup开头触发
- 为plugin_bilibili_parse输出的消息加上一个换行符,优化排版

* 小调整

- 考虑到屌字既难打又有碍观瞻,改为正则匹配`[屌|弔|吊]图`
- 增加了退群提醒的定制

* - 修复退群提醒本身忘记修改了的问题
2022-03-22 12:31:44 +08:00
Jiang-Red
81a4297eb1 添加更多数据,修改发送排版 (#167) 2022-03-21 18:18:29 +08:00
源文雨
17f5b52931 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2022-03-20 18:49:31 +08:00
源文雨
2250adf854 fix #161 2022-03-20 18:49:20 +08:00
GenesisAN
5cd46b3926 从url正则中去除用字 (#160)
从url正则中去除用字,以防止url中包含用字前缀导致图片显示失败
2022-03-20 14:43:55 +08:00
源文雨
6e2b10b788 fix lint 2022-03-20 14:40:47 +08:00
源文雨
5e301ccaaf fix lint 2022-03-20 14:33:43 +08:00
源文雨
206a38efab fix #154: 优化代码结构 2022-03-20 14:20:37 +08:00
Coloured-glaze
cdf844be52 🎨原神抽卡 (#156)
* Add files via upload

* 原神抽卡

* 🎨原神抽卡
2022-03-20 10:59:11 +08:00
源文雨
70cc28c191 fix ci 2022-03-19 19:58:16 +08:00
源文雨
35282fba6c update data 2022-03-19 19:52:54 +08:00
源文雨
e43f8e594d Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2022-03-19 19:51:59 +08:00
源文雨
21988fab76 ⬆️ update to go 1.18 2022-03-19 19:51:45 +08:00
himawari
2f3823abe2 feat:添加舔狗日记和修复睡眠管理的问题 (#152)
* feat:添加舔狗日记和修复睡眠管理的问题

* fix:修lint

* fix:修改铅笔小说网址

* fix:修改铅笔小说网址
2022-03-19 11:29:31 +08:00
源文雨
2c545e7b7f 🎨 优化pool 2022-03-18 16:50:07 +08:00
源文雨
22f2200778 🐛 b14 panic 2022-03-15 22:50:38 +08:00
源文雨
2f63253ec0 🎨 优化代码结构 2022-03-14 12:50:50 +08:00
源文雨
be7e8134f9 🎨 优化代码结构 2022-03-14 12:46:54 +08:00
源文雨
b85408e3e5 pixiv add backend dns result 2022-03-13 22:43:41 +08:00
源文雨
4828451f9e 🔖 v1.3.2 2022-03-13 13:21:52 +08:00
源文雨
b3b50e1353 🐛 搜图 有时无法下载图片 2022-03-13 13:14:01 +08:00
源文雨
95e8bf2f55 📝 edit readme 2022-03-12 20:22:28 +08:00
源文雨
cde7669c0b 优化代码结构 2022-03-12 11:35:20 +08:00
源文雨
ff4a33c51c edit readme 2022-03-12 11:05:19 +08:00
源文雨
06cf6f84aa edit readme 2022-03-12 00:27:27 +08:00
源文雨
556f6f134f edit readme 2022-03-12 00:27:15 +08:00
源文雨
b1ab7ef118 edit readme 2022-03-12 00:25:59 +08:00
源文雨
e5fd108a9c edit readme 2022-03-12 00:25:21 +08:00
源文雨
5a67bf2417 🐛 每天刷新 2022-03-12 00:18:26 +08:00
源文雨
cb020c1bbd 🐛 每天刷新 2022-03-12 00:17:33 +08:00
源文雨
bf75b29e33 🐛 每天刷新 2022-03-12 00:16:04 +08:00
源文雨
d730fd9cab 优化代码结构 2022-03-12 00:05:41 +08:00
Jiang-Red
a862e5be7c 添加 早报插件及设置欢迎语增加更多自定义 (#147)
* 添加 早报插件

* 添加 早报插件

* 添加 早报插件

* 添加 设置欢迎语更多自定义

* 添加 help说明

* 添加 manager设置欢迎语说明

* 怪

* 🎨 改进代码样式

* Update zaobao.go

* Update zaobao.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
2022-03-11 23:47:39 +08:00
源文雨
ebca124c86 🐛 修复 run 2022-03-11 23:02:08 +08:00
源文雨
3b7803a81b 优化代码结构 2022-03-11 16:34:26 +08:00
源文雨
b7b9d92148 优化代码结构 2022-03-11 16:18:11 +08:00
Rainy
44575fb19e 增加城市疫情查询 (#146)
* 增加城市疫情查询

* 增加城市疫情查询

* 增加城市疫情查询

* 增加城市疫情查询

* 增加查询城市疫情

* 增加城市查询疫情

* 增加城市疫情查询

* Update epidemic.go

Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
2022-03-11 16:10:14 +08:00
源文雨
f181a4b9cd 🎨 可自行编辑json 2022-03-11 11:40:51 +08:00
源文雨
77e5d8b0c2 ⬆️ update deps 2022-03-11 11:36:55 +08:00
源文雨
edd9feb8f8 🔥 drop ioutil 2022-03-11 11:32:13 +08:00
源文雨
81d6a06dbe 🎨 ascii2d color -> bovw 2022-03-11 10:46:01 +08:00
源文雨
8afbc67bf7 💩👌 make lint happy 2022-03-11 10:26:29 +08:00
源文雨
a27132f907 job可获取网页信息,可代表执行 2022-03-09 12:14:20 +08:00
源文雨
183be05d82 job可编程 2022-03-08 23:18:31 +08:00
源文雨
bccf789714 job增加执行指令 2022-03-08 20:39:02 +08:00
源文雨
55944dddb3 job增加参数读取 2022-03-08 18:14:41 +08:00
源文雨
f67932cc56 job增加参数读取 2022-03-08 18:11:24 +08:00
源文雨
6d633fac6a 🐛 edit readme 2022-03-08 18:10:01 +08:00
源文雨
86fc5c51c8 job增加参数读取 2022-03-08 18:07:59 +08:00
源文雨
156e9f07ad 🐛 job禁止递归触发&增加README 2022-03-08 13:04:44 +08:00
源文雨
1ba4722fc7 💩👌 make lint happy 2022-03-07 23:27:11 +08:00
源文雨
54c9857219 🎉 job增加注入指令结果 2022-03-07 22:49:19 +08:00
源文雨
ea56c7d0d2 🐛 panic: sync: WaitGroup is reused 2022-03-07 14:43:25 +08:00
源文雨
0cbe43df97 🐛 panic: sync: WaitGroup is reused 2022-03-07 14:08:23 +08:00
源文雨
1f941d883a 🐛 panic: sync: WaitGroup is reused 2022-03-07 14:01:15 +08:00
源文雨
f5b3e423fb 🐛 panic: sync: WaitGroup is reused 2022-03-07 13:56:05 +08:00
源文雨
6c7f81ca55 🔖 1.3.1 2022-03-07 13:41:23 +08:00
源文雨
3911b5ed82 🎨 优化初始化逻辑 2022-03-07 13:40:32 +08:00
源文雨
f38f3ab69c 🐛 定时指令触发器插件增加查看 2022-03-07 13:15:26 +08:00
源文雨
846db6f063 📝 edit README 2022-03-06 22:53:59 +08:00
源文雨
ff068a05b0 🐛 定时指令触发器插件增加限速器 2022-03-06 22:52:38 +08:00
源文雨
051b7dd182 🐛 定时指令触发器插件允许非管理私聊使用 2022-03-06 22:46:12 +08:00
源文雨
11870aeed6 🐛 定时指令触发器插件在某些bot失效 2022-03-06 22:37:35 +08:00
源文雨
9bcff82d9c Update main.go 2022-03-06 21:27:19 +08:00
源文雨
309efe8cd8 增加定时指令触发器插件 2022-03-06 21:21:28 +08:00
源文雨
bf54789f0f 🎨 优化pixiv下载 2022-03-05 23:01:28 +08:00
Kanri
01e527abdb 增加六阶七阶猜单词 (#140) 2022-03-05 10:36:01 +08:00
fumiama
db6b558c75 ⬆️ update deps 2022-03-04 12:17:58 +08:00
fumiama
9a792eb144 🍱 运势增加底图 东方归言录 by @KafCoppelia 2022-03-02 22:37:41 +08:00
fumiama
44e99664a3 🎨 关键字搜图改用云函数反代 2022-03-01 23:10:10 +08:00
fumiama
9f3dd37bf0 🎨 关键字搜图改用云函数反代 2022-03-01 23:02:22 +08:00
fumiama
f5936d9cb7 🎨 某些发图应用合并转发 2022-03-01 19:47:25 +08:00
fumiama
27e69ef022 yandex与ascii2d并行 2022-03-01 17:30:59 +08:00
fumiama
6262aab6bd 替换CustomNode为ctxext的封装 2022-03-01 17:29:19 +08:00
fumiama
4781bc8eb7 sync 2022-02-27 19:34:47 +08:00
fumiama
b233c4b638 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2022-02-27 19:32:29 +08:00
fumiama
0a0cc807dc fix #139 2022-02-27 19:31:53 +08:00
github-actions[bot]
feeeb63e52 🎨 改进代码样式 2022-02-27 10:59:03 +00:00
himawari
5c620d6268 feat:添加月幕galgame网站图 (#138)
* feat:添加月幕galgame网站图

* fix:修lint

* fix:不重复更新

* fix:增加命令提醒语

* fix:增加日语匹配

* fix:换位置加锁

* fix:隐式声明

* fix:copy数组

* Update ai_tts.go

Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
2022-02-27 18:57:52 +08:00
fumiama
a469000d7a 🔖 v1.3.0 2022-02-27 15:04:09 +08:00
80 changed files with 1805 additions and 930 deletions

View File

@@ -28,7 +28,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v2.1.3
with:
go-version: 1.17
go-version: 1.18
- name: Cache downloaded module
uses: actions/cache@v2
with:

View File

@@ -8,7 +8,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -28,9 +28,6 @@ jobs:
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true then the action will use pre-installed Go.
skip-go-installation: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

View File

@@ -8,7 +8,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -18,7 +18,6 @@ jobs:
with:
version: latest
args: --issues-exit-code=0
skip-go-installation: true
- name: Commit back
continue-on-error: true
run: |

View File

@@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2

View File

@@ -1,15 +1,11 @@
linters-settings:
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*
ignore: fmt:.*
ignoretests: true
goimports:
local-prefixes: github.com/FloatTech/ZeroBot-Plugin
gocritic:
disabled-checks:
- exitAfterDefer
forbidigo:
# Forbid the following identifiers
forbid:
@@ -66,6 +62,7 @@ run:
tests: false
skip-dirs:
- order
go: '1.18'
# output configuration options
output:

View File

@@ -66,6 +66,61 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [x] /服务列表
- [x] /服务详情
- [x] @Bot 插件冲突检测 (会在本群发送一条消息并在约 1s 后撤回以检测其它同类 bot 中已启用的插件并禁用)
- **定时指令触发器** `import _ "github.com/FloatTech/zbputils/job"`
- 注意:触发器具有限速,每 2s 仅允许最多一次触发
- [x] 记录以"完全匹配关键词"触发的(代表我执行的)指令
- [x] 取消以"完全匹配关键词"触发的(代表我执行的)指令
- [x] 记录在"cron"触发的指令
- [x] 取消在"cron"触发的指令
- [x] 查看所有触发指令
- [x] 查看在"cron"触发的指令
- [x] 查看以"完全匹配关键词"触发的(代表我执行的)指令
- [x] 注入指令结果:任意指令
- [x] 执行指令:任意指令
- 注:任意指令可以使用形如`?::参数1提示语::1!`,`?::参数2提示语::2!`,`?::?可选参数3提示语不回答将填入空值::3!`,`!::从url获取的参数::4!`,`!::?可选的从url获取的参数出错将填入空值::5!`的未定参数,在注入时一一匹配
- 一些示例
> 每日9:30推送摸鱼人日历
```
记录在"30 9 * * *"触发的指令
run[CQ:image,file=https://api.vvhan.com/api/moyu]
```
> 每日12:00以1/2概率执行coser指令
```python
记录在"0 12 * * *"触发的指令
注入指令结果>runcoderaw py
from random import random
if random() > 0.5: print('coser')
else: print('今天没有coser哦~')
```
> 每日15:00询问设置定时者否想看coser
```python
记录在"0 15 * * *"触发的指令
注入指令结果>runcoderaw py
if '?::想看coser吗::1!' == '': print('coser')
else: print('好吧')
```
> 自行编写简易的选择困难症助手小插件
```python
记录以"简易的选择困难症助手"触发的指令
执行指令>runcoderaw py
from random import random
if random() > 0.5: print('您最终会选?::请输入您的选择1::1!')
else: print('您最终会选?::请输入您的选择2::2!')
简易的选择困难症助手
```
> 自行编写随机b站404页趣图插件
```python
记录以"随机b站404页趣图"触发的代表我执行的指令
注入指令结果>runcoderaw py
import json
j = json.loads(r'''!::https://api.iyk0.com/bili_chart::1!''')
print("run[CQ:image,file="+j["img"]+"]")
随机b站404页趣图
```
![随机b站404页趣图](https://user-images.githubusercontent.com/41315874/157371451-c09ad3bb-c61a-4a42-9c47-fab3305bc0f8.png)
- **渲染任意文字到图片** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font"`
- [x] (用[终末体|终末变体|紫罗兰体|樱酥体|Consolas体|苹方体])渲染文字xxx
- **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat"`
- [x] [BOT名字]
- [x] [戳一戳BOT]
@@ -93,7 +148,7 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [x] 退出群聊[群号]@Bot
- [x] *入群欢迎
- [x] *退群通知
- [x] 设置欢迎语[欢迎~]
- [x] 设置欢迎语[欢迎~] 可选添加 [{at}] [{nickname}] [{avatar}]
- [x] 在[MM]月[dd]日的[hh]点[mm]分时(用[url])提醒大家[xxx]
- [x] 在[MM]月[每周 | 周几]的[hh]点[mm]分时(用[url])提醒大家[xxx]
- [x] 取消在[MM]月[dd]日的[hh]点[mm]分的提醒
@@ -107,14 +162,17 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [ ] 同意好友请求
- [ ] 撤回[@xxx] [xxx]
- [ ] 警告[@xxx]
- [x] run[xxx]
-使用gist加群自动审批请在群介绍添加以下说明同时开启`需要回答问题并由管理员审核`加群请在github新建一个gist其文件名为本群群号的字符串的md5(小写)内容为一行是当前unix时间戳(10分钟内有效)。然后请将您的用户名和gist哈希(小写)按照username/gisthash的格式填写到回答即可。
- 设置欢迎语可选添加参数说明:{at}可在发送时艾特被欢迎者 {nickname}是被欢迎者名字 {avatar}是被欢迎者头像
- **GitHub仓库搜索** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github"`
- [x] >github [xxx]
- [x] >github -p [xxx]
- **注入指令** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject"`
- [x] run[CQ码]
- **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode"`
- [x] > runcode [language] help
- [x] > runcode [language] [code block]
- [x] > runcoderaw [language] [code block]
- **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music"`
- [x] 点歌[xxx]
- [x] 网易点歌[xxx]
@@ -125,6 +183,7 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [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/FloatTech/ZeroBot-Plugin/plugin/gif"`
@@ -140,9 +199,17 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- **摸鱼** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu"`
- [x] /启用 moyu
- [x] /禁用 moyu
```
记录在"0 10 * * *"触发的指令
摸鱼提醒
```
- **摸鱼人日历** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu_calendar"`
- [x] /启用 moyucalendar
- [x] /禁用 moyucalendar
```
记录在"30 8 * * *"触发的指令
摸鱼人日历
```
- **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime"`
- [x] 来份[涩图/二次元/风景/车万]
- [x] 添加[涩图/二次元/风景/车万][P站图片ID]
@@ -179,7 +246,10 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [x] 放大图片[图片]
- **每日运势** `import _ github.com/FloatTech/ZeroBot-Plugin/plugin/fortune`
- [x] 运势 | 抽签
- [x] 设置底图[车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师 赛马娘]
- [x] 设置底图[车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师 赛马娘 东方归言录]
- **原神抽卡** `import _ github.com/FloatTech/ZeroBot-Plugin/plugin/genshin`
- [x] 切换原神卡池
- [x] 原神十连
- **睡眠管理** `import _ github.com/FloatTech/ZeroBot-Plugin/plugin/sleep_manage`
- [x] 早安 | 晚安
- **浅草寺求签** `import _ github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji`
@@ -197,7 +267,6 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili"`
- [x] >vup info [名字 | uid]
- [x] >user info [名字 | uid]
- [x] /开启粉丝日报
- **嘉然** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana"`
- [x] 小作文
- [x] 发大病
@@ -285,8 +354,26 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- **b站视频链接解析** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili_parse"`
- [x] https://www.bilibili.com/video/BV1xx411c7BF | https://www.bilibili.com/video/av1605 | https://b23.tv/I8uzWCA | https://www.bilibili.com/video/bv1xx411c7BF
- **煎蛋网无聊图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan"`
- [x] 来份
- [x] 更新
- [x] 来份[屌|弔|吊]
- [x] 更新[屌|弔|吊]
- **月幕galgame图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal"`
- [x] 随机galCG
- [x] 随机gal表情包
- [x] galCG[xxx]
- [x] gal表情包[xxx]
- [x] 更新gal
- **城市疫情查询** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/epidemic"`
- [x] xxx疫情
- **早报** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/zaobao"`
- api早上8点更新推荐定时在8点30后。配合插件`job`中的记录在"cron"触发的指令使用
- [x] /启用 zaobao
- [x] /禁用 zaobao
- **舔狗日记** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou"`
- [x] 舔狗日记
```
记录在"00 9 * * *"触发的指令
今日早报
```
- **TODO...**
## 使用方法

2
data

Submodule data updated: f8067d8790...9fc3ca233b

40
go.mod
View File

@@ -1,28 +1,29 @@
module github.com/FloatTech/ZeroBot-Plugin
go 1.17
go 1.18
require (
github.com/FloatTech/AnimeAPI v1.3.0-beta8.0.20220227060429-ae266747b1df
github.com/FloatTech/sqlite v0.2.0
github.com/FloatTech/zbputils v1.3.0-beta8.0.20220227042832-376a84a3ea87
github.com/FloatTech/AnimeAPI v1.3.2-0.20220326161751-d0d2797b91da
github.com/FloatTech/sqlite v0.2.1
github.com/FloatTech/zbputils v1.3.2-0.20220327063325-1389d5a92fff
github.com/antchfx/htmlquery v1.2.4
github.com/corona10/goimagehash v1.0.3
github.com/fogleman/gg v1.3.0
github.com/fumiama/cron v1.3.0
github.com/fumiama/go-base16384 v1.3.0
github.com/fumiama/go-registry v0.1.0
github.com/fumiama/gofastTEA v0.0.9
github.com/fumiama/go-base16384 v1.4.0
github.com/fumiama/go-registry v0.1.1
github.com/fumiama/gofastTEA v0.0.10
github.com/fumiama/gotracemoe v0.0.3
github.com/fumiama/sqlite3 v1.14.6
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/jinzhu/gorm v1.9.16
github.com/mroth/weightedrand v0.4.1
github.com/pkumza/numcn v1.0.0
github.com/shirou/gopsutil/v3 v3.21.12
github.com/shirou/gopsutil/v3 v3.22.2
github.com/sirupsen/logrus v1.8.1
github.com/tidwall/gjson v1.13.0
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220223090418-8c5d8eccaf3a
golang.org/x/image v0.0.0-20211028202545-6944b10bf410
github.com/tidwall/gjson v1.14.0
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220326160643-893d4e910785
golang.org/x/image v0.0.0-20220321031419-a8550c1d254a
)
require (
@@ -31,25 +32,24 @@ require (
github.com/disintegration/imaging v1.6.2 // indirect
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.10 // indirect
github.com/mattn/go-sqlite3 v1.14.12 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220325203850-36772127a21f // indirect
golang.org/x/text v0.3.7 // indirect
modernc.org/libc v1.14.5 // indirect
modernc.org/libc v1.14.12 // indirect
modernc.org/mathutil v1.4.1 // indirect
modernc.org/memory v1.0.5 // indirect
modernc.org/memory v1.0.7 // indirect
)

146
go.sum
View File

@@ -1,10 +1,9 @@
github.com/FloatTech/AnimeAPI v1.3.0-beta8.0.20220227060429-ae266747b1df h1:pz6mcz4pC8hEbyygM/QX/mX7pgvQOIpYF8H940/4Z8Q=
github.com/FloatTech/AnimeAPI v1.3.0-beta8.0.20220227060429-ae266747b1df/go.mod h1:uMe7TzdyGnyRn6AzMmkvDXp+GfTTWV/vBlv6mhhP8kg=
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
github.com/FloatTech/sqlite v0.2.0 h1:x3uls/hExXH1+bbaNLkvilce6ATtWlDx4IqoxBW/bv8=
github.com/FloatTech/sqlite v0.2.0/go.mod h1:xIDWIvpOFl8AXmZm0FC8t3PZjiR6ZutytCpBv2EWCns=
github.com/FloatTech/zbputils v1.3.0-beta8.0.20220227042832-376a84a3ea87 h1:nyUTZLGUAJP/kLXx48j2qdxQBPVqaZgypjjIqpIRqwk=
github.com/FloatTech/zbputils v1.3.0-beta8.0.20220227042832-376a84a3ea87/go.mod h1:Jn5LmnwqYivr64qQJBdhDwm2gRut8Hhq5gPBydV0Gvg=
github.com/FloatTech/AnimeAPI v1.3.2-0.20220326161751-d0d2797b91da h1:KbJujP8k2/3BYRb+F292zLmDOV79uTOu/24n3fhIwRU=
github.com/FloatTech/AnimeAPI v1.3.2-0.20220326161751-d0d2797b91da/go.mod h1:aC3EOKpb0R0VOdW9QIQCfqN6ZFymOfvCgzVY1/Fz3Og=
github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U=
github.com/FloatTech/zbputils v1.3.2-0.20220327063325-1389d5a92fff h1:h72B2RgFc4ObczhlS38+seue7/6CLhQBcOAwMe3TBmw=
github.com/FloatTech/zbputils v1.3.2-0.20220327063325-1389d5a92fff/go.mod h1:qZlHzG1s1giQrXaosjOAA2utGNaPZjwJsVZfBog2bhg=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc h1:AAx50/fb/xS4lvsdQg+bFbGvqSDhyV1MF+p2PLCamZ0=
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc/go.mod h1:OMmITAib6POA37xCichWM0aRnoVpSMZO1rB/G01wrr0=
@@ -15,7 +14,6 @@ github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/corona10/goimagehash v1.0.3 h1:NZM518aKLmoNluluhfHGxT3LGOnrojrxhGn63DR/CZA=
github.com/corona10/goimagehash v1.0.3/go.mod h1:VkvE0mLn84L4aF8vCb6mafVajEb6QYMHl2ZJLn0mOGI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -33,27 +31,19 @@ github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzP
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo=
github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY=
github.com/fumiama/go-base16384 v1.3.0 h1:J5Xtwh/3alGJt/z/0IFralo5UQA89iFWQqbxj5ZQZi8=
github.com/fumiama/go-base16384 v1.3.0/go.mod h1:RGA715p34BiLoZvPRtaxuo2q25Kq9jFsgUsJb8dwy14=
github.com/fumiama/go-registry v0.1.0 h1:CIzQN9wOZKIokALyYkNIpPQ7bpzmirDua77S2BicdVE=
github.com/fumiama/go-registry v0.1.0/go.mod h1:iJT3DVgH7KXpJZs6waXEjnWtJPUBBGhF+ByJIMRfngk=
github.com/fumiama/gofastTEA v0.0.9 h1:adaWz+014vMShnLUNWIHLBs0Yv6JNUohcaXZNtct5J0=
github.com/fumiama/gofastTEA v0.0.9/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk=
github.com/fumiama/go-base16384 v1.4.0 h1:4KrtewnmAChrZjPA7/QYc72t+vvsKF+DYB0q1iRPdpo=
github.com/fumiama/go-base16384 v1.4.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
github.com/fumiama/go-registry v0.1.1 h1:cmCRizjXHFW2ApwUHCXi8wKLJ6Gtt4GrShJlamGPbVI=
github.com/fumiama/go-registry v0.1.1/go.mod h1:iJT3DVgH7KXpJZs6waXEjnWtJPUBBGhF+ByJIMRfngk=
github.com/fumiama/gofastTEA v0.0.10 h1:JJJ+brWD4kie+mmK2TkspDXKzqq0IjXm89aGYfoGhhQ=
github.com/fumiama/gofastTEA v0.0.10/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk=
github.com/fumiama/gotracemoe v0.0.3 h1:iI5EbE9A3UUbfukG6+/soYPjp1S31eCNYf4tw7s6/Jc=
github.com/fumiama/gotracemoe v0.0.3/go.mod h1:tyqahdUzHf0bQIAVY/GYmDWvYYe5ik1ZbhnGYh+zl40=
github.com/fumiama/sqlite3 v1.14.6 h1:+e+iygyiDXQJVi7xeXIviBvR7hAc5y20WA9hRwfKn10=
github.com/fumiama/sqlite3 v1.14.6/go.mod h1:Xx9a2/OtHuy9pBjow0N+bE/RhNeZ7zZz5xh25vqbA5A=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
@@ -64,16 +54,11 @@ github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4er
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
@@ -83,18 +68,8 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
@@ -103,12 +78,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-sqlite3 v1.14.10 h1:MLn+5bFRlWMGoSRmJour3CL1w/qL96mvipqpwQW/Sfk=
github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0=
github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mroth/weightedrand v0.4.1 h1:rHcbUBopmi/3x4nnrvwGJBhX9d0vk+KgoLUZeDP6YyI=
github.com/mroth/weightedrand v0.4.1/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
@@ -116,48 +87,43 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkumza/numcn v1.0.0 h1:ZT5cf9IJkUZgRgEtCiNNykk0RwsrKXSTsvDHOwUTzgE=
github.com/pkumza/numcn v1.0.0/go.mod h1:QSeH+al9dWCd8di5HZM/ZqHqhZmUKfph572e9Ev/ETc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkBTKvR5gQLgA3e0hqjkY9u1wm+iOL45VN/qI=
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/shirou/gopsutil/v3 v3.21.12 h1:VoGxEW2hpmz0Vt3wUvHIl9fquzYLNpVpgNNB7pGJimA=
github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA=
github.com/shirou/gopsutil/v3 v3.22.2 h1:wCrArWFkHYIdDxx/FSfF5RB4dpJYW6t7rcp3+zL8uks=
github.com/shirou/gopsutil/v3 v3.22.2/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY=
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=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
github.com/tidwall/gjson v1.13.0 h1:3TFY9yxOQShrvmjdM76K+jc66zJeT6D3/VFFYCGQf7M=
github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.14.0 h1:6aeJ0bzojgWLa82gDQHcx3S0Lr/O51I9bJ5nv6JFx5w=
github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
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/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220223090418-8c5d8eccaf3a h1:Mw7850zyEgIr8VO9e8iofo78maed53FclPzRiMa7aeY=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220223090418-8c5d8eccaf3a/go.mod h1:NwXIp7PgjV+kUALMXJ4v4/3QcsRSOodtjhLekuPXFog=
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220326160643-893d4e910785 h1:alVsiLOu9H0GCriAkTMqn310izMNEzg9y1Z9FqAV1DY=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220326160643-893d4e910785/go.mod h1:NwXIp7PgjV+kUALMXJ4v4/3QcsRSOodtjhLekuPXFog=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
@@ -166,12 +132,10 @@ golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 h1:kACShD3qhmr/3rLmg1yXyt+N4HcwutKyPRB93s54TIU=
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 h1:S25/rfnfsMVgORT4/J61MJ7rdyseOZOyvLIrZEZ7s6s=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20220321031419-a8550c1d254a h1:LnH9RNcpPv5Kzi15lXg42lYMPUf0x8CuPv1YnvBWZAg=
golang.org/x/image v0.0.0-20220321031419-a8550c1d254a/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -181,10 +145,8 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 h1:0FB83qp0AzVJm+0wcIlauAjJ+tNdh7jLuacRYCIVv7s=
golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
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=
@@ -197,23 +159,18 @@ 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-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/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-20220325203850-36772127a21f h1:TrmogKRsSOxRMJbLYGrB4SBbW+LJcEllYBLME5Zk5pU=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
@@ -226,22 +183,12 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
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/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
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/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
@@ -259,6 +206,7 @@ modernc.org/cc/v3 v3.35.17/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g
modernc.org/cc/v3 v3.35.18/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.20/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.22/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.24/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
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=
@@ -300,7 +248,12 @@ modernc.org/ccgo/v3 v3.13.1/go.mod h1:aBYVOUfIlcSnrsRVU8VRS35y2DIfpgkmVkYZ0tpIXi
modernc.org/ccgo/v3 v3.15.9/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0=
modernc.org/ccgo/v3 v3.15.10/go.mod h1:wQKxoFn0ynxMuCLfFD09c8XPUCc8obfchoVR9Cn0fI8=
modernc.org/ccgo/v3 v3.15.12/go.mod h1:VFePOWoCd8uDGRJpq/zfJ29D0EVzMSyID8LCMWYbX6I=
modernc.org/ccgo/v3 v3.15.14/go.mod h1:144Sz2iBCKogb9OKwsu7hQEub3EVgOlyI8wMUPGKUXQ=
modernc.org/ccgo/v3 v3.15.15/go.mod h1:z5qltXjU4PJl0pE5nhYQCvA9DhPHiWsl5GWl89+NSYE=
modernc.org/ccgo/v3 v3.15.16/go.mod h1:XbKRMeMWMdq712Tr5ECgATYMrzJ+g9zAZEj2ktzBe24=
modernc.org/ccgo/v3 v3.15.17/go.mod h1:bofnFkpRFf5gLY+mBZIyTW6FEcp26xi2lgOFk2Rlvs0=
modernc.org/ccorpus v1.11.1/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
@@ -343,16 +296,23 @@ modernc.org/libc v1.12.0/go.mod h1:2MH3DaF/gCU8i/UBiVE1VFRos4o523M7zipmwH8SIgQ=
modernc.org/libc v1.14.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk=
modernc.org/libc v1.14.2/go.mod h1:MX1GBLnRLNdvmK9azU9LCxZ5lMyhrbEMK8rG3X/Fe34=
modernc.org/libc v1.14.3/go.mod h1:GPIvQVOVPizzlqyRX3l756/3ppsAgg1QgPxjr5Q4agQ=
modernc.org/libc v1.14.5 h1:DAHvwGoVRDZs5iJXnX9RJrgXSsorupCWmJ2ac964Owk=
modernc.org/libc v1.14.5/go.mod h1:2PJHINagVxO4QW/5OQdRrvMYo+bm5ClpUFfyXCYl9ak=
modernc.org/libc v1.14.6/go.mod h1:2PJHINagVxO4QW/5OQdRrvMYo+bm5ClpUFfyXCYl9ak=
modernc.org/libc v1.14.7/go.mod h1:f8xfWXW8LW41qb4X5+huVQo5dcfPlq7Cbny2TDheMv0=
modernc.org/libc v1.14.8/go.mod h1:9+JCLb1MWSY23smyOpIPbd5ED+rSS/ieiDWUpdyO3mo=
modernc.org/libc v1.14.10/go.mod h1:y1MtIWhwpJFpLYm6grAThtuXJKEsY6xkdZmXbRngIdo=
modernc.org/libc v1.14.12 h1:pUBZTYoISfbb4pCf4PECENpbvwDBxeKc+/dS9LyOWFM=
modernc.org/libc v1.14.12/go.mod h1:fJdoe23MHu2ruPQkFPPqCpToDi5cckzsbmkI6Ez0LqQ=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.0.4/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/memory v1.0.6/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw=
modernc.org/memory v1.0.7 h1:UE3cxTRFa5tfUibAV7Jqq8P7zRY0OlJg+yWVIIaluEE=
modernc.org/memory v1.0.7/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=

45
kanban/banner.go Normal file
View File

@@ -0,0 +1,45 @@
package kanban
import (
"fmt"
"strings"
"github.com/fumiama/go-registry"
)
var (
info = [...]string{
"* OneBot + ZeroBot + Golang",
"* Version 1.3.2 - 2022-03-13 13:21:15 +0800 CST",
"* Copyright © 2020 - 2022 FloatTech. All Rights Reserved.",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}
// Banner ...
Banner = strings.Join(info[:], "\n")
reg = registry.NewRegReader("reilia.westeurope.cloudapp.azure.com:32664", "fumiama")
)
// PrintBanner ...
func PrintBanner() {
fmt.Print(
"\n======================[ZeroBot-Plugin]======================",
"\n", Banner, "\n",
"----------------------[ZeroBot-公告栏]----------------------",
"\n", Kanban(), "\n",
"============================================================\n\n",
)
}
// Kanban ...
func Kanban() string {
err := reg.Connect()
if err != nil {
return err.Error()
}
defer reg.Close()
text, err := reg.Get("ZeroBot-Plugin/kanban")
if err != nil {
return err.Error()
}
return text
}

6
kanban/init.go Normal file
View File

@@ -0,0 +1,6 @@
// Package kanban 打印版本信息
package kanban
func init() {
PrintBanner()
}

55
main.go
View File

@@ -5,9 +5,10 @@ import (
"fmt"
"math/rand"
"os"
"strings"
"time"
"github.com/FloatTech/ZeroBot-Plugin/kanban" // 在最前打印 banner
// ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- //
// ----------------------插件优先级按顺序从高到低---------------------- //
// //
@@ -34,6 +35,8 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus" // 词典匹配回复
_ "github.com/FloatTech/zbputils/job" // 定时指令触发器
// ^^^^ //
// ^^^^^^^^^^^^^^ //
// ^^^^^^^高优先级区^^^^^^^ //
@@ -69,12 +72,16 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/drift_bottle" // 漂流瓶
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/epidemic" // 城市疫情查询
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/image_finder" // 关键字搜图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi" // 绝绝子生成器
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片
@@ -95,11 +102,14 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtb_quotation" // vtb语录
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun" // 网易云音乐热评
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordle" // 猜单词
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/zaobao" // 早报
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili_push" // b站推送
@@ -138,8 +148,7 @@ import (
// //
// //
// -----------------------以下为内置依赖,勿动------------------------ //
"github.com/FloatTech/zbputils/control/order"
"github.com/fumiama/go-registry"
"github.com/FloatTech/zbputils/process"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/driver"
@@ -148,19 +157,11 @@ import (
)
var (
contents = []string{
"* OneBot + ZeroBot + Golang",
"* Version 1.3.0 - 2022-02-09 14:31:34 +0800 CST",
"* Copyright © 2020 - 2021 FloatTech. All Rights Reserved.",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}
nicks = []string{"ATRI", "atri", "亚托莉", "アトリ"}
banner = strings.Join(contents, "\n")
token *string
url *string
adana *string
prefix *string
reg = registry.NewRegReader("reilia.fumiama.top:32664", "fumiama")
)
func init() {
@@ -181,7 +182,7 @@ func init() {
flag.Parse()
if *h {
printBanner()
kanban.PrintBanner()
fmt.Println("Usage:")
flag.PrintDefaults()
os.Exit(0)
@@ -198,41 +199,16 @@ func init() {
// webctrl.InitGui(*g)
}
func printBanner() {
fmt.Print(
"\n======================[ZeroBot-Plugin]======================",
"\n", banner, "\n",
"----------------------[ZeroBot-公告栏]----------------------",
"\n", getKanban(), "\n",
"============================================================\n",
)
}
func getKanban() string {
err := reg.Connect()
if err != nil {
return err.Error()
}
defer reg.Close()
text, err := reg.Get("ZeroBot-Plugin/kanban")
if err != nil {
return err.Error()
}
return text
}
func main() {
order.Wait()
printBanner()
rand.Seed(time.Now().UnixNano()) // 全局 seed其他插件无需再 seed
// 帮助
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(banner, "\n可发送\"/服务列表\"查看 bot 功能"))
ctx.SendChain(message.Text(kanban.Banner, "\n可发送\"/服务列表\"查看 bot 功能"))
})
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(getKanban()))
ctx.SendChain(message.Text(kanban.Kanban()))
})
zero.RunAndBlock(
zero.Config{
@@ -243,5 +219,6 @@ func main() {
SuperUsers: flag.Args(), // 通过命令行参数的方式添加主人账号
Driver: []zero.Driver{driver.NewWebSocketClient(*url, *token)},
},
process.GlobalInitMutex.Unlock,
)
}

View File

@@ -65,7 +65,7 @@ func init() { // 插件主体
}
})
// 直接随机图片无r18保护后果自负。如果出r18图可尽快通过发送"太涩了"撤回
engine.OnFullMatch("直接随机", ctxext.UserOrGrpAdmin).SetBlock(true).
engine.OnFullMatch("直接随机", zero.UserOrGrpAdmin).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if block {
ctx.SendChain(message.Text("请稍后再试哦"))
@@ -77,7 +77,13 @@ func init() { // 插件主体
} else {
url = randapi
}
setLastMsg(ctx.Event.GroupID, ctx.SendChain(message.Image(url).Add("cache", "0")))
setLastMsg(ctx.Event.GroupID, message.NewMessageID(
ctx.SendGroupForwardMessage(ctx.Event.GroupID,
message.Message{
ctxext.FakeSenderForwardNode(ctx,
message.Image(url).Add("cache", "0"),
),
}).Get("message_id").String()))
block = false
}
})
@@ -91,7 +97,7 @@ func init() { // 插件主体
}
})
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, zero.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中..."))
url := ctx.State["image_url"].([]string)[0]
@@ -149,9 +155,19 @@ func reply(ctx *zero.Ctx, class int, dhash string, comment string) error {
}
} else {
send = func(msg interface{}) int64 {
return ctx.Send(append(msg.(message.Message), message.Text(comment))).ID()
return ctx.SendGroupForwardMessage(ctx.Event.GroupID, message.Message{
ctxext.FakeSenderForwardNode(ctx, append(
msg.(message.Message),
message.Text(comment))...,
),
}).Get("message_id").Int()
}
}
return pool.SendRemoteImageFromPool(b14, u, send, ctxext.GetMessage(ctx))
return pool.SendRemoteImageFromPool(b14, u, send, func(i int64) zero.Message {
if class > 5 {
return ctxext.GetMessage(ctx)(i)
}
return ctxext.GetFirstMessageInForward(ctx)(i)
})
}

View File

@@ -4,6 +4,7 @@ import (
"errors"
"regexp"
"strconv"
"sync"
"github.com/pkumza/numcn"
log "github.com/sirupsen/logrus"
@@ -38,18 +39,26 @@ var (
)
type ttsInstances struct {
sync.RWMutex
m map[string]tts.TTS
l []string
}
func (t *ttsInstances) List() []string {
return t.l
t.RLock()
cl := make([]string, len(t.l))
_ = copy(cl, t.l)
t.RUnlock()
return cl
}
func init() {
engine := control.Register(ttsServiceName, order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "语音回复(包括拟声鸟和百度)\n- @Bot 任意文本(任意一句话回复)\n- 设置语音模式拟声鸟阿梓 | 设置语音模式拟声鸟药水哥 | 设置语音模式百度女声 | 设置语音模式百度男声| 设置语音模式百度度逍遥 | 设置语音模式百度度丫丫",
DisableOnDefault: true,
Help: "语音回复(包括拟声鸟和百度)\n" +
"- @Bot 任意文本(任意一句话回复)\n" +
"- 设置语音模式[拟声鸟阿梓 | 拟声鸟药水哥 | 百度女声 | 百度男声| 百度度逍遥 | 百度度丫丫]\n" +
"- 设置默认语音模式[拟声鸟阿梓 | 拟声鸟药水哥 | 百度女声 | 百度男声| 百度度逍遥 | 百度度丫丫]\n",
})
engine.OnMessage(zero.OnlyToMe).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
@@ -78,7 +87,13 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(err))
return
}
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("成功"))
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("设置成功,当前模式为", param))
})
engine.OnRegex(`^设置默认语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
param := ctx.State["regex_matched"].([]string)[1]
t.setDefaultSoundMode(param)
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("设置成功,默认模式为", param))
})
}
@@ -93,12 +108,14 @@ func (t *ttsInstances) setSoundMode(ctx *zero.Ctx, name string) error {
gid = -ctx.Event.UserID
}
var index int64
t.RLock()
for i, s := range t.l {
if s == name {
index = int64(i)
break
}
}
t.RUnlock()
m, ok := control.Lookup(ttsServiceName)
if !ok {
return errors.New("no such plugin")
@@ -113,6 +130,8 @@ func (t *ttsInstances) getSoundMode(ctx *zero.Ctx) (name string) {
}
m, ok := control.Lookup(ttsServiceName)
if ok {
t.RLock()
defer t.RUnlock()
index := m.GetData(gid)
if int(index) < len(t.l) {
return t.l[index]
@@ -120,3 +139,18 @@ func (t *ttsInstances) getSoundMode(ctx *zero.Ctx) (name string) {
}
return "拟声鸟阿梓"
}
func (t *ttsInstances) setDefaultSoundMode(name string) {
var index int
t.RLock()
for _, s := range t.l {
if s == name {
break
}
index++
}
t.RUnlock()
t.Lock()
t.l[0], t.l[index] = t.l[index], t.l[0]
t.Unlock()
}

View File

@@ -23,9 +23,9 @@ func init() {
en.OnRegex(`^加密\s?(.*)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es, err := base14.UTF16be2utf8(base14.EncodeString(str))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(es)))
es := base14.EncodeString(str)
if es != "" {
ctx.SendChain(message.Text(es))
} else {
ctx.SendChain(message.Text("加密失败!"))
}
@@ -33,9 +33,9 @@ func init() {
en.OnRegex(`^解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es, err := base14.UTF82utf16be(helper.StringToBytes(str))
if err == nil {
ctx.SendChain(message.Text(base14.DecodeString(es)))
es := base14.DecodeString(str)
if es != "" {
ctx.SendChain(message.Text(es))
} else {
ctx.SendChain(message.Text("解密失败!"))
}
@@ -44,7 +44,7 @@ func init() {
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
es, err := base14.UTF16be2utf8(base14.Encode(t.Encrypt(helper.StringToBytes(str))))
es, err := base14.UTF16BE2UTF8(base14.Encode(t.Encrypt(helper.StringToBytes(str))))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(es)))
} else {
@@ -55,7 +55,7 @@ func init() {
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
es, err := base14.UTF82utf16be(helper.StringToBytes(str))
es, err := base14.UTF82UTF16BE(helper.StringToBytes(str))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(t.Decrypt(base14.Decode(es)))))
} else {

View File

@@ -1,165 +0,0 @@
package bilibili
import (
"encoding/json"
"net/http"
"time"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/zbputils/control/order"
)
type follower struct {
Mid int `json:"mid"`
Uname string `json:"uname"`
Video int `json:"video"`
Roomid int `json:"roomid"`
Rise int `json:"rise"`
Follower int `json:"follower"`
GuardNum int `json:"guardNum"`
AreaRank int `json:"areaRank"`
}
// 开启日报推送
func init() {
fansDaily()
en := control.Register("fansdaily", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "fansdaily\n- /开启粉丝日报\n- /关闭粉丝日报",
})
zero.OnCommand("开启粉丝日报", zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
m, ok := control.Lookup("fansdaily")
if ok {
if m.IsEnabledIn(ctx.Event.GroupID) {
ctx.Send(message.Text("已启用!"))
} else {
m.Enable(ctx.Event.GroupID)
ctx.Send(message.Text("添加成功!"))
}
} else {
ctx.Send(message.Text("找不到该服务!"))
}
})
en.OnCommand("关闭粉丝日报", zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
m, ok := control.Lookup("fansdaily")
if ok {
if m.IsEnabledIn(ctx.Event.GroupID) {
m.Disable(ctx.Event.GroupID)
ctx.Send(message.Text("关闭成功!"))
} else {
ctx.Send(message.Text("未启用!"))
}
} else {
ctx.Send(message.Text("找不到该服务!"))
}
})
}
// 定时任务每天晚上最后2分钟执行一次
func fansDaily() {
_, err := process.CronTab.AddFunc("58 23 * * *", func() { sendNotice() })
if err != nil {
panic(err)
}
}
// 获取数据拼接消息链并发送
func getMsg() message.MessageSegment {
var (
diana = fansapi("672328094")
ava = fansapi("672346917")
eileen = fansapi("672342685")
bella = fansapi("672353429")
carol = fansapi("351609538")
)
return message.Text(
time.Now().Format("2006-01-02"), " Asoul全团粉丝日报如下", "\n\n",
"uid: ", diana.Mid, "\n",
"名字: ", diana.Uname, "\n",
"当前粉丝数: ", diana.Follower, "\n",
"今日涨粉数: ", diana.Rise, "\n",
"视频投稿数: ", diana.Video, "\n",
"直播间id: ", diana.Roomid, "\n",
"舰队: ", diana.GuardNum, "\n",
"直播总排名: ", diana.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", "672328094", "\n\n",
"uid: ", ava.Mid, "\n",
"名字: ", ava.Uname, "\n",
"当前粉丝数: ", ava.Follower, "\n",
"今日涨粉数: ", ava.Rise, "\n",
"视频投稿数: ", ava.Video, "\n",
"直播间id: ", ava.Roomid, "\n",
"舰队: ", ava.GuardNum, "\n",
"直播总排名: ", ava.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", "672346917", "\n\n",
"uid: ", eileen.Mid, "\n",
"名字: ", eileen.Uname, "\n",
"当前粉丝数: ", eileen.Follower, "\n",
"今日涨粉数: ", eileen.Rise, "\n",
"视频投稿数: ", eileen.Video, "\n",
"直播间id: ", eileen.Roomid, "\n",
"舰队: ", eileen.GuardNum, "\n",
"直播总排名: ", eileen.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", "672342685", "\n\n",
"uid: ", bella.Mid, "\n",
"名字: ", bella.Uname, "\n",
"当前粉丝数: ", bella.Follower, "\n",
"今日涨粉数: ", bella.Rise, "\n",
"视频投稿数: ", bella.Video, "\n",
"直播间id: ", bella.Roomid, "\n",
"舰队: ", bella.GuardNum, "\n",
"直播总排名: ", bella.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", "672353429", "\n\n",
"uid: ", carol.Mid, "\n",
"名字: ", carol.Uname, "\n",
"当前粉丝数: ", carol.Follower, "\n",
"今日涨粉数: ", carol.Rise, "\n",
"视频投稿数: ", carol.Video, "\n",
"直播间id: ", carol.Roomid, "\n",
"舰队: ", carol.GuardNum, "\n",
"直播总排名: ", carol.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", "351609538",
)
}
// 获取数据拼接消息链并发送
func sendNotice() {
m, ok := control.Lookup("fansdaily")
if ok {
msg := getMsg()
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, g := range ctx.GetGroupList().Array() {
grp := g.Get("group_id").Int()
if m.IsEnabledIn(grp) {
ctx.SendGroupMessage(grp, msg)
}
}
return true
})
}
}
// 请求api
func fansapi(uid string) *follower {
url := "https://api.vtbs.moe/v1/detail/" + uid
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result := &follower{}
if err := json.NewDecoder(resp.Body).Decode(result); err != nil {
panic(err)
}
return result
}

View File

@@ -2,7 +2,7 @@
package bilibili
import (
"io/ioutil"
"io"
"net/http"
control "github.com/FloatTech/zbputils/control"
@@ -27,7 +27,7 @@ func init() {
keyword := ctx.State["regex_matched"].([]string)[1]
rest, err := uid(keyword)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
id := rest.Get("data.result.0.mid").String()
@@ -36,20 +36,20 @@ func init() {
client := &http.Client{}
req, err := http.NewRequest(method, url, nil)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
req.Header.Add("cookie", "CURRENT_FNVAL=80; _uuid=772B88E8-3ED1-D589-29BB-F6CB5214239A06137infoc; blackside_state=1; bfe_id=6f285c892d9d3c1f8f020adad8bed553; rpdid=|(umY~Jkl|kJ0J'uYkR|)lu|); fingerprint=0ec2b1140fb30b56d7b5e415bc3b5fb1; buvid_fp=C91F5265-3DF4-4D5A-9FF3-C546370B14C0143096infoc; buvid_fp_plain=C91F5265-3DF4-4D5A-9FF3-C546370B14C0143096infoc; SESSDATA=9e0266f6%2C1639637127%2Cb0172%2A61; bili_jct=96ddbd7e22d527abdc0501339a12d4d3; DedeUserID=695737880; DedeUserID__ckMd5=0117660e75db7b01; sid=5labuhaf; PVID=1; bfe_id=1e33d9ad1cb29251013800c68af42315")
res, err := client.Do(req)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
data := string(body)

View File

@@ -1,11 +1,12 @@
package bilibili
import (
"encoding/json"
"errors"
"io/ioutil"
"net/http"
"time"
"github.com/FloatTech/zbputils/web"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -18,42 +19,67 @@ func init() {
keyword := ctx.State["regex_matched"].([]string)[1]
res, err := uid(keyword)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
id := res.Get("data.result.0.mid").String()
// 获取详情
json := fansapi(id)
fo, err := fansapi(id)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Text(
"uid: ", json.Mid, "\n",
"名字: ", json.Uname, "\n",
"当前粉丝数: ", json.Follower, "\n",
"24h涨粉数: ", json.Rise, "\n",
"视频投稿数: ", json.Video, "\n",
"直播间id: ", json.Roomid, "\n",
"舰队: ", json.GuardNum, "\n",
"直播总排名: ", json.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", json.Mid, "\n",
"uid: ", fo.Mid, "\n",
"名字: ", fo.Uname, "\n",
"当前粉丝数: ", fo.Follower, "\n",
"24h涨粉数: ", fo.Rise, "\n",
"视频投稿数: ", fo.Video, "\n",
"直播间id: ", fo.Roomid, "\n",
"舰队: ", fo.GuardNum, "\n",
"直播总排名: ", fo.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", fo.Mid, "\n",
"数据获取时间: ", time.Now().Format("2006-01-02 15:04:05"),
))
})
}
// 搜索api通过把触发指令传入的昵称找出uid返回
func uid(keyword string) (gjson.Result, error) {
func uid(keyword string) (*gjson.Result, error) {
api := "http://api.bilibili.com/x/web-interface/search/type?search_type=bili_user&&user_type=1&keyword=" + keyword
resp, err := http.Get(api)
data, err := web.GetData(api)
if err != nil {
return gjson.Result{}, err
return nil, err
}
if resp.StatusCode != http.StatusOK {
return gjson.Result{}, errors.New("code not 200")
}
data, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close()
json := gjson.ParseBytes(data)
if json.Get("data.numResults").Int() == 0 {
return gjson.Result{}, errors.New("查无此人")
return nil, errors.New("查无此人")
}
return json, nil
return &json, nil
}
type follower struct {
Mid int `json:"mid"`
Uname string `json:"uname"`
Video int `json:"video"`
Roomid int `json:"roomid"`
Rise int `json:"rise"`
Follower int `json:"follower"`
GuardNum int `json:"guardNum"`
AreaRank int `json:"areaRank"`
}
// 请求api
func fansapi(uid string) (*follower, error) {
url := "https://api.vtbs.moe/v1/detail/" + uid
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
result := &follower{}
if err := json.NewDecoder(resp.Body).Decode(result); err != nil {
return nil, err
}
return result, nil
}

View File

@@ -18,7 +18,6 @@ import (
"github.com/FloatTech/zbputils/binary"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/zbputils/web"
)
@@ -75,12 +74,11 @@ func init() {
go func() {
dbpath := en.DataFolder()
dbfile := dbpath + "push.db"
defer order.DoneOnExit()()
bdb = initialize(dbfile)
log.Println("[bilibilipush]加载bilibilipush数据库")
}()
en.OnRegex(`^添加订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^添加订阅\s?(\d+)$`, zero.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@@ -106,7 +104,7 @@ func init() {
ctx.SendChain(message.Text("已添加" + name + "的订阅"))
}
})
en.OnRegex(`^取消订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^取消订阅\s?(\d+)$`, zero.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@@ -132,7 +130,7 @@ func init() {
ctx.SendChain(message.Text("已取消" + name + "的订阅"))
}
})
en.OnRegex(`^取消动态订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^取消动态订阅\s?(\d+)$`, zero.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@@ -158,7 +156,7 @@ func init() {
ctx.SendChain(message.Text("已取消" + name + "的动态订阅"))
}
})
en.OnRegex(`^取消直播订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^取消直播订阅\s?(\d+)$`, zero.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@@ -184,7 +182,7 @@ func init() {
ctx.SendChain(message.Text("已取消" + name + "的直播订阅"))
}
})
en.OnFullMatch("推送列表", ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
en.OnFullMatch("推送列表", zero.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID
@@ -216,7 +214,7 @@ func init() {
log.Errorln("[bilibilipush]:", err)
}
if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
})
}
@@ -232,7 +230,7 @@ func bilibiliPushDaily() {
}
func checkBuid(buid int64) (status int, name string) {
data, err := web.ReqWith(fmt.Sprintf(infoURL, buid), "GET", referer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", referer, ua)
if err != nil {
log.Errorln("[bilibilipush]:", err)
}
@@ -290,7 +288,7 @@ func unsubscribeLive(buid, groupid int64) (err error) {
}
func getUserDynamicCard(buid int64) (cardList []gjson.Result) {
data, err := web.ReqWith(fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua)
if err != nil {
log.Errorln("[bilibilipush]:", err)
}

View File

@@ -23,7 +23,6 @@ func init() {
go func() {
dbpath := engine.DataFolder()
db.DBPath = dbpath + "bookreview.db"
defer order.DoneOnExit()()
// os.RemoveAll(dbpath)
_, _ = file.GetLazyData(db.DBPath, false, true)
err := db.Create("bookreview", &book{})
@@ -46,7 +45,7 @@ func init() {
log.Println("err:", err)
}
if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
})
@@ -58,7 +57,7 @@ func init() {
log.Println("err:", err)
}
if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
})
}

View File

@@ -21,7 +21,6 @@ func init() {
go func() {
dbpath := en.DataFolder()
db.DBPath = dbpath + "cxh.db"
defer order.DoneOnExit()()
// os.RemoveAll(dbpath)
_, _ = file.GetLazyData(db.DBPath, false, true)
err := db.Create("pinyin", &pinyin{})

View File

@@ -2,6 +2,8 @@
package coser
import (
"regexp"
"github.com/tidwall/gjson"
log "github.com/sirupsen/logrus"
@@ -19,6 +21,7 @@ import (
var (
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
coserURL = "http://ovooa.com/API/cosplay/api.php"
datestr = regexp.MustCompile(`/\d{4}-\d{2}-\d{2}/`)
)
func init() {
@@ -28,34 +31,28 @@ func init() {
}).ApplySingle(ctxext.DefaultSingle).OnFullMatch("coser", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByGroup).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中......"))
data, err := web.ReqWith(coserURL, "GET", "", ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), coserURL, "GET", "", ua)
if err != nil {
log.Println("err为:", err)
}
var m message.Message
text := gjson.Get(helper.BytesToString(data), "data.Title").String()
m = append(m,
message.CustomNode(
ctx.Event.Sender.NickName,
ctx.Event.UserID,
text,
))
m := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Text(text))}
ds := ""
gjson.Get(helper.BytesToString(data), "data.data").ForEach(func(_, value gjson.Result) bool {
m = append(m,
message.CustomNode(
ctx.Event.Sender.NickName,
ctx.Event.UserID,
[]message.MessageSegment{
message.Image(value.String()),
}),
)
if ds == "" {
ds = datestr.FindString(value.String())
} else if ds != datestr.FindString(value.String()) {
return false
}
m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Image(value.String())))
return true
})
if id := ctx.SendGroupForwardMessage(
ctx.Event.GroupID,
m).Get("message_id").Int(); id == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控"))
ctx.SendChain(message.Text("ERROR:可能被风控或下载图片用时过长,请耐心等待"))
}
})
}

View File

@@ -9,7 +9,6 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/math"
@@ -26,7 +25,6 @@ func init() {
go func() {
dbpath := engine.DataFolder()
db.DBPath = dbpath + "cp.db"
defer order.DoneOnExit()()
// os.RemoveAll(dbpath)
_, _ = file.GetLazyData(db.DBPath, false, true)
err := db.Create("cp_story", &cpstory{})
@@ -42,8 +40,8 @@ func init() {
engine.OnRegex("^组cp.*?(\\d+).*?(\\d+)", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
cs := getRandomCpStory()
gong := ctxext.CardOrNickName(ctx, math.Str2Int64(ctx.State["regex_matched"].([]string)[1]))
shou := ctxext.CardOrNickName(ctx, math.Str2Int64(ctx.State["regex_matched"].([]string)[2]))
gong := ctx.CardOrNickName(math.Str2Int64(ctx.State["regex_matched"].([]string)[1]))
shou := ctx.CardOrNickName(math.Str2Int64(ctx.State["regex_matched"].([]string)[2]))
text := strings.ReplaceAll(cs.Story, "<攻>", gong)
text = strings.ReplaceAll(text, "<受>", shou)
text = strings.ReplaceAll(text, cs.Gong, gong)

View File

@@ -29,7 +29,6 @@ func init() {
go func() {
dbpath := engine.DataFolder()
db.DBPath = dbpath + "curse.db"
defer order.DoneOnExit()()
_, err := file.GetLazyData(db.DBPath, false, true)
if err != nil {
panic(err)

View File

@@ -8,7 +8,6 @@ import (
"github.com/FloatTech/AnimeAPI/danbooru"
"github.com/FloatTech/AnimeAPI/saucenao"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img/writer"
zero "github.com/wdvxdr1123/ZeroBot"
@@ -29,7 +28,7 @@ func init() { // 插件主体
cachefolder := engine.DataFolder()
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, zero.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中..."))
for _, url := range ctx.State["image_url"].([]string) {

View File

@@ -26,7 +26,6 @@ func init() {
go func() {
datapath := engine.DataFolder()
dbfile := datapath + "text.db"
defer order.DoneOnExit()()
data.LoadText(dbfile)
}()
@@ -47,7 +46,7 @@ func init() {
Handle(func(ctx *zero.Ctx) {
err := data.AddText(ctx.State["regex_matched"].([]string)[1])
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
} else {
ctx.SendChain(message.Text("记住啦!"))
}

View File

@@ -8,7 +8,6 @@ import (
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -51,7 +50,7 @@ func init() {
err = newBottle(
ctx.Event.UserID,
grp,
ctxext.CardOrNickName(ctx, ctx.Event.UserID),
ctx.CardOrNickName(ctx.Event.UserID),
msg,
).throw(sea, channel)
if err != nil {

127
plugin/epidemic/epidemic.go Normal file
View File

@@ -0,0 +1,127 @@
// Package epidemic 城市疫情查询
package epidemic
import (
"encoding/json"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/zbputils/binary"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/web"
)
const (
servicename = "epidemic"
txurl = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"
)
// result 疫情查询结果
type result struct {
Data string `json:"data"`
}
// epidemic 疫情数据
type epidemic struct {
LastUpdateTime string `json:"lastUpdateTime"`
AreaTree []*area `json:"areaTree"`
}
// area 城市疫情数据
type area struct {
Name string `json:"name"`
Today struct {
Confirm int `json:"confirm"`
Wzzadd int `json:"wzz_add"`
} `json:"today"`
Total struct {
NowConfirm int `json:"nowConfirm"`
Confirm int `json:"confirm"`
Dead int `json:"dead"`
Heal int `json:"heal"`
Grade string `json:"grade"`
Wzz int `json:"wzz"`
} `json:"total"`
Children []*area `json:"children"`
}
func init() {
engine := control.Register(servicename, order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "城市疫情查询\n" +
"- xxx疫情\n",
})
engine.OnSuffix("疫情").SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
city := ctx.State["args"].(string)
if city == "" {
ctx.SendChain(message.Text("你还没有输入城市名字呢!"))
return
}
data, time, err := queryEpidemic(city)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
if data == nil {
ctx.SendChain(message.Text("没有找到【", city, "】城市的疫情数据."))
return
}
ctx.SendChain(
message.Text(
"【", data.Name, "】疫情数据\n",
"新增人数:", data.Today.Confirm, "\n",
"现有确诊:", data.Total.NowConfirm, "\n",
"累计确诊:", data.Total.Confirm, "\n",
"治愈人数:", data.Total.Heal, "\n",
"死亡人数:", data.Total.Dead, "\n",
"无症状人数:", data.Total.Wzz, "\n",
"新增无症状:", data.Today.Wzzadd, "\n",
"更新时间:\n『", time, "』",
),
)
})
}
// rcity 查找城市
func rcity(a *area, cityName string) *area {
if a == nil {
return nil
}
if a.Name == cityName {
return a
}
for _, v := range a.Children {
if v.Name == cityName {
return v
}
c := rcity(v, cityName)
if c != nil {
return c
}
}
return nil
}
// queryEpidemic 查询城市疫情
func queryEpidemic(findCityName string) (citydata *area, times string, err error) {
data, err := web.GetData(txurl)
if err != nil {
return
}
var r result
err = json.Unmarshal(data, &r)
if err != nil {
return
}
var e epidemic
err = json.Unmarshal(binary.StringToBytes(r.Data), &e)
if err != nil {
return
}
citydata = rcity(e.AreaTree[0], findCityName)
return citydata, e.LastUpdateTime, nil
}

43
plugin/font/main.go Normal file
View File

@@ -0,0 +1,43 @@
// Package font 渲染任意文字到图片
package font
import (
"github.com/FloatTech/zbputils/binary"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/img/text"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() {
control.Register("font", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "渲染任意文字到图片\n- (用[终末体|终末变体|紫罗兰体|樱酥体|Consolas体|苹方体])渲染文字xxx",
}).OnRegex(`^(用.+)?渲染文字([\s\S]+)$`).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
fnt := ctx.State["regex_matched"].([]string)[1]
txt := ctx.State["regex_matched"].([]string)[2]
switch fnt {
case "用终末体":
fnt = text.SyumatuFontFile
case "用终末变体":
fnt = text.NisiFontFile
case "用紫罗兰体":
fnt = text.VioletEvergardenFontFile
case "用樱酥体":
fnt = text.SakuraFontFile
case "用Consolas体":
fnt = text.ConsolasFontFile
case "用苹方体":
default:
fnt = text.FontFile
}
b, err := text.RenderToBase64(txt, fnt, 400, 20)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Image("base64://" + binary.BytesToString(b)))
})
}

View File

@@ -42,7 +42,7 @@ const (
var (
// 底图类型列表
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹", "李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想", "战双", "阴阳师", "赛马娘"}
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹", "李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想", "战双", "阴阳师", "赛马娘", "东方归言录"}
// 映射底图与 index
index = make(map[string]uint8)
// 签文
@@ -55,11 +55,10 @@ func init() {
DisableOnDefault: false,
Help: "每日运势: \n" +
"- 运势 | 抽签\n" +
"- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘]",
"- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘 | 东方归言录]",
PublicDataFolder: "Fortune",
})
go func() {
defer order.DoneOnExit()()
for i, s := range table {
index[s] = uint8(i)
}
@@ -126,7 +125,7 @@ func init() {
zipfile := images + kind + ".zip"
_, err := file.GetLazyData(zipfile, false, false)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
@@ -137,7 +136,7 @@ func init() {
// 随机获取背景
background, index, err := randimage(zipfile, seed)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
@@ -156,7 +155,7 @@ func init() {
return err
}, ctxext.Send(ctx), ctxext.GetMessage(ctx))
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
})

View File

@@ -34,7 +34,6 @@ func init() {
go func() {
dbpath := en.DataFolder()
db.DBPath = dbpath + "jokes.db"
defer order.DoneOnExit()()
_, err := file.GetLazyData(db.DBPath, false, true)
if err != nil {
panic(err)
@@ -49,7 +48,7 @@ func init() {
en.OnPrefix("讲个笑话").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
// 获取名字
name := ctxext.NickName(ctx)
name := ctx.NickName()
var j joke
err := db.Pick("jokes", &j)
if err != nil {

16
plugin/genshin/data.go Normal file
View File

@@ -0,0 +1,16 @@
package genshin
type storage uint64
func (s *storage) is5starsmode() bool {
return *s&1 == 1
}
func (s *storage) setmode(is5stars bool) bool {
if is5stars {
*s |= 1
} else {
*s &= 0xffffffff_fffffffe
}
return is5stars
}

343
plugin/genshin/ys.go Normal file
View File

@@ -0,0 +1,343 @@
// Package genshin 原神抽卡
package genshin
import (
"archive/zip"
"image"
"image/color"
"image/draw"
"image/jpeg"
"image/png"
"math/rand"
"strings"
"sync/atomic"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img/writer"
"github.com/FloatTech/zbputils/process"
"github.com/golang/freetype"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
type zipfilestructure map[string][]*zip.File
var (
totl uint64 // 累计抽奖次数
filetree = make(zipfilestructure, 32)
starN3, starN4, starN5 *zip.File
)
func init() {
engine := control.Register("genshin", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "原神抽卡\n- 原神十连\n- 切换原神卡池",
PublicDataFolder: "Genshin",
}).ApplySingle(ctxext.DefaultSingle)
go func() {
zipfile := engine.DataFolder() + "Genshin.zip"
_, err := file.GetLazyData(zipfile, false, false)
if err != nil {
panic(err)
}
err = parsezip(zipfile)
if err != nil {
panic(err)
}
}()
engine.OnFullMatch("切换原神卡池").SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
c, ok := control.Lookup("genshin")
if !ok {
ctx.SendChain(message.Text("找不到服务!"))
return
}
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID
}
store := (storage)(c.GetData(gid))
if store.setmode(!store.is5starsmode()) {
process.SleepAbout1sTo2s()
ctx.SendChain(message.Text("切换到五星卡池~"))
} else {
process.SleepAbout1sTo2s()
ctx.SendChain(message.Text("切换到普通卡池~"))
}
err := c.SetData(gid, int64(store))
if err != nil {
process.SleepAbout1sTo2s()
ctx.SendChain(message.Text("ERROR:", err))
}
})
engine.OnFullMatch("原神十连").SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
c, ok := control.Lookup("genshin")
if !ok {
ctx.SendChain(message.Text("找不到服务!"))
return
}
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID
}
store := (storage)(c.GetData(gid))
img, err := randnums(10, store)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
b, cl := writer.ToBytes(img)
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.ImageBytes(b)))
cl()
})
}
func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
var (
fours, fives = make([]*zip.File, 0, 10), make([]*zip.File, 0, 10) // 抽到 四, 五星角色
threeArms, fourArms, fiveArms = make([]*zip.File, 0, 10), make([]*zip.File, 0, 10), make([]*zip.File, 0, 10) // 抽到 三 , 四, 五星武器
fourN, fiveN = 0, 0 // 抽到 四, 五星角色的数量
bgs = make([]*zip.File, 0, 10) // 背景图片名
threeN2, fourN2, fiveN2 = 0, 0, 0 // 抽到 三 , 四, 五星武器的数量
hero, stars = make([]*zip.File, 0, 10), make([]*zip.File, 0, 10) // 角色武器名, 储存星级图标
cicon = make([]*zip.File, 0, 10) // 元素图标
fivebg, fourbg, threebg = filetree["five_bg.jpg"][0], filetree["four_bg.jpg"][0], filetree["three_bg.jpg"][0] // 背景图片名
fivelen = len(filetree["five"])
five2len = len(filetree["five2"])
threelen = len(filetree["Three"])
fourlen = len(filetree["four"])
four2len = len(filetree["four2"])
)
if totl%9 == 0 { // 累计9次加入一个五星
switch rand.Intn(2) {
case 0:
fiveN++
fives = append(fives, filetree["five"][rand.Intn(fivelen)])
case 1:
fiveN2++
fiveArms = append(fiveArms, filetree["five2"][rand.Intn(five2len)])
}
nums--
}
if store.is5starsmode() { // 5星模式
for i := 0; i < nums; i++ {
switch rand.Intn(2) {
case 0:
fiveN++
fives = append(fives, filetree["five"][rand.Intn(fivelen)])
case 1:
fiveN2++
fiveArms = append(fiveArms, filetree["five2"][rand.Intn(five2len)])
}
}
} else { // 默认模式
for i := 0; i < nums; i++ {
a := rand.Intn(1000)
switch { // 抽卡几率 三星75% 四星18% 五星7%
case a >= 0 && a <= 750:
threeN2++
threeArms = append(threeArms, filetree["Three"][rand.Intn(threelen)])
case a > 750 && a <= 840:
fourN++
fours = append(fours, filetree["four"][rand.Intn(fourlen)]) // 随机角色
case a > 840 && a <= 930:
fourN2++
fourArms = append(fourArms, filetree["four2"][rand.Intn(four2len)]) // 随机武器
case a > 930 && a <= 965:
fiveN++
fives = append(fives, filetree["five"][rand.Intn(fivelen)])
default:
fiveN2++
fiveArms = append(fiveArms, filetree["five2"][rand.Intn(five2len)])
}
}
if fourN+fourN2 == 0 && threeN2 > 0 { // 没有四星时自动加入
threeN2--
threeArms = threeArms[:len(threeArms)-1]
switch rand.Intn(2) {
case 0:
fourN++
fours = append(fours, filetree["four"][rand.Intn(fourlen)]) // 随机角色
case 1:
fourN2++
fourArms = append(fourArms, filetree["four2"][rand.Intn(four2len)]) // 随机武器
}
}
_ = atomic.AddUint64(&totl, 1)
}
icon := func(f *zip.File) *zip.File {
name := f.Name
name = name[strings.LastIndex(name, "/")+1:strings.Index(name, "_")] + ".png"
logrus.Debugln("[genshin]get named file", name)
return filetree[name][0]
}
he := func(cnt int, id int, f *zip.File, bg *zip.File) {
var hen *[]*zip.File
for i := 0; i < cnt; i++ {
switch id {
case 1:
hen = &threeArms
case 2:
hen = &fourArms
case 3:
hen = &fours
case 4:
hen = &fiveArms
case 5:
hen = &fives
}
bgs = append(bgs, bg) // 加入颜色背景
hero = append(hero, (*hen)[i])
stars = append(stars, f) // 加入星级图标
cicon = append(cicon, icon((*hen)[i])) // 加入元素图标
}
}
if fiveN > 0 { // 按顺序加入
he(fiveN, 5, starN5, fivebg) // 五星角色
}
if fourN > 0 {
he(fourN, 3, starN4, fourbg) // 四星角色
}
if fiveN2 > 0 {
he(fiveN2, 4, starN5, fivebg) // 五星武器
}
if fourN2 > 0 {
he(fourN2, 2, starN4, fourbg) // 四星武器
}
if threeN2 > 0 {
he(threeN2, 1, starN3, threebg) // 三星武器
}
var c1, c2, c3 uint8 = 50, 50, 50 // 背景颜色
img00, err := filetree["bg0.jpg"][0].Open() // 打开背景图片
if err != nil {
return
}
rectangle := image.Rect(0, 0, 1920, 1080) // 图片宽度, 图片高度
rgba = image.NewRGBA(rectangle)
draw.Draw(rgba, rgba.Bounds(), image.NewUniform(color.RGBA{c1, c2, c3, 255}), image.Point{}, draw.Over)
context := freetype.NewContext() // 创建一个新的上下文
context.SetDPI(72) // 每英寸 dpi
context.SetClip(rgba.Bounds())
context.SetDst(rgba)
defer img00.Close()
img0, err := jpeg.Decode(img00) // 读取一个本地图像
if err != nil {
return
}
offset := image.Pt(0, 0) // 图片在背景上的位置
draw.Draw(rgba, img0.Bounds().Add(offset), img0, image.Point{}, draw.Over)
w1, h1 := 230, 0
for i := 0; i < len(hero); i++ {
if i > 0 {
w1 += 146 // 图片宽度
}
imgs, err := bgs[i].Open() // 取出背景图片
if err != nil {
return nil, err
}
defer imgs.Close()
img, _ := jpeg.Decode(imgs)
offset := image.Pt(w1, h1)
draw.Draw(rgba, img.Bounds().Add(offset), img, image.Point{}, draw.Over)
imgs1, err := hero[i].Open() // 取出图片名
if err != nil {
return nil, err
}
defer imgs1.Close()
img1, _ := png.Decode(imgs1)
offset1 := image.Pt(w1, h1)
draw.Draw(rgba, img1.Bounds().Add(offset1), img1, image.Point{}, draw.Over)
imgs2, err := stars[i].Open() // 取出星级图标
if err != nil {
return nil, err
}
defer imgs2.Close()
img2, _ := png.Decode(imgs2)
offset2 := image.Pt(w1, h1)
draw.Draw(rgba, img2.Bounds().Add(offset2), img2, image.Point{}, draw.Over)
imgs3, err := cicon[i].Open() // 取出类型图标
if err != nil {
return nil, err
}
defer imgs3.Close()
img3, _ := png.Decode(imgs3)
offset3 := image.Pt(w1, h1)
draw.Draw(rgba, img3.Bounds().Add(offset3), img3, image.Point{}, draw.Over)
}
imgs4, err := filetree["Reply.png"][0].Open() // "分享" 图标
if err != nil {
return nil, err
}
defer imgs4.Close()
img4, err := png.Decode(imgs4)
if err != nil {
return nil, err
}
offset4 := image.Pt(1270, 945) // 宽, 高
draw.Draw(rgba, img4.Bounds().Add(offset4), img4, image.Point{}, draw.Over)
return
}
func parsezip(zipFile string) error {
zipReader, err := zip.OpenReader(zipFile) // will not close
if err != nil {
return err
}
for _, f := range zipReader.File {
if f.FileInfo().IsDir() {
filetree[f.Name] = make([]*zip.File, 0, 32)
continue
}
f.Name = f.Name[8:]
i := strings.LastIndex(f.Name, "/")
if i < 0 {
filetree[f.Name] = []*zip.File{f}
logrus.Debugln("[genshin]insert file", f.Name)
continue
}
folder := f.Name[:i]
if folder != "" {
filetree[folder] = append(filetree[folder], f)
logrus.Debugln("[genshin]insert file into", folder)
if folder == "gacha" {
switch f.Name[i+1:] {
case "ThreeStar.png":
starN3 = f
case "FourStar.png":
starN4 = f
case "FiveStar.png":
starN5 = f
}
}
}
}
return nil
}

View File

@@ -4,7 +4,7 @@ package github
import (
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
@@ -36,12 +36,12 @@ func init() { // 插件主体
}.Encode()
body, err := netGet(api.String(), header)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
}
// 解析请求
info := gjson.ParseBytes(body)
if info.Get("total_count").Int() == 0 {
ctx.SendChain(message.Text("ERROR: 没有找到这样的仓库"))
ctx.SendChain(message.Text("ERROR:没有找到这样的仓库"))
return
}
repo := info.Get("items.0")
@@ -97,7 +97,7 @@ func init() { // 插件主体
}
// notnull 如果传入文本为空,则返回默认值
//nolint: unparam
func notnull(text, defstr string) string {
if text == "" {
return defstr
@@ -119,7 +119,7 @@ func netGet(dest string, header http.Header) ([]byte, error) {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}

View File

@@ -66,7 +66,7 @@ func init() {
cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String()
cachefile := cachedir + cid
if file.IsNotExist(cachefile) {
data, err := web.ReqWith(
data, err := web.RequestDataWith(web.NewDefaultClient(),
`https://res.fbigame.com/hs/v13/`+cid+`.png?auth_key=`+
gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(),
reqconf[0], reqconf[1], reqconf[2])
@@ -77,20 +77,13 @@ func init() {
continue
}
}
sk = append(
sk,
message.CustomNode(
zero.BotConfig.NickName[0],
ctx.Event.SelfID,
[]message.MessageSegment{message.Image("file:///" + cachefile)}, // 图片
),
)
sk = append(sk, ctxext.FakeSenderForwardNode(ctx, message.Image("file:///"+cachefile)))
}
if id := ctx.SendGroupForwardMessage(
ctx.Event.GroupID,
sk,
).Get("message_id").Int(); id == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
})
// 卡组
@@ -105,10 +98,10 @@ func init() {
}
func sh(s string) string {
data, err := web.ReqWith("https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
data, err := web.RequestDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
if err == nil {
url := hs + para + "&hash=" + strings.SplitN(strings.SplitN(helper.BytesToString(data), `var hash = "`, 2)[1], `"`, 2)[0] + "&search=" + s
r, err := web.ReqWith(url, reqconf[0], reqconf[1], reqconf[2])
r, err := web.RequestDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2])
if err == nil {
return helper.BytesToString(r)
}
@@ -117,10 +110,10 @@ func sh(s string) string {
}
func kz(s string) string {
data, err := web.ReqWith("https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
data, err := web.RequestDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
if err == nil {
url := hs + para + "mod=general_deck_image&deck_code=" + s + "&deck_text=&hash=" + strings.SplitN(strings.SplitN(helper.BytesToString(data), `var hash = "`, 2)[1], `"`, 2)[0] + "&search=" + s
r, err := web.ReqWith(url, reqconf[0], reqconf[1], reqconf[2])
r, err := web.RequestDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2])
if err == nil {
return "base64://" + gjson.Get(helper.BytesToString(r), "img").String()
}

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"math/rand"
"net/url"
"strings"
zero "github.com/wdvxdr1123/ZeroBot"
@@ -43,13 +44,13 @@ func init() {
keyword := ctx.State["regex_matched"].([]string)[1]
soutujson, err := soutuapi(keyword)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
rannum := rand.Intn(len(soutujson.Data.Illusts))
illust, err := pixiv.Works(soutujson.Data.Illusts[rannum].ID)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
u := illust.ImageUrls[0]
@@ -59,9 +60,9 @@ func init() {
err = pool.SendImageFromPool(n, f, func() error {
// 下载图片
return illust.DownloadToCache(0)
}, ctxext.Send(ctx), ctxext.GetMessage(ctx))
}, ctxext.SendFakeForwardToGroup(ctx), ctxext.GetFirstMessageInForward(ctx))
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
})
@@ -69,8 +70,7 @@ func init() {
// soutuapi 请求api
func soutuapi(keyword string) (r resultjson, err error) {
url := "https://api.pixivel.moe/v2/pixiv/illust/search/" + keyword + "?page=0"
data, err := web.ReqWith(url, "GET", "https://pixivel.moe/", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36")
data, err := web.GetData("https://copymanga.azurewebsites.net/api/pixivel?" + url.QueryEscape(keyword) + "?page=0")
if err != nil {
return
}

23
plugin/inject/main.go Normal file
View File

@@ -0,0 +1,23 @@
// Package inject 注入指令
package inject
import (
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() {
en := control.Register("inject", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "注入指令\n" +
"- run[CQ码]",
})
// 运行 CQ 码
en.OnPrefix("run", zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 可注入,权限为主人
ctx.Send(message.UnescapeCQCodeText(ctx.State["args"].(string)))
})
}

View File

@@ -25,14 +25,13 @@ const (
func init() {
engine := control.Register("jandan", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "煎蛋网无聊图\n- 来份屌图\n- 更新屌图\n",
Help: "煎蛋网无聊图\n- 来份[屌|弔|吊]图\n- 更新[屌|弔|吊]图\n",
PublicDataFolder: "Jandan",
})
go func() {
dbpath := engine.DataFolder()
db.DBPath = dbpath + "pics.db"
defer order.DoneOnExit()()
_, _ = file.GetLazyData(db.DBPath, false, false)
err := db.Create("picture", &picture{})
if err != nil {
@@ -45,7 +44,7 @@ func init() {
logrus.Printf("[jandan]读取%d张图片", n)
}()
engine.OnFullMatch("来份屌图").SetBlock(true).
engine.OnRegex(`来份[屌|弔|吊]图`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
u, err := getRandomPicture()
if err != nil {
@@ -55,7 +54,7 @@ func init() {
ctx.SendChain(message.Image(u))
})
engine.OnFullMatch("更新屌图", zero.SuperUserPermission).SetBlock(true).
engine.OnRegex(`更新[屌|弔|吊]图`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.Send("少女更新中...")
webpageURL := api

View File

@@ -2,8 +2,6 @@
package lolicon
import (
"io/ioutil"
"net/http"
"strings"
"time"
@@ -16,6 +14,7 @@ import (
"github.com/FloatTech/zbputils/img/pool"
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/zbputils/control/order"
)
@@ -38,27 +37,21 @@ func init() {
Handle(func(ctx *zero.Ctx) {
go func() {
for i := 0; i < math.Min(cap(queue)-len(queue), 2); i++ {
resp, err := http.Get(api)
data, err := web.GetData(api)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
continue
}
if resp.StatusCode != http.StatusOK {
ctx.SendChain(message.Text("ERROR: code ", resp.StatusCode))
continue
}
data, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close()
json := gjson.ParseBytes(data)
if e := json.Get("error").Str; e != "" {
ctx.SendChain(message.Text("ERROR: ", e))
ctx.SendChain(message.Text("ERROR:", e))
continue
}
url := json.Get("data.0.urls.original").Str
url = strings.ReplaceAll(url, "i.pixiv.cat", "i.pixiv.re")
name := url[strings.LastIndex(url, "/")+1 : len(url)-4]
m, err := pool.GetImage(name)
if err != nil && err != pool.ErrImgFileAsync {
if err != nil {
m.SetFile(url)
_, err = m.Push(ctxext.SendToSelf(ctx), ctxext.GetMessage(ctx))
process.SleepAbout1sTo2s()
@@ -72,7 +65,7 @@ func init() {
}()
select {
case <-time.After(time.Minute):
ctx.SendChain(message.Text("ERROR: 等待填充,请稍后再试......"))
ctx.SendChain(message.Text("ERROR:等待填充,请稍后再试......"))
case img := <-queue:
id := ctx.SendChain(message.Image(img))
if id.ID() == 0 {

View File

@@ -48,8 +48,10 @@ const (
"- 取消在\"cron\"的提醒\n" +
"- 列出所有提醒\n" +
"- 翻牌\n" +
"- 设置欢迎语XXX(可加{at}在欢迎时@对方)\n" +
"- 设置欢迎语XXX 可选添加 [{at}] [{nickname}] [{avatar}] [{id}] {at}可在发送时艾特被欢迎者 {nickname}是被欢迎者名字 {avatar}是被欢迎者头像 {id}是被欢迎者QQ号\n" +
"- 测试欢迎语\n" +
"- 设置告别辞 参数同设置欢迎语\n" +
"- 测试告别辞\n" +
"- [开启 | 关闭]入群验证"
)
@@ -66,7 +68,6 @@ func init() { // 插件主体
})
go func() {
defer order.DoneOnExit()()
db.DBPath = engine.DataFolder() + "config.db"
clock = timer.NewClock(db)
err := db.Create("welcome", &welcome{})
@@ -77,6 +78,10 @@ func init() { // 插件主体
if err != nil {
panic(err)
}
err = db.Create("farewell", &welcome{})
if err != nil {
panic(err)
}
}()
// 升为管理
@@ -282,7 +287,7 @@ func init() { // 插件主体
dateStrs := ctx.State["regex_matched"].([]string)
ts := timer.GetFilledTimer(dateStrs, ctx.Event.SelfID, ctx.Event.GroupID, false)
if ts.En() {
go clock.RegisterTimer(ts, true)
go clock.RegisterTimer(ts, true, false)
ctx.SendChain(message.Text("记住了~"))
} else {
ctx.SendChain(message.Text("参数非法:" + ts.Alert))
@@ -295,7 +300,7 @@ func init() { // 插件主体
var url, alert string
switch len(dateStrs) {
case 4:
url = dateStrs[2]
url = strings.TrimPrefix(dateStrs[2], "用")
alert = dateStrs[3]
case 3:
alert = dateStrs[2]
@@ -305,7 +310,7 @@ func init() { // 插件主体
}
logrus.Debugln("[manager] cron:", dateStrs[1])
ts := timer.GetFilledCronTimer(dateStrs[1], alert, url, ctx.Event.SelfID, ctx.Event.GroupID)
if clock.RegisterTimer(ts, true) {
if clock.RegisterTimer(ts, true, false) {
ctx.SendChain(message.Text("记住了~"))
} else {
ctx.SendChain(message.Text("参数非法:" + ts.Alert))
@@ -382,7 +387,7 @@ func init() { // 插件主体
var w welcome
err := db.Find("welcome", &w, "where gid = "+strconv.FormatInt(ctx.Event.GroupID, 10))
if err == nil {
ctx.SendGroupMessage(ctx.Event.GroupID, message.ParseMessageFromString(strings.ReplaceAll(w.Msg, "{at}", "[CQ:at,qq="+strconv.FormatInt(ctx.Event.UserID, 10)+"]")))
ctx.SendGroupMessage(ctx.Event.GroupID, message.ParseMessageFromString(welcometocq(ctx, w.Msg)))
} else {
ctx.SendChain(message.Text("欢迎~"))
}
@@ -412,13 +417,13 @@ func init() { // 插件主体
}
return false
}
next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID), rule)
next := zero.NewFutureEvent("message", 999, false, ctx.CheckSession(), rule)
recv, cancel := next.Repeat()
select {
case <-time.After(time.Minute):
cancel()
ctx.SendChain(message.Text("拜拜啦~"))
ctx.SetGroupKick(ctx.Event.GroupID, uid, false)
cancel()
case <-recv:
cancel()
ctx.SendChain(message.Text("答对啦~"))
@@ -431,8 +436,14 @@ func init() { // 插件主体
engine.OnNotice().SetBlock(false).
Handle(func(ctx *zero.Ctx) {
if ctx.Event.NoticeType == "group_decrease" {
userid := ctx.Event.UserID
ctx.SendChain(message.Text(ctxext.CardOrNickName(ctx, userid), "(", userid, ")", "离开了我们..."))
var w welcome
err := db.Find("farewell", &w, "where gid = "+strconv.FormatInt(ctx.Event.GroupID, 10))
if err == nil {
ctx.SendGroupMessage(ctx.Event.GroupID, message.ParseMessageFromString(welcometocq(ctx, w.Msg)))
} else {
userid := ctx.Event.UserID
ctx.SendChain(message.Text(ctx.CardOrNickName(userid), "(", userid, ")", "离开了我们..."))
}
}
})
// 设置欢迎语
@@ -455,11 +466,37 @@ func init() { // 插件主体
var w welcome
err := db.Find("welcome", &w, "where gid = "+strconv.FormatInt(ctx.Event.GroupID, 10))
if err == nil {
ctx.SendGroupMessage(ctx.Event.GroupID, message.ParseMessageFromString(strings.ReplaceAll(w.Msg, "{at}", "[CQ:at,qq="+strconv.FormatInt(ctx.Event.UserID, 10)+"]")))
ctx.SendGroupMessage(ctx.Event.GroupID, message.ParseMessageFromString(welcometocq(ctx, w.Msg)))
} else {
ctx.SendChain(message.Text("欢迎~"))
}
})
// 设置告别辞
engine.OnRegex(`^设置告别辞([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
w := &welcome{
GrpID: ctx.Event.GroupID,
Msg: ctx.State["regex_matched"].([]string)[1],
}
err := db.Insert("farewell", w)
if err == nil {
ctx.SendChain(message.Text("记住啦!"))
} else {
ctx.SendChain(message.Text("出错啦: ", err))
}
})
// 测试告别辞
engine.OnFullMatch("测试告别辞", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var w welcome
err := db.Find("farewell", &w, "where gid = "+strconv.FormatInt(ctx.Event.GroupID, 10))
if err == nil {
ctx.SendGroupMessage(ctx.Event.GroupID, message.ParseMessageFromString(welcometocq(ctx, w.Msg)))
} else {
userid := ctx.Event.UserID
ctx.SendChain(message.Text(ctx.CardOrNickName(userid), "(", userid, ")", "离开了我们..."))
}
})
// 入群后验证开关
engine.OnRegex(`^(.*)入群验证$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
@@ -510,15 +547,6 @@ func init() { // 插件主体
}
ctx.SendChain(message.Text("找不到服务!"))
})
// 运行 CQ 码
engine.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var cmd = ctx.State["regex_matched"].([]string)[1]
cmd = strings.ReplaceAll(cmd, "&#91;", "[")
cmd = strings.ReplaceAll(cmd, "&#93;", "]")
// 可注入,权限为主人
ctx.Send(cmd)
})
// 根据 gist 自动同意加群
// 加群请在github新建一个gist其文件名为本群群号的字符串的md5(小写)内容为一行是当前unix时间戳(10分钟内有效)。
// 然后请将您的用户名和gist哈希(小写)按照username/gisthash的格式填写到回答即可。
@@ -550,3 +578,16 @@ func init() { // 插件主体
}
})
}
// 传入 ctx 和 welcome格式string 返回cq格式string 使用方法:welcometocq(ctx,w.Msg)
func welcometocq(ctx *zero.Ctx, welcome string) string {
at := "[CQ:at,qq=" + strconv.FormatInt(ctx.Event.UserID, 10) + "]"
avatar := "[CQ:image,file=" + "http://q4.qlogo.cn/g?b=qq&nk=" + strconv.FormatInt(ctx.Event.UserID, 10) + "&s=640]"
id := strconv.FormatInt(ctx.Event.UserID, 10)
nickname := ctx.CardOrNickName(ctx.Event.UserID)
cqstring := strings.ReplaceAll(welcome, "{at}", at)
cqstring = strings.ReplaceAll(cqstring, "{nickname}", nickname)
cqstring = strings.ReplaceAll(cqstring, "{avatar}", avatar)
cqstring = strings.ReplaceAll(cqstring, "{id}", id)
return cqstring
}

View File

@@ -8,6 +8,7 @@ import (
"time"
sql "github.com/FloatTech/sqlite"
"github.com/FloatTech/zbputils/process"
"github.com/fumiama/cron"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
@@ -47,7 +48,7 @@ func NewClock(db *sql.Sqlite) (c Clock) {
}
// RegisterTimer 注册计时器
func (c *Clock) RegisterTimer(ts *Timer, save bool) bool {
func (c *Clock) RegisterTimer(ts *Timer, save, isinit bool) bool {
var key uint32
if save {
key = ts.GetTimerID()
@@ -62,6 +63,9 @@ func (c *Clock) RegisterTimer(ts *Timer, save bool) bool {
logrus.Println("[群管]注册计时器", key)
if ts.Cron != "" {
var ctx *zero.Ctx
if isinit {
process.GlobalInitMutex.Lock()
}
if ts.SelfID != 0 {
ctx = zero.GetBot(ts.SelfID)
} else {
@@ -71,6 +75,9 @@ func (c *Clock) RegisterTimer(ts *Timer, save bool) bool {
return false
})
}
if isinit {
process.GlobalInitMutex.Unlock()
}
eid, err := c.cron.AddFunc(ts.Cron, func() { ts.sendmsg(ts.GrpID, ctx) })
if err == nil {
c.entmu.Lock()
@@ -187,7 +194,7 @@ func (c *Clock) loadTimers(db *sql.Sqlite) {
var t Timer
_ = c.db.FindFor("timer", &t, "", func() error {
tescape := t
go c.RegisterTimer(&tescape, false)
go c.RegisterTimer(&tescape, false, true)
return nil
})
}

View File

@@ -8,7 +8,7 @@ import (
reg "github.com/fumiama/go-registry"
)
var sr = reg.NewRegedit("reilia.fumiama.top:32664", "fumiama", "--")
var sr = reg.NewRegedit("reilia.westeurope.cloudapp.azure.com:32664", "fumiama", "--")
func TestGetHoliday(t *testing.T) {
registry.Connect()

View File

@@ -21,7 +21,7 @@ func NewHoliday(name string, dur, year int, month time.Month, day int) *Holiday
return &Holiday{name: name, date: time.Date(year, month, day, 0, 0, 0, 0, time.Local), dur: time.Duration(dur) * time.Hour * 24}
}
var registry = reg.NewRegReader("reilia.fumiama.top:32664", "fumiama")
var registry = reg.NewRegReader("reilia.westeurope.cloudapp.azure.com:32664", "fumiama")
// GetHoliday 从 reg 服务器获取节日
func GetHoliday(name string) *Holiday {

View File

@@ -2,68 +2,62 @@
package moyu
import (
"sync"
"time"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/zbputils/control/order"
)
var (
msg message.Message
mu sync.Mutex
lastupdate time.Time
)
func init() { // 插件主体
control.Register("moyu", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "moyu\n" +
"- /启用 moyu\n" +
"- /禁用 moyu",
})
// 定时任务每天10点执行一次
_, err := process.CronTab.AddFunc("0 10 * * *", func() { sendNotice() })
if err != nil {
panic(err)
}
}
// 获取数据拼接消息链并发送
func sendNotice() {
m, ok := control.Lookup("moyu")
if ok {
if registry.Connect() != nil {
return
}
msg := message.Message{
message.Text(time.Now().Format("2006-01-02")),
message.Text("上午好,摸鱼人!\n工作再累一定不要忘记摸鱼哦有事没事起身去茶水间去厕所去廊道走走别老在工位上坐着钱是老板的,但命是自己的。\n"),
message.Text(weekend()),
message.Text("\n"),
message.Text(GetHoliday("元旦")),
message.Text("\n"),
message.Text(GetHoliday("春节")),
message.Text("\n"),
message.Text(GetHoliday("清明节")),
message.Text("\n"),
message.Text(GetHoliday("劳动节")),
message.Text("\n"),
message.Text(GetHoliday("端午节")),
message.Text("\n"),
message.Text(GetHoliday("中秋节")),
message.Text("\n"),
message.Text(GetHoliday("国庆节")),
message.Text("\n"),
message.Text("上班是帮老板赚钱,摸鱼是赚老板的钱!最后,祝愿天下所有摸鱼人,都能愉快的渡过每一天…"),
}
_ = registry.Close()
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, g := range ctx.GetGroupList().Array() {
grp := g.Get("group_id").Int()
if m.IsEnabledIn(grp) {
ctx.SendGroupMessage(grp, msg)
"- /禁用 moyu\n" +
"- 记录在\"0 10 * * *\"触发的指令\n" +
" - 摸鱼提醒",
}).OnFullMatch("摸鱼提醒").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
mu.Lock()
defer mu.Unlock()
if msg == nil || time.Since(lastupdate) > time.Hour*20 {
if registry.Connect() != nil {
return
}
msg = message.Message{
message.Text(time.Now().Format("2006-01-02")),
message.Text("上午好,摸鱼人!\n工作再累一定不要忘记摸鱼哦有事没事起身去茶水间去厕所去廊道走走别老在工位上坐着钱是老板的,但命是自己的。\n"),
message.Text(weekend()),
message.Text("\n"),
message.Text(GetHoliday("元旦")),
message.Text("\n"),
message.Text(GetHoliday("春节")),
message.Text("\n"),
message.Text(GetHoliday("清明节")),
message.Text("\n"),
message.Text(GetHoliday("劳动节")),
message.Text("\n"),
message.Text(GetHoliday("端午节")),
message.Text("\n"),
message.Text(GetHoliday("中秋节")),
message.Text("\n"),
message.Text(GetHoliday("国庆节")),
message.Text("\n"),
message.Text("上班是帮老板赚钱,摸鱼是赚老板的钱!最后,祝愿天下所有摸鱼人,都能愉快的渡过每一天…"),
}
_ = registry.Close()
lastupdate = time.Now()
}
return true
ctx.Send(msg)
})
}
}

View File

@@ -14,7 +14,6 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/process"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -31,61 +30,29 @@ func init() {
DisableOnDefault: true,
Help: "摸鱼人日历\n" +
"- /启用 moyucalendar\n" +
"- /禁用 moyucalendar",
"- /禁用 moyucalendar\n" +
"- 记录在\"30 8 * * *\"触发的指令\n" +
" - 摸鱼人日历",
}).OnFullMatch("摸鱼人日历").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
title := fmt.Sprintf("摸鱼人日历 %d月%d日", time.Now().Month(), time.Now().Day())
sg, cookies, err := sougou(title, "摸鱼人日历", ua)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
wx, err := redirect(sg, cookies, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
image, err := calendar(wx, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Image(image))
})
// 定时任务每天8点30分执行一次
_, err := process.CronTab.AddFunc("30 8 * * *", func() {
m, ok := control.Lookup("moyucalendar")
if !ok {
return
}
title := fmt.Sprintf("摸鱼人日历 %d月%d日", time.Now().Month(), time.Now().Day())
sg, cookies, err := sougou(title, "摸鱼人日历", ua)
if err != nil {
return
}
wx, err := redirect(sg, cookies, ua)
if err != nil {
return
}
image, err := calendar(wx, ua)
if err != nil {
return
}
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, g := range ctx.GetGroupList().Array() {
grp := g.Get("group_id").Int()
if m.IsEnabledIn(grp) {
ctx.SendGroupMessage(grp, message.Message{message.Image(image)})
process.SleepAbout1sTo2s()
}
}
return true
})
})
if err != nil {
panic(err)
}
}
func sougou(title, publisher, ua string) (string, []*http.Cookie, error) {

View File

@@ -5,7 +5,7 @@ import (
"crypto/md5"
"encoding/hex"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
@@ -231,7 +231,7 @@ func netGet(url string, header http.Header) []byte {
return nil
}
defer res.Body.Close()
result, _ := ioutil.ReadAll(res.Body)
result, _ := io.ReadAll(res.Body)
return result
}
@@ -245,6 +245,6 @@ func netPost(url string, data url.Values, header http.Header) []byte {
return nil
}
defer res.Body.Close()
result, _ := ioutil.ReadAll(res.Body)
result, _ := io.ReadAll(res.Body)
return result
}

View File

@@ -51,9 +51,16 @@ func init() {
err := ns.db.Pick(imgtype, sc)
ns.mu.RUnlock()
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
} else {
p := "file:///" + setupath + "/" + sc.Path
if ctx.Event.GroupID != 0 {
ctx.SendGroupForwardMessage(ctx.Event.GroupID, message.Message{
ctxext.FakeSenderForwardNode(ctx,
message.Text(imgtype, ": ", sc.Name, "\n"), message.Image(p),
)})
return
}
ctx.SendChain(message.Text(imgtype, ": ", sc.Name, "\n"), message.Image(p))
}
})
@@ -64,7 +71,7 @@ func init() {
if err == nil {
ctx.SendChain(message.Text("成功!"))
} else {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
}
})
engine.OnRegex(`^设置本地setu绝对路径(.*)$`, zero.SuperUserPermission).SetBlock(true).
@@ -74,7 +81,7 @@ func init() {
if err == nil {
ctx.SendChain(message.Text("成功!"))
} else {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
}
})
engine.OnFullMatch("刷新所有本地setu", zero.SuperUserPermission).SetBlock(true).
@@ -83,7 +90,7 @@ func init() {
if err == nil {
ctx.SendChain(message.Text("成功!"))
} else {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
}
})
engine.OnFullMatch("所有本地setu分类").SetBlock(true).

View File

@@ -19,7 +19,6 @@ import (
"github.com/FloatTech/zbputils/control/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
)
@@ -47,7 +46,7 @@ func init() {
ctx.SendChain(message.Text("大家的wife都是", wn, "\n"), message.Image(baseuri+"/"+grpf+"/"+wn), message.Text("\n哦~"))
default:
// 获取名字
name := ctxext.NickName(ctx)
name := ctx.NickName()
now := time.Now()
s := md5.Sum(helper.StringToBytes(fmt.Sprintf("%s%d%d%d", name, now.Year(), now.Month(), now.Day())))
r := rand.New(rand.NewSource(int64(binary.LittleEndian.Uint64(s[:]))))
@@ -57,7 +56,7 @@ func init() {
}
})
// 上传一张图
engine.OnPrefix("添加wife", zero.OnlyGroup, chkAddWifePermission, ctxext.MustProvidePicture).SetBlock(true).
engine.OnPrefix("添加wife", zero.OnlyGroup, chkAddWifePermission, zero.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
name := ""
for _, elem := range ctx.Event.Message {

View File

@@ -2,7 +2,7 @@
package nbnhhsh
import (
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
@@ -31,7 +31,7 @@ func getValue(text string) []string {
urlValues.Add("text", text)
resp, err := http.PostForm("https://lab.magiconch.com/api/nbnhhsh/guess", urlValues)
if err == nil {
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err == nil {
resp.Body.Close()
json := gjson.ParseBytes(body)

View File

@@ -3,7 +3,7 @@ package novel
import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/cookiejar"
"net/url"
@@ -25,14 +25,14 @@ import (
)
const (
websiteURL = "https://www.23qb.net"
websiteURL = "https://www.23qb.com"
websiteTitle = "铅笔小说"
errorTitle = "出现错误!"
username = "zerobot"
password = "123456"
submit = "%26%23160%3B%B5%C7%26%23160%3B%26%23160%3B%C2%BC%26%23160%3B"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
loginURL = websiteURL + "/login.php?do=submit&jumpurl=https%3A%2F%2Fwww.23qb.net%2F"
loginURL = websiteURL + "/login.php?do=submit&jumpurl=https%3A%2F%2Fwww.23qb.com%2F"
searchURL = websiteURL + "/saerch.php"
idReg = `/(\d+)/`
)
@@ -84,7 +84,7 @@ func init() {
log.Println("err:", err)
}
if id := ctx.SendChain(message.Image("base64://" + helper.BytesToString(data))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
} else {
text := htmlquery.InnerText(htmlquery.FindOne(doc, "//div[@id='tipss']"))
@@ -164,7 +164,7 @@ func search(searchKey string) (searchHTML string) {
log.Errorln("[novel]", err)
}
defer searchResp.Body.Close()
searchData, err := ioutil.ReadAll(searchResp.Body)
searchData, err := io.ReadAll(searchResp.Body)
if err != nil {
log.Errorf("[novel] get response for url=%s got error=%s\n", searchURL, err.Error())
}

View File

@@ -18,7 +18,7 @@ func init() {
Help: "nsfw图片识别\n- nsfw打分[图片]",
}).ApplySingle(ctxext.DefaultSingle)
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"nsfw打分"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
engine.OnKeywordGroup([]string{"nsfw打分"}, zero.OnlyGroup, zero.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {
@@ -35,7 +35,7 @@ func init() {
DisableOnDefault: true,
Help: "nsfw图片自动识别\n- 当图片属于非 neutral 类别时自动发送评价",
})
en.OnMessage(ctxext.IsPicExists).SetBlock(false).
en.OnMessage(zero.IsPicExists).SetBlock(false).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {

View File

@@ -33,7 +33,6 @@ func init() { // 插件主体
go func() {
dbpath := engine.DataFolder()
db.DBPath = dbpath + "kuji.db"
defer order.DoneOnExit()()
_, _ = file.GetLazyData(db.DBPath, false, true)
err := db.Create("kuji", &kuji{})
if err != nil {
@@ -62,7 +61,7 @@ func init() { // 插件主体
log.Errorln("[omikuji]:", err)
}
if id := ctx.SendChain(message.At(ctx.Event.UserID), message.Image("base64://"+helper.BytesToString(kujiBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
})
}

View File

@@ -23,7 +23,6 @@ func init() {
go func() {
datapath := en.DataFolder()
jsonfile := datapath + "rate.json"
defer order.DoneOnExit()()
area := make(rate, 226)
err := load(&area, jsonfile)
if err != nil {

View File

@@ -3,7 +3,7 @@ package runcode
import (
"errors"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
@@ -104,9 +104,10 @@ func init() {
"JavaScript || TypeScript || PHP || Shell \n" +
"Kotlin || Rust || Erlang || Ruby || Swift \n" +
"R || VB || Py2 || Perl || Pascal || Scala",
}).ApplySingle(ctxext.DefaultSingle).OnRegex(`^>runcode\s(.+?)\s([\s\S]+)$`).SetBlock(true).Limit(ctxext.LimitByUser).
}).ApplySingle(ctxext.DefaultSingle).OnRegex(`^>runcode(raw)?\s(.+?)\s([\s\S]+)$`).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
language := ctx.State["regex_matched"].([]string)[1]
israw := ctx.State["regex_matched"].([]string)[1] != ""
language := ctx.State["regex_matched"].([]string)[2]
language = strings.ToLower(language)
if runType, exist := table[language]; !exist {
// 不支持语言
@@ -116,10 +117,9 @@ func init() {
)
} else {
// 执行运行
block := ctx.State["regex_matched"].([]string)[2]
block = message.UnescapeCQCodeText(block)
if block == "help" {
// 输出模板
block := message.UnescapeCQText(ctx.State["regex_matched"].([]string)[3])
switch block {
case "help":
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, " ", language, "-template:\n"),
message.Text(
@@ -127,19 +127,23 @@ func init() {
templates[language],
),
)
} else {
default:
if output, err := runCode(block, runType); err != nil {
// 运行失败
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text("ERROR: ", err),
message.Text("ERROR:", err),
)
} else {
// 运行成功
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text(output),
)
if israw {
ctx.SendChain(message.Text(output))
} else {
ctx.SendChain(
message.Text("> ", ctx.Event.Sender.NickName, "\n"),
message.Text(output),
)
}
}
}
}
@@ -177,7 +181,7 @@ func runCode(code string, runType [2]string) (string, error) {
if body.StatusCode != http.StatusOK {
return "", errors.New("code not 200")
}
res, err := ioutil.ReadAll(body.Body)
res, err := io.ReadAll(body.Body)
if err != nil {
return "", err
}

View File

@@ -36,7 +36,7 @@ func init() { // 插件主体
// 获取P站插图信息
illust, err := pixiv.Works(id)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
if illust.Pid > 0 {
@@ -53,8 +53,9 @@ func init() { // 插件主体
continue
}
logrus.Debugln("[sausenao]开始下载", n)
logrus.Debugln("[sausenao]urls:", illust.ImageUrls)
err1 := illust.DownloadToCache(i)
if err != pool.ErrImgFileAsync && err1 == nil {
if err1 == nil {
m.SetFile(f)
_, _ = m.Push(ctxext.SendToSelf(ctx), ctxext.GetMessage(ctx))
}
@@ -83,14 +84,14 @@ func init() { // 插件主体
}
})
// 以图搜图
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, zero.OnlyGroup, zero.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.SendChain(message.Text("少女祈祷中......"))
for _, pic := range ctx.State["image_url"].([]string) {
fmt.Println(pic)
if result, err := saucenao.SauceNAO(pic); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
} else {
// 返回SauceNAO的结果
ctx.SendChain(
@@ -109,11 +110,10 @@ func init() { // 插件主体
continue
}
if result, err := yandex.Yandex(pic); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
} else {
// 返回SauceNAO的结果
ctx.SendChain(
message.Text("我有把握是这个"),
message.Text("也许是这个"),
message.Text(
"\n",
"标题:", result.Title, "\n",
@@ -123,43 +123,31 @@ func init() { // 插件主体
"直链:", "https://pixivel.moe/detail?id=", result.Pid,
),
)
continue
}
// 不论结果如何都执行 ascii2d 搜索
if result, err := ascii2d.Ascii2d(pic); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
continue
} else {
var msg message.Message = []message.MessageSegment{
message.CustomNode(
ctx.Event.Sender.Name(),
ctx.Event.UserID,
"ascii2d搜图结果",
)}
msg := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Text("ascii2d搜图结果"))}
for i := 0; i < len(result) && i < 5; i++ {
msg = append(
msg,
message.CustomNode(
ctx.Event.Sender.Name(),
ctx.Event.UserID,
[]message.MessageSegment{
message.Image(result[i].Thumb),
message.Text(fmt.Sprintf(
"标题:%s\n图源%s\n画师%s\n画师链接%s\n图片链接%s",
result[i].Name,
result[i].Type,
result[i].AuthNm,
result[i].Author,
result[i].Link,
)),
},
),
msg = append(msg, ctxext.FakeSenderForwardNode(ctx,
message.Image(result[i].Thumb),
message.Text(fmt.Sprintf(
"标题:%s\n图源%s\n画师%s\n画师链接%s\n图片链接%s",
result[i].Name,
result[i].Type,
result[i].AuthNm,
result[i].Author,
result[i].Link,
))),
)
}
if id := ctx.SendGroupForwardMessage(
ctx.Event.GroupID,
msg,
).Get("message_id").Int(); id == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
}
}

View File

@@ -39,7 +39,7 @@ func init() {
}).ApplySingle(ctxext.DefaultSingle)
cachedir := engine.DataFolder()
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"放大图片"}, zero.OnlyGroup, ctxext.MustProvidePicture, getPara).SetBlock(true).
engine.OnKeywordGroup([]string{"放大图片"}, zero.OnlyGroup, zero.MustProvidePicture, getPara).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {
@@ -111,7 +111,7 @@ func init() {
}
func getPara(ctx *zero.Ctx) bool {
next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID))
next := zero.NewFutureEvent("message", 999, false, ctx.CheckSession())
recv, cancel := next.Repeat()
i := 0
paras := [2]int{}
@@ -119,9 +119,10 @@ func getPara(ctx *zero.Ctx) bool {
for {
select {
case <-time.After(time.Second * 120):
cancel()
return false
case e := <-recv:
msg := e.Message.ExtractPlainText()
case c := <-recv:
msg := c.Event.Message.ExtractPlainText()
num, err := strconv.Atoi(msg)
if err != nil {
ctx.SendChain(message.Text("请输入数字!"))

View File

@@ -14,7 +14,6 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img"
"github.com/FloatTech/zbputils/img/text"
@@ -43,7 +42,6 @@ func init() {
})
cachePath := engine.DataFolder() + "cache/"
go func() {
defer order.DoneOnExit()()
os.RemoveAll(cachePath)
err := os.MkdirAll(cachePath, 0755)
if err != nil {
@@ -108,7 +106,7 @@ func init() {
canvas.SetRGB(0, 0, 0)
canvas.DrawString(hourWord, float64(back.Bounds().Size().X)*0.1, float64(back.Bounds().Size().Y)*1.2)
canvas.DrawString(monthWord, float64(back.Bounds().Size().X)*0.6, float64(back.Bounds().Size().Y)*1.2)
nickName := ctxext.CardOrNickName(ctx, uid)
nickName := ctx.CardOrNickName(uid)
if err = canvas.LoadFontFace(text.FontFile, float64(back.Bounds().Size().X)*0.04); err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
@@ -204,12 +202,12 @@ func getLevel(count int) int {
func initPic(picFile string) {
if file.IsNotExist(picFile) {
data, err := web.ReqWith(backgroundURL, "GET", referer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), backgroundURL, "GET", referer, ua)
if err != nil {
log.Errorln("[score]", err)
}
picURL := gjson.Get(string(data), "pic").String()
data, err = web.ReqWith(picURL, "GET", "", ua)
data, err = web.RequestDataWith(web.NewDefaultClient(), picURL, "GET", "", ua)
if err != nil {
log.Errorln("[score]", err)
}

View File

@@ -62,7 +62,6 @@ func init() { // 插件主体
})
go func() {
defer order.DoneOnExit()()
// 如果数据库不存在则下载
pool.db.DBPath = engine.DataFolder() + "SetuTime.db"
_, _ = fileutil.GetLazyData(pool.db.DBPath, false, false)
@@ -87,13 +86,13 @@ func init() { // 插件主体
ctx.SendChain(message.Text("INFO: 正在填充弹药......"))
time.Sleep(time.Second * 10)
if pool.size(imgtype) == 0 {
ctx.SendChain(message.Text("ERROR: 等待填充,请稍后再试......"))
ctx.SendChain(message.Text("ERROR:等待填充,请稍后再试......"))
return
}
}
// 从缓冲池里抽一张
if id := ctx.SendChain(*pool.pop(imgtype)); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
})
@@ -119,7 +118,7 @@ func init() { // 插件主体
)
// 查询数据库
if err := pool.remove(imgtype, id); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Text("删除成功"))
@@ -160,14 +159,12 @@ func (p *imgpool) push(ctx *zero.Ctx, imgtype string, illust *pixiv.Illust) {
if fileutil.IsNotExist(f) {
// 下载图片
if err := illust.DownloadToCache(0); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
}
if err != imagepool.ErrImgFileAsync {
m.SetFile(f)
_, _ = m.Push(ctxext.SendToSelf(ctx), ctxext.GetMessage(ctx))
}
m.SetFile(f)
_, _ = m.Push(ctxext.SendToSelf(ctx), ctxext.GetMessage(ctx))
msg = message.Image("file:///" + f)
} else {
msg = message.Image(m.String())
@@ -200,7 +197,7 @@ func (p *imgpool) fill(ctx *zero.Ctx, imgtype string) {
illust := &pixiv.Illust{}
// 查询出一张图片
if err := p.db.Pick(imgtype, illust); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
continue
}
// 向缓冲池添加一张图片

View File

@@ -11,7 +11,7 @@ import (
func init() {
engine.OnFullMatch("哄我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(chpURL, "GET", chpReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), chpURL, "GET", chpReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return

View File

@@ -11,7 +11,7 @@ import (
func init() {
engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(duURL, "GET", duReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), duURL, "GET", duReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return

View File

@@ -11,7 +11,7 @@ import (
func init() {
engine.OnFullMatch("发个朋友圈").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(pyqURL, "GET", pyqReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), pyqURL, "GET", pyqReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return

View File

@@ -12,7 +12,7 @@ import (
func init() {
engine.OnFullMatch("来碗绿茶").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(chayiURL, "GET", loveliveReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), chayiURL, "GET", loveliveReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
@@ -22,7 +22,7 @@ func init() {
})
engine.OnFullMatch("渣我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(ganhaiURL, "GET", loveliveReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), ganhaiURL, "GET", loveliveReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return

View File

@@ -14,7 +14,7 @@ import (
func init() {
engine.OnFullMatch("讲个段子").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(yduanziURL, "POST", yduanziReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), yduanziURL, "POST", yduanziReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return

View File

@@ -24,33 +24,52 @@ func init() {
"- 卖萌[@xxx]\n" +
"- 抽老婆[@xxx]",
})
engine.OnPrefix("异世界转生", number(587874)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handle)
engine.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handle)
engine.OnPrefix("卖萌", number(360578)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handle)
engine.OnPrefix("抽老婆", number(1075116)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handle)
engine.OnPrefix("异世界转生", number(587874)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handlepic)
engine.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handlepic)
engine.OnPrefix("卖萌", number(360578)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handletxt)
engine.OnPrefix("抽老婆", number(1075116)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handlecq)
engine.OnPrefix("黄油角色", number(1115465)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(handlepic)
}
// shindanmaker 处理函数
func handle(ctx *zero.Ctx) {
func handletxt(ctx *zero.Ctx) {
// 获取名字
name := ctxext.NickName(ctx)
name := ctx.NickName()
// 调用接口
txt, err := shindanmaker.Shindanmaker(ctx.State["id"].(int64), name)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
// TODO: 可注入
switch ctx.State["id"].(int64) {
case 587874, 162207:
data, err := text.RenderToBase64(txt, text.FontFile, 400, 20)
if err != nil {
log.Errorln("[shindan]:", err)
}
if id := ctx.SendChain(message.Image("base64://" + helper.BytesToString(data))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
}
default:
ctx.Send(txt)
ctx.SendChain(message.Text(txt))
}
func handlecq(ctx *zero.Ctx) {
// 获取名字
name := ctx.NickName()
// 调用接口
txt, err := shindanmaker.Shindanmaker(ctx.State["id"].(int64), name)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.Send(txt)
}
func handlepic(ctx *zero.Ctx) {
// 获取名字
name := ctx.NickName()
// 调用接口
txt, err := shindanmaker.Shindanmaker(ctx.State["id"].(int64), name)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
data, err := text.RenderToBase64(txt, text.FontFile, 400, 20)
if err != nil {
log.Errorln("[shindan]:", err)
}
if id := ctx.SendChain(message.Image("base64://" + helper.BytesToString(data))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
}

View File

@@ -1,5 +1,4 @@
// Package model 睡眠管理数据库
package model
package sleepmanage
import (
"os"
@@ -10,11 +9,14 @@ import (
log "github.com/sirupsen/logrus"
)
// SleepDB 睡眠数据库
type SleepDB gorm.DB
// sdb 睡眠数据库全局变量
var sdb *sleepdb
// Initialize 初始化
func Initialize(dbpath string) *SleepDB {
// sleepdb 睡眠数据库结构体
type sleepdb gorm.DB
// initialize 初始化
func initialize(dbpath string) *sleepdb {
var err error
if _, err = os.Stat(dbpath); err != nil || os.IsNotExist(err) {
// 生成文件
@@ -29,27 +31,18 @@ func Initialize(dbpath string) *SleepDB {
panic(err)
}
gdb.AutoMigrate(&SleepManage{})
return (*SleepDB)(gdb)
}
// Open 打开
func Open(dbpath string) (*SleepDB, error) {
db, err := gorm.Open("sqlite3", dbpath)
if err != nil {
return nil, err
}
return (*SleepDB)(db), nil
return (*sleepdb)(gdb)
}
// Close 关闭
func (sdb *SleepDB) Close() error {
func (sdb *sleepdb) Close() error {
db := (*gorm.DB)(sdb)
return db.Close()
}
// SleepManage 睡眠信息
type SleepManage struct {
gorm.Model
ID uint `gorm:"primary_key"`
GroupID int64 `gorm:"column:group_id"`
UserID int64 `gorm:"column:user_id"`
SleepTime time.Time `gorm:"column:sleep_time"`
@@ -60,8 +53,8 @@ func (SleepManage) TableName() string {
return "sleep_manage"
}
// Sleep 更新睡眠时间
func (sdb *SleepDB) Sleep(gid, uid int64) (position int, awakeTime time.Duration) {
// sleep 更新睡眠时间
func (sdb *sleepdb) sleep(gid, uid int64) (position int, awakeTime time.Duration) {
db := (*gorm.DB)(sdb)
now := time.Now()
var today time.Time
@@ -92,8 +85,8 @@ func (sdb *SleepDB) Sleep(gid, uid int64) (position int, awakeTime time.Duration
return position, awakeTime
}
// GetUp 更新起床时间
func (sdb *SleepDB) GetUp(gid, uid int64) (position int, sleepTime time.Duration) {
// getUp 更新起床时间
func (sdb *sleepdb) getUp(gid, uid int64) (position int, sleepTime time.Duration) {
db := (*gorm.DB)(sdb)
now := time.Now()
today := now.Add(-time.Hour*time.Duration(-6+now.Hour()) - time.Minute*time.Duration(now.Minute()) - time.Second*time.Duration(now.Second()))

View File

@@ -12,8 +12,6 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin/sleep_manage/model"
)
func init() {
@@ -22,15 +20,13 @@ func init() {
Help: "sleepmanage\n- 早安\n- 晚安",
PrivateDataFolder: "sleep",
})
dbfile := engine.DataFolder() + "manage.db"
go func() {
sdb = initialize(engine.DataFolder() + "manage.db")
log.Println("[sleepmanage]加载sleepmanage数据库")
}()
engine.OnFullMatch("早安", isMorning, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
db, err := model.Open(dbfile)
if err != nil {
log.Errorln(err)
return
}
position, getUpTime := db.GetUp(ctx.Event.GroupID, ctx.Event.UserID)
position, getUpTime := sdb.getUp(ctx.Event.GroupID, ctx.Event.UserID)
log.Println(position, getUpTime)
hour, minute, second := timeDuration(getUpTime)
if (hour == 0 && minute == 0 && second == 0) || hour >= 24 {
@@ -38,16 +34,10 @@ func init() {
} else {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(fmt.Sprintf("早安成功!你的睡眠时长为%d时%d分%d秒,你是今天第%d个起床的", hour, minute, second, position)))
}
db.Close()
})
engine.OnFullMatch("晚安", isEvening, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
db, err := model.Open(dbfile)
if err != nil {
log.Errorln(err)
return
}
position, sleepTime := db.Sleep(ctx.Event.GroupID, ctx.Event.UserID)
position, sleepTime := sdb.sleep(ctx.Event.GroupID, ctx.Event.UserID)
log.Println(position, sleepTime)
hour, minute, second := timeDuration(sleepTime)
if (hour == 0 && minute == 0 && second == 0) || hour >= 24 {
@@ -55,7 +45,6 @@ func init() {
} else {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(fmt.Sprintf("晚安成功!你的清醒时长为%d时%d分%d秒,你是今天第%d个睡觉的", hour, minute, second, position)))
}
db.Close()
})
}

View File

@@ -23,8 +23,7 @@ func init() {
PublicDataFolder: "Chat",
})
go func() {
defer order.DoneOnExit()()
data, err := file.GetLazyData(engine.DataFolder()+"kimoi.json", true, true)
data, err := file.GetLazyData(engine.DataFolder()+"kimoi.json", true, false)
if err != nil {
panic(err)
}

54
plugin/tiangou/tiangou.go Normal file
View File

@@ -0,0 +1,54 @@
// Package tiangou 舔狗日记
package tiangou
import (
sql "github.com/FloatTech/sqlite"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
type tiangou struct {
ID uint32 `db:"id"`
Text string `db:"text"`
}
var db = &sql.Sqlite{}
func init() {
en := control.Register("tiangou", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "舔狗日记\n" +
"- 舔狗日记",
PublicDataFolder: "Tiangou",
})
go func() {
dbpath := en.DataFolder()
db.DBPath = dbpath + "tiangou.db"
_, err := file.GetLazyData(db.DBPath, false, true)
if err != nil {
panic(err)
}
err = db.Create("tiangou", &tiangou{})
if err != nil {
panic(err)
}
c, _ := db.Count("tiangou")
logrus.Infoln("[tiangou]加载", c, "条舔狗日记")
}()
en.OnFullMatch("舔狗日记").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
var t tiangou
err := db.Pick("tiangou", &t)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Text(t.Text))
})
}

View File

@@ -5,7 +5,6 @@ import (
"fmt"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
trmoe "github.com/fumiama/gotracemoe"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -23,14 +22,14 @@ func init() { // 插件主体
Help: "tracemoe\n- 搜番 | 搜索番剧[图片]",
})
// 以图搜图
engine.OnKeywordGroup([]string{"搜番", "搜索番剧"}, ctxext.MustProvidePicture).SetBlock(true).
engine.OnKeywordGroup([]string{"搜番", "搜索番剧"}, zero.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.SendChain(message.Text("少女祈祷中......"))
for _, pic := range ctx.State["image_url"].([]string) {
fmt.Println(pic)
if result, err := moe.Search(pic, true, true); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
} else if len(result.Result) > 0 {
r := result.Result[0]
hint := "我有把握是这个!"

View File

@@ -2,11 +2,6 @@
package translation
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@@ -14,29 +9,11 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/zbputils/control/order"
)
func tl(d string) ([]byte, error) {
url := "https://api.cloolc.club/fanyi?data=" + d
resp, err := http.Get(url)
if err != nil {
fmt.Println(err)
}
data, err := ioutil.ReadAll(resp.Body)
_ = resp.Body.Close()
if err != nil {
return nil, err
}
if code := resp.StatusCode; code != 200 {
// 如果返回不是200则立刻抛出错误
errmsg := fmt.Sprintf("code %d", code)
return nil, errors.New(errmsg)
}
return data, err
}
func init() {
control.Register("translation", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
@@ -45,11 +22,11 @@ func init() {
}).OnRegex(`^>TL\s(-.{1,10}? )?(.*)$`).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
msg := []string{ctx.State["regex_matched"].([]string)[2]}
rely, err := tl(msg[0])
data, err := web.GetData("https://api.cloolc.club/fanyi?data=" + msg[0])
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
}
info := gjson.ParseBytes(rely)
info := gjson.ParseBytes(data)
repo := info.Get("data.0")
process.SleepAbout1sTo2s()
ctx.SendChain(message.Text(repo.Get("value.0")))

View File

@@ -2,7 +2,7 @@
package model
import (
"io/ioutil"
"io"
"math/rand"
"net/http"
"os"
@@ -199,7 +199,7 @@ func (vdb *VtbDB) GetVtbList() (uidList []string) {
}
defer resp.Body.Close()
bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)
if err != nil {
log.Errorln(err)
return
@@ -262,7 +262,7 @@ func (vdb *VtbDB) StoreVtb(uid string) {
}
defer resp.Body.Close()
bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)
if err != nil {
log.Errorln(err)
return

View File

@@ -2,7 +2,6 @@
package vtbquotation
import (
"crypto/tls"
"fmt"
"io"
"net/http"
@@ -22,6 +21,7 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/zbputils/control/order"
@@ -44,7 +44,6 @@ func init() {
dbfile := engine.DataFolder() + "vtb.db"
storePath := engine.DataFolder() + "store/"
go func() {
defer order.DoneOnExit()()
err := os.MkdirAll(storePath, 0755)
if err != nil {
panic(err)
@@ -71,7 +70,7 @@ func init() {
log.Errorln("[vtb]:", err)
}
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
// 步骤012依次选择3个类别
step := 0
@@ -79,31 +78,31 @@ func init() {
errorCount := 0
for {
select {
case e := <-echo: // 接收到需要复读的消息
case c := <-echo: // 接收到需要复读的消息
// 错误次数达到3次结束命令
if errorCount >= 3 {
ctx.SendChain(message.Reply(e.MessageID), message.Text("输入错误太多,请重新发指令"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("输入错误太多,请重新发指令"))
return
}
switch step {
case 0:
firstIndex, err = strconv.Atoi(e.RawMessage)
firstIndex, err = strconv.Atoi(c.Event.RawMessage)
// log.Println(fmt.Sprintf("当前在第%d步", step))
// log.Println(fmt.Sprintf("firstIndex:%d,secondIndex:%d,thirdIndex:%d", firstIndex, secondIndex, thirdIndex))
if err != nil {
ctx.SendChain(message.Reply(e.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
errorCount++
} else {
secondStepMessage := db.GetAllSecondCategoryMessageByFirstIndex(firstIndex)
// log.Println(secondStepMessage)
if secondStepMessage == "" {
ctx.SendChain(message.Reply(e.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
firstStepImageBytes, err := text.RenderToBase64(db.GetAllFirstCategoryMessage(), text.FontFile, 400, 20)
if err != nil {
log.Errorln("[vtb]:", err)
}
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
errorCount++
} else {
@@ -112,29 +111,29 @@ func init() {
log.Errorln("[vtb]:", err)
}
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
step++
}
}
case 1:
secondIndex, err = strconv.Atoi(e.RawMessage)
secondIndex, err = strconv.Atoi(c.Event.RawMessage)
// log.Println(fmt.Sprintf("当前在第%d步", step))
// log.Println(fmt.Sprintf("firstIndex:%d,secondIndex:%d,thirdIndex:%d", firstIndex, secondIndex, thirdIndex))
if err != nil {
ctx.SendChain(message.Reply(e.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
errorCount++
} else {
thirdStepMessage := db.GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(firstIndex, secondIndex)
// log.Println(thirdStepMessage)
if thirdStepMessage == "" {
ctx.SendChain(message.Reply(e.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
secondStepMessageBytes, err := text.RenderToBase64(db.GetAllSecondCategoryMessageByFirstIndex(firstIndex), text.FontFile, 400, 20)
if err != nil {
log.Errorln("[vtb]:", err)
}
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
errorCount++
} else {
@@ -143,30 +142,30 @@ func init() {
log.Errorln("[vtb]:", err)
}
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(thirdStepMessageBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
step++
}
}
case 2:
thirdIndex, err = strconv.Atoi(e.RawMessage)
thirdIndex, err = strconv.Atoi(c.Event.RawMessage)
// log.Println(fmt.Sprintf("当前在第%d步", step))
// log.Println(fmt.Sprintf("firstIndex:%d,secondIndex:%d,thirdIndex:%d", firstIndex, secondIndex, thirdIndex))
if err != nil {
ctx.SendChain(message.Reply(e.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
errorCount++
} else {
tc := db.GetThirdCategory(firstIndex, secondIndex, thirdIndex)
reg := regexp.MustCompile(regStr)
recURL := tc.ThirdCategoryPath
if recURL == "" {
ctx.SendChain(message.Reply(e.MessageID), message.Text("没有内容请重新选择,三次输入错误,指令可退出重输"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("没有内容请重新选择,三次输入错误,指令可退出重输"))
firstStepImageBytes, err := text.RenderToBase64(db.GetAllFirstCategoryMessage(), text.FontFile, 400, 20)
if err != nil {
log.Errorln("[vtb]:", err)
}
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
errorCount++
step = 1
@@ -178,7 +177,7 @@ func init() {
recURL = strings.ReplaceAll(recURL, "+", "%20")
// log.Println(recordUrl)
}
ctx.SendChain(message.Reply(e.MessageID), message.Text("请欣赏《"+tc.ThirdCategoryName+"》"))
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请欣赏《"+tc.ThirdCategoryName+"》"))
if !re.MatchString(recURL) {
log.Errorln("[vtb]:文件格式不匹配")
@@ -255,14 +254,7 @@ func init() {
func initRecord(recordFile, recordURL string) {
if file.IsNotExist(recordFile) {
transport := http.Transport{
TLSClientConfig: &tls.Config{
MaxVersion: tls.VersionTLS12,
},
}
client := &http.Client{
Transport: &transport,
}
client := web.NewTLS12Client()
req, _ := http.NewRequest("GET", recordURL, nil)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0")

View File

@@ -24,7 +24,7 @@ func init() {
Help: "wangyiyun \n- 来份网易云热评",
}).OnFullMatch("来份网易云热评").SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
data, err := web.ReqWith(wangyiyunURL, "GET", wangyiyunReferer, ua)
data, err := web.RequestDataWith(web.NewDefaultClient(), wangyiyunURL, "GET", wangyiyunReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return

View File

@@ -1,79 +0,0 @@
package wordle
import (
"strconv"
"unsafe"
goBinary "encoding/binary"
"github.com/FloatTech/zbputils/binary"
)
type wordpack [3]byte
/*
func pack(word string) (w wordpack) {
if len(word) != 5 {
panic("word must be 5 letters")
}
r := []rune(word)
for i := range r {
if r[i] < 'k' { // 0-9
r[i] -= 'a' - '0'
} else {
r[i] -= 10
}
}
word = string(r)
n, err := strconv.ParseUint(word, 26, 32)
if err != nil {
panic(err)
}
wt := binary.SelectWriter()
wt.WriteUInt32LE(uint32(n))
copy(w[:], wt.Bytes())
binary.PutWriter(wt)
return
}
*/
func (w wordpack) String() (word string) {
wt := binary.SelectWriter()
_, _ = wt.Write(w[:])
_ = wt.WriteByte(0)
n := goBinary.LittleEndian.Uint32(wt.Bytes())
binary.PutWriter(wt)
word = strconv.FormatUint(uint64(n), 26)
for len(word) < 5 {
word = "0" + word
}
r := []rune(word)
for i := range r {
if r[i] < 'a' { // 0-9
r[i] += 'a' - '0'
} else {
r[i] += 10
}
}
word = string(r)
return
}
func loadwords(data []byte) (wordpacks []wordpack) {
(*slice)(unsafe.Pointer(&wordpacks)).data = (*slice)(unsafe.Pointer(&data)).data
(*slice)(unsafe.Pointer(&wordpacks)).len = len(data) / 3
(*slice)(unsafe.Pointer(&wordpacks)).cap = (*slice)(unsafe.Pointer(&data)).cap / 3
return
}
// slice is the runtime representation of a slice.
// It cannot be used safely or portably and its representation may
// change in a later release.
//
// Unlike reflect.SliceHeader, its Data field is sufficient to guarantee the
// data it references will not be garbage collected.
type slice struct {
data unsafe.Pointer
len int
cap int
}

View File

@@ -3,6 +3,7 @@ package wordle
import (
"errors"
"fmt"
"image/color"
"math/rand"
"sort"
@@ -40,8 +41,19 @@ var colors = [...]color.RGBA{
{219, 219, 219, 255},
}
var words []string
var questions []string
var classdict = map[string]int{
"": 5,
"五阶": 5,
"六阶": 6,
"七阶": 7,
}
type dictionary map[int]struct {
dict []string
cet4 []string
}
var words = make(dictionary)
func init() {
en := control.Register("wordle", order.AcquirePrio(), &control.Options{
@@ -61,47 +73,50 @@ func init() {
}),
))
go func() {
questionsdata, err := file.GetLazyData(en.DataFolder()+"questions.bin", true, true)
if err != nil {
panic(err)
for i := 5; i <= 7; i++ {
dc, err := file.GetLazyData(fmt.Sprintf("%scet-4_%d.txt", en.DataFolder(), i), true, true)
if err != nil {
panic(err)
}
c := strings.Split(string(dc), "\n")
sort.Strings(c)
dd, err := file.GetLazyData(fmt.Sprintf("%sdict_%d.txt", en.DataFolder(), i), true, true)
if err != nil {
panic(err)
}
d := strings.Split(string(dd), "\n")
sort.Strings(d)
words[i] = struct {
dict []string
cet4 []string
}{d, c}
}
questionspacks := loadwords(questionsdata)
questions = make([]string, len(questionspacks))
for i := range questionspacks {
questions[i] = questionspacks[i].String()
}
wordsdata, err := file.GetLazyData(en.DataFolder()+"words.bin", true, true)
if err != nil {
panic(err)
}
wordpacks := loadwords(wordsdata)
words = make([]string, len(wordpacks))
for i := range wordpacks {
words[i] = wordpacks[i].String()
}
sort.Strings(words)
}()
en.OnRegex(`(个人|团队)猜单词`, zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
en.OnRegex(`(个人|团队)(五阶|六阶|七阶)?猜单词`, zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
target := questions[rand.Intn(len(questions))]
class := classdict[ctx.State["regex_matched"].([]string)[2]]
target := words[class].cet4[rand.Intn(len(words[class].cet4))]
game := newWordleGame(target)
_, img, cl, _ := game("")
typ := ctx.State["regex_matched"].([]string)[1]
ctx.Send(
message.ReplyWithMessage(ctx.Event.MessageID,
message.ImageBytes(img),
message.Text("你有6次机会猜出单词单词长度为5,请发送单词"),
message.Text("你有", class+1, "次机会猜出单词,单词长度为", class, ",请发送单词"),
),
)
cl()
var next *zero.FutureEvent
if typ == "个人" {
next = zero.NewFutureEvent("message", 999, false, zero.RegexRule(`^[A-Z]{5}$|^[a-z]{5}$`), zero.OnlyGroup, zero.CheckUser(ctx.Event.UserID))
if ctx.State["regex_matched"].([]string)[1] == "个人" {
next = zero.NewFutureEvent("message", 999, false, zero.RegexRule(fmt.Sprintf(`^([A-Z]|[a-z]){%d}$`, class)),
zero.OnlyGroup, ctx.CheckSession())
} else {
next = zero.NewFutureEvent("message", 999, false, zero.RegexRule(`^[A-Z]{5}$|^[a-z]{5}$`), zero.OnlyGroup, zero.CheckGroup(ctx.Event.GroupID))
next = zero.NewFutureEvent("message", 999, false, zero.RegexRule(fmt.Sprintf(`^([A-Z]|[a-z]){%d}$`, class)),
zero.OnlyGroup, zero.CheckGroup(ctx.Event.GroupID))
}
var win bool
var err error
recv, cancel := next.Repeat()
defer cancel()
for {
select {
case <-time.After(time.Second * 120):
@@ -111,12 +126,12 @@ func init() {
),
)
return
case e := <-next.Next():
win, img, cl, err = game(e.Message.String())
case c := <-recv:
win, img, cl, err = game(c.Event.Message.String())
switch {
case win:
ctx.Send(
message.ReplyWithMessage(e.MessageID,
message.ReplyWithMessage(c.Event.MessageID,
message.ImageBytes(img),
message.Text("太棒了,你猜出来了!"),
),
@@ -125,7 +140,7 @@ func init() {
return
case err == errTimesRunOut:
ctx.Send(
message.ReplyWithMessage(e.MessageID,
message.ReplyWithMessage(c.Event.MessageID,
message.ImageBytes(img),
message.Text("游戏结束...答案是: ", target),
),
@@ -134,19 +149,19 @@ func init() {
return
case err == errLengthNotEnough:
ctx.Send(
message.ReplyWithMessage(e.MessageID,
message.ReplyWithMessage(c.Event.MessageID,
message.Text("单词长度错误"),
),
)
case err == errUnknownWord:
ctx.Send(
message.ReplyWithMessage(e.MessageID,
message.ReplyWithMessage(c.Event.MessageID,
message.Text("你确定存在这样的单词吗?"),
),
)
default:
ctx.Send(
message.ReplyWithMessage(e.MessageID,
message.ReplyWithMessage(c.Event.MessageID,
message.ImageBytes(img),
),
)
@@ -158,6 +173,7 @@ func init() {
}
func newWordleGame(target string) func(string) (bool, []byte, func(), error) {
var class = len(target)
record := make([]string, 0, len(target)+1)
return func(s string) (win bool, data []byte, cl func(), err error) {
if s != "" {
@@ -169,8 +185,8 @@ func newWordleGame(target string) func(string) (bool, []byte, func(), error) {
err = errLengthNotEnough
return
}
i := sort.SearchStrings(words, s)
if i >= len(words) || words[i] != s {
i := sort.SearchStrings(words[class].dict, s)
if i >= len(words[class].dict) || words[class].dict[i] != s {
err = errUnknownWord
return
}
@@ -181,13 +197,14 @@ func newWordleGame(target string) func(string) (bool, []byte, func(), error) {
}
}
var side = 20
ctx := gg.NewContext((side+2)*5+26, (side+2)*6+26)
var space = 10
ctx := gg.NewContext((side+4)*class+space*2-4, (side+4)*(class+1)+space*2-4)
ctx.SetColor(color.RGBA{255, 255, 255, 255})
ctx.Clear()
for i := 0; i < len(target)+1; i++ {
for j := 0; j < len(target); j++ {
for i := 0; i < class+1; i++ {
for j := 0; j < class; j++ {
if len(record) > i {
ctx.DrawRectangle(float64(10+j*(side+4)), float64(10+i*(side+4)), float64(side), float64(side))
ctx.DrawRectangle(float64(space+j*(side+4)), float64(space+i*(side+4)), float64(side), float64(side))
switch {
case record[i][j] == target[j]:
ctx.SetColor(colors[match])

View File

@@ -31,7 +31,7 @@ func init() {
// 调用接口
i, err := strconv.Atoi(ctx.State["regex_matched"].([]string)[1])
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
w := newWtf(i)
@@ -54,7 +54,7 @@ func init() {
text, err = w.predict(name)
}
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
ctx.SendChain(message.Text("ERROR:", err))
return
}
// TODO: 可注入

View File

@@ -3,9 +3,9 @@ package wtf
import (
"encoding/json"
"errors"
"io"
"net/http"
"net/url"
"github.com/FloatTech/zbputils/web"
)
/* JS path getter for https://wtf.hiigara.net/ranking
@@ -134,12 +134,7 @@ func (w *wtf) predict(names ...string) (string, error) {
name += "/" + url.QueryEscape(n)
}
u := apiprefix + w.path + name
resp, err := http.Get(u)
if err != nil {
return "", err
}
r, err := io.ReadAll(resp.Body)
resp.Body.Close()
r, err := web.GetData(u)
if err != nil {
return "", err
}

275
plugin/ymgal/model.go Normal file
View File

@@ -0,0 +1,275 @@
package ymgal
import (
"fmt"
"math/rand"
"net/url"
"os"
"regexp"
"strconv"
"sync"
"time"
"github.com/antchfx/htmlquery"
_ "github.com/fumiama/sqlite3" // import sql
"github.com/jinzhu/gorm"
log "github.com/sirupsen/logrus"
)
// gdb 得分数据库
var gdb *ymgaldb
// ymgaldb galgame图片数据库
type ymgaldb gorm.DB
var mu sync.RWMutex
// ymgal gal图片储存结构体
type ymgal struct {
ID int64 `gorm:"column:id" `
Title string `gorm:"column:title" `
PictureType string `gorm:"column:picture_type" `
PictureDescription string `gorm:"column:picture_description;type:varchar(1024)" `
PictureList string `gorm:"column:picture_list;type:varchar(20000)" `
}
// TableName ...
func (ymgal) TableName() string {
return "ymgal"
}
// initialize 初始化ymgaldb数据库
func initialize(dbpath string) *ymgaldb {
var err error
if _, err = os.Stat(dbpath); err != nil || os.IsNotExist(err) {
// 生成文件
f, err := os.Create(dbpath)
if err != nil {
return nil
}
defer f.Close()
}
gdb, err := gorm.Open("sqlite3", dbpath)
if err != nil {
panic(err)
}
gdb.AutoMigrate(&ymgal{})
return (*ymgaldb)(gdb)
}
func (gdb *ymgaldb) insertOrUpdateYmgalByID(id int64, title, pictureType, pictureDescription, pictureList string) (err error) {
db := (*gorm.DB)(gdb)
y := ymgal{
ID: id,
Title: title,
PictureType: pictureType,
PictureDescription: pictureDescription,
PictureList: pictureList,
}
if err = db.Debug().Model(&ymgal{}).First(&y, "id = ? ", id).Error; err != nil {
if gorm.IsRecordNotFoundError(err) {
err = db.Debug().Model(&ymgal{}).Create(&y).Error // newUser not user
}
} else {
err = db.Debug().Model(&ymgal{}).Where("id = ? ", id).Update(map[string]interface{}{
"title": title,
"picture_type": pictureType,
"picture_description": pictureDescription,
"picture_list": pictureList,
}).Error
}
return
}
func (gdb *ymgaldb) getYmgalByID(id string) (y ymgal) {
db := (*gorm.DB)(gdb)
db.Debug().Model(&ymgal{}).Where("id = ?", id).Take(&y)
return
}
func (gdb *ymgaldb) randomYmgal(pictureType string) (y ymgal) {
db := (*gorm.DB)(gdb)
var count int
s := db.Debug().Model(&ymgal{}).Where("picture_type = ?", pictureType).Count(&count)
if count == 0 {
return
}
s.Offset(rand.Intn(count)).Take(&y)
return
}
func (gdb *ymgaldb) getYmgalByKey(pictureType, key string) (y ymgal) {
db := (*gorm.DB)(gdb)
var count int
s := db.Debug().Model(&ymgal{}).Where("picture_type = ? and (picture_description like ? or title like ?) ", pictureType, "%"+key+"%", "%"+key+"%").Count(&count)
if count == 0 {
return
}
s.Offset(rand.Intn(count)).Take(&y)
return
}
const (
webURL = "https://www.ymgal.com"
cgType = "Gal CG"
emoticonType = "其他"
webPicURL = webURL + "/co/picset/"
reNumber = `\d+`
)
var (
cgURL = webURL + "/search?type=picset&sort=default&category=" + url.QueryEscape(cgType) + "&page="
emoticonURL = webURL + "/search?type=picset&sort=default&category=" + url.QueryEscape(emoticonType) + "&page="
commonPageNumberExpr = "//*[@id='pager-box']/div/a[@class='icon item pager-next']/preceding-sibling::a[1]/text()"
cgIDList []string
emoticonIDList []string
)
func initPageNumber() (maxCgPageNumber, maxEmoticonPageNumber int) {
doc, err := htmlquery.LoadURL(cgURL + "1")
if err != nil {
log.Errorln("[ymgal]:", err)
}
maxCgPageNumber, err = strconv.Atoi(htmlquery.FindOne(doc, commonPageNumberExpr).Data)
if err != nil {
log.Errorln("[ymgal]:", err)
}
doc, err = htmlquery.LoadURL(emoticonURL + "1")
if err != nil {
log.Errorln("[ymgal]:", err)
}
maxEmoticonPageNumber, err = strconv.Atoi(htmlquery.FindOne(doc, commonPageNumberExpr).Data)
if err != nil {
log.Errorln("[ymgal]:", err)
}
return
}
func getPicID(pageNumber int, pictureType string) {
var picURL string
if pictureType == cgType {
picURL = cgURL + strconv.Itoa(pageNumber)
} else if pictureType == emoticonType {
picURL = emoticonURL + strconv.Itoa(pageNumber)
}
doc, err := htmlquery.LoadURL(picURL)
if err != nil {
log.Errorln("[ymgal]:", err)
}
list := htmlquery.Find(doc, "//*[@id='picset-result-list']/ul/div/div[1]/a")
for i := 0; i < len(list); i++ {
re := regexp.MustCompile(reNumber)
picID := re.FindString(list[i].Attr[0].Val)
if pictureType == cgType {
cgIDList = append(cgIDList, picID)
} else if pictureType == emoticonType {
emoticonIDList = append(emoticonIDList, picID)
}
}
}
func updatePic() {
maxCgPageNumber, maxEmoticonPageNumber := initPageNumber()
for i := 1; i <= maxCgPageNumber; i++ {
getPicID(i, cgType)
time.Sleep(time.Millisecond * 500)
}
for i := 1; i <= maxEmoticonPageNumber; i++ {
getPicID(i, emoticonType)
time.Sleep(time.Millisecond * 500)
}
CGLOOP:
for i := len(cgIDList) - 1; i >= 0; i-- {
mu.RLock()
y := gdb.getYmgalByID(cgIDList[i])
mu.RUnlock()
if y.PictureList == "" {
mu.Lock()
storeCgPic(cgIDList[i])
mu.Unlock()
} else {
break CGLOOP
}
time.Sleep(time.Millisecond * 500)
}
EMOTICONLOOP:
for i := len(emoticonIDList) - 1; i >= 0; i-- {
mu.RLock()
y := gdb.getYmgalByID(emoticonIDList[i])
mu.RUnlock()
if y.PictureList == "" {
mu.Lock()
storeEmoticonPic(emoticonIDList[i])
mu.Unlock()
} else {
break EMOTICONLOOP
}
time.Sleep(time.Millisecond * 500)
}
}
func storeCgPic(picIDStr string) {
picID, err := strconv.ParseInt(picIDStr, 10, 64)
if err != nil {
log.Errorln("[ymgal]:", err)
}
pictureType := cgType
doc, err := htmlquery.LoadURL(webPicURL + picIDStr)
if err != nil {
log.Errorln("[ymgal]:", err)
}
title := htmlquery.FindOne(doc, "//meta[@name='name']").Attr[1].Val
pictureDescription := htmlquery.FindOne(doc, "//meta[@name='description']").Attr[1].Val
pictureNumberStr := htmlquery.FindOne(doc, "//div[@class='meta-info']/div[@class='meta-right']/span[2]/text()").Data
re := regexp.MustCompile(reNumber)
pictureNumber, err := strconv.Atoi(re.FindString(pictureNumberStr))
if err != nil {
log.Errorln("[ymgal]:", err)
}
pictureList := ""
for i := 1; i <= pictureNumber; i++ {
picURL := htmlquery.FindOne(doc, fmt.Sprintf("//*[@id='main-picset-warp']/div/div[2]/div/div[@class='swiper-wrapper']/div[%d]", i)).Attr[1].Val
if i == 1 {
pictureList += picURL
} else {
pictureList += "," + picURL
}
}
err = gdb.insertOrUpdateYmgalByID(picID, title, pictureType, pictureDescription, pictureList)
if err != nil {
log.Errorln("[ymgal]:", err)
}
}
func storeEmoticonPic(picIDStr string) {
picID, err := strconv.ParseInt(picIDStr, 10, 64)
if err != nil {
log.Errorln("[ymgal]:", err)
}
pictureType := emoticonType
doc, err := htmlquery.LoadURL(webPicURL + picIDStr)
if err != nil {
log.Errorln("[ymgal]:", err)
}
title := htmlquery.FindOne(doc, "//meta[@name='name']").Attr[1].Val
pictureDescription := htmlquery.FindOne(doc, "//meta[@name='description']").Attr[1].Val
pictureNumberStr := htmlquery.FindOne(doc, "//div[@class='meta-info']/div[@class='meta-right']/span[2]/text()").Data
re := regexp.MustCompile(reNumber)
pictureNumber, err := strconv.Atoi(re.FindString(pictureNumberStr))
if err != nil {
log.Errorln("[ymgal]:", err)
}
pictureList := ""
for i := 1; i <= pictureNumber; i++ {
picURL := htmlquery.FindOne(doc, fmt.Sprintf("//*[@id='main-picset-warp']/div/div[@class='stream-list']/div[%d]/img", i)).Attr[1].Val
if i == 1 {
pictureList += picURL
} else {
pictureList += "," + picURL
}
}
err = gdb.insertOrUpdateYmgalByID(picID, title, pictureType, pictureDescription, pictureList)
if err != nil {
log.Errorln("[ymgal]:", err)
}
}

76
plugin/ymgal/ymgal.go Normal file
View File

@@ -0,0 +1,76 @@
// Package ymgal 月幕galgame
package ymgal
import (
"strings"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() {
engine := control.Register("ymgal", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "月幕galgame\n- 随机galCG\n- 随机gal表情包\n- galCG[xxx]\n- gal表情包[xxx]\n- 更新gal\n",
PublicDataFolder: "Ymgal",
})
dbfile := engine.DataFolder() + "ymgal.db"
go func() {
_, _ = file.GetLazyData(dbfile, false, false)
gdb = initialize(dbfile)
}()
engine.OnRegex("^随机gal(CG|表情包)$").Limit(ctxext.LimitByUser).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.Send("少女祈祷中......")
pictureType := ctx.State["regex_matched"].([]string)[1]
var y ymgal
if pictureType == "表情包" {
y = gdb.randomYmgal(emoticonType)
} else {
y = gdb.randomYmgal(cgType)
}
sendYmgal(y, ctx)
})
engine.OnRegex("^gal(CG|表情包)([一-龥ぁ-んァ-ヶA-Za-z0-9]{1,25})$").Limit(ctxext.LimitByUser).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.Send("少女祈祷中......")
pictureType := ctx.State["regex_matched"].([]string)[1]
key := ctx.State["regex_matched"].([]string)[2]
var y ymgal
if pictureType == "CG" {
y = gdb.getYmgalByKey(cgType, key)
} else {
y = gdb.getYmgalByKey(emoticonType, key)
}
sendYmgal(y, ctx)
})
engine.OnFullMatch("更新gal", zero.SuperUserPermission).SetBlock(true).Handle(
func(ctx *zero.Ctx) {
ctx.Send("少女祈祷中......")
updatePic()
ctx.Send("ymgal数据库已更新")
})
}
func sendYmgal(y ymgal, ctx *zero.Ctx) {
if y.PictureList == "" {
ctx.SendChain(message.Text(zero.BotConfig.NickName[0] + "暂时没有这样的图呢"))
return
}
m := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Text(y.Title))}
if y.PictureDescription != "" {
m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Text(y.PictureDescription)))
}
for _, v := range strings.Split(y.PictureList, ",") {
m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Image(v)))
}
if id := ctx.SendGroupForwardMessage(
ctx.Event.GroupID,
m).Get("message_id").Int(); id == 0 {
ctx.SendChain(message.Text("ERROR:可能被风控了"))
}
}

67
plugin/zaobao/zaobao.go Normal file
View File

@@ -0,0 +1,67 @@
// Package zaobao 易即今日公众号api的今日早报
package zaobao
import (
"sync"
"time"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/zbputils/binary"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/zbputils/control/order"
)
const (
api = "http://api.soyiji.com/news_jpg"
referer = "safe.soyiji.com"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.66"
)
var (
picdata []byte
mu sync.Mutex
pictime time.Time
)
func init() { // 插件主体
engine := control.Register("zaobao", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "易即今日公众号api的今日早报\n" +
"api早上8点更新推荐定时在8点30后\n" +
"配合插件job中的记录在\"cron\"触发的指令使用\n" +
"- 记录在\"0 9 * * *\"触发的指令\n" +
" - 今日早报",
})
engine.OnFullMatch("今日早报", zero.OnlyGroup).SetBlock(false).
Handle(func(ctx *zero.Ctx) {
err := getdata()
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.ImageBytes(picdata))
})
}
func getdata() error { // 获取图片链接并且下载
mu.Lock()
defer mu.Unlock()
if picdata != nil && time.Since(pictime) <= time.Hour*20 {
return nil
}
data, err := web.RequestDataWith(web.NewDefaultClient(), api, "GET", "", ua)
if err != nil {
return err
}
picdata, err = web.RequestDataWith(web.NewDefaultClient(), gjson.Get(binary.BytesToString(data), "url").String(), "GET", referer, ua)
if err != nil {
return err
}
pictime = time.Now()
return nil
}