763 Commits

Author SHA1 Message Date
acd5408552 🍱 更新xx用什么的数据集 2023-04-15 01:43:10 +08:00
31b6bc7de4 🍱 更新收集的宝箱数据 2023-04-14 11:58:26 +08:00
4db59f2b1d 🍱 更新新圣遗物数据 2023-04-13 14:21:48 +08:00
99496abd40 添加查询琦良良换xx圣遗物的支持 2023-04-13 01:09:17 +08:00
d372757f72 🍱 更新原神3.6版本的metadata 2023-04-12 01:01:56 +08:00
689efe6595 🍱 更新血量表等杂图资源 2023-04-09 00:56:57 +08:00
7ec5618d56 🍱 更新原石预估素材 2023-04-02 00:28:07 +08:00
b4817ef539 🍱 新增新角色的参考面板,优化体验 2023-04-01 00:49:27 +08:00
739a14237c 增加获取抽卡记录链接功能 (#449) 2023-03-26 13:18:41 +08:00
c7f7130db3 🍱 更新参考面板版本深渊内容 2023-03-25 13:24:52 +08:00
15671c5204 🐛 修复材料 (#470) 2023-03-21 17:13:38 +08:00
a9644b6af2 🍱 更新原石预估 2023-03-14 00:23:24 +08:00
ca793d9b50 新增导出v3数据 2023-03-09 23:15:46 +08:00
b2564f3303 新增gsrc (#463) 2023-03-08 22:27:56 +08:00
bf530c7c49 🐛 修复查询白术的数据异常 2023-03-02 22:24:25 +08:00
d3214bd468 🍱 补充部分原神3.6的数据资料 2023-03-02 21:49:46 +08:00
04e05d708a ️ 支持查询白术查询卡维,修复几个BUG,优化体验 2023-03-02 21:17:33 +08:00
986dc750de 🎨 删除通用获取成功log (#461) 2023-03-02 02:32:42 +08:00
e0f6e68fb8 🐛 修补MetaData, 调整BUG(#461) 2023-03-02 00:04:08 +08:00
94aaa52fd6 🍱 更新原神3.5版本MetaData 2023-03-01 01:12:37 +08:00
f684f0e833 add Python 3.11 tests 2023-02-23 11:52:00 +08:00
772d54ef99 ⬆️ update nonebug 2023-02-23 11:38:01 +08:00
b6c855c1ae 🎨 更新切换api的API地址 2023-02-15 21:06:38 +08:00
558f280996 🐛 修复下载全部资源的问题 2023-02-14 23:24:16 +08:00
d75a023d10 下载全部资源将会检查版本差异 2023-02-14 22:28:47 +08:00
cd2eb1d217 🐛 修复部分情况下,扫码登陆无法获取正确UID 2023-02-11 15:34:11 +08:00
1a69c787b2 🎨 扫码登陆功能改为群聊触发以降低封号概率 (#443)
* 将扫码登陆功能改为群聊降低封号概率,并且增加uid绑定检验。

* 将扫码登陆功能改为群聊降低封号概率,并且增加uid绑定检验。

* 将扫码登陆功能改为群聊降低封号概率,并且增加uid绑定检验。

* 🚨 auto fix by pre-commit-ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-02-09 21:55:31 +08:00
e77b8b74b4 新增强制刷新抽卡记录 2023-02-09 01:55:55 +08:00
5da43afd78 📝 合并雷神和薙刀效果 2023-02-08 00:26:19 +08:00
fa3319a48d 🚑️ 修复删除配置项错误的问题 2023-02-07 00:08:16 +08:00
4f349cd253 🎨 移除失效配置、新增随机图配置 2023-02-06 23:47:27 +08:00
955ff47542 🐛 修复查询雷神的数值错误 2023-02-06 23:40:16 +08:00
ae38504e7e 修复test_adv 2023-02-05 21:55:45 +08:00
03e31d6416 🔧 修复pre-commit 2023-02-05 21:07:55 +08:00
4f0a3202ea 📝 更新查询收集的最大值 2023-02-05 21:02:40 +08:00
32e15df3cd 👽️ 更换随机图接口地址 (#441) 2023-02-05 20:25:07 +08:00
3a202afd19 📝 更新攻略、gs帮助、修复伤害参考bug 2023-02-04 19:11:21 +08:00
28227236da 🎨 微调强制刷新界面` 2023-02-03 00:29:40 +08:00
ed68e42385 🎨 修改强制刷新界面 2023-02-02 00:27:40 +08:00
b850f099d1 👽 更新ENKA_API 2023-01-29 22:52:15 +08:00
768619e0c1 ⬆️ update poetry-core(#433) 2023-01-28 08:05:35 +08:00
137c83471e 🍱 更新3.4血量表抗性表 2023-01-27 23:44:25 +08:00
20319c02ac 🐛 修复注册时间 2023-01-26 20:28:11 +08:00
79d90deae0 🚨 移除重复导入 2023-01-26 19:35:35 +08:00
9fee49e090 新增原神注册时间命令 (#431) 2023-01-26 19:11:19 +08:00
cc145d9a5c 🐛 修复查询心海的伤害计算和毕业度错误 2023-01-25 20:58:00 +08:00
1fbecaee53 🎨扫码登陆套聊天记录 (#430)
* 更改了一下刷新抽卡失败的提示

* 为扫码登陆套聊天记录,加入免责声明

* 🚨 auto fix by pre-commit-ci

* Update qrlogin.py

* 🚨 auto fix by pre-commit-ci

* 🎨 移动通用函数至`message`

* 🚨 auto fix by pre-commit-ci

* 🚨 修复一些警告

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: KimigaiiWuyi <444835641@qq.com>
2023-01-25 16:33:21 +08:00
f7ff22ad4c 新增chbg文件夹以供查询角色的自定义图 2023-01-24 00:02:59 +08:00
416cc371fc 新增查成就查委托 2023-01-23 15:54:46 +08:00
e73cd9e6eb 🍱 更新一部分成就资源 2023-01-23 15:21:08 +08:00
ec622d1388 🍱 更新艾尔海森瑶瑶的参考面板 2023-01-22 23:03:27 +08:00
bdfc63a6c7 🍱 增加查询米卡的治疗量计算,修复旅行者BUG 2023-01-20 19:11:57 +08:00
0c7d737ab7 🐛 修复新角色基础数值错误的问题 2023-01-20 00:10:08 +08:00
e0ae84ac89 🍱 更新3.5版本角色的别名和有效词条 2023-01-19 23:37:12 +08:00
b9519acf89 🍱 支持部分3.5版本的角色和武器的替换 2023-01-19 23:19:37 +08:00
6f22752b07 🐛 修复签到 (#428) 2023-01-18 21:54:52 +08:00
e13b3e5a52 🍱 更新原神3.4版本MetaData 2023-01-18 02:02:51 +08:00
8b3771a3a0 🐛 修复原神每日签到奖励物品名称获取错误的问题 (#428)
* 修复原神每日签到奖励物品名称获取错误的问题

* 🚨 auto fix by pre-commit-ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-01-17 22:22:24 +08:00
4ec467e154 📝 修改ck帮助的说明 (#421) 2023-01-17 00:21:52 +08:00
5b6384764a 🎨 补充_pass内容 2023-01-17 00:15:16 +08:00
7838611f14 新增刷新全部CK(需SU用户) 2023-01-16 23:31:52 +08:00
24257cdf90 🐛 修复xx在哪的一部分使用体验 (#427) 2023-01-15 17:42:48 +08:00
7692e9799a 新增刷新CK(需要用户绑定SK) 2023-01-15 00:48:22 +08:00
bdff2b31c1 🎨 增加几个安柏计划API 2023-01-14 23:59:14 +08:00
052d3c1c73 🐛 修正暴击率低于0%时期望伤害低于普通值的问题 (#422)
* 修正暴击率低于0%时期望伤害低于普通值的问题

* 🚨 auto fix by pre-commit-ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-01-10 22:53:21 +08:00
e5824e407e 🍱 更新原始预估3.4 2023-01-10 22:50:40 +08:00
5540fab06a 🎨 修改convert_img方法 2023-01-08 00:53:55 +08:00
6240d020eb 🐛 修复错误的sp_base 2023-01-06 23:17:56 +08:00
59c93fd6ef 🍱 同步查询艾尔海森的倍率,新增查询夜兰的蒸发伤害 2023-01-05 23:49:31 +08:00
668ad813c8 🐛 修复特殊情况下几种默认反应倍率 2023-01-03 23:59:02 +08:00
5eb4675628 🐛 修复原神公告的部分详情出现https错误 2023-01-02 23:49:24 +08:00
261437f466 🐛 修复清除原神公告红点 2023-01-01 01:31:17 +08:00
b24708f913 📝 更新gs帮助 2022-12-30 00:30:11 +08:00
3ff5b4f2fa 🐛 修复查询绫人等几个角色的伤害异常(#413) 2022-12-29 23:36:56 +08:00
698d310684 🎨 improve config
genshinuid_disabled_plugins: 禁用的插件(meta 无效)
genshinuid_priority: GenshinUID 的优先级

e.g.
```env
genshinuid_disabled_plugins=["enka", "help", "map"]
genshinuid_priority=5
```
2022-12-29 22:02:05 +08:00
18ed57b93a 🐛 修复导入子插件不完整的问题 2022-12-28 23:54:31 +08:00
ea486f7ff5 🐛 修复SQLModel导包问题 2022-12-28 23:49:15 +08:00
cd4ecb462c 🎨 separation of test dependencies into a new group
only test: poetry install --with test --without dev
2022-12-28 22:55:55 +08:00
3c3785cd48 🚨 fix lint warnings 2022-12-28 22:38:37 +08:00
37a6d2f7a8 新增原神公告 (#409) 2022-12-28 21:38:31 +08:00
29c46a93d6 🚑 fix bbs coin error 2022-12-28 10:22:08 +08:00
5ba1ba09e6 新增扫码登陆 2022-12-27 23:57:57 +08:00
21c7049fdd use pypi source default 2022-12-27 23:03:14 +08:00
76469c56a7 fix tests 2022-12-27 22:22:27 +08:00
b30bd4fa9c 🎨 update metadatas 2022-12-27 22:07:19 +08:00
eb6e822b6f 新增版本深渊,后可跟版本号 2022-12-22 00:16:22 +08:00
80f8a12789 增加hhw_api的相关方法 2022-12-21 23:01:43 +08:00
278cbcaa63 🎨 调整添加CK时候的判定顺序,修复几个BUG 2022-12-20 00:42:56 +08:00
ac98c9f896 新增数据文件夹内bg文件夹,用于存放自定义图片 2022-12-19 00:04:30 +08:00
c02d1f2f07 新增查询探索, 重绘的查询收集 2022-12-18 19:51:00 +08:00
0f1a0b02c2 🎨 添加draw_bar绘图方法,重绘收集样式 2022-12-18 19:48:18 +08:00
f4d1d47554 🐛 修复已知BUG、修改参考数值和角色BUFF错误 2022-12-17 19:17:17 +08:00
fb4c6b569c 🐛 修复已知BUG,优化报错提示(#405) 2022-12-16 23:19:53 +08:00
5e52c9abd4 🎨 为多条推送信息添加换行符 (#403) 2022-12-14 12:12:37 +08:00
c413e7d65c 🐛 修正国际服七圣召唤api (#402) 2022-12-14 12:00:45 +08:00
9e6cd2a2a8 🐛 下载全部资源时判断是否为空文件名 2022-12-14 09:45:03 +08:00
38910e9a2b 🐛 查询时额外输出问题 2022-12-14 00:07:15 +08:00
933e97ff97 攻略换用本地攻略源 2022-12-13 23:23:04 +08:00
09aa9af93a 🎨 更新深渊概览API,添加自动下载攻略 2022-12-13 23:15:37 +08:00
f1ff90c423 🍱 补充3.3新角色的参考面板毕业度 2022-12-12 22:52:40 +08:00
897399b77e 📝 限制绑定uid位数, 补充gs帮助 2022-12-11 17:16:48 +08:00
0099d16072 🎨 一些响应方式的修改 2022-12-11 15:25:18 +08:00
519aef0ca1 🎨 修改资源文件名 (#400)
* 修改资源文件名

统一命名,去除卡牌资源文件结尾的符号

* 🚨 auto fix by pre-commit-ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-12-11 14:07:54 +08:00
a6f66c5231 🎨 update dependencies 2022-12-11 14:01:01 +08:00
63488e7bbf 新增七圣召唤命令,后可跟UID 2022-12-11 13:54:13 +08:00
c7ceb7a14c 🎨 添加七圣召唤的API,修复一部分BUG 2022-12-11 13:50:06 +08:00
49612280fa 🍱 补充一些遗漏资源,修复几个BUG 2022-12-09 23:15:04 +08:00
e18e69aeed 🍱 补充一部分3.4的资源文件 2022-12-09 20:25:52 +08:00
1b402defbc 新增原牌功能, 例如原牌狼末 2022-12-08 23:29:54 +08:00
245446e329 🍱 增加一些资源文件 2022-12-08 23:20:55 +08:00
0832d9d79e 📝 提高原神版本至3.3 2022-12-07 01:08:32 +08:00
376f537701 🍱 新增原神3.3版本的元数据 2022-12-07 01:05:54 +08:00
a5933222c5 🐛 修复低星圣遗物的错误 2022-12-05 23:39:38 +08:00
455e9207ff 🐛 修复抽卡记录平均UP错误和提纳里的毕业度 2022-12-04 17:03:39 +08:00
fee7e8a936 🎨 优化一部分API访问 2022-12-04 13:55:06 +08:00
ba2b4aa86f 🐛 修复截获CK字段的错误 2022-12-03 00:04:32 +08:00
76f18d9c7c 🍱 补充版本规划3.3 2022-12-02 22:51:23 +08:00
95dbe36cf9 🐛 修复深渊概览刷新失败 2022-12-02 22:45:24 +08:00
d0d56f1a6d 🐛 修复未绑定UID时签到指令异常返回 2022-11-30 23:53:00 +08:00
b3a64c8aec 🐛 修复查询妮露的不正确毕业度(#397) 2022-11-29 22:01:36 +08:00
9d34e463ec 🎨 强制刷新支持使用@别人查询(#396) 2022-11-29 21:14:53 +08:00
0cb727784b 🎨 优化毕业度的计算值 2022-11-29 21:09:23 +08:00
1b743e9096 🎨 重做的毕业度计算 2022-11-29 01:48:01 +08:00
1ec87752a4 🚑️ 补充错误获取的CK 2022-11-26 23:31:42 +08:00
94050454e6 新增深渊统计(深渊概览) 2022-11-26 15:12:15 +08:00
2886cbfebf 🐛 修复缓存获取CK的BUG 2022-11-26 15:06:46 +08:00
fddc85c91e 🐛 修复仅修改命座的报错 2022-11-24 11:57:02 +08:00
63f5d0686b 🐛 修复查询六命散兵换xx无法生效的问题 2022-11-24 00:34:03 +08:00
21a6a3eafc 支持查询公子换香菱沙类似用法,并可以任意组合 2022-11-24 00:23:24 +08:00
a7eb2a33cb 💥 修改PROXY配置至config.json 2022-11-23 22:02:33 +08:00
aaf7431c92 🐛 兼容国际服的ID至UID的转换, 尝试从绑定UID读取 2022-11-12 17:00:29 +08:00
49a77f7fb9 👽️ 判断v2版本的米游社CK(#383) 2022-11-12 16:18:02 +08:00
ef923c5ba9 🐛 修复 Actions 错误 (#371)
* 🐛 修复 Actions 错误
 - PR 仓库无法执行 pre-commit
 - metadata 单元测试出错

* 🐛 修复 etc 单元测试出错

* 🐛 修复 pre-commit Actions 在 PR 中 checkout 错误

* 🚧 添加 pre-commit Actions 权限

* 🚧 调整 `pull_request_target` 触发类型

* 🚧 区分 pre-commit 提交步骤

* 🐛 remove `pull_request` trigger

* 🚨 auto fix by pre-commit-ci

* 🔥 delete pre-commit workflow

Co-authored-by: MingxuanGame <MingxuanGame@outlook.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-12 00:33:54 +08:00
68c42305e5 🎨 改进一部分错误提示 2022-11-12 00:28:55 +08:00
7fb4a4d572 👽️ 增加mr出现验证码的错误提示(#379) 2022-11-11 23:42:44 +08:00
ecdb232beb 🎨 修改部分角色BUFF,修改部分UI表现 2022-11-11 22:51:06 +08:00
8cd9570e2d 支持查询beta角色(数据从安柏计划获取) 2022-11-10 01:39:37 +08:00
e42ef039d1 📝 增加WeChat适配器的相关描述 2022-11-09 00:32:22 +08:00
28dce2f15c 为校验全部Cookies功能添加国际服支持(#377) 2022-11-08 21:36:21 +08:00
5ee22c89bf 🍱 增加一部分提示, 更新血量表等资源(#364) 2022-11-07 00:08:43 +08:00
9ddba001be 🐛 修复纳西妲业障除的伤害计算错误 2022-11-06 20:33:41 +08:00
58cabae6ee 🚑强制刷新检查绑定的UID 2022-11-06 19:13:12 +08:00
b59b406027 久岐忍,刻晴等角色添加更多的反应, 修复一些效果错误 2022-11-06 18:42:44 +08:00
e6d4d452a5 🍱 更新纳西妲的参考面板 2022-11-06 15:41:17 +08:00
8d82fba7af 🎨 添加判断刻晴是不是up (#376) 2022-11-06 14:45:25 +08:00
0a81e2b9fa 🐛 修复抽卡记录兜底值 2022-11-06 01:05:45 +08:00
98e0174348 重做的抽卡记录 2022-11-06 00:47:11 +08:00
9596199a3a 🐛 修复导入抽卡数据的ID错误 2022-11-05 01:49:57 +08:00
b9406eb634 🐛 修复低星圣遗物面板刷新的问题(#360) 2022-11-05 01:17:03 +08:00
30f164b2a1 添加几个角色的反应伤害, 修复*海量BUG 2022-11-04 23:35:01 +08:00
66224ece5b 🐛 修复防御力不正确加成, 优化使用体验 2022-11-03 05:11:50 +00:00
db9860531b 🐛 圣遗物四件套情况少计算两件套效果 2022-11-03 00:45:33 +08:00
d8d2ede988 支持查询六命莱依拉带精五月光换公子圣遗物类似用法 2022-11-03 00:00:00 +08:00
044701e730 🐛 修复一些效果和标记问题 2022-11-02 22:12:14 +08:00
2d1f766d7c 🐛 修正国际服ds生成规则 (#370) 2022-11-02 20:52:42 +08:00
b01117c224 🔧 兼容 Poetry (#368) 2022-11-02 16:04:22 +08:00
8ca7237075 🚑 向下兼容Python版本 2022-11-02 15:40:50 +08:00
41f047a96f 🐛 临时对随机获取cookie过程进行服务器隔离防止互相污染 (#367) 2022-11-02 13:25:45 +08:00
ad3859ed71 🍱 更新原神3.2版本伤害数据 2022-11-02 13:13:14 +08:00
e62f9ba574 🍱 新增原神3.2版本的元数据 2022-11-02 08:47:41 +08:00
93bcf9fbbc 🎨 统一角色面板处理文件 2022-11-01 22:50:56 +08:00
3ac2267cee 🐛 修复更新记录的绘图越界 2022-11-01 21:50:37 +08:00
c46f14e59f 为部分功能添加国际服支持 (#366)
Signed-off-by: Chino Kafuu <twfx1207@gmail.com>
2022-11-01 21:12:53 +08:00
99be740d11 ♻️ 重构部分伤害计算相关代码 2022-11-01 21:10:39 +08:00
21ddfa3cd6 补全对PicMenu的支持 (#361) 2022-10-31 15:10:10 +08:00
00bdc5fccb 🍱 更新参考面板妮露, 修复已知Bug 2022-10-24 21:16:20 +08:00
918632ad71 🐛 向下兼容网页控制台 2022-10-23 22:18:26 +08:00
b4f8371e5d 网页控制台为无管理员权限用户新增添加CK功能(#347) 2022-10-23 21:32:08 +08:00
59cc1e35c4 🐛 修复替换武器时因未正确判断类型导致伤害错误 2022-10-22 00:47:25 +08:00
798069565a 🎨 更新角色别名配置 (#359)
* 🎨 更新角色别名配置

* 🐛 修复角色别名识别

不再考虑输入为别名中字符串子串的情况
2022-10-22 00:13:43 +08:00
0b3dddb870 新增更新记录 2022-10-22 00:06:23 +08:00
58a0df17b8 新增gs清除缓存(如查询相关异常可尝试) 2022-10-21 00:40:34 +08:00
bdd4f26fe3 调整数据库缓存清除逻辑 2022-10-21 00:34:16 +08:00
c3ae3ed0db 查询妮露增加丰穰之核伤害计算(默认算上双水双草Buff) 2022-10-20 23:48:41 +08:00
ecd7a57ef3 🐛 查询甘雨伤害大招加成计算有误 2022-10-20 01:20:40 +08:00
c231cb4267 gs开启随机图的面板回复开启原图功能 2022-10-18 22:33:23 +08:00
26eb980e5b 🚚 为资源文件夹添加TEMP目录 2022-10-18 22:31:42 +08:00
ffb2558fec 🐛 修复一个面板抗性引发的问题; 更新伤害乘区 2022-10-18 21:00:47 +08:00
a9f26bb102 📝 补充gs帮助文件 2022-10-18 00:55:20 +08:00
2c1ad1466b 🎨 利用fastapi_genshin_map重写地图逻辑 2022-10-18 00:33:12 +08:00
25ffbfc4bc 🐛 修复一个导致CK死循环的错误(#354) 2022-10-17 22:49:38 +08:00
34eb5093d9 🐛 修复查询满命妮露的问题 2022-10-16 13:46:58 +08:00
9ac01864c5 重做的活动列表和新增卡池列表 2022-10-14 22:26:12 +08:00
db3ba78639 🎨 更高容纳度的get_qq_avatar方法 2022-10-14 01:28:13 +08:00
7617c29b6d 🔧 重命名依赖项 2022-10-14 01:10:42 +08:00
62d8ee5cd3 🐛 活动列表现在可以使用 2022-10-13 22:42:45 +08:00
bec03e8acc 重做的毕业度统计 2022-10-12 23:56:08 +08:00
396015763b 🎨 新增复用绘图方法, 更换默认背景图 2022-10-12 23:51:15 +08:00
4a1c402c38 ️ 增加gs帮助的内容 2022-10-10 23:53:06 +08:00
5fc6df94f6 现在查询展柜角色以图片返回 2022-10-10 23:29:17 +08:00
c39ddf30c2 🎨 优化绘图方法, 从中间裁切, 更新部分默认背景 2022-10-10 23:27:04 +08:00
124de5aff3 🐛 修复旅行者ID问题 2022-10-10 09:58:37 +08:00
3e61f3411a 🐛 修复强制刷新旅行者无法显示 2022-10-10 08:45:13 +08:00
1488e3eebb 🍱 更新3.1角色的参考面板 2022-10-10 00:41:21 +08:00
f32e40d362 现在强制刷新以图片返回结果 2022-10-10 00:25:54 +08:00
60af532185 🎨 新增一些绘图方法, 简化代码 2022-10-10 00:16:14 +08:00
ff317b8f7c 🐛 修复在高版本的依赖下插件报错 2022-10-07 22:28:33 +08:00
a703593836 新增清除无效用户(#206) 2022-10-07 21:28:45 +08:00
5f801276f5 🚑️ 缺漏符号 2022-10-07 13:39:13 +08:00
a2a6228b66 🎨 修改网页控制台主页 2022-10-07 13:35:11 +08:00
712380c24b 🎨 拉大签到间隔时长 2022-10-06 23:38:31 +08:00
27db2e14c4 新增gs开启跳过无感验证 2022-10-06 23:15:02 +08:00
3005b435d2 🐛 网页控制台的HTML修改 2022-10-06 19:29:05 +08:00
46a6e846e6 新增查询公子成长曲线类似用法 2022-10-05 18:24:19 +08:00
954e1dd965 新增各种缺失的曲线数据,修复大量面板Bug 2022-10-05 18:21:33 +08:00
f40730e510 improve downloading files 2022-10-05 15:46:30 +08:00
a60baf7975 add tests for etcimg and guide 2022-10-04 22:03:42 +08:00
7b9aec2761 🐛 fix creating map 2022-10-04 20:01:27 +08:00
a40a0ea74d 🙈 update .gitignore 2022-10-04 17:46:26 +08:00
711fe2ad1c 🎨 why not use Chinese? 2022-10-04 17:43:25 +08:00
391bf0aa0b 新增gs开启多彩面板 2022-10-04 00:09:50 +08:00
56a609226b support changing primary key 2022-10-03 23:02:27 +08:00
bc17763617 🐛 fix changing config error 2022-10-03 19:33:46 +08:00
a5a418f51c 🚀 support deploying by docker
docker build -t genshinuid:v3.1.0 .

nonebot 在 /nb2/nb2,GenshinUID 在 /plugin,需要的可自行挂载(用 docker volume)

默认不带有 go-cqhttp 及 nonebot-plugin-gocqhttp 插件,暴露端口 8080,需要自己连接 go-cqhttp

build 前修改 deploy 文件夹下的 .env.dev 修改镜像的 nonebot2 配置,或者可以运行后挂载 nb2 目录修改
2022-10-03 18:17:18 +08:00
aeec83f982 🐛 fix tests 2022-10-02 23:49:07 +08:00
85171c0172 ✏️ rename branch 2022-10-02 23:45:42 +08:00
1c363b7ff3 init tests 2022-10-02 23:43:40 +08:00
19dd446219 🎨 限制触发条件 2022-10-02 22:52:13 +08:00
6c778f1fcb 新增血量排行 2022-10-02 22:42:49 +08:00
7dad667064 🎨 更新收集数据,血量表,抗性表 2022-10-02 22:37:57 +08:00
c0532c06dd 🐛 面板查询的几个遗留问题 2022-10-02 22:15:14 +08:00
245121b318 🐛 remove logger for settings 2022-10-02 21:57:22 +08:00
501e8398b0 🐛 fix pydantic checking error 2022-10-02 21:40:46 +08:00
bac4d7061c mount WebConsole to nonebot ASGI server
path: /genshinuid
2022-10-02 18:47:27 +08:00
2cddf1c481 🎨 修改收集的数据和生成地图相关问题 2022-10-02 16:28:01 +08:00
973c64a2dc ⬆️ update genshinmap from MingxuanGame/GenshinMap 2022-10-02 14:11:50 +08:00
d4fd84da9b 🎨 更新gs帮助以及补漏其他功能 2022-10-02 01:53:28 +08:00
fd1f366db3 🐛 原石札记中分母为0的情况(#346) 2022-10-02 01:17:46 +08:00
86cc55cf78 🍱 角色成长曲线数据 2022-10-02 01:13:46 +08:00
70bc3b5143 新增御神签(#344) 2022-10-02 00:09:58 +08:00
6838ce7d5a 新增抽表情(#344) 2022-10-01 21:56:12 +08:00
75269479be 🐛 原石札记的一些UI问题 2022-10-01 20:41:20 +08:00
5d426aa4b4 新增当前信息(#337) 2022-10-01 19:49:01 +08:00
34af5a7c27 增加draw_note_img方法(#337) 2022-10-01 19:05:18 +08:00
dbd60d4ac4 🎨 原石预估现在将会输出当前原神版本的对应图片 2022-09-29 21:56:52 +08:00
ad4af70e21 新增赛诺E渡荒之雷伤害计算及超激化, 修复大量bug 2022-09-29 21:49:02 +08:00
06fa1a71fa 🎨 计算基础天赋时,如果没有则跳过 2022-09-29 08:40:59 +08:00
8cffc3f070 🐛 每日空值忽略世界等级(#342) 2022-09-28 22:32:58 +08:00
670cf730e7 🐛 每日如果收到空值则忽略签名处理(#342) 2022-09-28 21:15:26 +08:00
76a350a834 🐛 一部分武器的效果异常 2022-09-28 10:45:34 +08:00
830a246d96 🍱 新增原神3.1版本的角色和武器数据 2022-09-28 10:13:10 +08:00
5f7dfb93fc 🎨 修改mask.png的所在位置 2022-09-26 22:57:23 +08:00
113613bc94 🍱 新增原神3.1版本的元数据 2022-09-26 22:36:43 +08:00
bb6a2666ff 🐛 伤害值增加的错误计算 2022-09-26 21:35:45 +08:00
0e90dd9613 🐛 修复磐岩结绿攻击力转化效果 (#340) 2022-09-26 09:57:40 +08:00
2a5144b1d6 🎨 忽略空值 (#336) 2022-09-25 17:28:20 +08:00
1591cc6052 🐛 修复查询旅行者的问题 2022-09-24 22:49:58 +08:00
d8ec80bcd2 支持查询六命公子换精五飞雷类似用法 2022-09-24 18:59:31 +08:00
a50f26ecdc 支持查询雷神换精三弓藏类似用法 2022-09-22 23:44:22 +08:00
e59d42e168 🐛 现在可以更换低星武器 2022-09-22 23:29:08 +08:00
0941cd1196 🐛 修复抽卡记录中可能获取到空字典的情况 2022-09-22 23:17:36 +08:00
3e22dae35f 🐛 修复查询公子换月华时生命不正确以及部分角色天赋问题 2022-09-22 23:02:37 +08:00
ca40fad6d3 支持查询公子换冬极类似用法 2022-09-22 01:40:57 +08:00
11bee5a2fc 🎨 改进一些奇怪的问题 2022-09-22 01:39:19 +08:00
9cd5fbd0dc 🐛 解决远程链接用户无法发送本地图片 2022-09-22 01:12:21 +08:00
5443ef8ae2 使用计算替代读取面板, 也可使用gs开启旧面板返回 2022-09-22 01:08:16 +08:00
6e90802e30 🐛 修复琴位于探索中每日失效的问题 2022-09-21 01:58:41 +08:00
79f9aa9237 新增原石统计3.1 2022-09-20 21:33:15 +08:00
81da9e5735 🎨 gs重启将会杀死windows进程 2022-09-19 21:18:00 +08:00
fe439f7fb8 📝 Update requirements.txt 2022-09-19 21:16:56 +08:00
2608259a14 🐛 更新gs帮助 2022-09-18 18:32:58 +08:00
ca49ee0682 📝 更新gs帮助 2022-09-18 18:28:47 +08:00
c0ab255b32 📝 优化gs更新提示 2022-09-18 16:56:11 +08:00
99146c70ac 🐛 使用driver替换@get_driver() 2022-09-18 01:53:13 +08:00
8b7a1f5da7 🎨 优化的gs重启 2022-09-18 01:51:13 +08:00
d1312c5ecc gs重启 2022-09-17 21:32:20 +08:00
f2e3687f17 🎨 优化gs更新返回提醒 2022-09-17 11:18:50 +08:00
fbc76e5f8c 📝 导入新子插件包 2022-09-17 01:37:11 +08:00
4511f6c6c2 gs更新,gs强制更新,gs强行强制更新 2022-09-17 01:23:08 +08:00
7d98e374ee 🎨 分离添加时发送的消息类型 2022-09-17 00:17:33 +08:00
c917459e79 🐛 修复五郎位于探索中每日失效的问题(#334) 2022-09-17 00:14:16 +08:00
63710928f4 🔧 增加GitPython,fastapi_user_auth,fastapi_amis_admin依赖 2022-09-17 00:11:07 +08:00
5d21214a65 新增gs开启网页控制台 2022-09-16 23:58:18 +08:00
ab83a6689f 🎨 改进部分写法以避免type ignore (#332) 2022-09-14 23:04:31 +08:00
c8238e83cf 🐛 查询云堇时毕业度不正确显示 2022-09-12 16:04:40 +08:00
79bb8c2595 🍱 毕业度计算增加多莉,钟离E总护盾量 2022-09-12 15:02:18 +08:00
2ba6701304 🎨 修正新角色的有效词条 2022-09-12 12:10:21 +08:00
29a5a1a8b5 🐛 使用绝对路径导出抽卡记录 2022-09-12 00:45:35 +08:00
0faeef3544 抽卡记录中角色祈愿将新增up标识 2022-09-12 00:26:50 +08:00
efb31d55af 🐛 查询角色时因随机图API导致的错误 2022-09-11 23:11:12 +08:00
997e024681 🎨 调整并发任务超时时间 2022-09-11 20:50:24 +08:00
1445e0decb 📝 add requirements.txt 2022-09-11 19:11:19 +08:00
2a55819cd5 增加删除CK的数据库方法(#206) 2022-09-11 19:08:23 +08:00
cbf8d26005 使用sqlmodel替换base基类(#319) 2022-09-11 17:52:28 +08:00
4dc93cb7c2 🐛 修复消息段类型不匹配导致无法发送消息 (#329) 2022-09-11 17:50:29 +08:00
43e1202499 🐛 修复伤害计算因暴击率造成的数值错误(#328) 2022-09-11 14:49:46 +08:00
47fbf74e29 更换为下载速度更快的MINIGGICU 2022-09-11 14:35:55 +08:00
27b343a95e 🐛 auto move: delete utils 2022-09-10 18:00:01 +08:00
e8642ac7d8 add auto move files script 2022-09-10 17:49:01 +08:00
ffd27fe2db 🐛 gs帮助在部分情况下无法发送成功 2022-09-10 15:25:55 +08:00
b8395ab3fe 🐛 提高等待时间 2022-09-10 15:22:11 +08:00
e95f1ce4e3 🐛 并发下载漏剩余文件 2022-09-10 15:18:56 +08:00
cf67c7f1ea 并发下载资源包 2022-09-10 15:14:38 +08:00
5bd4890add 🚑 exist_ok=True 2022-09-10 15:02:03 +08:00
38471d4f11 🔀 merge nonebot2-beta1-git into nonebot2-beta1 (#325)
 支持使用 pip/nb-cli 安装
2022-09-10 14:49:16 +08:00
d3e1b24fdb 🔊 change warning to info 2022-09-10 00:25:48 +08:00
3cefc786ff 🔥 remove poetry.lock 2022-09-10 00:21:31 +08:00
d2f9c95e95 🐛 init dir 2022-09-10 00:20:37 +08:00
bdfd5714d2 🐛 遗漏的路径 2022-09-09 23:46:13 +08:00
244e4ae414 🚚 移动资源路径 2022-09-09 23:32:33 +08:00
0f225418be 🚚 change the player data path 2022-09-09 22:58:29 +08:00
82f7b05a69 🎨 change the warning colors 2022-09-09 22:30:11 +08:00
78daf6a934 support installing by pip 2022-09-09 20:58:48 +08:00
843166211b 📝 更新README.md 2022-09-09 11:34:42 +08:00
9fffc3be60 🐛 修复新匹配算法带来的问题 2022-09-09 00:27:48 +08:00
0643b7d888 添加CK和SK时转为图片回复(#320) 2022-09-09 00:13:17 +08:00
0dff2bf76a 🎨 增加添加CK的返回图片 2022-09-09 00:11:25 +08:00
ee88d072a1 🎨 降低精通带来的毕业度提升 2022-09-08 23:16:43 +08:00
89181be54a 🎨 增加gs帮助内容 2022-09-08 21:48:57 +08:00
bc522c2259 🐛 修复计算毕业度时香菱的攻击加成 2022-09-08 13:01:45 +08:00
6f8c5b60e0 gs帮助现在可用 2022-09-08 02:31:29 +08:00
b5992535c8 draw_help_card.py 2022-09-08 02:29:57 +08:00
1354400e27 👽️ 修复Enka的返回值增加 2022-09-07 10:50:51 +08:00
a96cb5b92f 🐛 角色伤害加成获取有误 2022-09-07 10:23:05 +08:00
2682b0c807 💬 增加制作帮助图所需资源 2022-09-07 00:52:09 +08:00
7788067def 🐛 小鹿的英文简称错误 2022-09-06 19:55:09 +08:00
7ba36afa97 🐛 神里绫华Q+3不生效 2022-09-06 15:05:15 +08:00
3c6f46bf7b 🐛 伤害计算减防不生效 2022-09-06 15:04:37 +08:00
3c8a706d2d Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-09-06 10:36:53 +08:00
fe1dad35ab 🚑 fix unknown parameterless 2022-09-06 10:34:33 +08:00
7c6d123bff 📝 更新须弥宝箱数量(#318) 2022-09-06 09:35:17 +08:00
45e3781020 use rule to simplify code 2022-09-05 23:40:25 +08:00
40af1c28db 🎨 补充遗漏内容 2022-09-05 21:44:03 +08:00
f325cc136b 新增gs开启催命模式 2022-09-05 21:41:36 +08:00
31d3f6f783 🍱 更新血量表,抗性表, 增加雷神E协同攻击超激化 2022-09-04 14:08:40 +08:00
e8ca7f7853 新增任务<任务名>,任务<地区名> 2022-09-04 13:58:17 +08:00
ff4ee1929d 🔥 删除无用代码 2022-09-04 01:39:16 +08:00
1b8e05d02b 改进的毕业度计算 2022-09-04 01:22:04 +08:00
5dbea107ab 🎨 修复空UID仍然输出log(#316) 2022-09-03 17:45:45 +08:00
09b47a5f2d 🎨 增加几个角色的反应伤害;移除雷神A的超激化反应 2022-09-03 17:30:55 +08:00
03cc73696a 新增gs配置,gs开启定时签到,gs开启定时米游币 2022-09-03 11:07:08 +08:00
6cbb92423b draw_config_card.py 2022-09-03 11:03:19 +08:00
79dff3fe7c 🐛 值错误 2022-09-02 01:25:02 +08:00
0c4719dc07 🍻 修复之前bug造成的影响 2022-09-02 01:23:50 +08:00
f9e1c3f7dd 🐛 uigf_gacha_type映射关系 2022-09-02 01:18:32 +08:00
b67eed8089 Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-09-02 00:04:34 +08:00
f604d7a007 支持导出抽卡记录和导入抽卡记录 2022-09-02 00:04:00 +08:00
d222368ba8 Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-09-02 00:03:14 +08:00
2e361247c8 🐛 返回字段错误 2022-09-02 00:02:38 +08:00
46f389e5eb Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-09-02 00:01:54 +08:00
cbb7947dd0 👷 auto run pre-commit in pull requests 2022-09-02 00:01:09 +08:00
c52c2192e7 改进的导入导出方法 2022-09-01 23:41:02 +08:00
5402f034fe export and import.py 2022-09-01 00:22:28 +08:00
7d50cc134b 📝 新增xx用什么的须弥角色信息 2022-08-31 21:00:07 +08:00
71bcb82082 🐛 修复每月统计(#315) 2022-08-31 20:47:21 +08:00
7061832664 🐛 修复一些问题 2022-08-31 20:40:31 +08:00
bb119bfd6f 🐛 首次刷新抽卡记录可能失败 2022-08-31 02:44:56 +00:00
ee987c11ed 🐛 查询柯莱的蔓激化 2022-08-31 02:19:10 +00:00
d80706beaf 新增gs开启随机图 2022-08-31 01:39:52 +00:00
09f1f39d62 🐛 修复刷新抽卡记录 2022-08-30 23:55:34 +08:00
d95c1a0c2d 📝 增加更多的角色别名 2022-08-30 23:30:11 +08:00
10a0199fdb 🐛 尝试修复刷新抽卡记录的数据错误 2022-08-30 22:46:01 +08:00
edc86d456d 📝 修改收集命令数据为3.0版本 2022-08-30 22:25:17 +08:00
445d190d34 增加切换api 2022-08-30 22:22:50 +08:00
b84c00c6a1 🐛 现在可以使用草主推荐等旅行者攻略 2022-08-30 22:15:51 +08:00
de78a3b13c 新增刻晴, 提纳里, 柯莱, 北斗的草系反应 2022-08-30 22:14:06 +08:00
68baa744b2 🍱 增加新角色参考面板 2022-08-30 21:39:42 +08:00
0aaf186615 🐛 猎人之径的效果错误问题 2022-08-30 10:31:46 +08:00
22febab01c 添加插件帮助 (#311) 2022-08-30 09:00:02 +08:00
47929f764c 🐛 fix req.json() error 2022-08-30 08:40:27 +08:00
72ebb26b12 🐛 fix miHoYo BBS api error 2022-08-29 21:38:48 +08:00
8333d61eae use req.json() instead of json.loads 2022-08-29 19:31:38 +08:00
9efaf75c0a recover changes
This reverts commit 9bd0085982.
2022-08-29 14:55:36 +08:00
9bd0085982 🐛 httpx.ReadTimeout 2022-08-29 14:08:59 +08:00
21150c7514 🎨 refactor by sourcery 2022-08-29 01:21:58 +08:00
2a337ce8e9 🚨 fix codestyle warnings 2022-08-29 00:46:56 +08:00
51866deb99 🚨 fix F841 and E722 warnings 2022-08-29 00:07:17 +08:00
331198fa5a 🚨 fix import warning 2022-08-28 23:57:14 +08:00
017fbf6683 remove requests 2022-08-28 23:08:16 +08:00
6c68ba3657 🐛 fix import error 2022-08-28 22:30:42 +08:00
a05fdfb9b8 🚨 fix F405 warning(#308) 2022-08-28 21:51:30 +08:00
4a211dd32f 🐛 修复久岐忍大招的伤害显示问题, 增加草系反应 2022-08-28 18:31:26 +08:00
96628af1c8 🎨 适用于多种情形的convert_img 2022-08-28 17:26:13 +08:00
d53f920bb3 🎨 抽卡记录现在计算平均时会排除掉首个出金 2022-08-28 14:14:55 +08:00
4c84a729d0 🐛 直接添加Stoken无法添加成功的问题 2022-08-28 13:30:09 +08:00
3548477289 Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-08-28 13:04:26 +08:00
b836263039 🐛 修复一处提示文案错误 2022-08-28 00:28:01 +08:00
7ddf72ea17 🐛 修复刷新抽卡记录 2022-08-27 19:00:46 +08:00
e960a19060 增加部分草系反应的计算 2022-08-27 18:53:11 +08:00
44934543ea 🐛 修复地图黑色区域,重新生成地图即可 2022-08-27 02:42:26 +08:00
f9fc8539eb 🚨 meta中的错误格式 2022-08-26 22:54:12 +08:00
4002f8597a 🐛 解决合并冲突 2022-08-26 22:48:22 +08:00
fa490d744a 适配PicMenu插件(nonebot2版本需求上升至2.0.0b4 2022-08-26 22:41:45 +08:00
a6dfb9489c 新增刷新抽卡记录,抽卡记录 2022-08-26 22:33:59 +08:00
5f074c645c edit
edit

edit

edittttt
2022-08-26 22:33:50 +08:00
3b1e03a8ac 增加3.0新角色的伤害计算 2022-08-26 22:33:49 +08:00
10fb6c23f8 更换minigg.icu为资源自动下载站 2022-08-26 22:33:49 +08:00
6071903db4 edit 2022-08-26 01:13:46 +08:00
97eafe0c4f feat: 适配PicMenu插件(nonebot2版本需求上升至2.0.0b4 2022-08-25 02:36:39 +08:00
4f7ee1b8fc 🐛 尝试解决文件冲突问题 2022-08-24 23:33:31 +08:00
790c6c363a 🍱 增加部分3.0图片资源 2022-08-24 22:46:06 +08:00
a680fd40c0 🍱 新增部分3.0 map原始数据* 2022-08-24 01:06:18 +08:00
e7d6b90950 🎨 新增, 修复EnkaAPI 2022-08-22 05:15:30 +00:00
8dc4bf8b38 🚸 增加部分错误提示 2022-08-22 01:07:27 +08:00
372a03baaa 🐛 修复大部分武器常驻效果错误的问题 2022-08-21 20:36:22 +08:00
9a22c2f0a0 🐛 武器常驻被动不参与计算 2022-08-20 23:51:29 +08:00
e7f934342e 🐛 倍率和常量互相转换 2022-08-20 19:16:51 +08:00
b385d78655 🐛 修复伤害计算中可能的逻辑错误 2022-08-20 12:21:07 +08:00
d853a3bffe 🐛 查询神里绫华进行附魔 2022-08-19 22:42:44 +08:00
2331e54519 🐛 修复查询甘雨查询夜兰中特殊箭矢的重击计算 2022-08-19 22:31:01 +08:00
84111f11b9 🐛 修复添加CK字段中如果存在cookie_token会忽略login_ticket的bug 2022-08-19 21:15:51 +08:00
2120c5387c 🔨 update requirements.txt 2022-08-19 19:36:55 +08:00
0c1d0c8dd3 🐛 查询雷神梦想一刀伤害错误 2022-08-19 19:03:58 +08:00
ca81bbf131 Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-08-19 19:02:07 +08:00
418399abf2 🔨 add requirements.txt 2022-08-19 19:01:51 +08:00
1fca111eef 🐛 技能等级也应缩小一位 2022-08-19 13:19:26 +08:00
02627e9743 🐛 转换等级时应缩小一位 2022-08-19 09:18:15 +08:00
e0f19e144f 🐛 修复salt的问题导致的其他任务无法完成 2022-08-19 01:41:54 +08:00
2f88ca9f96 👽️ 修复因为米游社API变动导致的开始获取米游币失败 2022-08-19 01:35:14 +08:00
55296b8ca7 查询风系角色时,将会计算扩散伤害 2022-08-19 01:01:28 +08:00
a1ad2a2ab5 🐛 雷神满愿力的计算方式,角色偏移等 2022-08-18 20:37:30 +08:00
d7cd6b0955 查询胡桃等增加蒸发反应计算,查询雷神增加满愿力计算 2022-08-18 01:52:37 +08:00
5e706cc04d 新增血量表, 抗性表 2022-08-16 22:04:42 +08:00
18ae78863c 🐛 启动会下载多余的圣遗物图片 2022-08-16 22:00:51 +08:00
ab8cfe3290 优化 (#296)
* 优化资源下载

* 优化资源点查询
优化地图名称提示
优化查询语句匹配
2022-08-16 20:42:14 +08:00
91c4224b01 👽️ 再次增大重试间隔, 尝试修复全部重签 2022-08-16 01:00:32 +08:00
f60716f3fe 新增版本规划(版本规划2.8), 伤害乘区 2022-08-16 00:14:29 +08:00
8e4c3aa3e7 数据库会在凌晨0点进行备份,备份留存最近五天 2022-08-16 00:12:25 +08:00
0aa94deaae 查询面板现支持自定义图片;支持查询旅行者 2022-08-15 23:20:46 +08:00
2eafb87fe5 每日现在可以显示体力回满还需要多久 2022-08-15 21:56:18 +08:00
3205499096 🐛 genshinuid_map支持python3.8 2022-08-15 20:36:45 +08:00
9e13b43d8d 🐛 全部重签 2022-08-15 15:37:08 +08:00
efbfea22e1 👽 尝试通过重试修复签到全部重签 2022-08-15 13:32:21 +08:00
3f55b031b2 🐛 修复毕业度统计,修复查询魈伤害计算 2022-08-15 00:10:24 +08:00
df7245d9c7 🐛 ST to St 2022-08-14 23:02:55 +08:00
3191714394 🐛 genshinuid_enka伤害计算附魔问题 2022-08-14 22:51:08 +08:00
1bf87585cf Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-08-14 22:48:04 +08:00
e6be183259 🐛 修复mode引发的问题 2022-08-14 22:46:57 +08:00
ba1da7f328 🐛 兼容不使用米游币的数据库问题 2022-08-14 20:36:36 +08:00
32fd9c66e1 🐛 每日信息的存在性校验 2022-08-14 19:21:50 +08:00
e42fe4d745 🐛 handle_exc 2022-08-14 18:50:10 +08:00
88395108dc 🐛 List 2022-08-14 18:44:28 +08:00
6b01b98f1f 🐛 生成地图的链接错误 2022-08-14 18:42:34 +08:00
300f907985 🐛 生成地图的错误提示 2022-08-14 18:34:17 +08:00
9c196a7341 🐛 type hints 2022-08-14 18:22:57 +08:00
8dc2494bed 🐛 extend_existing 2022-08-14 16:55:23 +08:00
0da4c273e7 🐛 extend_existing 2022-08-14 16:37:10 +08:00
c371f64449 添加依赖sklearn和shapely 2022-08-14 16:08:38 +08:00
0f4f02c687 🎉 GenshinUID 3.0 beta 2022-08-14 14:34:32 +08:00
9bf5c26b22 Merge pull request #291 from lgc2333/patch-1
修复文本错误
2022-08-09 14:11:02 +08:00
641d4a5ad9 修复文本错误 2022-08-09 14:01:36 +08:00
816feb22e6 🐛 Enka UA 2022-08-08 12:08:50 +08:00
64c145c68d 👽️ 修复原神签到 2022-08-05 08:42:49 +08:00
a8b2ad5fbc ��️ 修复开始获取米游币 2022-08-05 00:40:34 +08:00
8a57b016cd 🐛 修复伤害计算 2022-07-20 21:08:57 +08:00
e76eff24fe 更新:查询收集的max_data 2022-07-20 16:59:46 +08:00
1105ff1ac7 Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-07-16 19:23:16 +08:00
cf6ea4bc6a 优化:伤害计算 2022-07-16 19:23:00 +08:00
a70061b158 修复:EnkaAPI 2022-07-16 14:11:44 +08:00
5fa9ef4b84 更新:用什么, 给谁用 2022-07-15 00:25:44 +08:00
bc02c23cee 修复:活动列表 2022-07-15 00:13:35 +08:00
beb9a566a3 修改:version 2022-07-14 22:24:56 +08:00
3480677c52 修复:鹿野院平藏资源问题 2022-07-14 08:54:54 +08:00
ea86619795 更新:2.8相关资源 2022-07-13 23:23:58 +08:00
e2d75b3752 修改:avatarCardOffsetMap.json 2022-07-11 10:37:48 +08:00
6269277b96 修复:毕业度统计 2022-07-11 10:35:23 +08:00
31941d31b2 优化:伤害计算区域对齐 2022-07-10 01:57:25 +08:00
55bfd25f64 新增:毕业度统计 2022-07-09 20:55:11 +08:00
6706fd1312 修改:UI贴图 2022-07-09 20:53:21 +08:00
35d0596f17 新增:查询展柜角色的伤害计算 2022-07-09 20:47:27 +08:00
5ab0693f7b 修复:命座影响天赋的map引入 2022-07-03 00:23:30 +08:00
4277a40450 修复:遗漏的图片 2022-07-03 00:09:17 +08:00
cfa3f91379 修复:班尼特的元素充能效率计算为有效词条 2022-07-02 23:16:18 +08:00
4b1ad04662 修改:查询角色面板的背景上色方式 2022-07-02 22:26:53 +08:00
c854194fcc 修复:因为地脉活动导致的活动列表错误问题 2022-07-02 17:12:40 +08:00
451e871d1b 新增:每日自动米游币任务结束后向SUPERUSER发送报告 2022-07-02 01:13:40 +08:00
4bc1533063 新增:校验全部Stoken 2022-07-02 00:51:08 +08:00
62649caa31 优化:命座显示天赋+3 2022-07-01 22:37:11 +08:00
0c9b291ee9 修复:特殊情况下查询深渊角色显示头像异常 2022-07-01 13:07:21 +08:00
29df398de6 新增:谁能用可以模糊查询圣遗物匹配信息 2022-06-30 23:47:28 +08:00
0694443bca 修复:推荐表内的换行问题 2022-06-30 23:43:57 +08:00
75b078810a 修复:能用啥的三星武器丢失问题 2022-06-30 23:18:31 +08:00
7aa07579db 修复:查询展柜角色中旅行者无法正常显示 2022-06-30 23:09:30 +08:00
a50a6167e2 优化:查询失败返回语句优化 2022-06-27 00:05:32 +08:00
382068070e 优化:全新的活动列表界面 2022-06-26 21:35:55 +08:00
782307e4bb chore(deps): Bump nonebot2 from 2.0.0b2 to 2.0.0b4 2022-06-25 20:16:58 +08:00
94f3c3a7cb 修复:天赋的tag问题 2022-06-25 11:45:54 +08:00
d441c25c51 优化:天赋的数字类型判断 2022-06-25 01:27:40 +08:00
675e8e4f65 更新:gs帮助 2022-06-25 01:00:32 +08:00
3a02a8f496 删除:无用的测试代码 2022-06-25 00:50:24 +08:00
387f618c59 修复:查询词云 2022-06-25 00:47:09 +08:00
0bacc8c674 修复:天赋中存在数字错乱的问题 2022-06-25 00:18:07 +08:00
ee74e054d8 修复:查询展柜角色 元素充能效率 -> 充能效率 2022-06-24 19:36:43 +08:00
83681c8e15 修复:久岐忍的探索派遣状态问题 2022-06-24 00:33:38 +08:00
27572a3af4 更新:gs帮助内容 2022-06-24 00:31:23 +08:00
2ad9b6242e 修复:烟绯的毕业度计算问题 2022-06-23 19:35:28 +08:00
01de70c1af 新增:完善dmgMap.json的制作方式 2022-06-22 21:54:58 +08:00
00c5280ec6 新增:久岐忍有效词条的计算 2022-06-22 01:11:58 +08:00
cca8c34bba 优化:圣遗物评分将变为有效词条计数 2022-06-22 01:00:23 +08:00
bf259f805d 修改:强制刷新返回字段,减少风控 2022-06-21 13:02:54 +08:00
ebdbec5fcd 修复:抗性区的计算问题 2022-06-21 12:53:49 +08:00
d96c7b0e06 修复:伤害计算错误 2022-06-19 21:05:02 +08:00
a6130424d5 优化:查询展柜角色优化整体UI 2022-06-19 15:50:51 +08:00
b8ce462636 修复:部分文案重叠 2022-06-19 14:48:45 +08:00
7c1508fd23 修复:完善全角色查询展柜角色毕业度的计算 2022-06-18 20:29:33 +08:00
5581b85332 查询展柜角色中完善角色立绘偏移 2022-06-17 00:28:47 +08:00
5dc5110ee3 '新增:引入avatarOffsetMap.json' 2022-06-14 00:24:17 +08:00
fe31910a09 修改:开始获取米游币的回复描述 2022-06-13 19:44:50 +08:00
04a486a256 '修复:计算毕业度时,绫人,绫华,迪奥娜,霄宫,九条的异常问题' 2022-06-13 00:05:26 +08:00
d1ca4da918 '新增:查询xx页面新增角色毕业度' 2022-06-12 22:56:55 +08:00
75d6083419 修复:强制刷新造成的安柏数据错误;新增:equipSets字段 2022-06-11 17:29:39 +08:00
c2e87458a1 更新:参考面板水新增夜兰 2022-06-07 19:22:42 +08:00
202e86ee77 Update README.md 2022-06-07 12:57:31 +08:00
27eef2e13e 优化:武器命令(防止两个Bot互刷) 2022-06-06 13:06:44 +08:00
9c9bae7cc6 新增:数据库将保留五天备份 2022-06-05 22:24:21 +08:00
6c41b75e42 修复:查询收集小数问题 & 更新数据 2022-06-05 20:26:14 +08:00
bfbf3140ac 优化:查询攻略图片前校验URL是否存在 2022-06-05 18:26:36 +08:00
a2305773a9 支持通过uid方式查询其他玩家的展柜信息 2022-06-05 16:42:49 +08:00
ec250a3cbb 修复若水和落霞的武器map 2022-06-05 16:30:04 +08:00
f7d62129cb 完善查询展柜信息的错误提示 2022-06-05 13:58:06 +08:00
d24a3109f0 更新xx能用啥命令的推荐表 & 备注 2022-06-04 21:57:43 +08:00
e2b52b0987 完善Map制作方式 2022-06-04 14:45:04 +08:00
8fb71cb0be fix 2022-06-03 19:19:17 +08:00
a974b7b1b7 去除UI线框,换用默认大图 2022-06-03 19:08:25 +08:00
a475fd8811 修复:命座数据问题 2022-06-02 11:37:07 +08:00
74e471380a 添加:夜兰 2022-06-02 09:50:10 +08:00
6f9d251fd1 添加:夜兰 2022-06-02 09:49:29 +08:00
8e87716175 Merge pull request #249 from lgc2333/nonebot2-beta1
fix
2022-06-02 01:41:51 +08:00
daffc0e39f Merge remote-tracking branch 'origin/nonebot2-beta1' into nonebot2-beta1 2022-06-02 01:40:05 +08:00
ac2346def6 ~~fuck~~ fix 2022-06-02 01:39:50 +08:00
e7c9071a2a Merge branch 'KimigaiiWuyi:nonebot2-beta1' into nonebot2-beta1 2022-06-02 01:19:02 +08:00
07ac6fc212 requirements 2022-06-02 01:18:00 +08:00
6bb12944b8 fix 2022-06-02 01:17:02 +08:00
46d94cebe3 Merge pull request #248 from lgc2333/nonebot2-beta1
fix & format
2022-06-02 00:12:12 +08:00
94838c0a0a fix 2022-06-01 23:52:37 +08:00
4e2f6d8ee0 fix 2022-06-01 23:40:26 +08:00
47bc645b68 format 2022-06-01 23:34:57 +08:00
60d1c59f2c matcher.**finsih** 2022-06-01 23:33:48 +08:00
96d4ba3211 Merge branch 'nonebot2-beta1' of https://github.com/lgc2333/GenshinUID into nonebot2-beta1 2022-06-01 23:16:33 +08:00
26fbb1b38c 补充文件 2022-06-01 23:13:59 +08:00
d201c33278 Merge branch 'nonebot2-beta1' of https://github.com/lgc2333/GenshinUID into nonebot2-beta1 2022-06-01 22:57:46 +08:00
97fee4c824 新增:查询展柜角色 2022-06-01 22:14:57 +08:00
12bd7ba921 chore(deps): pin nonebot2 to 2.0.0b2 2022-06-01 15:04:19 +08:00
29a98bab97 fix: import ActionFailed from nonebot.adapters.onebot.v11 2022-06-01 15:03:09 +08:00
e4c4e66e58 新增:查询收集 2022-06-01 00:02:24 +08:00
f74d04f53a Merge branch 'KimigaiiWuyi:nonebot2-beta1' into nonebot2-beta1 2022-05-31 01:52:42 +08:00
ead44f46f6 新增:gs关闭米游币推送 2022-05-28 21:41:34 +08:00
894da9c2a6 整理依赖 (#240) 2022-05-25 21:36:23 +08:00
ae25d5c6b1 修复:新api接口(-record) 2022-05-18 19:44:01 +08:00
4f605e8654 Merge #229 into nonebot2-beta1 (by @lgc2333) 2022-05-11 08:37:38 +08:00
ca8ecb677b Merge branch 'nonebot2-beta1' of https://github.com/lgc2333/GenshinUID into nonebot2-beta1 2022-05-11 02:25:26 +08:00
89db8d35ca reformat README 2022-05-11 02:21:54 +08:00
65c3496e37 Merge #222 into nonebot2-beta1 (by @lgc2333)
gen char_adv_list.json from xlsx that weapon_adv and char_adv use
2022-05-02 22:32:43 +08:00
eccfe329a3 rename 2022-05-02 22:30:20 +08:00
86e22f7374 modify regex match param 2022-05-02 22:27:12 +08:00
62fccbedef move 2022-05-02 22:23:48 +08:00
4ef0be08e8 fix 2022-05-02 22:19:11 +08:00
1fd5b6c564 gen char_adv_list.json from xlsx that weapon_adv and char_adv use 2022-05-02 22:11:58 +08:00
1a88b93efd 同步查询 -> uid & mys 2022-05-01 23:00:54 +08:00
1b3706a46b 颜色转换 2022-05-01 22:58:59 +08:00
ecad374c03 Merge #220 into nonebot2-beta1
fix: use depends
2022-04-30 21:57:42 +08:00
fa4ca0be51 fix: use depends(fix #207, fix #219) 2022-04-30 21:49:51 +08:00
240a01fb18 Merge pull request #216 from yen-qian/nonebot2-beta1
修复安装时httpx版本冲突问题
2022-04-28 17:49:19 +08:00
yen
7103e7d8ca Update requirements.txt 2022-04-28 17:46:24 +08:00
728ea9abc2 yapf 2022-04-27 23:44:56 +08:00
2f90e0ee3b 新增:参考面板(eg.参考面板火) 2022-04-27 23:11:12 +08:00
42d28f2fed 当ck数量大于9条时,[校验全部Cookies]命令输出精简 2022-04-26 22:12:05 +08:00
1893edf8a7 fix: send error message(fix #207, fix #208) 2022-04-25 21:29:15 +08:00
92b9e1737f fix:send error message 2022-04-20 09:23:57 +08:00
d4c5d515c8 fix #205 2022-04-18 22:27:07 +08:00
1198c71160 fix #205 2022-04-18 22:23:16 +08:00
6d4704da56 test: wiki 2022-04-18 17:08:56 +08:00
4234cc2d2e fix:audio error&style: use finish 2022-04-18 16:53:54 +08:00
c07e864aa0 Merge #204 into nonebot2-beta1 (by @shirokurakana)
减少重复代码
2022-04-17 22:52:37 +08:00
de97644fd0 fix: finish can't raise FinishedException 2022-04-17 22:50:02 +08:00
3b862cb54f 减少重复代码 2022-04-17 22:24:54 +08:00
192682ea2a Merge pull request #202 from shirokurakana/nonebot2-beta1
重做消息响应器&参数获取
2022-04-17 11:03:48 +08:00
3593c2d163 防止一律响应开头满足条件的消息 2022-04-16 15:03:11 +08:00
9ae88a11d5 使用更好的方式实现指令参数的获取 2022-04-16 15:01:41 +08:00
7efc532f3e 合并 #199
Revert 197 nonebot2-beta1
2022-04-15 20:23:13 +08:00
c2e62045fd feat: use one scheduler 2022-04-15 15:14:59 +08:00
5de79b499f Revert "小修复" 2022-04-15 14:56:00 +08:00
dffdbcc4c6 Merge pull request #197 from shirokurakana/nonebot2-beta1
小修复
2022-04-14 18:13:40 +08:00
90e5b9d3e7 scheduler只需要require一次 2022-04-14 16:20:54 +08:00
6b6d9ee479 修复未配置优先级时引发的问题 2022-04-14 16:19:11 +08:00
3ae3611d36 fix: the error message send error by record type 2022-04-11 20:51:14 +08:00
7c75145a50 fix: the error message send error by record type 2022-04-11 20:47:13 +08:00
ad88bc5011 fix: key-value error 2022-04-08 17:34:50 +08:00
18a16db8db 合并 #192 (closed #191)
补上一个空格 & 修复给谁用
2022-04-08 17:28:36 +08:00
bb385e3f9f fix: key and value error 2022-04-08 17:27:21 +08:00
d600d4ff9a fix 2022-04-08 17:23:06 +08:00
71620ce015 fix text 2022-04-08 17:16:09 +08:00
19d9781107 modify 2022-04-08 17:13:09 +08:00
f42788c008 修复给谁用 2022-04-08 16:04:28 +08:00
6c95472351 补上一个空格 2022-04-08 15:58:58 +08:00
1a92f35fcc 适应米游社数据 2022-04-08 00:17:11 +08:00
f800581446 修复:未探索地下造成的查询错误 & gs帮助错别字 2022-04-06 23:14:17 +08:00
b63c5b9ba3 修复:米游社新命名造成的查询错误 & 优化:更深的颜色遮罩 2022-04-06 21:06:52 +08:00
22204b115d 修改错误 2022-04-06 00:21:12 +08:00
35b884a2d3 新增:gs帮助 & xx推荐|攻略 2022-04-06 00:15:07 +08:00
7440ef2805 Merge pull request #179 from lgc2333/nonebot2-beta1
规范引号
2022-04-03 22:36:27 +08:00
c54facc919 规范引号 2022-04-03 21:40:47 +08:00
4390193184 向下兼容Python 3.8 2022-04-02 23:51:38 +08:00
23ec1dce8d 合并lgc2333/nonebot2-beta1(#176)
修复全部重签
2022-04-02 21:00:27 +08:00
d3853a6eb4 修复全部重签 2022-04-02 20:47:49 +08:00
dfe71c99f0 Merge pull request #166 from chenchenriver/nonebot2-beta1
Update get_mihoyo_bbs_data.py
2022-04-01 14:22:10 +08:00
6ef6005112 Update get_mihoyo_bbs_data.py 2022-04-01 14:18:00 +08:00
e39094f54a 更新:推荐表格信息 2022-04-01 00:33:17 +08:00
435e4a2d9a fix 2022-04-01 00:23:48 +08:00
746cb89bf3 新增:当前状态 & 当前信息添加参量质变仪信息 2022-04-01 00:22:04 +08:00
83a8c53449 Merge branch 'nonebot2-beta1' of github.com:KimigaiiWuyi/GenshinUID into nonebot2-beta1 2022-04-01 00:21:55 +08:00
0907e10271 新增:当前状态 & 当前信息添加参量质变仪信息 2022-04-01 00:21:24 +08:00
e07183beae 修复活动列表未进行正则提取的错误以及当前信息图片全部恢复的重合问题(fix #130) 2022-03-31 14:34:48 +08:00
8daec54d15 更新依赖 2022-03-31 13:44:23 +08:00
0fc4d899b6 修复:八角色UI重叠问题 2022-03-31 09:40:16 +08:00
53b9026d0a 新增:层岩巨渊的适配 2022-03-31 01:20:21 +08:00
0ec2685d37 同步:beta1 & main分支 2022-03-31 00:06:46 +08:00
656fbb4749 Merge pull request #156 from lgc2333/nonebot2-beta1
修复词云
2022-03-30 09:27:03 +08:00
2a4da7699d 删除测试代码 2022-03-29 23:49:06 +08:00
b5ff2b3613 尝试修复词云 2022-03-29 23:37:29 +08:00
c121c95a4c Merge branch 'KimigaiiWuyi:nonebot2-beta1' into nonebot2-beta1 2022-03-29 23:24:36 +08:00
cbcaa41640 修复:御神签偶发性输出空字符串 & 其他 2022-03-29 23:18:08 +08:00
2e37a0ff9a 修复:御神签偶发性输出空字符串 & 其他 2022-03-29 23:17:08 +08:00
4389d23bcc Merge remote-tracking branch 'origin/nonebot2-beta1' into nonebot2-beta1 2022-03-29 23:15:34 +08:00
a2b2f2f3d3 尝试修复词云 2022-03-29 23:14:44 +08:00
0ddad55580 尝试修复词云 2022-03-29 22:49:17 +08:00
1cc1d4e765 Merge pull request #153 from lgc2333/nonebot2-beta1
修复满树脂仍然显示剩余时间的问题 & Fix
2022-03-29 15:00:44 +08:00
72bd7be66e fix 2022-03-29 04:03:37 +08:00
b1ff73ef0d 修复满树脂仍然显示剩余时间的问题 2022-03-29 03:59:07 +08:00
72d9fa0828 尝试修复 2022-03-29 03:50:31 +08:00
82e33b153b 建议无疑早日使用jb 2022-03-29 03:42:19 +08:00
06c67c85f8 建议无疑早日使用jb 2022-03-29 03:38:41 +08:00
fdeafed874 修改:开启/关闭为gs开启/gs关闭 2022-03-29 00:32:47 +08:00
e3fb49c791 re: 2022-03-29 00:31:18 +08:00
71db7d8f0f 同步 2022-03-28 00:10:03 +08:00
223f519ee1 新增:开启自动米游币 & 当前信息(当前状态图片版)& 全部重获取;优化:新的查询样式 2022-03-26 18:58:26 +08:00
8d6b3c5c77 Merge pull request #143 from lgc2333/nonebot2-beta1
fixes
2022-03-18 09:35:42 +08:00
a60b64181c fix 2022-03-18 09:29:59 +08:00
5260abac14 fix 2022-03-18 09:04:50 +08:00
7838150f35 fix tip 2022-03-18 08:39:10 +08:00
cd0c38700c Merge pull request #142 from lgc2333/nonebot2-beta1
兼容
2022-03-17 23:29:03 +08:00
70c23164c5 修复失误 2022-03-17 22:15:56 +08:00
f3c5cb80a1 兼容 2022-03-17 21:33:19 +08:00
f28d7ae0a0 nb a16分支同步(pr #141 by @Igc2333)
与nb a16分支同步
2022-03-17 20:29:37 +08:00
017c561008 与nb a16分支同步 2022-03-17 20:18:08 +08:00
35dcd29d74 Update the setting of priority(Fix #137) 2022-03-13 20:19:00 +08:00
3c4c7a83c8 修复:全部重签 2022-03-11 10:13:55 +08:00
5f20fbd347 新增:开始获取米游币 & 添加Stokne;修复:活动列表 2022-03-10 23:58:39 +08:00
d0f334c9aa 米游币自动获取前提:Stoken获取指南 2022-03-09 00:24:09 +08:00
0333757b92 fix 2022-03-09 00:18:22 +08:00
89fe126579 准备:当前状态图片版 & 自动米游币获取 2022-03-09 00:01:16 +08:00
b9991ac7d2 修改结构 2022-03-06 23:36:19 +08:00
ef0913e6dd 补充:新增文件 2022-03-06 00:04:57 +08:00
564f3b2783 新增:xxx用什么|能用啥|怎么养&xxx能给谁|给谁用|要给谁|谁能用 2022-03-05 23:57:24 +08:00
d49c3297ed 优化:统一深渊生成图 & 统一返回 (添加大量冗余代码 2022-03-05 22:01:45 +08:00
3df56c1249 ReadMe 2022-02-22 23:58:50 +08:00
e43392253c 更新接口 2022-02-22 23:52:41 +08:00
2d1339f8c1 优化:天赋wiki的显示(合并转发) 2022-02-22 23:49:57 +08:00
9597a6d1ba Merge pull request #118 from shirokurakana/nonebot2-beta1
nonebot2-beta1 分支的一些修复工作
2022-02-16 19:20:40 +08:00
8f3bc1f9ee 修复发不出消息 2022-02-16 17:17:54 +08:00
b8279048c1 使用MessageSegment代替CQ码 2022-02-16 16:44:53 +08:00
d2a8c048a1 修复:深渊查询问题 2022-02-16 16:16:28 +08:00
b785adf105 修复:活动列表时间 2022-02-15 00:14:01 +08:00
414e384f1c Merge pull request #115 from MingxuanGame/nonebot2-beta1
Nonebot2 beta1
2022-02-12 19:04:04 +08:00
0ca23df74f 格式化提交(事件响应部分) 2022-02-12 18:49:19 +08:00
e6b629d9e1 格式化提交(数据部分) 2022-02-12 18:48:52 +08:00
c37e008261 Merge pull request #109 from MingxuanGame/nonebot2
nonebot2 2.0.0b1更新
2022-02-08 13:50:29 +08:00
f3eb0b0aa1 填无疑复制错的坑 2022-02-07 23:49:49 +08:00
563933f78f nonebot2 2.0.0b1更新 2022-02-07 23:40:35 +08:00
89a8883f07 requirements 2022-02-06 23:26:47 +08:00
adc0a86ce0 修复 2022-02-04 19:26:28 +08:00
0fb37e41ab 优化:报错 2022-02-04 19:23:18 +08:00
ce110cba99 Merge branch 'nonebot2' of github.com:KimigaiiWuyi/GenshinUID into nonebot2 2022-02-03 20:08:05 +08:00
bf51b8a2a6 Readme 2022-02-03 20:07:48 +08:00
a3e9a00568 Merge pull request #104 from lgc2333/patch-1
fix
2022-02-03 17:57:29 +08:00
5adf659ac5 fix 2022-02-03 17:49:28 +08:00
7500be4078 优化:定时任务log&活动列表图片发送 2022-02-03 00:05:39 +08:00
c933d5d9ef requirements.txt 2022-02-02 13:00:06 +08:00
157ad92eda 优化:校验全部Cookies现在会私聊已失效CK的QQ账号提醒ck过期 2022-02-02 10:59:00 +08:00
82d2fbcda1 README! 2022-02-01 19:07:04 +08:00
2afaa437b7 优化:八角色UI信息内容 2022-02-01 18:39:07 +08:00
b7c896e18a 补充代码 2022-02-01 00:16:20 +08:00
16dc1fe974 优化:自动签到报告&新增:开启简洁签到报告 2022-02-01 00:05:57 +08:00
586481062c 删除:无效代码 2022-01-27 00:02:27 +08:00
fd0e60796e 修复:同步新的WikiAPI接口;优化:错误提示. 2022-01-26 23:47:11 +08:00
e91564ac08 添加依赖 2022-01-25 14:15:51 +08:00
e9042d42fd 临时修改 2022-01-25 14:12:42 +08:00
b92ff01ddb Update getMes.py 2022-01-25 13:40:59 +08:00
5d736dbda1 修改获取Cookies 2022-01-25 13:39:36 +08:00
a5006183ae 优化:每日签到 2022-01-24 00:39:28 +08:00
3b919f54fb 同步语音重试:PR #81 2022-01-23 01:54:40 +08:00
9c3e260d1a 移除:数据库优化命令 2022-01-23 01:13:55 +08:00
0054148196 新增:食物/圣遗物命令,支持模糊查询;修复&优化:签到/添加Ck指令 2022-01-23 00:52:45 +08:00
0be58c1f43 Create LICENSE 2022-01-11 19:39:37 +08:00
02d4809d2c Merge pull request #86 from lgc2333/nonebot2
edit
2022-01-08 20:48:50 +08:00
cea56eb3ea edit 2022-01-08 20:47:39 +08:00
e53a1d2299 Merge pull request #85 from lgc2333/nonebot2
加入洞天宝钱大概积攒速度和全恢复时间
2022-01-08 20:47:24 +08:00
2f0f8ccbd6 add features 2022-01-08 20:13:45 +08:00
c120bf65a3 Merge pull request #82 from lgc2333/nonebot2
修正文本
2022-01-07 12:30:54 +08:00
dd0720a32c edit 2022-01-07 11:51:54 +08:00
ed8d169134 edit 2022-01-07 11:49:17 +08:00
e59d4ed1e5 edit 2022-01-07 11:09:50 +08:00
7955f52ba9 Update getImg.py 2022-01-07 10:46:02 +08:00
fc9e35ed05 edit 2022-01-07 10:40:50 +08:00
c7cc86ca2d Merge pull request #81 from lgc2333/nonebot2
fix
2022-01-06 10:28:12 +08:00
199c2f3a78 fix record 2022-01-06 04:17:44 +08:00
5c9960b5af Merge pull request #80 from lgc2333/nonebot2
fix
2022-01-06 03:01:08 +08:00
81d5e52528 fix 2022-01-06 02:47:21 +08:00
8f70742528 fix 2022-01-06 02:41:27 +08:00
d00b7bcbd9 Merge pull request #78 from lgc2333/nonebot2
optimize
2022-01-06 02:31:57 +08:00
c47d091c40 fix 2022-01-06 02:24:45 +08:00
7ff2609f2d optimize 2022-01-06 02:17:37 +08:00
1e2f605776 readme 2022-01-06 00:35:21 +08:00
05f53275f6 新增:语音命令;修复:渊下宫带来的查询错误问题;新增:当前状态命令查询洞天宝钱数量 2022-01-06 00:17:11 +08:00
5728d4ecad Merge pull request #77 from lgc2333/nonebot2
修复活动列表发图失败
2022-01-06 00:11:03 +08:00
91758947ac update event list when load plugin 2022-01-05 21:45:17 +08:00
a6e06dce57 fix send pic 2022-01-05 21:03:37 +08:00
bc49efa759 修复:角色命令可能出错的问题 2022-01-01 15:42:23 +08:00
ad88859ca6 新增:开启&关闭自动签到/推送服务,可由超级管理员操作 2021-12-30 23:03:35 +08:00
3dce0539c6 新增:命座查询的模糊匹配;优化:代码结构 2021-12-30 22:29:29 +08:00
fcc038abc1 新增:武器已支持查询某个固定等级属性 & 支持模糊查询;修复:角色查等级时元素精通数值不正确显示。 2021-12-30 00:38:21 +08:00
247709b06a 修复:角色命令现已支持模糊查询(修复之前直接输出Json) 2021-12-30 00:02:12 +08:00
a4fbaccee8 修复&优化:数据获取方式 & 推送树脂可能造成的Bug;新增:原魔、天赋指令。 2021-12-29 23:51:45 +08:00
0fce1cbe92 Merge branch 'nonebot2' of github.com:KimigaiiWuyi/GenshinUID into nonebot2 2021-12-26 22:18:38 +08:00
823e998114 修复:活动列表可能导致的bug 2021-12-26 22:18:06 +08:00
66e76c71ba Merge pull request #64 from lgc2333/nonebot2
fix
2021-12-25 16:15:42 +08:00
926b48a890 fix 2021-12-25 16:06:02 +08:00
22b7a53e58 Merge pull request #62 from wudifeixue/patch-2
修复米哈游更改api造成的插件损坏
2021-12-24 14:06:11 +08:00
f09547ba04 重新再次修复 2021-12-23 23:04:26 -07:00
6f54c0c99a 补充意外删除的debug信息 2021-12-23 22:53:03 -07:00
5bc89880fe 修复米哈游更改api造成的插件损坏
顺便更新了更好的后台错误反馈信息方便debug
2021-12-23 22:48:20 -07:00
aab3d148c4 修复:Readme 2021-12-20 01:04:50 +08:00
c23e577c45 新增:若干功能 2021-12-20 00:33:38 +08:00
69250a8700 Merge pull request #56 from ZhouYingSASA/nonebot2
Nonebot2:完善错误处理
2021-12-16 01:39:02 +08:00
5a9e63c54a fix: 完善错误处理 2021-12-16 01:27:56 +08:00
336c3f2aaf fix: 完善错误处理 2021-12-16 01:25:54 +08:00
9ba855fa17 修复:原神wiki相关功能 2021-12-11 00:28:47 +08:00
bd47c1dce8 fix 2021-12-10 00:51:34 +08:00
d04dd57aef !!fix!! 2021-12-04 19:17:37 +08:00
18a054ae66 !!fix!! 2021-12-04 19:13:08 +08:00
1b6dc2a194 !!fix!! 2021-12-04 19:03:19 +08:00
421291929d Merge pull request #35 from lgc2333/nonebot2
fix&feature
2021-11-26 10:09:32 +08:00
ecf9419186 fix 2021-11-26 04:30:46 +08:00
b5362fe575 feature 2021-11-26 04:03:23 +08:00
ac223d02b3 edit 2021-11-26 03:27:08 +08:00
babac2d270 fix 2021-11-26 02:51:42 +08:00
7ea57c069e fix 2021-11-25 22:09:07 +08:00
68a0fc6073 Merge branch 'nonebot2' of github.com:KimigaiiWuyi/GenshinUID into nonebot2 2021-11-25 22:03:27 +08:00
cedd47a453 fix 2021-11-25 22:02:56 +08:00
b72594f20e Merge pull request #31 from lgc2333/nonebot2
fixxxxxxxxxxxxxxxxxxx custom background of wordcloud
2021-11-21 03:08:25 +08:00
61cf1ce79e fixxxxxxxxxxxxxxxxxxx 2021-11-21 02:30:15 +08:00
997688fa67 Merge pull request #30 from lgc2333/nonebot2
fix wordcloud & add requirements
2021-11-21 02:16:04 +08:00
6aa62f2451 fix 2021-11-21 02:04:05 +08:00
96a2bf6a46 Update requirements.txt 2021-11-21 02:03:23 +08:00
53a58d458c Merge pull request #29 from lgc2333/nonebot2
紧急修复bug
2021-11-21 01:30:18 +08:00
4452e35f6a 紧急修复bug 2021-11-21 01:21:08 +08:00
608c505d7a 紧急修复bug 2021-11-21 01:13:40 +08:00
da36b1ae0d readme 2021-11-21 00:29:16 +08:00
d72bdf87ad fix and feat 2021-11-21 00:18:23 +08:00
dd19fc6bd2 Merge pull request #26 from lgc2333/nonebot2
尝试解决签到限制问题 添加通过.env.*配置文件设置消息处理优先级
2021-11-20 22:25:40 +08:00
a51d03c6ee 尝试解决签到限制问题 添加通过.env.*配置文件设置消息处理优先级 2021-11-20 03:55:21 +08:00
d73a6d57e4 尝试解决签到限制问题 添加通过.env.*配置文件设置消息处理优先级 2021-11-20 03:15:28 +08:00
84b46699ba Merge pull request #24 from lgc2333/nonebot2
改回readme 在requirements.txt添加nonebot-plugin-apscheduler>=0.1.2
2021-11-19 12:18:10 +08:00
9bdb8dfc3f Update README.md 2021-11-19 12:15:08 +08:00
286a74d004 Update requirements.txt 2021-11-19 12:14:16 +08:00
3cd332d8f5 Merge pull request #23 from lgc2333/patch-1
edit
2021-11-19 00:29:37 +08:00
2a3db3784f edit 2021-11-19 00:19:21 +08:00
1cea32424d fix 2021-11-18 00:43:11 +08:00
207c82dfab 合并Hoshino提交,修复Bug 2021-11-16 21:45:46 +08:00
dff8992adc fix 2021-11-15 00:51:16 +08:00
8a7fdb1709 fix 2021-11-15 00:14:43 +08:00
94682d43fe readme 2021-11-14 23:59:05 +08:00
2e34937700 NoneBot2 support 2021-11-14 23:48:04 +08:00
64 changed files with 934 additions and 1107 deletions

42
.github/workflows/unittest.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Unittest
on:
push:
branches:
- nonebot2-beta1
pull_request:
jobs:
test:
name: Test
strategy:
matrix:
version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
shell: bash
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.version }}
architecture: "x64"
cache: "poetry"
- name: Install dependencies
run: poetry install --with test --without dev
shell: bash
- name: Run Pytest
run: |
cd tests
poetry run pytest

View File

@ -1,5 +1,7 @@
ci: ci:
autofix_commit_msg: ":rotating_light: auto fix by pre-commit-ci" autofix_commit_msg: ":rotating_light: auto fix by pre-commit-ci"
skip:
- "poetry-lock"
autofix_prs: true autofix_prs: true
autoupdate_branch: master autoupdate_branch: master
autoupdate_schedule: monthly autoupdate_schedule: monthly

View File

@ -1,39 +1,25 @@
from pathlib import Path
from pkgutil import iter_modules
from nonebot.log import logger from nonebot.log import logger
from nonebot import require, load_all_plugins, get_plugin_by_module_name from nonebot import require, load_all_plugins, get_plugin_by_module_name
from .config import config as _config
require('nonebot_plugin_apscheduler') require('nonebot_plugin_apscheduler')
if get_plugin_by_module_name("GenshinUID"): if get_plugin_by_module_name("GenshinUID"):
logger.info("推荐直接加载 GenshinUID 仓库文件夹") logger.info("推荐直接加载 GenshinUID 仓库文件夹")
load_all_plugins( load_all_plugins(
[ [
'GenshinUID.genshinuid_abyss', f"GenshinUID.{module.name}"
'GenshinUID.genshinuid_adv', for module in iter_modules([str(Path(__file__).parent)])
'GenshinUID.genshinuid_ann', if module.ispkg
'GenshinUID.genshinuid_gcg', and (
'GenshinUID.genshinuid_xkdata', (name := module.name[11:]) == "meta"
'GenshinUID.genshinuid_check', or name not in _config.disabled_plugins
'GenshinUID.genshinuid_collection', )
'GenshinUID.genshinuid_config', # module.name[:11] == genshinuid_
'GenshinUID.genshinuid_enka',
'GenshinUID.genshinuid_etcimg',
'GenshinUID.genshinuid_eventlist',
'GenshinUID.genshinuid_gachalog',
'GenshinUID.genshinuid_guide',
'GenshinUID.genshinuid_help',
'GenshinUID.genshinuid_map',
'GenshinUID.genshinuid_meta',
'GenshinUID.genshinuid_mhybbscoin',
'GenshinUID.genshinuid_mys',
'GenshinUID.genshinuid_note',
'GenshinUID.genshinuid_resin',
'GenshinUID.genshinuid_resource',
'GenshinUID.genshinuid_roleinfo',
'GenshinUID.genshinuid_signin',
'GenshinUID.genshinuid_user',
'GenshinUID.genshinuid_wikitext',
'GenshinUID.genshinuid_webconsole',
'GenshinUID.genshinuid_update',
], ],
[], [],
) )

View File

@ -1,5 +1,15 @@
from nonebot import get_driver from typing import Set
config = get_driver().config from nonebot import get_driver
SUPERUSERS = {x for x in config.superusers} from pydantic import Field, BaseModel
priority = 2
class Config(BaseModel):
disabled_plugins: Set[str] = Field(
default_factory=set, alias="genshinuid_disabled_plugins"
)
priority: int = Field(2, alias="genshinuid_priority")
config = Config.parse_obj(get_driver().config)
priority = config.priority

View File

@ -1,18 +1,22 @@
from typing import Any, Tuple from typing import Any, Tuple, Union
from nonebot import on_regex from nonebot import on_regex
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import RegexGroup from nonebot.params import Depends, RegexGroup
from nonebot.adapters.ntchat import MessageSegment, TextMessageEvent from nonebot.adapters.onebot.v11 import (
MessageSegment,
GroupMessageEvent,
PrivateMessageEvent,
)
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from .draw_abyss_card import draw_abyss_img from .draw_abyss_card import draw_abyss_img
from ..utils.message.error_reply import UID_HINT from ..utils.message.error_reply import UID_HINT
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.message.get_image_and_at import ImageAndAt
from ..utils.mhy_api.convert_mysid_to_uid import convert_mysid from ..utils.mhy_api.convert_mysid_to_uid import convert_mysid
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
from ..utils.draw_image_tools.send_image_tool import convert_img
get_abyss_info = on_regex( get_abyss_info = on_regex(
r'^(\[CQ:at,qq=[0-9]+\])?( )?' r'^(\[CQ:at,qq=[0-9]+\])?( )?'
@ -21,7 +25,6 @@ get_abyss_info = on_regex(
r'(\[CQ:at,qq=[0-9]+\])?( )?$', r'(\[CQ:at,qq=[0-9]+\])?( )?$',
block=True, block=True,
) )
# 恢复了查询二字,和其他的查询打架下次解决
@get_abyss_info.handle() @get_abyss_info.handle()
@ -53,19 +56,15 @@ get_abyss_info = on_regex(
), ),
) )
async def send_abyss_info( async def send_abyss_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Tuple[Any, ...] = RegexGroup(), args: Tuple[Any, ...] = RegexGroup(),
custom: ImageAndAt = Depends(),
): ):
logger.info('开始执行[查询深渊信息]') logger.info('开始执行[查询深渊信息]')
logger.info(f'[查询深渊信息]参数: {args}') logger.info(f'[查询深渊信息]参数: {args}')
qid = event.from_wxid at = custom.get_first_at()
if event.at_user_list: qid = at or event.user_id
for user in event.at_user_list:
user = user.strip()
if user != "":
qid = user
if args[2] == 'mys': if args[2] == 'mys':
uid = await convert_mysid(args[3]) uid = await convert_mysid(args[3])
elif args[3] is None: elif args[3] is None:
@ -98,7 +97,6 @@ async def send_abyss_info(
if isinstance(im, str): if isinstance(im, str):
await matcher.finish(im) await matcher.finish(im)
elif isinstance(im, bytes): elif isinstance(im, bytes):
im = await convert_img(im)
await matcher.finish(MessageSegment.image(im)) await matcher.finish(MessageSegment.image(im))
else: else:
await matcher.finish('发生了未知错误,请联系管理员检查后台输出!') await matcher.finish('发生了未知错误,请联系管理员检查后台输出!')

View File

@ -2,7 +2,7 @@ from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import CommandArg from nonebot.params import CommandArg
from nonebot.adapters.ntchat import Message from nonebot.adapters.onebot.v11 import Message
from ..config import priority from ..config import priority
from .get_achi_desc import get_achi, get_daily_achi from .get_achi_desc import get_achi, get_daily_achi

View File

@ -1,4 +1,3 @@
import base64
import random import random
import asyncio import asyncio
@ -8,11 +7,11 @@ from nonebot.params import CommandArg
from nonebot import get_bot, on_command from nonebot import get_bot, on_command
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat import ( Message,
MessageEvent, MessageEvent,
MessageSegment, MessageSegment,
TextMessageEvent, GroupMessageEvent,
) )
from .util import black_ids from .util import black_ids
@ -62,19 +61,19 @@ async def send_ann_pic(
@reg_ann.handle() @reg_ann.handle()
@handle_exception('设置原神公告', '设置原神公告失败') @handle_exception('设置原神公告', '设置原神公告失败')
async def send_reg_ann( async def send_reg_ann(
event: TextMessageEvent, event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
await matcher.finish(sub_ann(event.room_wxid)) await matcher.finish(sub_ann(event.group_id))
@unreg_ann.handle() @unreg_ann.handle()
@handle_exception('取消原神公告', '取消设置原神公告失败') @handle_exception('取消原神公告', '取消设置原神公告失败')
async def send_unreg_ann( async def send_unreg_ann(
event: TextMessageEvent, event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
await matcher.finish(unsub_ann(event.room_wxid)) await matcher.finish(unsub_ann(event.group_id))
@consume_ann.handle() @consume_ann.handle()
@ -83,7 +82,7 @@ async def send_consume_ann(
event: MessageEvent, event: MessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
qid = event.from_wxid qid = event.user_id
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
uid = str(uid) uid = str(uid)
if '未找到绑定的UID' in uid: if '未找到绑定的UID' in uid:
@ -100,9 +99,11 @@ async def check_ann_state():
logger.info('[原神公告] 定时任务: 原神公告查询..') logger.info('[原神公告] 定时任务: 原神公告查询..')
ids = string_config.get_config('Ann_Ids') ids = string_config.get_config('Ann_Ids')
sub_list = string_config.get_config('Ann_Groups') sub_list = string_config.get_config('Ann_Groups')
if not sub_list: if not sub_list:
logger.info('没有群订阅, 取消获取数据') logger.info('没有群订阅, 取消获取数据')
return return
if not ids: if not ids:
ids = await ann().get_ann_ids() ids = await ann().get_ann_ids()
if not ids: if not ids:
@ -110,9 +111,10 @@ async def check_ann_state():
string_config.set_config('Ann_Ids', ids) string_config.set_config('Ann_Ids', ids)
logger.info('初始成功, 将在下个轮询中更新.') logger.info('初始成功, 将在下个轮询中更新.')
return return
new_ids = await ann().get_ann_ids()
new_ids = await ann().get_ann_ids()
new_ann = set(ids) ^ set(new_ids) new_ann = set(ids) ^ set(new_ids)
if not new_ann: if not new_ann:
logger.info('[原神公告] 没有最新公告') logger.info('[原神公告] 没有最新公告')
return return
@ -123,20 +125,18 @@ async def check_ann_state():
try: try:
img = await ann_detail_card(ann_id) # 防止抛出异常报错 img = await ann_detail_card(ann_id) # 防止抛出异常报错
bot = get_bot() bot = get_bot()
b64img = base64.b64encode(img)
for group in sub_list: for group in sub_list:
try: try:
await bot.call_api( await bot.call_api(
api='send_image', api='send_group_msg',
to_wxid=str(group), group_id=group,
file_path="base64://" + b64img.decode(), message=MessageSegment.image(img),
) )
await asyncio.sleep(random.uniform(1, 3)) await asyncio.sleep(random.uniform(1, 3))
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(str(e))
logger.info('[原神公告] 推送完毕, 更新数据库') logger.info('[原神公告] 推送完毕, 更新数据库')
string_config.set_config('Ann_Ids', new_ids) string_config.set_config('Ann_Ids', new_ids)

View File

@ -1,12 +1,17 @@
import random import random
import asyncio import asyncio
from typing import Union
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat import Bot, TextMessageEvent from nonebot.adapters.onebot.v11 import (
Bot,
GroupMessageEvent,
PrivateMessageEvent,
)
from ..config import priority from ..config import priority
from .backup_data import data_backup from .backup_data import data_backup
@ -20,17 +25,11 @@ from ..utils.message.get_cqhttp_data import (
get_group_member_list, get_group_member_list,
) )
backup = on_command( backup = on_command('gs清除缓存', rule=FullCommand(), priority=priority)
'gs清除缓存', rule=FullCommand(), priority=priority, permission=SUPERUSER check = on_command('校验全部Cookies', rule=FullCommand(), priority=priority)
) check_stoken = on_command('校验全部Stoken', rule=FullCommand(), priority=priority)
check = on_command(
'校验全部Cookies', rule=FullCommand(), priority=priority, permission=SUPERUSER
)
check_stoken = on_command(
'校验全部Stoken', rule=FullCommand(), priority=priority, permission=SUPERUSER
)
remove_invalid_user = on_command( remove_invalid_user = on_command(
'清除无效用户', rule=FullCommand(), priority=priority, permission=SUPERUSER '清除无效用户', rule=FullCommand(), priority=priority
) )
backup_scheduler = scheduler backup_scheduler = scheduler
@ -58,7 +57,7 @@ async def daily_refresh_charData():
) )
async def send_backup_msg( async def send_backup_msg(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
if not await SUPERUSER(bot, event): if not await SUPERUSER(bot, event):
@ -85,7 +84,7 @@ async def send_backup_msg(
) )
async def send_remove_invalid_user_msg( async def send_remove_invalid_user_msg(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
if not await SUPERUSER(bot, event): if not await SUPERUSER(bot, event):

View File

@ -1,13 +1,20 @@
from typing import Union
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import CommandArg from nonebot.params import Depends, CommandArg
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat import MessageSegment, TextMessageEvent Message,
MessageSegment,
GroupMessageEvent,
PrivateMessageEvent,
)
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.data_convert.get_uid import get_uid from ..utils.data_convert.get_uid import get_uid
from ..utils.message.error_reply import UID_HINT from ..utils.message.error_reply import UID_HINT
from ..utils.message.get_image_and_at import ImageAndAt
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
from .draw_collection_card import draw_explora_img, draw_collection_img from .draw_collection_card import draw_explora_img, draw_collection_img
@ -42,20 +49,23 @@ get_explora_info = on_command('查询探索', aliases={'探索', 'ts'}, block=Tr
), ),
) )
async def send_collection_info( async def send_collection_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
logger.info('开始执行[查询收集信息]') logger.info('开始执行[查询收集信息]')
logger.info('[查询收集信息]参数: {}'.format(args)) logger.info('[查询收集信息]参数: {}'.format(args))
raw_mes = args.extract_plain_text().strip() raw_mes = args.extract_plain_text().strip()
if event.at_user_list: at = custom.get_first_at()
qid = event.at_user_list[0] if at:
qid = at
else: else:
qid = event.from_wxid qid = event.user_id
# 获取uid
uid = await get_uid(qid, raw_mes) uid = await get_uid(qid, raw_mes)
logger.info('[查询收集信息]uid: {}'.format(uid)) logger.info('[查询角色面板]uid: {}'.format(uid))
if '未找到绑定的UID' in uid: if '未找到绑定的UID' in uid:
await matcher.finish(UID_HINT) await matcher.finish(UID_HINT)
@ -72,20 +82,23 @@ async def send_collection_info(
@get_explora_info.handle() @get_explora_info.handle()
@handle_exception('查询探索信息') @handle_exception('查询探索信息')
async def send_explora_info( async def send_explora_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
logger.info('开始执行[查询探索信息]') logger.info('开始执行[查询探索信息]')
logger.info('[查询探索信息]参数: {}'.format(args)) logger.info('[查询探索信息]参数: {}'.format(args))
raw_mes = args.extract_plain_text().strip() raw_mes = args.extract_plain_text().strip()
if event.at_user_list: at = custom.get_first_at()
qid = event.at_user_list[0] if at:
qid = at
else: else:
qid = event.from_wxid qid = event.user_id
# 获取uid
uid = await get_uid(qid, raw_mes) uid = await get_uid(qid, raw_mes)
logger.info('[查询探索信息]uid: {}'.format(uid)) logger.info('[查询角色面板]uid: {}'.format(uid))
if '未找到绑定的UID' in uid: if '未找到绑定的UID' in uid:
await matcher.finish(UID_HINT) await matcher.finish(UID_HINT)

View File

@ -1,17 +1,23 @@
from typing import Any, Tuple from typing import Any, Tuple, Union
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import RegexGroup
from nonebot import on_regex, on_command from nonebot import on_regex, on_command
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot.adapters.ntchat import Bot, MessageSegment, TextMessageEvent from nonebot.params import Depends, CommandArg, RegexGroup
from nonebot.adapters.onebot.v11 import (
Bot,
Message,
MessageSegment,
GroupMessageEvent,
PrivateMessageEvent,
)
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand
from .draw_config_card import draw_config_img from .draw_config_card import draw_config_img
from ..utils.message.error_reply import UID_HINT from ..utils.message.error_reply import UID_HINT
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.message.get_image_and_at import ImageAndAt
from .set_config import set_push_value, set_config_func from .set_config import set_push_value, set_config_func
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
@ -27,7 +33,7 @@ push_config = on_regex(
r'(\[CQ:at,qq=[0-9]+\])?( )?$' r'(\[CQ:at,qq=[0-9]+\])?( )?$'
) )
config_card = on_command('gs配置', rule=FullCommand()) config_card = on_command('gs配置')
@config_card.handle() @config_card.handle()
@ -44,7 +50,9 @@ config_card = on_command('gs配置', rule=FullCommand())
'- <ft color=(238,120,0)>gs配置</ft>' '- <ft color=(238,120,0)>gs配置</ft>'
), ),
) )
async def send_config_card(matcher: Matcher): async def send_config_card(matcher: Matcher, args: Message = CommandArg()):
if args:
await matcher.finish()
logger.info('开始执行[gs配置]') logger.info('开始执行[gs配置]')
im = await draw_config_img() im = await draw_config_img()
if isinstance(im, str): if isinstance(im, str):
@ -77,59 +85,38 @@ async def send_config_card(matcher: Matcher):
) )
async def send_config_msg( async def send_config_msg(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Tuple[Any, ...] = RegexGroup(), args: Tuple[Any, ...] = RegexGroup(),
custom: ImageAndAt = Depends(),
): ):
logger.info('开始执行[设置阈值信息]') logger.info('开始执行[设置阈值信息]')
logger.info('[设置阈值信息]参数: {}'.format(args)) logger.info('[设置阈值信息]参数: {}'.format(args))
wxid_list = [] qid = event.user_id
wxid_list.append(event.from_wxid) at = custom.get_first_at()
qid = event.from_wxid
if event.at_user_list:
for user in event.at_user_list:
user = user.strip()
if user != "" and await SUPERUSER(bot, event):
qid = user
else:
await matcher.finish(
MessageSegment.room_at_msg(
content="{$@}你没有权限操作别人的状态噢~", at_list=wxid_list
)
)
if at and await SUPERUSER(bot, event):
qid = at
elif at and at != qid:
await matcher.finish('你没有权限操作别人的状态噢~', at_sender=True)
logger.info('[设置阈值信息]qid: {}'.format(qid)) logger.info('[设置阈值信息]qid: {}'.format(qid))
try: try:
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
except TypeError: except TypeError:
await matcher.finish( await matcher.finish(UID_HINT)
MessageSegment.room_at_msg(
content='{$@}' + UID_HINT, at_list=wxid_list
)
)
func = args[4].replace('阈值', '') func = args[4].replace('阈值', '')
if args[5]: if args[5]:
try: try:
value = int(args[5]) value = int(args[5])
except ValueError: except ValueError:
await matcher.finish( await matcher.finish('请输入数字哦~', at_sender=True)
MessageSegment.room_at_msg(
content="{$@}请输入数字哦~", at_list=wxid_list
)
)
else: else:
await matcher.finish( await matcher.finish('请输入正确的阈值数字!', at_sender=True)
MessageSegment.room_at_msg(
content="{$@}请输入正确的阈值数字!", at_list=wxid_list
)
)
logger.info('[设置阈值信息]func: {}, value: {}'.format(func, value)) logger.info('[设置阈值信息]func: {}, value: {}'.format(func, value))
im = await set_push_value(func, str(uid), value) im = await set_push_value(func, str(uid), value)
await matcher.finish( await matcher.finish(im, at_sender=True)
MessageSegment.room_at_msg(content="{$@}" + f"{im}", at_list=wxid_list)
)
# 开启 自动签到 和 推送树脂提醒 功能 # 开启 自动签到 和 推送树脂提醒 功能
@ -154,49 +141,38 @@ async def send_config_msg(
) )
async def open_switch_func( async def open_switch_func(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Tuple[Any, ...] = RegexGroup(), args: Tuple[Any, ...] = RegexGroup(),
at: ImageAndAt = Depends(),
): ):
wxid_list = [] qid = event.user_id
wxid_list.append(event.from_wxid) atqq = at.get_first_at() if at else None
qid = event.from_wxid
if event.at_user_list:
for user in event.at_user_list:
user = user.strip()
if user != "" and await SUPERUSER(bot, event):
qid = user
else:
await matcher.finish(
MessageSegment.room_at_msg(
content="{$@}你没有权限操作别人的状态噢~", at_list=wxid_list
)
)
config_name = args[4] config_name = args[4]
logger.info(f'[{qid}]尝试[{args[3]}]了[{config_name}]功能') logger.info(f'[{qid}]尝试[{args[3]}]了[{config_name}]功能')
fake_seession = f'group_{event.room_wxid}_{event.from_wxid}'
if args[3] == '开启': if args[3] == '开启':
query = 'OPEN' query = 'OPEN'
gid = ( gid = (
fake_seession.split('_')[1] event.get_session_id().split('_')[1]
if len(fake_seession.split('_')) == 3 if len(event.get_session_id().split('_')) == 3
else 'on' else 'on'
) )
else: else:
query = 'CLOSED' query = 'CLOSED'
gid = 'off' gid = 'off'
is_admin = await SUPERUSER(bot, event)
if atqq:
if is_admin:
qid = atqq
elif atqq != qid:
await matcher.finish('你没有权限操作别人的状态噢~', at_sender=True)
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
if uid is None or not isinstance(uid, str) or not uid.isdecimal(): if uid is None or not isinstance(uid, str) or not uid.isdecimal():
await matcher.finish( await matcher.finish(UID_HINT)
MessageSegment.room_at_msg(
content='{$@}' + UID_HINT, at_list=wxid_list
)
)
im = await set_config_func( im = await set_config_func(
config_name=config_name, config_name=config_name,
@ -204,8 +180,6 @@ async def open_switch_func(
qid=str(qid), qid=str(qid),
option=gid, option=gid,
query=query, query=query,
is_admin=await SUPERUSER(bot, event), is_admin=is_admin,
)
await matcher.finish(
MessageSegment.room_at_msg(content="{$@}" + f"{im}", at_list=wxid_list)
) )
await matcher.finish(im, at_sender=True)

View File

@ -5,7 +5,7 @@ from ..utils.download_resource.RESOURCE_PATH import MAIN_PATH
from ..utils.db_operation.db_operation import get_all_bind, get_user_bind_data from ..utils.db_operation.db_operation import get_all_bind, get_user_bind_data
DATA_PATH = MAIN_PATH / 'v3_data.json' DATA_PATH = MAIN_PATH / 'v3_data.json'
BOT_ID = 'ntchat' BOT_ID = 'onebot'
RECOGNIZE_SERVER = { RECOGNIZE_SERVER = {
'1': 'cn_gf01', '1': 'cn_gf01',
'2': 'cn_gf01', '2': 'cn_gf01',

View File

@ -1,21 +1,20 @@
import re import re
import random import random
import asyncio import asyncio
from typing import Tuple from typing import Tuple, Union
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import CommandArg
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot.params import Depends, CommandArg
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat import (
Bot, Bot,
MessageEvent, Message,
MessageSegment, MessageSegment,
TextMessageEvent, GroupMessageEvent,
QuoteMessageEvent, PrivateMessageEvent,
) )
from ..config import priority from ..config import priority
@ -27,13 +26,14 @@ from ..utils.message.error_reply import UID_HINT
from ..utils.enka_api.get_enka_data import switch_api from ..utils.enka_api.get_enka_data import switch_api
from ..utils.enka_api.enka_to_card import enka_to_card from ..utils.enka_api.enka_to_card import enka_to_card
from ..utils.enka_api.enka_to_data import enka_to_data from ..utils.enka_api.enka_to_data import enka_to_data
from ..utils.message.get_image_and_at import ImageAndAt
from ..utils.download_resource.RESOURCE_PATH import TEMP_PATH from ..utils.download_resource.RESOURCE_PATH import TEMP_PATH
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
from ..utils.db_operation.db_operation import select_db, get_all_uid from ..utils.db_operation.db_operation import select_db, get_all_uid
refresh = on_command('强制刷新') refresh = on_command('强制刷新')
original_pic = on_command('原图', rule=FullCommand()) original_pic = on_command('原图', rule=FullCommand())
change_api = on_command('切换api', rule=FullCommand()) change_api = on_command('切换api')
get_charcard_list = on_command('毕业度统计') get_charcard_list = on_command('毕业度统计')
get_char_info = on_command( get_char_info = on_command(
'查询', '查询',
@ -60,10 +60,11 @@ refresh_scheduler = scheduler
) )
async def send_change_api_info( async def send_change_api_info(
bot: Bot, bot: Bot,
event: MessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(),
): ):
if not await SUPERUSER(bot, event): if args or not await SUPERUSER(bot, event):
return return
im = await switch_api() im = await switch_api()
@ -86,10 +87,11 @@ async def send_change_api_info(
), ),
) )
async def send_original_pic( async def send_original_pic(
event: QuoteMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
msg_id = event.quote_message_id if event.reply:
msg_id = event.reply.message_id
path = TEMP_PATH / f'{msg_id}.jpg' path = TEMP_PATH / f'{msg_id}.jpg'
if path.exists(): if path.exists():
logger.info('[原图]访问图片: {}'.format(path)) logger.info('[原图]访问图片: {}'.format(path))
@ -145,33 +147,28 @@ async def send_original_pic(
), ),
) )
async def send_char_info( async def send_char_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
raw_mes = args.extract_plain_text().strip() raw_mes = args.extract_plain_text().strip()
name = ''.join(re.findall('[\u4e00-\u9fa5]', raw_mes)) name = ''.join(re.findall('[\u4e00-\u9fa5]', raw_mes))
# 如果输入中(查询之后的内容)没有其他字符串(如角色名等)则忽略。
if not name: if not name:
return return
# 若查询中有@则排除@后内容,排除后若@前没有 其他内容则不继续运行下方代码 防止与roleinfo查询打架
# 修改后@人应该在命令末尾 如:查询万叶@XXXX
if "@" in raw_mes:
raw_mes = raw_mes.split("@")[0]
if not raw_mes:
return
logger.info('开始执行[查询角色面板]') logger.info('开始执行[查询角色面板]')
# 获取被@的Wxid排除"" at = custom.get_first_at()
qid = event.from_wxid img = custom.get_first_image()
if event.at_user_list:
for user in event.at_user_list: if at:
user = user.strip() qid = at
if user != "": else:
qid = user qid = event.user_id
logger.info('[查询角色面板]WXID: {}'.format(qid)) logger.info('[查询角色面板]QQ: {}'.format(qid))
# 获取uid # 获取uid
uid = re.findall(r'\d+', raw_mes.split("@")[0]) uid = re.findall(r'\d+', raw_mes)
if uid: if uid:
uid = uid[0] uid = uid[0]
else: else:
@ -182,15 +179,15 @@ async def send_char_info(
if '未找到绑定的UID' in uid: if '未找到绑定的UID' in uid:
await matcher.finish(UID_HINT) await matcher.finish(UID_HINT)
im = await draw_enka_img(raw_mes, uid, None) im = await draw_enka_img(raw_mes, uid, img)
if isinstance(im, str): if isinstance(im, str):
await matcher.finish(im) await matcher.finish(im)
elif isinstance(im, Tuple): elif isinstance(im, Tuple):
await matcher.send(MessageSegment.image(im[0])) req = await matcher.send(MessageSegment.image(im[0]))
# msg_id = req['message_id'] msg_id = req['message_id']
if im[1]: if im[1]:
with open(TEMP_PATH / f'{uid}.jpg', 'wb') as f: with open(TEMP_PATH / f'{msg_id}.jpg', 'wb') as f:
f.write(im[1]) f.write(im[1])
else: else:
await matcher.finish('发生了未知错误,请联系管理员检查后台输出!') await matcher.finish('发生了未知错误,请联系管理员检查后台输出!')
@ -248,19 +245,17 @@ async def daily_refresh_charData():
async def send_card_info( async def send_card_info(
bot: Bot, bot: Bot,
matcher: Matcher, matcher: Matcher,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
message = args.extract_plain_text().strip().replace(' ', '') message = args.extract_plain_text().strip().replace(' ', '')
uid = re.findall(r'\d+', message.split("@")[0]) # str uid = re.findall(r'\d+', message) # str
m = ''.join(re.findall('[\u4e00-\u9fa5]', message)) m = ''.join(re.findall('[\u4e00-\u9fa5]', message))
# 获取被@的Wxid排除"" qid = event.user_id
qid = event.from_wxid at = custom.get_first_at()
if event.at_user_list: if at:
for user in event.at_user_list: qid = at
user = user.strip()
if user != "":
qid = user
if len(uid) >= 1: if len(uid) >= 1:
uid = uid[0] uid = uid[0]
@ -306,21 +301,19 @@ async def send_card_info(
), ),
) )
async def send_charcard_list( async def send_charcard_list(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
raw_mes = args.extract_plain_text().strip() raw_mes = args.extract_plain_text().strip()
# 获取被@的Wxid排除"" qid = event.user_id
qid = event.from_wxid at = custom.get_first_at()
if event.at_user_list: if at:
for user in event.at_user_list: qid = at
user = user.strip()
if user != "":
qid = user
# 获取uid # 获取uid
uid = re.findall(r'\d+', raw_mes.split("@")[0]) uid = re.findall(r'\d+', raw_mes)
if uid: if uid:
uid = uid[0] uid = uid[0]
else: else:

View File

@ -5,8 +5,7 @@ from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot import on_regex, on_command from nonebot import on_regex, on_command
from nonebot.params import CommandArg, RegexGroup from nonebot.params import CommandArg, RegexGroup
from nonebot.adapters.ntchat import MessageSegment from nonebot.adapters.onebot.v11 import Message, MessageSegment
from nonebot.adapters.ntchat.message import Message
from ..version import Genshin_version from ..version import Genshin_version
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu

View File

@ -1,7 +1,7 @@
from nonebot import on_command from nonebot import on_command
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat import MessageSegment from nonebot.adapters.onebot.v11 import MessageSegment
from ..config import priority from ..config import priority
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 KiB

View File

@ -1,15 +1,13 @@
import os from typing import Union
import asyncio
from nonebot.log import logger from nonebot.log import logger
from nonebot.rule import is_type
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot import get_bot, on_command, on_message from nonebot import get_bot, on_notice, on_command
from nonebot.adapters.ntchat.permission import GROUP from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat import ( NoticeEvent,
MessageSegment, MessageSegment,
FileMessageEvent, GroupMessageEvent,
TextMessageEvent, PrivateMessageEvent,
) )
from .get_gachalogs import save_gachalogs from .get_gachalogs import save_gachalogs
@ -23,8 +21,8 @@ from .export_and_import import export_gachalogs, import_gachalogs
get_gacha_log = on_command('刷新抽卡记录', aliases={'强制刷新抽卡记录'}, rule=FullCommand()) get_gacha_log = on_command('刷新抽卡记录', aliases={'强制刷新抽卡记录'}, rule=FullCommand())
get_gacha_log_card = on_command('抽卡记录', rule=FullCommand()) get_gacha_log_card = on_command('抽卡记录', rule=FullCommand())
import_gacha_log = on_message(block=False, rule=(is_type(FileMessageEvent))) import_gacha_log = on_notice()
export_gacha_log = on_command('导出抽卡记录', rule=FullCommand(), permission=GROUP) export_gacha_log = on_command('导出抽卡记录', rule=FullCommand())
@export_gacha_log.handle() @export_gacha_log.handle()
@ -43,12 +41,12 @@ export_gacha_log = on_command('导出抽卡记录', rule=FullCommand(), permissi
), ),
) )
async def export_gacha_log_info( async def export_gacha_log_info(
event: TextMessageEvent, event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[导出抽卡记录]') logger.info('开始执行[导出抽卡记录]')
qid = event.from_wxid qid = event.user_id
gid = event.room_wxid gid = event.group_id
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
bot = get_bot() bot = get_bot()
if not isinstance(uid, str) or '未找到绑定的UID' in uid: if not isinstance(uid, str) or '未找到绑定的UID' in uid:
@ -56,9 +54,10 @@ async def export_gacha_log_info(
raw_data = await export_gachalogs(uid) raw_data = await export_gachalogs(uid)
if raw_data['retcode'] == 'ok': if raw_data['retcode'] == 'ok':
await bot.call_api( await bot.call_api(
'send_file', 'upload_group_file',
to_wxid=gid, group_id=gid,
file_path=raw_data['url'], name=raw_data['name'],
file=raw_data['url'],
) )
logger.info(f'[导出抽卡记录] UID{uid}成功!') logger.info(f'[导出抽卡记录] UID{uid}成功!')
await matcher.finish('上传成功!') await matcher.finish('上传成功!')
@ -82,22 +81,21 @@ async def export_gacha_log_info(
'- <ft color=(238,120,0)>私聊发送json格式的离线文件</ft>' '- <ft color=(238,120,0)>私聊发送json格式的离线文件</ft>'
), ),
) )
async def import_gacha_log_info(event: FileMessageEvent, matcher: Matcher): async def import_gacha_log_info(event: NoticeEvent, matcher: Matcher):
await asyncio.sleep(2) # 等待下载文件,避免占用 args = event.dict()
# 检测文件是否存在并小于8MB if args['notice_type'] != 'offline_file':
if ( await matcher.finish()
os.path.exists(event.file) url = args['file']['url']
and os.path.getsize(event.file) <= 8 * 1024 * 1024 name: str = args['file']['name']
and event.file_name.endswith(".json") if not name.endswith('.json'):
): return
uid = await select_db(event.from_wxid, mode='uid') qid = args['user_id']
uid = await select_db(qid, mode='uid')
if not isinstance(uid, str) or '未找到绑定的UID' in uid: if not isinstance(uid, str) or '未找到绑定的UID' in uid:
await matcher.finish(UID_HINT) await matcher.finish(UID_HINT)
logger.info('开始执行[导入抽卡记录]') logger.info('开始执行[导入抽卡记录]')
im = await import_gachalogs(event.file, uid) im = await import_gachalogs(url, uid)
await matcher.finish(im) await matcher.finish(im)
else:
await matcher.finish()
@get_gacha_log_card.handle() @get_gacha_log_card.handle()
@ -116,14 +114,14 @@ async def import_gacha_log_info(event: FileMessageEvent, matcher: Matcher):
), ),
) )
async def send_gacha_log_card_info( async def send_gacha_log_card_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[抽卡记录]') logger.info('开始执行[抽卡记录]')
uid = await select_db(event.from_wxid, mode='uid') uid = await select_db(event.user_id, mode='uid')
if isinstance(uid, str): if isinstance(uid, str):
im = await draw_gachalogs_img(uid, event.from_wxid) # type: ignore im = await draw_gachalogs_img(uid, event.user_id)
if isinstance(im, bytes): if isinstance(im, bytes):
await matcher.finish(MessageSegment.image(im)) await matcher.finish(MessageSegment.image(im))
else: else:
@ -148,21 +146,15 @@ async def send_gacha_log_card_info(
), ),
) )
async def send_daily_info( async def send_daily_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[刷新抽卡记录]') logger.info('开始执行[刷新抽卡记录]')
wxid_list = [] uid = await select_db(event.user_id, mode='uid')
wxid_list.append(event.from_wxid)
uid = await select_db(event.from_wxid, mode='uid')
if isinstance(uid, str): if isinstance(uid, str):
is_force = False is_force = False
if event.msg.startswith('强制'): if event.raw_message.startswith('强制'):
is_force = True is_force = True
tip = '正在刷新抽卡记录,请耐心等待,不要重复发送命令。'
await matcher.send(
MessageSegment.room_at_msg(content=tip, at_list=wxid_list)
)
im = await save_gachalogs(uid, None, is_force) im = await save_gachalogs(uid, None, is_force)
await matcher.finish(im) await matcher.finish(im)
else: else:

View File

@ -16,13 +16,7 @@ INT_TO_TYPE = {
async def import_gachalogs(history_url: str, uid: str) -> str: async def import_gachalogs(history_url: str, uid: str) -> str:
# 是否Json文件检测 history_data: dict = json.loads(get(history_url).text)
try:
if not history_url.startswith(('http', 'https')):
with open(history_url, 'r', encoding='utf-8') as history_url_files:
history_data = json.load(history_url_files)
else:
history_data: dict = get(history_url).json()
data_uid = history_data['info']['uid'] data_uid = history_data['info']['uid']
if data_uid != uid: if data_uid != uid:
return f'该抽卡记录UID{data_uid}与你绑定UID{uid}不符合!' return f'该抽卡记录UID{data_uid}与你绑定UID{uid}不符合!'
@ -38,8 +32,6 @@ async def import_gachalogs(history_url: str, uid: str) -> str:
result[INT_TO_TYPE[item['gacha_type']]].append(item) result[INT_TO_TYPE[item['gacha_type']]].append(item)
im = await save_gachalogs(uid, result) im = await save_gachalogs(uid, result)
return im return im
except Exception:
return '导入失败请检查你的Json文件'
async def export_gachalogs(uid: str) -> dict: async def export_gachalogs(uid: str) -> dict:

View File

@ -0,0 +1,43 @@
from nonebot import on_command
from nonebot.log import logger
from nonebot.matcher import Matcher
from nonebot.adapters.onebot.v11 import Bot, GroupMessageEvent
from .gacha_url import post_url
from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand
from ..utils.message.error_reply import UID_HINT
from ..utils.db_operation.db_operation import select_db
from ..utils.exception.handle_exception import handle_exception
get_gacha_url = on_command(
'获取抽卡记录链接', aliases={'抽卡链接', '抽卡记录链接'}, rule=FullCommand()
)
@get_gacha_url.handle()
@handle_exception('获取抽卡记录链接')
@register_menu(
'获取抽卡记录链接',
'获取抽卡记录链接',
'获取用户的抽卡记录链接',
trigger_method='群聊指令',
detail_des=(
'介绍:\n'
'导出抽卡记录的链接以用于原神小程序\n'
' \n'
'指令:\n'
'- <ft color=(238,120,0)>抽卡链接</ft>'
),
)
async def _(
bot: Bot,
event: GroupMessageEvent,
matcher: Matcher,
):
await get_gacha_url.send("正在获取抽卡记录链接")
logger.info('开始执行[获取抽卡记录链接]')
uid = await select_db(event.user_id, mode='uid')
if not isinstance(uid, str) or '未找到绑定的UID' in uid:
await matcher.finish(UID_HINT)
await post_url(bot, uid, str(event.group_id), str(event.user_id))

View File

@ -0,0 +1,53 @@
import time
from urllib.parse import quote
from nonebot.adapters.onebot.v11 import Bot
from ..utils.message.error_reply import SK_HINT
from ..utils.message.send_msg import send_forward_msg
from ..utils.mhy_api.get_mhy_data import get_authkey_by_cookie
async def post_url(bot: Bot, uid: str, group_id: str, qid: str):
async def send_group_msg(msg: str):
await bot.call_api(
api='send_group_msg',
group_id=group_id,
message=msg,
)
return ''
authkey = await get_authkey_by_cookie(uid)
if authkey == {}:
return await send_group_msg(SK_HINT)
authkey = authkey['data']['authkey']
now = time.time()
region = ""
if uid[0] == "1" or uid[0] == "2":
region = 'cn_gf01'
elif uid[0] == "5":
region = "'cn_qd01'"
elif uid[0] == "6":
region = "'os_usa'"
elif uid[0] == "7":
region = "'os_euro'"
elif uid[0] == "8":
region = "'os_asia'"
elif uid[0] == "9":
region = "'os_cht'"
else:
region = 'cn_gf01'
msgs = []
msgs.append(f"uid{uid}的抽卡记录链接为:")
url = (
f"https://hk4e-api.mihoyo.com/event/gacha_info/api/getGachaLog?"
f"authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&"
f"gacha_id=fecafa7b6560db5f3182222395d88aaa6aaac1bc"
f"&timestamp={str(int(now))}"
f"&lang=zh-cn&device_type=mobile&plat_type=ios&region={region}"
f"&authkey={quote(authkey,'utf-8')}"
f"&game_biz=hk4e_cn&gacha_type=301&page=1&size=5&end_id=0"
)
msgs.append(url)
await send_forward_msg(bot, group_id, "抽卡链接", qid, msgs)
return "成功执行"

View File

@ -3,13 +3,13 @@ import re
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import CommandArg from nonebot.params import Depends, CommandArg
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import Message, MessageEvent, MessageSegment
from nonebot.adapters.ntchat import MessageSegment, TextMessageEvent
from ..config import priority from ..config import priority
from .draw_gcginfo import draw_gcg_info from .draw_gcginfo import draw_gcg_info
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.message.get_image_and_at import ImageAndAt
from ..utils.message.error_reply import CK_HINT, UID_HINT from ..utils.message.error_reply import CK_HINT, UID_HINT
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
@ -20,30 +20,26 @@ get_gcg_info = on_command('七圣召唤', aliases={'七圣', '召唤'}, priority
@get_gcg_info.handle() @get_gcg_info.handle()
@handle_exception('七圣召唤', '获取/发送七圣召唤失败', '@未找到绑定信息\n' + CK_HINT) @handle_exception('七圣召唤', '获取/发送七圣召唤失败', '@未找到绑定信息\n' + CK_HINT)
async def send_gcg_pic( async def send_gcg_pic(
event: TextMessageEvent, event: MessageEvent,
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
raw_mes = args.extract_plain_text().strip().replace(' ', '') raw_mes = args.extract_plain_text().strip().replace(' ', '')
if "@" in raw_mes: name = ''.join(re.findall('[\u4e00-\u9fa5]', raw_mes))
name = ''.join(re.findall('^[\u4e00-\u9fa5]+', raw_mes.split("@")[0]))
if name:
return
else:
name = ''.join(re.findall('^[\u4e00-\u9fa5]+', raw_mes))
if name: if name:
return return
at = custom.get_first_at()
logger.info('开始执行[七圣召唤]') logger.info('开始执行[七圣召唤]')
qid = event.from_wxid
if event.at_user_list: if at:
for user in event.at_user_list: qid = at
user = user.strip() else:
if user != "": qid = event.user_id
qid = user logger.info('[七圣召唤]QQ: {}'.format(qid))
logger.info('[七圣召唤]WXID: {}'.format(qid))
# 获取uid # 获取uid
uid = re.findall(r'\d+', raw_mes.split("@")[0]) uid = re.findall(r'\d+', raw_mes)
if uid: if uid:
uid = uid[0] uid = uid[0]
else: else:

View File

@ -7,8 +7,12 @@ from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot import on_regex, on_command from nonebot import on_regex, on_command
from nonebot.params import CommandArg, RegexGroup from nonebot.params import CommandArg, RegexGroup
from nonebot.adapters.ntchat import MessageSegment from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat.message import Message Bot,
Message,
MessageSegment,
GroupMessageEvent,
)
from .get_card import get_gs_card from .get_card import get_gs_card
from .get_guide import get_gs_guide from .get_guide import get_gs_guide
@ -23,6 +27,7 @@ get_bluekun_pic = on_command('参考面板')
get_card = on_command('原牌') get_card = on_command('原牌')
get_abyss = on_command('版本深渊') get_abyss = on_command('版本深渊')
IMG_PATH = Path(__file__).parent / 'img' IMG_PATH = Path(__file__).parent / 'img'
@ -110,8 +115,10 @@ async def send_gscard_pic(matcher: Matcher, args: Message = CommandArg()):
@get_abyss.handle() @get_abyss.handle()
@handle_exception('版本深渊') @handle_exception('原牌')
async def send_abyss_review( async def send_abyss_review(
bot: Bot,
event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
): ):
@ -121,8 +128,22 @@ async def send_abyss_review(
version = str(args[0]) version = str(args[0])
im = await get_review(version) im = await get_review(version)
if isinstance(im, List): if isinstance(im, List):
im = '\n'.join(im) mes = []
await matcher.finish(im) for msg in im:
mes.append(
{
'type': 'node',
'data': {
'name': '小仙',
'uin': '3399214199',
'content': msg,
},
}
)
await bot.call_api(
'send_group_forward_msg', group_id=event.group_id, messages=mes
)
await matcher.finish()
elif isinstance(im, str): elif isinstance(im, str):
await matcher.finish(im) await matcher.finish(im)
elif isinstance(im, bytes): elif isinstance(im, bytes):

View File

@ -5,7 +5,7 @@ from pathlib import Path
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.adapters.ntchat import MessageSegment from nonebot.adapters.onebot.v11 import MessageSegment
from .draw_help_card import draw_help_img from .draw_help_card import draw_help_img
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu

View File

@ -1,11 +1,16 @@
from typing import Any, Dict from typing import Any, Dict, Union
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import RegexDict from nonebot.params import RegexDict
from nonebot import on_regex, on_command from nonebot import on_regex, on_command
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot.adapters.ntchat import Bot, MessageSegment, TextMessageEvent from nonebot.adapters.onebot.v11 import (
Bot,
MessageSegment,
GroupMessageEvent,
PrivateMessageEvent,
)
from ..config import priority from ..config import priority
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
@ -55,7 +60,7 @@ MAP_CHN_NAME = {
) )
async def send_change_map_msg( async def send_change_map_msg(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
if not await SUPERUSER(bot, event): if not await SUPERUSER(bot, event):
@ -124,6 +129,7 @@ async def send_find_map_msg(
logger.info('本地未缓存,正在渲染...') logger.info('本地未缓存,正在渲染...')
im = await draw_genshin_map(name, map_id, map_name) im = await draw_genshin_map(name, map_id, map_name)
if isinstance(im, str): if isinstance(im, str):
# 如果无结果,直接不返回
await matcher.finish() await matcher.finish()
elif isinstance(im, bytes): elif isinstance(im, bytes):
await matcher.finish(MessageSegment.image(im)) await matcher.finish(MessageSegment.image(im))

View File

@ -6,11 +6,12 @@ from nonebot.matcher import Matcher
from nonebot import get_bot, on_command from nonebot import get_bot, on_command
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat import Bot, MessageEvent, MessageSegment from nonebot.adapters.onebot.v11 import MessageEvent
from ..config import SUPERUSERS, priority from ..config import priority
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
from ..utils.nonebot2.utils import get_superusers
from ..utils.db_operation.db_operation import config_check from ..utils.db_operation.db_operation import config_check
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
from .daily_mihoyo_bbs_coin import mihoyo_coin, all_daily_mihoyo_bbs_coin from .daily_mihoyo_bbs_coin import mihoyo_coin, all_daily_mihoyo_bbs_coin
@ -19,7 +20,7 @@ bbscoin_scheduler = scheduler
get_mihoyo_coin = on_command('开始获取米游币', priority=priority, rule=FullCommand()) get_mihoyo_coin = on_command('开始获取米游币', priority=priority, rule=FullCommand())
all_bbscoin_recheck = on_command( all_bbscoin_recheck = on_command(
'全部重获取', priority=priority, rule=FullCommand() '全部重获取', permission=SUPERUSER, priority=priority, rule=FullCommand()
) )
@ -39,16 +40,10 @@ all_bbscoin_recheck = on_command(
), ),
) )
async def send_mihoyo_coin(event: MessageEvent, matcher: Matcher): async def send_mihoyo_coin(event: MessageEvent, matcher: Matcher):
wxid_list = [] await matcher.send('开始操作……', at_sender=True)
wxid_list.append(event.from_wxid) qid = event.user_id
await matcher.send(
MessageSegment.room_at_msg(content='{$@}开始操作……', at_list=wxid_list)
)
qid = event.from_wxid
im = await mihoyo_coin(qid) im = await mihoyo_coin(qid)
await matcher.finish( await matcher.finish(im, at_sender=True)
MessageSegment.room_at_msg(content="{$@}" + f'{im}', at_list=wxid_list)
)
@all_bbscoin_recheck.handle() @all_bbscoin_recheck.handle()
@ -65,13 +60,12 @@ async def send_mihoyo_coin(event: MessageEvent, matcher: Matcher):
'- <ft color=(238,120,0)>全部重获取</ft>' '- <ft color=(238,120,0)>全部重获取</ft>'
), ),
) )
async def bbs_recheck(bot: Bot, event: MessageEvent, matcher: Matcher): async def bbs_recheck(
if await SUPERUSER(bot, event): matcher: Matcher,
):
await matcher.send('已开始执行!可能需要较久时间!') await matcher.send('已开始执行!可能需要较久时间!')
await send_daily_mihoyo_bbs_sign() await send_daily_mihoyo_bbs_sign()
await matcher.finish('执行完成!') await matcher.finish('执行完成!')
else:
return
# 每日一点十六分进行米游币获取 # 每日一点十六分进行米游币获取
@ -86,12 +80,12 @@ async def send_daily_mihoyo_bbs_sign():
im, im_private = await all_daily_mihoyo_bbs_coin() im, im_private = await all_daily_mihoyo_bbs_coin()
if im_private: if im_private:
for user_id in im_private: for user_id in im_private:
await bot.call_api( await bot.send_private_msg(
'send_text', to_wxid=user_id, content=im_private[user_id] user_id=user_id, message=im_private[user_id]
) )
await asyncio.sleep(5 + random.randint(1, 3)) await asyncio.sleep(5 + random.randint(1, 3))
if await config_check('PrivateReport'): if await config_check('PrivateReport'):
for qid in SUPERUSERS: for qid in get_superusers():
await bot.call_api(api='send_text', to_wxid=qid, content=im) await bot.call_api(api='send_private_msg', user_id=qid, message=im)
await asyncio.sleep(5 + random.randint(1, 3)) await asyncio.sleep(5 + random.randint(1, 3))
logger.info('米游币获取已结束。') logger.info('米游币获取已结束。')

View File

@ -1,22 +1,23 @@
import asyncio
from typing import Any, Tuple from typing import Any, Tuple
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import RegexGroup from nonebot.params import RegexGroup
from nonebot import on_regex, on_command from nonebot import on_regex, on_command
from nonebot.adapters.ntchat import ( from nonebot.adapters.onebot.v11 import (
Bot, Bot,
MessageEvent, MessageEvent,
MessageSegment, MessageSegment,
TextMessageEvent, GroupMessageEvent,
) )
from ..config import priority from ..config import priority
from .get_lots_data import get_lots_msg from .get_lots_data import get_lots_msg
from .get_meme_card import get_meme_img from .get_meme_card import get_meme_img
from .get_mys_data import get_task_detail
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
from .get_mys_data import get_region_task, get_task_detail
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
get_task_adv = on_regex( get_task_adv = on_regex(
@ -49,11 +50,10 @@ get_lots = on_command('御神签', priority=priority, rule=FullCommand())
) )
async def send_task_adv( async def send_task_adv(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
args: Tuple[Any, ...] = RegexGroup(), args: Tuple[Any, ...] = RegexGroup(),
): ):
'''
if str(args[2]) in ['须弥', '层岩', '海岛']: if str(args[2]) in ['须弥', '层岩', '海岛']:
im = await get_region_task(str(args[2])) im = await get_region_task(str(args[2]))
for i in im: for i in im:
@ -63,7 +63,6 @@ async def send_task_adv(
await asyncio.sleep(1) await asyncio.sleep(1)
await matcher.finish() await matcher.finish()
else: else:
'''
im = await get_task_detail(str(args[2])) im = await get_task_detail(str(args[2]))
await matcher.finish(im) await matcher.finish(im)
@ -99,7 +98,7 @@ async def send_meme_card(matcher: Matcher):
), ),
) )
async def send_lots_data(matcher: Matcher, event: MessageEvent): async def send_lots_data(matcher: Matcher, event: MessageEvent):
qid = event.from_wxid qid = event.user_id
logger.info('开始执行[御神签]') logger.info('开始执行[御神签]')
im = await get_lots_msg(qid) im = await get_lots_msg(qid)
await matcher.finish(im) await matcher.finish(im)

View File

@ -1,7 +1,7 @@
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.adapters.ntchat import MessageEvent, MessageSegment from nonebot.adapters.onebot.v11 import MessageEvent, MessageSegment
from .note_text import award from .note_text import award
from ..config import priority from ..config import priority
@ -33,23 +33,15 @@ async def send_monthly_data(
event: MessageEvent, event: MessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
qid = event.from_wxid qid = event.user_id
wxid_list = []
wxid_list.append(event.from_wxid)
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
if isinstance(uid, str): if isinstance(uid, str):
if '未找到绑定的UID' in uid: if '未找到绑定的UID' in uid:
await matcher.finish( await matcher.finish(UID_HINT)
MessageSegment.room_at_msg(
content='{$@}' + UID_HINT, at_list=wxid_list
)
)
else: else:
await matcher.finish('发生未知错误...') await matcher.finish('发生未知错误...')
im = await award(uid) im = await award(uid)
await matcher.finish( await matcher.finish(im, at_sender=True)
MessageSegment.room_at_msg(content="{$@}" + f'{im}', at_list=wxid_list)
)
# 群聊内 每月统计 功能 # 群聊内 每月统计 功能
@ -73,17 +65,11 @@ async def send_monthly_pic(
event: MessageEvent, event: MessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
qid = event.from_wxid qid = event.user_id
wxid_list = []
wxid_list.append(event.from_wxid)
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
if isinstance(uid, str): if isinstance(uid, str):
if '未找到绑定的UID' in uid: if '未找到绑定的UID' in uid:
await matcher.finish( await matcher.finish(UID_HINT)
MessageSegment.room_at_msg(
content='{$@}' + UID_HINT, at_list=wxid_list
)
)
else: else:
await matcher.finish('发生未知错误...') await matcher.finish('发生未知错误...')
logger.info(f'[原石札记] 开始绘制,UID: {uid}') logger.info(f'[原石札记] 开始绘制,UID: {uid}')

View File

@ -1,10 +1,16 @@
import asyncio import asyncio
from typing import Union
from nonebot.log import logger from nonebot.log import logger
from nonebot.params import Depends
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot import get_bot, on_command from nonebot import get_bot, on_command
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat import MessageSegment, TextMessageEvent from nonebot.adapters.onebot.v11 import (
MessageSegment,
GroupMessageEvent,
PrivateMessageEvent,
)
from .notice import get_notice_list from .notice import get_notice_list
from .resin_text import get_resin_text from .resin_text import get_resin_text
@ -13,6 +19,7 @@ from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
from ..utils.message.error_reply import UID_HINT from ..utils.message.error_reply import UID_HINT
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.message.get_image_and_at import ImageAndAt
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
notice_scheduler = scheduler notice_scheduler = scheduler
@ -40,17 +47,16 @@ get_daily_info = on_command('当前状态', rule=FullCommand())
), ),
) )
async def send_daily_info( async def send_daily_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
custom: ImageAndAt = Depends(),
): ):
logger.info('开始执行[每日信息文字版]') logger.info('开始执行[每日信息文字版]')
qid = event.from_wxid at = custom.get_first_at()
if event.at_user_list: qid = event.user_id
for user in event.at_user_list: if at:
user = user.strip() qid = at
if user != "":
qid = user
logger.info('[每日信息文字版]QQ号: {}'.format(qid)) logger.info('[每日信息文字版]QQ号: {}'.format(qid))
uid: str = await select_db(qid, mode='uid') # type: ignore uid: str = await select_db(qid, mode='uid') # type: ignore
@ -113,19 +119,19 @@ async def notice_job():
), ),
) )
async def send_uid_info( async def send_uid_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
custom: ImageAndAt = Depends(),
): ):
logger.info('开始执行[每日信息]') logger.info('开始执行[每日信息]')
qid = event.from_wxid
if event.at_user_list: at = custom.get_first_at()
for user in event.at_user_list: qid = event.user_id
user = user.strip() if at:
if user != "": qid = at
qid = user
logger.info('[每日信息]QQ号: {}'.format(qid)) logger.info('[每日信息]QQ号: {}'.format(qid))
im = await get_resin_img(qid) # type:ignore im = await get_resin_img(qid)
if isinstance(im, str): if isinstance(im, str):
await matcher.finish(im) await matcher.finish(im)
elif isinstance(im, bytes): elif isinstance(im, bytes):

View File

@ -1,11 +1,16 @@
import asyncio import asyncio
import threading import threading
from typing import Union
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot.adapters.ntchat import Bot, TextMessageEvent from nonebot.adapters.onebot.v11 import (
Bot,
GroupMessageEvent,
PrivateMessageEvent,
)
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
@ -34,7 +39,7 @@ download_resource = on_command('下载全部资源', rule=FullCommand())
) )
async def send_download_resource_msg( async def send_download_resource_msg(
bot: Bot, bot: Bot,
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
): ):
if not await SUPERUSER(bot, event): if not await SUPERUSER(bot, event):

View File

@ -1,11 +1,16 @@
import re import re
from typing import Union
from nonebot import on_command from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import CommandArg from nonebot.params import Depends, CommandArg
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat import MessageSegment, TextMessageEvent Message,
MessageSegment,
GroupMessageEvent,
PrivateMessageEvent,
)
from .get_regtime import calc_reg_time from .get_regtime import calc_reg_time
from .draw_roleinfo_card import draw_pic from .draw_roleinfo_card import draw_pic
@ -13,6 +18,7 @@ from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
from ..utils.message.error_reply import UID_HINT from ..utils.message.error_reply import UID_HINT
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.message.get_image_and_at import ImageAndAt
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
get_role_info = on_command('uid', aliases={'查询'}) get_role_info = on_command('uid', aliases={'查询'})
@ -47,31 +53,22 @@ get_reg_time = on_command(
), ),
) )
async def send_role_info( async def send_role_info(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
custom: ImageAndAt = Depends(),
): ):
raw_mes = args.extract_plain_text().strip().replace(' ', '') raw_mes = args.extract_plain_text().strip().replace(' ', '')
# 若@在文本中 先无视@后面内容 如果@前面有内容则无视并停止执行下方命令 避免与enka查询打架 name = ''.join(re.findall('[\u4e00-\u9fa5]', raw_mes))
if "@" in raw_mes:
name = ''.join(re.findall('^[\u4e00-\u9fa5]+', raw_mes.split("@")[0]))
if name: if name:
return return
else: qid = event.user_id
name = ''.join(re.findall('^[\u4e00-\u9fa5]+', raw_mes)) at = custom.get_first_at()
if name: if at:
return qid = at
qid = event.from_wxid
# 识别@的人 排除空
if event.at_user_list:
for user in event.at_user_list:
user = user.strip()
if user != "":
qid = user
# 获取uid # 获取uid
uid = re.findall(r'\d+', raw_mes.split("@")[0]) uid = re.findall(r'\d+', raw_mes)
if uid: if uid:
uid = uid[0] uid = uid[0]
else: else:
@ -97,16 +94,14 @@ async def send_role_info(
@get_reg_time.handle() @get_reg_time.handle()
async def regtime( async def regtime(
event: TextMessageEvent, event: Union[GroupMessageEvent, PrivateMessageEvent],
matcher: Matcher, matcher: Matcher,
custom: ImageAndAt = Depends(),
): ):
qid = event.from_wxid qid = event.user_id
# 识别@的人 排除空 at = custom.get_first_at()
if event.at_user_list: if at:
for user in event.at_user_list: qid = at
user = user.strip()
if user != "":
qid = user
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
uid = str(uid) uid = str(uid)

View File

@ -5,8 +5,7 @@ from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot import get_bot, on_command from nonebot import get_bot, on_command
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot_plugin_apscheduler import scheduler from nonebot.adapters.onebot.v11 import MessageEvent
from nonebot.adapters.ntchat import Bot, MessageEvent, MessageSegment
from ..config import priority from ..config import priority
@ -15,6 +14,8 @@ try:
except ImportError: except ImportError:
from .sign import sign_in, daily_sign from .sign import sign_in, daily_sign
from nonebot_plugin_apscheduler import scheduler
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
@ -23,7 +24,9 @@ from ..utils.db_operation.db_operation import select_db, config_check
sign_scheduler = scheduler sign_scheduler = scheduler
get_sign = on_command('签到', priority=priority, rule=FullCommand()) get_sign = on_command('签到', priority=priority, rule=FullCommand())
all_recheck = on_command('全部重签', priority=priority, rule=FullCommand()) all_recheck = on_command(
'全部重签', permission=SUPERUSER, priority=priority, rule=FullCommand()
)
# 每日零点半执行米游社原神签到 # 每日零点半执行米游社原神签到
@ -53,16 +56,12 @@ async def get_sign_func(
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[签到]') logger.info('开始执行[签到]')
qid = event.from_wxid qid = event.user_id
wxid_list = []
wxid_list.append(event.from_wxid)
logger.info('[签到]QQ号: {}'.format(qid)) logger.info('[签到]QQ号: {}'.format(qid))
uid = await select_db(qid, mode='uid') uid = await select_db(qid, mode='uid')
logger.info('[签到]UID: {}'.format(uid)) logger.info('[签到]UID: {}'.format(uid))
im = await sign_in(uid) im = await sign_in(uid)
await matcher.finish( await matcher.finish(im, at_sender=True)
MessageSegment.room_at_msg(content="{$@}" + f'{im}', at_list=wxid_list)
)
@all_recheck.handle() @all_recheck.handle()
@ -79,9 +78,7 @@ async def get_sign_func(
'- <ft color=(238,120,0)>全部重签</ft>' '- <ft color=(238,120,0)>全部重签</ft>'
), ),
) )
async def recheck(bot: Bot, event: MessageEvent, matcher: Matcher): async def recheck(matcher: Matcher):
if not await SUPERUSER(bot, event):
return
logger.info('开始执行[全部重签]') logger.info('开始执行[全部重签]')
await matcher.send('已开始执行') await matcher.send('已开始执行')
await send_daily_sign() await send_daily_sign()
@ -101,9 +98,9 @@ async def send_daily_sign():
for qid in private_msg_list: for qid in private_msg_list:
try: try:
await bot.call_api( await bot.call_api(
api='send_text', api='send_private_msg',
to_wxid=qid, user_id=qid,
content=private_msg_list[qid], message=private_msg_list[qid],
) )
except Exception: except Exception:
logger.warning(f'[每日全部签到] QQ {qid} 私聊推送失败!') logger.warning(f'[每日全部签到] QQ {qid} 私聊推送失败!')
@ -125,16 +122,13 @@ async def send_daily_sign():
report, report,
) )
else: else:
msg_title = group_msg_list[gid]['push_message'].rstrip() msg_title = group_msg_list[gid]['push_message']
# 发送群消息 # 发送群消息
at_wxid = []
at_wxid.append(group_msg_list[gid]['wxid'])
try: try:
await bot.call_api( await bot.call_api(
api='send_room_at_msg', api='send_group_msg',
to_wxid=gid, group_id=gid,
at_list=at_wxid, message=msg_title,
content=msg_title,
) )
except Exception: except Exception:
logger.warning(f'[每日全部签到]群 {gid} 推送失败!') logger.warning(f'[每日全部签到]群 {gid} 推送失败!')

View File

@ -139,18 +139,16 @@ async def single_daily_sign(uid: str, gid: str, qid: str):
# 如果失败, 则添加到推送列表 # 如果失败, 则添加到推送列表
if im.startswith('签到失败') or im.startswith('网络有点忙'): if im.startswith('签到失败') or im.startswith('网络有点忙'):
# 不用MessageSegment.at(row[2]),因为不方便移植 # 不用MessageSegment.at(row[2]),因为不方便移植
message = f'UID:{uid} | {im}' message = f'[CQ:at,qq={qid}] {im}'
group_msg_list[gid]['failed'] += 1 group_msg_list[gid]['failed'] += 1
group_msg_list[gid]['push_message'] += message + '\n' group_msg_list[gid]['push_message'] += '\n' + message
else: else:
group_msg_list[gid]['success'] += 1 group_msg_list[gid]['success'] += 1
# 没有开启简洁签到, 则每条消息都要携带@信息 # 没有开启简洁签到, 则每条消息都要携带@信息
else: else:
# 不用MessageSegment.at(row[2]),因为不方便移植 # 不用MessageSegment.at(row[2]),因为不方便移植
# message = '{$@}' + f'UID:{uid} | {im}' message = f'[CQ:at,qq={qid}] {im}'
message = f'UID:{uid} | {im}' group_msg_list[gid]['push_message'] += '\n' + message
group_msg_list[gid]['wxid'] = qid
group_msg_list[gid]['push_message'] += message + '\n'
group_msg_list[gid]['success'] -= 1 group_msg_list[gid]['success'] -= 1

View File

@ -5,7 +5,7 @@ from nonebot.matcher import Matcher
from nonebot.params import RegexGroup from nonebot.params import RegexGroup
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot import get_bot, on_regex, get_driver, on_command from nonebot import get_bot, on_regex, get_driver, on_command
from nonebot.adapters.ntchat import Bot, MessageEvent, MessageSegment from nonebot.adapters.onebot.v11 import Bot, MessageEvent, MessageSegment
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
@ -32,15 +32,15 @@ async def _():
return return
if update_log['send_type'] == 'group': if update_log['send_type'] == 'group':
await bot.call_api( await bot.call_api(
api='send_room_at_msg', api='send_group_msg',
to_wxid=update_log['send_to'], group_id=update_log['send_to'],
content=update_log['msg'], message=update_log['msg'],
) )
else: else:
await bot.call_api( await bot.call_api(
api='send_text', api='send_private_msg',
to_wxid=update_log['send_to'], user_id=update_log['send_to'],
content=update_log['msg'], message=update_log['msg'],
) )
logger.info('遗留信息检查完毕!') logger.info('遗留信息检查完毕!')
@ -89,7 +89,7 @@ async def send_restart_msg(
if not await SUPERUSER(bot, event): if not await SUPERUSER(bot, event):
return return
logger.warning('开始执行[重启]') logger.warning('开始执行[重启]')
qid = event.from_wxid qid = event.user_id
if len(event.get_session_id().split('_')) == 3: if len(event.get_session_id().split('_')) == 3:
send_id = event.get_session_id().split('_')[1] send_id = event.get_session_id().split('_')[1]
send_type = 'group' send_type = 'group'

View File

@ -1,4 +1,3 @@
import asyncio
from typing import Any, Tuple from typing import Any, Tuple
from nonebot.log import logger from nonebot.log import logger
@ -6,39 +5,33 @@ from nonebot.matcher import Matcher
from nonebot import on_regex, on_command from nonebot import on_regex, on_command
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER
from nonebot.params import CommandArg, RegexGroup from nonebot.params import CommandArg, RegexGroup
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import (
from nonebot.adapters.ntchat.permission import PRIVATE PRIVATE_FRIEND,
from nonebot.adapters.ntchat import (
Bot, Bot,
Message,
MessageEvent, MessageEvent,
MessageSegment, MessageSegment,
TextMessageEvent, GroupMessageEvent,
) )
from .topup import topup_
from ..config import priority from ..config import priority
from .topup import GOODS, topup_
from .qrlogin import qrcode_login from .qrlogin import qrcode_login
from .get_ck_help_msg import get_ck_help
from .draw_user_card import get_user_card from .draw_user_card import get_user_card
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.nonebot2.rule import FullCommand from ..utils.nonebot2.rule import FullCommand
from .get_ck_help_msg import get_ck_help, get_qr_help
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
from .add_ck import deal_ck, get_ck_by_stoken, get_ck_by_all_stoken from .add_ck import deal_ck, get_ck_by_stoken, get_ck_by_all_stoken
from ..utils.db_operation.db_operation import bind_db, delete_db, switch_db from ..utils.db_operation.db_operation import bind_db, delete_db, switch_db
add_cookie = on_command('添加', permission=PRIVATE) add_cookie = on_command('添加', permission=PRIVATE_FRIEND)
get_ck_msg = on_command( get_ck_msg = on_command(
'绑定ck说明', '绑定ck说明',
aliases={'ck帮助', '绑定ck'}, aliases={'ck帮助', '绑定ck'},
block=True, block=True,
rule=FullCommand(), rule=FullCommand(),
) )
get_qr_msg = on_command(
'扫码登录说明',
aliases={'扫码帮助', '登录帮助', '登陆帮助'},
block=True,
rule=FullCommand(),
)
bind_info = on_command( bind_info = on_command(
'绑定信息', priority=priority, block=True, rule=FullCommand() '绑定信息', priority=priority, block=True, rule=FullCommand()
) )
@ -65,40 +58,19 @@ get_qrcode_login = on_command(
aliases={'扫码登陆', '扫码登入'}, aliases={'扫码登陆', '扫码登入'},
rule=FullCommand(), rule=FullCommand(),
) )
get_topup = on_command( get_topup = on_command('gsrc', priority=priority, block=True, aliases={'原神充值'})
'gsrc', priority=priority, block=True, aliases={'原神充值', 'pay'}
)
@get_topup.handle() @get_topup.handle()
async def send_topup( async def send_topup(bot: Bot, event: GroupMessageEvent):
matcher: Matcher, event: TextMessageEvent, args: Message = CommandArg() qid = event.user_id
): goods_id = event.raw_message.replace('原神充值', '').replace('gsrc', '')
# 获取被@的Wxid排除"" if goods_id == "":
qid = event.from_wxid goods_id = 0
if event.at_user_list: else:
for user in event.at_user_list: goods_id = int(goods_id)
user = user.strip() group_id = event.group_id
if user != "": await topup_(bot, qid, group_id, goods_id)
qid = user
goods_id, method = 0, "alipay"
for s in str(args).split():
# 支持指定支付方式
if "微信" in s or "wx" in s:
method = "weixin"
continue
if "支付宝" in s or "zfb" in s:
method = "alipay"
# 输入物品别名识别
for gId, gData in GOODS.items():
if (s == gId) or (s in gData["aliases"]):
goods_id = gId
break
group_id = event.room_wxid
await matcher.finish(
await topup_(matcher, qid, group_id, goods_id, method)
)
@refresh_all_ck.handle() @refresh_all_ck.handle()
@ -118,7 +90,7 @@ async def send_refresh_ck_msg(
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[刷新CK]') logger.info('开始执行[刷新CK]')
qid = event.from_wxid qid = event.user_id
im = await get_ck_by_stoken(qid) im = await get_ck_by_stoken(qid)
if isinstance(im, str): if isinstance(im, str):
await matcher.finish(im) await matcher.finish(im)
@ -128,12 +100,13 @@ async def send_refresh_ck_msg(
@get_qrcode_login.handle() @get_qrcode_login.handle()
async def send_qrcode_login( async def send_qrcode_login(
bot: Bot, bot: Bot,
event: MessageEvent, event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[扫码登陆]') logger.info('开始执行[扫码登陆]')
qid = event.from_wxid qid = event.user_id
im = await qrcode_login(matcher, qid) groupid = event.group_id
im = await qrcode_login(bot, groupid, qid)
if not im: if not im:
return return
im = await deal_ck(im, qid) im = await deal_ck(im, qid)
@ -158,7 +131,7 @@ async def send_bind_card(
matcher: Matcher, matcher: Matcher,
): ):
logger.info('开始执行[查询用户绑定状态]') logger.info('开始执行[查询用户绑定状态]')
qid = event.from_wxid qid = event.user_id
im = await get_user_card(qid) im = await get_user_card(qid)
logger.info('[查询用户绑定状态]完成!等待图片发送中...') logger.info('[查询用户绑定状态]完成!等待图片发送中...')
await matcher.finish(MessageSegment.image(im)) await matcher.finish(MessageSegment.image(im))
@ -184,7 +157,7 @@ async def send_add_ck_msg(
event: MessageEvent, matcher: Matcher, args: Message = CommandArg() event: MessageEvent, matcher: Matcher, args: Message = CommandArg()
): ):
mes = args.extract_plain_text().strip().replace(' ', '') mes = args.extract_plain_text().strip().replace(' ', '')
qid = event.from_wxid qid = event.user_id
im = await deal_ck(mes, qid) im = await deal_ck(mes, qid)
if isinstance(im, str): if isinstance(im, str):
await matcher.finish(im) await matcher.finish(im)
@ -245,9 +218,7 @@ async def send_link_uid_msg(
): ):
logger.info('开始执行[绑定/解绑用户信息]') logger.info('开始执行[绑定/解绑用户信息]')
logger.info('[绑定/解绑]参数: {}'.format(args)) logger.info('[绑定/解绑]参数: {}'.format(args))
qid = event.from_wxid qid = event.user_id
wxid_list = []
wxid_list.append(event.from_wxid)
logger.info('[绑定/解绑]UserID: {}'.format(qid)) logger.info('[绑定/解绑]UserID: {}'.format(qid))
if args[0] in ('绑定'): if args[0] in ('绑定'):
@ -265,23 +236,20 @@ async def send_link_uid_msg(
im = await delete_db(qid, {'UID': args[2]}) im = await delete_db(qid, {'UID': args[2]})
else: else:
im = await delete_db(qid, {'MYSID': args[2]}) im = await delete_db(qid, {'MYSID': args[2]})
await matcher.finish( await matcher.finish(im, at_sender=True)
MessageSegment.room_at_msg(content="{$@}" + f'{im}', at_list=wxid_list)
)
@get_ck_msg.handle() @get_ck_msg.handle()
async def send_ck_help(matcher: Matcher): async def send_ck_help(bot: Bot, event: GroupMessageEvent):
msg_list = await get_ck_help() msg_list = await get_ck_help()
forward_msg = []
for msg in msg_list: for msg in msg_list:
await matcher.send(msg) forward_msg.append(
await asyncio.sleep(0.5) {
"type": "node",
"data": {"name": "小冰", "uin": "2854196306", "content": msg},
@get_qr_msg.handle() }
async def send_qr_help(matcher: Matcher): )
msg_list = await get_qr_help() await bot.call_api(
for msg in msg_list: 'send_group_forward_msg', group_id=event.group_id, messages=forward_msg
await matcher.send(msg) )
await asyncio.sleep(0.5)
await asyncio.sleep(0.5)

View File

@ -55,7 +55,7 @@ async def get_ck_by_all_stoken():
return im return im
async def get_ck_by_stoken(qid: str): async def get_ck_by_stoken(qid: int):
uid_list: List = await select_db(qid, mode='list') # type: ignore uid_list: List = await select_db(qid, mode='list') # type: ignore
uid_dict = {uid: qid for uid in uid_list} uid_dict = {uid: qid for uid in uid_list}
im = await refresh_ck_by_uid_list(uid_dict) im = await refresh_ck_by_uid_list(uid_dict)

View File

@ -1,241 +0,0 @@
from io import BytesIO
from time import strftime, localtime
from httpx import AsyncClient
from PIL import Image, ImageDraw, ImageFont
from ..utils.genshin_fonts.genshin_fonts import FONT_ORIGIN_PATH
def font(size: int) -> ImageFont.FreeTypeFont:
"""Pillow 绘制字体设置"""
return ImageFont.truetype(str(FONT_ORIGIN_PATH), size=size)
# 支付宝充值图片绘制
async def draw_ali(
uid,
item_info: str,
item_price: str,
item_order_no: str,
qrcode,
item_icon: str,
item_create_time: int,
item_id: str,
) -> bytes:
"""充值图片绘制"""
async with AsyncClient() as client:
_img = await client.get(item_icon, timeout=10.0)
itemImg = Image.open(BytesIO(_img.content)).convert("RGBA")
themeColor = "#1678ff"
warning = 20 if item_id == 'ys_chn_blessofmoon_tier5' else 0
res = Image.new("RGBA", (450, 530), themeColor)
drawer = ImageDraw.Draw(res)
resample = getattr(Image, "Resampling", Image).LANCZOS
# 头部矩形背景
drawer.rectangle(
(75, 50 - warning, 375 - 1, 150 - warning), fill="#E5F9FF", width=0
)
# 商品图片
item = itemImg.resize((90, 90), resample=resample)
res.paste(item, (80, 55 - warning), item)
# 二维码图片
qrcode = Image.open(qrcode)
qrcode = qrcode.resize((300, 300), resample=resample)
res.paste(qrcode, (75, 150 + warning), qrcode)
# 商品名称
drawer.text(
(
int(175 + (195 - font(25).getlength(item_info)) / 2),
int(70 - warning + (30 - font(25).getbbox(item_info)[-1]) / 2),
),
item_info,
fill="#000000",
font=font(25),
)
# 价格
drawer.text(
(
int(175 + (195 - font(25).getlength(item_price)) / 2),
int(105 - warning + (30 - font(25).getbbox(item_price)[-1]) / 2),
),
item_price,
fill="#000000",
font=font(25),
)
# 商品充值 UID
drawer.text(
(
int((460 - font(15).getlength(f"充值到 UID{uid}")) / 2),
int(
155
+ warning
+ (20 - font(15).getbbox(f"充值到 UID{uid}")[-1]) / 2
),
),
f"充值到 UID{uid}",
fill="#333333",
font=font(15),
)
# 月卡相关商品警告
if warning:
# 首部矩形背景
drawer.rectangle((75, 130, 375 - 1, 170), fill="#eeeeee", width=0)
# 转换警告文字
warning_text = "特殊情况将直接返还 330 创世结晶"
drawer.text(
(
int((450 - font(15).getlength(warning_text)) / 2),
int(130 + (40 - font(15).getbbox(warning_text)[-1]) / 2),
),
warning_text,
fill="#ff5652",
font=font(15),
)
# 图片生成时间
timestamp = strftime("%Y-%m-%d %H:%M:%S", localtime(int(item_create_time)))
drawer.text(
(int((460 - font(15).getlength(timestamp)) / 2), 425 + warning),
timestamp,
fill="#1678ff",
font=font(15),
)
# 账单信息
ticket = f"支付宝账单编号 {item_order_no}"
drawer.text(
(int((450 - font(15).getlength(ticket)) / 2), 460 + warning),
ticket,
fill="#ffffff",
font=font(15),
)
# 免责声明
drawer.text(
(
int(
(
410
- font(15).getlength(
"免责声明:该充值接口由米游社提供,不对充值结果负责。\n请在充值前仔细阅读米哈游的充值条款。"
)
/ 2
)
),
490 + warning,
),
"免责声明:该充值接口由米游社提供,不对充值结果负责。\n 请在充值前仔细阅读米哈游的充值条款。",
fill="#FFA500",
font=font(12),
)
buf = BytesIO()
res.convert("RGB").save(buf, format="PNG")
return buf.getvalue()
# 微信充值图片绘制
async def draw_wx(
uid,
item_info: str,
item_price: str,
item_order_no: str,
item_icon: str,
item_create_time: int,
item_id: str,
) -> bytes:
"""充值图片绘制"""
async with AsyncClient() as client:
_img = await client.get(item_icon, timeout=10.0)
itemImg = Image.open(BytesIO(_img.content)).convert("RGBA")
themeColor = "#29ac66"
warning = 20 if item_id == 'ys_chn_blessofmoon_tier5' else 0
res = Image.new("RGBA", (450, 200), themeColor)
drawer = ImageDraw.Draw(res)
resample = getattr(Image, "Resampling", Image).LANCZOS
left = (450 - 370) / 2 # (图片宽度 - 矩形宽度) / 2
top = (200 - 130) / 2 # (图片高度 - 矩形高度) / 2
# 头部矩形背景
drawer.rectangle(
(
left,
top - warning,
left + 370,
top + 130 - warning,
), # 使用新的左上角和右下角的坐标
fill="#E5F9FF", # 保留原有的填充色
width=0, # 保留原有的边框宽度
)
# 商品图片
item = itemImg.resize((110, 110), resample=resample)
res.paste(item, (55, 50 - warning), item)
# 商品名称
drawer.text(
(
int(175 + (215 - font(25).getlength(item_info)) / 2),
int(50 - warning + (30 - font(25).getbbox(item_info)[-1]) / 2),
),
item_info,
fill="#000000",
font=font(25),
)
# 价格
drawer.text(
(
int(180 + (195 - font(25).getlength(item_price)) / 2),
int(80 - warning + (30 - font(25).getbbox(item_price)[-1]) / 2),
),
item_price,
fill="#000000",
font=font(25),
)
# 商品充值 UID
drawer.text(
(
int(185 + (195 - font(15).getlength(f"充值到 UID{uid}")) / 2),
int(
120
- warning
+ (20 - font(15).getbbox(f"充值到 UID{uid}")[-1]) / 2
),
),
f"充值到 UID{uid}",
fill="#000000",
font=font(15),
)
# 图片生成时间
timestamp = strftime("%Y-%m-%d %H:%M:%S", localtime(int(item_create_time)))
drawer.text(
(int(185 + (195 - font(15).getlength(timestamp)) / 2), 140 - warning),
timestamp,
fill="#29ac66",
font=font(15),
)
if warning:
# 首部矩形背景
drawer.rectangle(
(left, top + 110, left + 370, top + 130), fill="#eeeeee", width=0
)
# 转换警告文字
warning_text = "特殊情况将直接返还 330 创世结晶"
drawer.text(
(
int((450 - font(15).getlength(warning_text)) / 2),
int(135 + (40 - font(15).getbbox(warning_text)[-1]) / 2),
),
warning_text,
fill="#ff5652",
font=font(15),
)
# 账单信息
ticket = f"微信支付账单编号 {item_order_no}"
drawer.text(
(int((450 - font(15).getlength(ticket)) / 2), 170),
ticket,
fill="#ffffff",
font=font(15),
)
buf = BytesIO()
res.convert("RGB").save(buf, format="PNG")
return buf.getvalue()

View File

@ -29,7 +29,7 @@ gs_font_15 = genshin_font_origin(15)
gs_font_26 = genshin_font_origin(26) gs_font_26 = genshin_font_origin(26)
async def get_user_card(qid: str) -> bytes: async def get_user_card(qid: int) -> bytes:
uid_list: List = await select_db(qid, 'list') # type: ignore uid_list: List = await select_db(qid, 'list') # type: ignore
w, h = 500, len(uid_list) * 210 + 330 w, h = 500, len(uid_list) * 210 + 330
img = await get_simple_bg(w, h) img = await get_simple_bg(w, h)

View File

@ -26,10 +26,6 @@ http://user.mihoyo.com/(国服)
然后在和机器人的私聊窗口,粘贴发送即可 然后在和机器人的私聊窗口,粘贴发送即可
''' '''
QRL = '''请在群里发送【扫码登录】并用米游社/原神进行扫码绑定
如果使用该功能请先绑定UID后再进行登录
注意不要乱扫他人二维码'''
async def get_ck_help() -> List: async def get_ck_help() -> List:
msg_list = [] msg_list = []
@ -38,9 +34,3 @@ async def get_ck_help() -> List:
msg_list.append(CK_URL) msg_list.append(CK_URL)
msg_list.append(SK_URL) msg_list.append(SK_URL)
return msg_list return msg_list
async def get_qr_help() -> List:
msg_list = []
msg_list.append(QRL)
return msg_list

View File

@ -3,15 +3,13 @@ import json
import base64 import base64
import asyncio import asyncio
from http.cookies import SimpleCookie from http.cookies import SimpleCookie
from typing import Any, List, Tuple, Union, Literal, NoReturn from typing import Any, Tuple, Union, Literal
import qrcode import qrcode
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher
from qrcode.constants import ERROR_CORRECT_L from qrcode.constants import ERROR_CORRECT_L
from nonebot.adapters.ntchat import MessageSegment
from ..utils.message.error_reply import UID_HINT from ..utils.message.send_msg import send_forward_msg
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.mhy_api.get_mhy_data import ( from ..utils.mhy_api.get_mhy_data import (
check_qrcode, check_qrcode,
@ -22,13 +20,12 @@ from ..utils.mhy_api.get_mhy_data import (
get_cookie_token_by_stoken, get_cookie_token_by_stoken,
) )
disnote = '''免责声明您将通过扫码完成获取米游社sk以及ck。 disnote = '''免责声明:您将通过扫码完成获取米游社sk以及ck。
登录米游社相当于将账号授权于机器人,可能会带来未知的账号风险 本Bot将不会保存您的登录状态
我方仅提供米游社查询及相关游戏内容服务
若您的账号封禁、被盗等处罚与我方无关。 若您的账号封禁、被盗等处罚与我方无关。
登录后即代表您同意机器人使用协议并知晓会带来未知的账号风险! 害怕风险请勿扫码!
若想取消授权,请到米游社退出登录以清除机器人绑定的登录状态。 '''
请用米游社/原神扫描下方二维码登录:'''
def get_qrcode_base64(url): def get_qrcode_base64(url):
@ -66,36 +63,41 @@ async def refresh(
continue continue
if status_data['data']['stat'] == 'Confirmed': if status_data['data']['stat'] == 'Confirmed':
logger.info('二维码已确认') logger.info('二维码已确认')
# print(status_data['data']['payload']['raw'])
break break
return True, json.loads(status_data['data']['payload']['raw']) return True, json.loads(status_data['data']['payload']['raw'])
async def qrcode_login(matcher: Matcher, user_id) -> str: async def qrcode_login(bot, group_id, user_id) -> str:
async def send_group_msg(msg: str, at_list: List) -> NoReturn: async def send_group_msg(msg: str):
await matcher.finish( await bot.call_api(
MessageSegment.room_at_msg(content=msg, at_list=at_list) api='send_group_msg',
group_id=group_id,
message=msg,
) )
return ''
wxid_list = []
wxid_list.append(user_id)
code_data = await create_qrcode_url() code_data = await create_qrcode_url()
try: try:
await matcher.send( im = []
MessageSegment.image( im.append('请使用米游社扫描下方二维码登录:')
f'base64://{get_qrcode_base64(code_data["url"])}' im.append(
) f'[CQ:image,file=base64://{get_qrcode_base64(code_data["url"])}]'
)
await matcher.send(
MessageSegment.room_at_msg(
content='{$@}' + disnote, at_list=wxid_list
) )
im.append(
'免责声明:您将通过扫码完成获取米游社sk以及ck。\n'
'本Bot将不会保存您的登录状态。\n'
'我方仅提供米游社查询及相关游戏内容服务,\n'
'若您的账号封禁、被盗等处罚与我方无关。\n'
'害怕风险请勿扫码~'
) )
await send_forward_msg(bot, group_id, "扫码小助手", str(user_id), im)
except Exception: except Exception:
logger.warning('[扫码登录] {user_id} 图片发送失败') logger.warning(f'[扫码登录] {user_id} 图片发送失败')
status, game_token_data = await refresh(code_data) status, game_token_data = await refresh(code_data)
if status: if status:
assert game_token_data is not None # 骗过 pyright assert game_token_data is not None # 骗过 pyright
logger.info('[扫码登录]game_token获取成功') logger.info('game_token获取成功')
cookie_token = await get_cookie_token(**game_token_data) cookie_token = await get_cookie_token(**game_token_data)
stoken_data = await get_stoken_by_game_token( stoken_data = await get_stoken_by_game_token(
account_id=int(game_token_data['uid']), account_id=int(game_token_data['uid']),
@ -109,6 +111,7 @@ async def qrcode_login(matcher: Matcher, user_id) -> str:
ck = ck['data']['cookie_token'] ck = ck['data']['cookie_token']
cookie_check = f'account_id={account_id};cookie_token={ck}' cookie_check = f'account_id={account_id};cookie_token={ck}'
get_uid = await get_mihoyo_bbs_info(account_id, cookie_check) get_uid = await get_mihoyo_bbs_info(account_id, cookie_check)
# 剔除除了原神之外的其他游戏
im = None im = None
if get_uid: if get_uid:
for i in get_uid['data']['list']: for i in get_uid['data']['list']:
@ -117,15 +120,18 @@ async def qrcode_login(matcher: Matcher, user_id) -> str:
break break
else: else:
im = f'你的米游社账号{account_id}尚未绑定原神账号,请前往米游社操作!' im = f'你的米游社账号{account_id}尚未绑定原神账号,请前往米游社操作!'
await send_group_msg(im, wxid_list) return await send_group_msg(im)
else: else:
im = '请求失败, 请稍后再试...' im = '请求失败, 请稍后再试...'
await send_group_msg(im, wxid_list) return await send_group_msg(im)
uid_bind = await select_db(user_id, mode='uid') uid_bind = await select_db(user_id, mode='uid')
# 没有在gsuid绑定uid的情况
if uid_bind == "未找到绑定的UID~": if uid_bind == "未找到绑定的UID~":
logger.warning('game_token获取失败') logger.warning('game_token获取失败')
await matcher.finish(UID_HINT) im = '你还没有绑定uid请输入[绑定uid123456]绑定你的uid再发送[扫码登录]进行绑定'
return await send_group_msg(im)
# 比对gsuid数据库和扫码登陆获取到的uid
if str(uid_bind) == uid_check or str(uid_bind) == account_id: if str(uid_bind) == uid_check or str(uid_bind) == account_id:
return SimpleCookie( return SimpleCookie(
{ {
@ -136,12 +142,9 @@ async def qrcode_login(matcher: Matcher, user_id) -> str:
} }
).output(header='', sep=';') ).output(header='', sep=';')
else: else:
logger.warning('game_token获取失败:非触发者本人扫码') logger.warning('game_token获取失败')
im = ( im = 'game_token获取失败被非绑定指定uid用户扫取取消绑定请重新发送[扫码登录]登录账号'
'{$@}' + f'检测到扫码登录UID{uid_check}与绑定UID{uid_bind}不同,'
'gametoken获取失败请重新发送[扫码登录]进行登录'
)
await send_group_msg(im, wxid_list)
else: else:
logger.warning('game_token获取失败') logger.warning('game_token获取失败')
await send_group_msg('{$@}game_token获取失败二维码已过期', wxid_list) im = 'game_token获取失败二维码已过期'
return await send_group_msg(im)

View File

@ -2,73 +2,19 @@ import io
import base64 import base64
import asyncio import asyncio
import traceback import traceback
from typing import List, NoReturn
import qrcode import qrcode
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher
from qrcode.constants import ERROR_CORRECT_L from qrcode.constants import ERROR_CORRECT_L
from nonebot.adapters.ntchat import MessageSegment
from .draw_topup_img import draw_wx, draw_ali from ..utils.message.send_msg import send_forward_msg
from ..utils.message.error_reply import UID_HINT
from ..utils.db_operation.db_operation import select_db from ..utils.db_operation.db_operation import select_db
from ..utils.mhy_api.get_mhy_data import topup, checkorder, fetchgoods from ..utils.mhy_api.get_mhy_data import topup, checkorder, fetchgoods
disnote = '''免责声明:该充值接口由米游社提供,不对充值结果负责。 disnote = '''免责声明:
请在充值前仔细阅读米哈游的充值条款。''' 该充值接口由米游社提供,不对充值结果负责。
请在充值前仔细阅读米哈游的充值条款。
GOODS = { '''
0: {
"title": "创世结晶×60",
"aliases": ["创世结晶x60", "结晶×60", "结晶x60", "创世结晶60", "结晶60"],
},
1: {
"title": "创世结晶×300",
"aliases": ["创世结晶x300", "结晶×300", "结晶x300", "创世结晶300", "结晶300", "30"],
},
2: {
"title": "创世结晶×980",
"aliases": ["创世结晶x980", "结晶×980", "结晶x980", "创世结晶980", "结晶980", "98"],
},
3: {
"title": "创世结晶×1980",
"aliases": [
"创世结晶x1980",
"结晶×1980",
"结晶x1980",
"创世结晶1980",
"结晶1980",
"198",
],
},
4: {
"title": "创世结晶×3280",
"aliases": [
"创世结晶x3280",
"结晶×3280",
"结晶x3280",
"创世结晶3280",
"结晶3280",
"328",
],
},
5: {
"title": "创世结晶×6480",
"aliases": [
"创世结晶x6480",
"结晶×6480",
"结晶x6480",
"创世结晶6480",
"结晶6480",
"648",
],
},
6: {
"title": "空月祝福",
"aliases": ["空月", "祝福", "月卡", "小月卡"],
},
}
def get_qrcode_base64(url): def get_qrcode_base64(url):
@ -87,7 +33,7 @@ def get_qrcode_base64(url):
return base64.b64encode(img_byte).decode() return base64.b64encode(img_byte).decode()
async def refresh(order, uid, oid): async def refresh(order, uid):
times = 0 times = 0
while True: while True:
await asyncio.sleep(5) await asyncio.sleep(5)
@ -95,91 +41,53 @@ async def refresh(order, uid, oid):
if order_status != 900: if order_status != 900:
pass pass
else: else:
return "{$@}" + f"支付成功!\nUID:{uid}\n订单号:{oid}" return "支付成功"
times += 1 times += 1
if times > 60: if times > 60:
return "{$@}" + f"支付超时!\nUID:{uid}\n订单号:{oid}" return "支付超时"
async def topup_(matcher: Matcher, qid, group_id, goods_id, method): async def topup_(bot, qid, group_id, goods_id):
async def send_group_msg(msg: str, at_list: List) -> NoReturn: async def send_group_msg(msg: str):
await matcher.finish( await bot.call_api(
MessageSegment.room_at_msg(content=msg, at_list=at_list) api='send_group_msg',
group_id=group_id,
message=msg,
) )
return ''
wxid_list = []
wxid_list.append(qid)
uid = await select_db(qid, mode="uid") uid = await select_db(qid, mode="uid")
if uid is None: if uid is None:
await send_group_msg("{$@}" + UID_HINT, wxid_list) await send_group_msg("未绑定米游社账号")
return
fetchgoods_data = await fetchgoods() fetchgoods_data = await fetchgoods()
try: try:
goods_data = fetchgoods_data[goods_id] goods_data = fetchgoods_data[goods_id]
except Exception as e: except Exception:
logger.warning(f'[充值]错误 {e}') await send_group_msg("商品不存在,最大为" + str(len(fetchgoods_data) - 1))
await send_group_msg( return
"{$@}商品不存在,最大为" + str(len(fetchgoods_data) - 1), wxid_list
)
try: try:
order = await topup(uid, goods_data, method) order = await topup(uid, goods_data)
except Exception as e: except Exception:
logger.warning(f"[充值] {group_id} {qid} 错误:{e}") await send_group_msg("出错了,可能是cookie过期或接口出错")
await send_group_msg("{$@}出错了,可能是Cookie过期或接口出错。", wxid_list) logger.warning(f"[充值] {group_id} {qid}")
return
try: try:
im = []
b64_data = get_qrcode_base64(order["encode_order"]) b64_data = get_qrcode_base64(order["encode_order"])
img_b64decode = base64.b64decode(b64_data) qrc = f'[CQ:image,file=base64://{b64_data}]'
qrimage = io.BytesIO(img_b64decode) # 二维码 im.append(f"充值uid{uid}")
item_icon_url: str = goods_data['goods_icon'] # 图标 im.append(
item_id: str = goods_data['goods_id'] # 商品内部id f"商品名称:{goods_data['goods_name']}×{str(goods_data['goods_unit'])}"
item_pay_url: str = order['encode_order'] # 支付链接
item_name_full = (
f"{goods_data['goods_name']}×{str(goods_data['goods_unit'])}"
)
# 物品名字(非月卡)
item_name: str = (
item_name_full
if int(goods_data['goods_unit']) > 0 if int(goods_data['goods_unit']) > 0
else goods_data["goods_name"] else goods_data["goods_name"],
) )
# 物品名字 im.append(f'商品价格:{int(order["amount"])/100}')
item_price: str = order["currency"] + str( im.append(f"订单号:{order['order_no']}")
int(order["amount"]) / 100 im.append(disnote)
) # 价格 im.append(qrc)
item_order_no: str = order['order_no'] # 订单号 await send_forward_msg(bot, group_id, "小助手", str(qid), im)
item_create_time: int = order['create_time'] # 创建时间 except Exception:
if method == 'alipay':
img_data = await draw_ali(
uid,
item_name,
item_price,
item_order_no,
qrimage,
item_icon_url,
item_create_time,
item_id,
)
return MessageSegment.image(img_data)
else:
img_data = await draw_wx(
uid,
item_name,
item_price,
item_order_no,
item_icon_url,
item_create_time,
item_id,
)
msg_text = '{$@}' + f' UID{uid}\n{item_name}\n{item_create_time}'
msg_text2 = msg_text + f'\n\nZF{item_pay_url}\n\n{disnote}'
at_msg = MessageSegment.room_at_msg(
content=msg_text2, at_list=wxid_list
)
return MessageSegment.image(img_data) + at_msg
except Exception as e:
traceback.print_exc() traceback.print_exc()
logger.warning(f"[充值] {group_id} 图片发送失败: {e}") logger.warning(f"[充值] {group_id} 图片发送失败")
await send_group_msg( await send_group_msg(await refresh(order, uid))
await refresh(order, uid, order['order_no']), wxid_list
)

View File

@ -3,13 +3,19 @@ import re
from nonebot import on_command from nonebot import on_command
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.params import CommandArg from nonebot.params import CommandArg
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import (
Bot,
Message,
MessageSegment,
GroupMessageEvent,
)
from ..config import priority from ..config import priority
from ..genshinuid_meta import register_menu from ..genshinuid_meta import register_menu
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception
from .get_wiki_text import ( from .get_wiki_text import (
char_wiki, char_wiki,
audio_wiki,
foods_wiki, foods_wiki,
weapon_wiki, weapon_wiki,
enemies_wiki, enemies_wiki,
@ -26,8 +32,7 @@ get_audio = on_command('语音', priority=priority)
get_artifacts = on_command('圣遗物', priority=priority) get_artifacts = on_command('圣遗物', priority=priority)
get_food = on_command('食物', priority=priority) get_food = on_command('食物', priority=priority)
# 语音暂时不支持
'''
@get_audio.handle() @get_audio.handle()
@handle_exception('语音', '语音发送失败可能是FFmpeg环境未配置。') @handle_exception('语音', '语音发送失败可能是FFmpeg环境未配置。')
@register_menu( @register_menu(
@ -56,7 +61,6 @@ async def send_audio(matcher: Matcher, args: Message = CommandArg()):
await matcher.finish(im) await matcher.finish(im)
else: else:
await matcher.finish(MessageSegment.record(im)) await matcher.finish(MessageSegment.record(im))
'''
@get_enemies.handle() @get_enemies.handle()
@ -149,8 +153,6 @@ async def send_weapon(matcher: Matcher, args: Message = CommandArg()):
await matcher.finish(im) await matcher.finish(im)
# 天赋暂时不支持
'''
@get_talents.handle() @get_talents.handle()
@handle_exception('天赋') @handle_exception('天赋')
@register_menu( @register_menu(
@ -171,6 +173,7 @@ async def send_weapon(matcher: Matcher, args: Message = CommandArg()):
) )
async def send_talents( async def send_talents(
bot: Bot, bot: Bot,
event: GroupMessageEvent,
matcher: Matcher, matcher: Matcher,
args: Message = CommandArg(), args: Message = CommandArg(),
): ):
@ -184,10 +187,10 @@ async def send_talents(
'send_group_forward_msg', group_id=event.group_id, messages=im 'send_group_forward_msg', group_id=event.group_id, messages=im
) )
await matcher.finish() await matcher.finish()
return
else: else:
im = '参数不正确。' im = '参数不正确。'
await matcher.finish(im) await matcher.finish(im)
'''
@get_char.handle() @get_char.handle()

View File

@ -6,7 +6,7 @@ from nonebot import on_command
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot_plugin_apscheduler import scheduler from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.ntchat import MessageSegment from nonebot.adapters.onebot.v11 import MessageSegment
from .draw_abyss_total import TOTAL_IMG, draw_xk_abyss_img from .draw_abyss_total import TOTAL_IMG, draw_xk_abyss_img
from ..utils.exception.handle_exception import handle_exception from ..utils.exception.handle_exception import handle_exception

View File

@ -11,7 +11,7 @@ class UidDataDAL:
def __init__(self, db_session: Session): def __init__(self, db_session: Session):
self.db_session = db_session self.db_session = db_session
async def get_user_data(self, userid: str) -> Optional[UidData]: async def get_user_data(self, userid: int) -> Optional[UidData]:
""" """
:说明: :说明:
获取用户的绑定信息 获取用户的绑定信息
@ -37,7 +37,7 @@ class UidDataDAL:
bind_list.append(item.__dict__) bind_list.append(item.__dict__)
return bind_list return bind_list
async def user_exists(self, userid: str) -> bool: async def user_exists(self, userid: int) -> bool:
""" """
:说明: :说明:
是否存在用户的绑定信息 是否存在用户的绑定信息
@ -67,7 +67,7 @@ class UidDataDAL:
uid_list.extend(item.UID.split("_")) uid_list.extend(item.UID.split("_"))
return uid_list return uid_list
async def get_uid_list(self, userid: str) -> List[str]: async def get_uid_list(self, userid: int) -> List[str]:
""" """
:说明: :说明:
获得用户的绑定UID列表 获得用户的绑定UID列表
@ -83,7 +83,7 @@ class UidDataDAL:
return uid_list return uid_list
return [] return []
async def get_uid(self, userid: str) -> str: async def get_uid(self, userid: int) -> str:
""" """
:说明: :说明:
获得用户绑定的UID 获得用户绑定的UID
@ -98,14 +98,14 @@ class UidDataDAL:
else: else:
return '未找到绑定的UID~' return '未找到绑定的UID~'
async def switch_uid(self, userid: str, uid: Optional[str] = None) -> str: async def switch_uid(self, userid: int, uid: Optional[str] = None) -> str:
""" """
:说明: :说明:
切换绑定的UID列表,绑定一个UID的情况下返回无法切换 切换绑定的UID列表,绑定一个UID的情况下返回无法切换
切换前 -> 12_13_14 切换前 -> 12_13_14
切换后 -> 13_12_14 切换后 -> 13_12_14
:参数: :参数:
* userid (int): WX号。 * userid (int): QQ号。
* uid (str): 切换的UID, 可选, 不传入的话自动切换下一个。 * uid (str): 切换的UID, 可选, 不传入的话自动切换下一个。
:返回: :返回:
* msg (str): 回调信息。 * msg (str): 回调信息。
@ -126,7 +126,7 @@ class UidDataDAL:
else: else:
return '你还没有绑定过UID噢~' return '你还没有绑定过UID噢~'
async def get_mysid_list(self, userid: str) -> List[str]: async def get_mysid_list(self, userid: int) -> List[str]:
""" """
:说明: :说明:
获得用户的绑定MYSID列表 获得用户的绑定MYSID列表
@ -142,7 +142,7 @@ class UidDataDAL:
return mys_list return mys_list
return [] return []
async def get_mysid(self, userid: str) -> str: async def get_mysid(self, userid: int) -> str:
""" """
:说明: :说明:
获得用户绑定的MYSID 获得用户绑定的MYSID
@ -157,7 +157,7 @@ class UidDataDAL:
else: else:
return "未找到绑定的MYSID~" return "未找到绑定的MYSID~"
async def get_anyid(self, userid: str) -> str: async def get_anyid(self, userid: int) -> str:
""" """
:说明: :说明:
获得用户绑定的ID信息 获得用户绑定的ID信息
@ -176,7 +176,7 @@ class UidDataDAL:
else: else:
return '未找到绑定的ID信息~' return '未找到绑定的ID信息~'
async def bind_db(self, userid: str, data: dict) -> str: async def bind_db(self, userid: int, data: dict) -> str:
""" """
:说明: :说明:
绑定UID或者MYSID 绑定UID或者MYSID
@ -229,7 +229,7 @@ class UidDataDAL:
await self.db_session.flush() # type: ignore await self.db_session.flush() # type: ignore
return _bind return _bind
async def delete_db(self, userid: str, data: Optional[dict]) -> str: async def delete_db(self, userid: int, data: Optional[dict]) -> str:
""" """
:说明: :说明:
删除用户的绑定UID或者MYSID 删除用户的绑定UID或者MYSID
@ -284,7 +284,7 @@ class UidDataDAL:
async def update_db( async def update_db(
self, self,
userid: str, userid: int,
data: Optional[dict], data: Optional[dict],
): ):
""" """

View File

@ -33,7 +33,7 @@ class PushData(SQLModel, table=True):
class UidData(SQLModel, table=True): class UidData(SQLModel, table=True):
__table_args__ = {'keep_existing': True} __table_args__ = {'keep_existing': True}
USERID: str = Field(default='WX_100001', primary_key=True, title='WX') USERID: int = Field(default=100000000, primary_key=True, title='QQ')
UID: Optional[str] = Field(title='UID') UID: Optional[str] = Field(title='UID')
MYSID: Optional[str] = Field(title='米游社通行证(废弃)') MYSID: Optional[str] = Field(title='米游社通行证(废弃)')
@ -42,7 +42,7 @@ class NewCookiesTable(SQLModel, table=True):
__table_args__ = {'keep_existing': True} __table_args__ = {'keep_existing': True}
UID: int = Field(default=100000000, primary_key=True, title='UID') UID: int = Field(default=100000000, primary_key=True, title='UID')
Cookies: str = Field(title='CK') Cookies: str = Field(title='CK')
QID: str = Field(title='QQ号') QID: int = Field(title='QQ号')
StatusA: str = Field(title='全局推送开关') StatusA: str = Field(title='全局推送开关')
StatusB: str = Field(title='自动签到') StatusB: str = Field(title='自动签到')
StatusC: str = Field(title='自动米游币') StatusC: str = Field(title='自动米游币')

View File

@ -92,7 +92,7 @@ async def get_all_stoken() -> List:
async def select_db( async def select_db(
userid: str, mode: str = 'auto' userid: int, mode: str = 'auto'
) -> Union[List[str], str, None]: ) -> Union[List[str], str, None]:
""" """
:说明: :说明:
@ -126,14 +126,14 @@ async def select_db(
return im return im
async def switch_db(userid: str, uid: Optional[str] = None) -> str: async def switch_db(userid: int, uid: Optional[str] = None) -> str:
""" """
:说明: :说明:
切换绑定的UID列表,绑定一个UID的情况下返回无法切换 切换绑定的UID列表,绑定一个UID的情况下返回无法切换
切换前 -> 12_13_14 切换前 -> 12_13_14
切换后 -> 13_14_12 切换后 -> 13_14_12
:参数: :参数:
* userid (str): WX号。 * userid (str): QQ号。
:返回: :返回:
* im (str): 回调信息。 * im (str): 回调信息。
""" """
@ -144,7 +144,7 @@ async def switch_db(userid: str, uid: Optional[str] = None) -> str:
return im return im
async def delete_db(userid: str, data: dict) -> str: async def delete_db(userid: int, data: dict) -> str:
""" """
:说明: :说明:
删除当前绑定的UID信息 删除当前绑定的UID信息

View File

@ -184,7 +184,10 @@ async def get_level_pic(level: int) -> Image.Image:
async def get_qq_avatar( async def get_qq_avatar(
qid: Optional[Union[int, str]] = None, avatar_url: Optional[str] = None qid: Optional[Union[int, str]] = None, avatar_url: Optional[str] = None
) -> Image.Image: ) -> Image.Image:
avatar_url = 'https://s2.loli.net/2022/01/31/kwCIl3cF1Z2GxnR.png' if qid:
avatar_url = f'http://q1.qlogo.cn/g?b=qq&nk={qid}&s=640'
elif avatar_url is None:
avatar_url = 'https://q1.qlogo.cn/g?b=qq&nk=3399214199&s=640'
char_pic = Image.open(BytesIO(get(avatar_url).content)).convert('RGBA') char_pic = Image.open(BytesIO(get(avatar_url).content)).convert('RGBA')
return char_pic return char_pic

View File

@ -52,4 +52,4 @@ async def convert_img(
else: else:
async with aiofiles.open(img, 'rb') as fp: async with aiofiles.open(img, 'rb') as fp:
img = await fp.read() img = await fp.read()
return f'base64://{b64encode(img).decode()}' return f'[CQ:image,file=base64://{b64encode(img).decode()}]'

View File

@ -4,6 +4,7 @@ from typing import Optional
from nonebot.log import logger from nonebot.log import logger
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from nonebot.exception import FinishedException from nonebot.exception import FinishedException
from nonebot.adapters.onebot.v11 import ActionFailed
def handle_exception( def handle_exception(
@ -29,6 +30,10 @@ def handle_exception(
matcher: Matcher = kwargs['matcher'] matcher: Matcher = kwargs['matcher']
try: try:
await func(**kwargs) await func(**kwargs)
except ActionFailed as e:
# 此为bot本身由于风控或网络问题发不出消息并非代码本身出问题
await matcher.send(f'发送消息失败{e.info["wording"]}')
logger.exception(f'发送{name}消息失败')
except FinishedException: except FinishedException:
# `finish` 会抛出此异常,应予以抛出而不处理 # `finish` 会抛出此异常,应予以抛出而不处理
raise raise
@ -41,7 +46,9 @@ def handle_exception(
if not fail_msg: if not fail_msg:
fail_msg = log_msg fail_msg = log_msg
if fail_msg[0] == '@': if fail_msg[0] == '@':
await matcher.send(f'{fail_msg[1:]}\n错误信息为{e}') await matcher.send(
f'{fail_msg[1:]}\n错误信息为{e}', at_sender=True
)
else: else:
await matcher.send(f'{fail_msg}\n错误信息为{e}') await matcher.send(f'{fail_msg}\n错误信息为{e}')
if log_msg[0] == '@': if log_msg[0] == '@':

View File

@ -1,11 +1,11 @@
from typing import List from typing import List
from nonebot.adapters.ntchat import Bot from nonebot.adapters.onebot.v11 import Bot
async def get_all_friend_list(bot: Bot) -> List[int]: async def get_all_friend_list(bot: Bot) -> List[int]:
friend_list = [] friend_list = []
friend_dict_list = await bot.call_api('get_contacts') friend_dict_list = await bot.call_api('get_friend_list')
for friend in friend_dict_list: for friend in friend_dict_list:
friend_list.append(friend['user_id']) friend_list.append(friend['user_id'])
return friend_list return friend_list
@ -14,7 +14,7 @@ async def get_all_friend_list(bot: Bot) -> List[int]:
async def get_group_member_list(bot: Bot, group_id: int) -> List[int]: async def get_group_member_list(bot: Bot, group_id: int) -> List[int]:
member_list = [] member_list = []
group_member_list = await bot.call_api( group_member_list = await bot.call_api(
'get_room_members', group_id=group_id 'get_group_member_list', group_id=group_id
) )
for group_member in group_member_list: for group_member in group_member_list:
member_list.append(group_member['user_id']) member_list.append(group_member['user_id'])

View File

@ -1,12 +1,12 @@
from typing import List from typing import List
from nonebot.adapters.qqguild import Bot from nonebot.adapters.onebot.v11 import Bot
# 发送聊天记录 # 发送聊天记录
async def send_forward_msg( async def send_forward_msg(
bot: Bot, bot: Bot,
userid: int, groupid: int,
name: str, name: str,
uin: str, uin: str,
msgs: List[str], msgs: List[str],
@ -19,5 +19,5 @@ async def send_forward_msg(
messages = [to_json(msg) for msg in msgs] messages = [to_json(msg) for msg in msgs]
await bot.call_api( await bot.call_api(
"send_private_forward_msg", user_id=userid, messages=messages "send_group_forward_msg", group_id=groupid, messages=messages
) )

View File

@ -877,7 +877,7 @@ async def fetchgoods():
return goodslist["data"]["goods_list"] return goodslist["data"]["goods_list"]
async def topup(uid, goods, method): async def topup(uid, goods):
device_id = str(uuid.uuid4()) device_id = str(uuid.uuid4())
HEADER = copy.deepcopy(_HEADER) HEADER = copy.deepcopy(_HEADER)
HEADER["Cookie"] = await owner_cookies(uid) HEADER["Cookie"] = await owner_cookies(uid)
@ -902,7 +902,7 @@ async def topup(uid, goods, method):
"price_tier": goods["tier_id"], "price_tier": goods["tier_id"],
# "price_tier": "Tier_1", # "price_tier": "Tier_1",
"currency": "CNY", "currency": "CNY",
"pay_plat": method, "pay_plat": "alipay",
} }
data = {"order": order, "sign": gen_payment_sign(order)} data = {"order": order, "sign": gen_payment_sign(order)}
HEADER["x-rpc-device_id"] = device_id HEADER["x-rpc-device_id"] = device_id

View File

@ -1,6 +1,6 @@
from nonebot.rule import Rule from nonebot.rule import Rule
from nonebot.params import Depends, CommandArg from nonebot.params import Depends, CommandArg
from nonebot.adapters.ntchat.message import Message from nonebot.adapters.onebot.v11 import Message
async def full_command(arg: Message = CommandArg()) -> bool: async def full_command(arg: Message = CommandArg()) -> bool:

124
poetry.lock generated
View File

@ -889,32 +889,32 @@ test = ["objgraph", "psutil"]
[[package]] [[package]]
name = "h11" name = "h11"
version = "0.12.0" version = "0.14.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
category = "main" category = "main"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.7"
files = [ files = [
{file = "h11-0.12.0-py3-none-any.whl", hash = "sha256:36a3cb8c0a032f56e2da7084577878a035d3b61d104230d4bd49c0c6b555a9c6"}, {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
{file = "h11-0.12.0.tar.gz", hash = "sha256:47222cb6067e4a307d535814917cd98fd0a57b6788ce715755fa2b6c28b56042"}, {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
] ]
[[package]] [[package]]
name = "httpcore" name = "httpcore"
version = "0.15.0" version = "0.16.3"
description = "A minimal low-level HTTP client." description = "A minimal low-level HTTP client."
category = "main" category = "main"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "httpcore-0.15.0-py3-none-any.whl", hash = "sha256:1105b8b73c025f23ff7c36468e4432226cbb959176eab66864b8e31c4ee27fa6"}, {file = "httpcore-0.16.3-py3-none-any.whl", hash = "sha256:da1fb708784a938aa084bde4feb8317056c55037247c787bd7e19eb2c2949dc0"},
{file = "httpcore-0.15.0.tar.gz", hash = "sha256:18b68ab86a3ccf3e7dc0f43598eaddcf472b602aba29f9aa6ab85fe2ada3980b"}, {file = "httpcore-0.16.3.tar.gz", hash = "sha256:c5d6f04e2fc530f39e0c077e6a30caa53f1451096120f1f38b954afd0b17c0cb"},
] ]
[package.dependencies] [package.dependencies]
anyio = ">=3.0.0,<4.0.0" anyio = ">=3.0,<5.0"
certifi = "*" certifi = "*"
h11 = ">=0.11,<0.13" h11 = ">=0.13,<0.15"
sniffio = ">=1.0.0,<2.0.0" sniffio = ">=1.0.0,<2.0.0"
[package.extras] [package.extras]
@ -923,19 +923,19 @@ socks = ["socksio (>=1.0.0,<2.0.0)"]
[[package]] [[package]]
name = "httpx" name = "httpx"
version = "0.23.0" version = "0.23.3"
description = "The next generation HTTP client." description = "The next generation HTTP client."
category = "main" category = "main"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "httpx-0.23.0-py3-none-any.whl", hash = "sha256:42974f577483e1e932c3cdc3cd2303e883cbfba17fe228b0f63589764d7b9c4b"}, {file = "httpx-0.23.3-py3-none-any.whl", hash = "sha256:a211fcce9b1254ea24f0cd6af9869b3d29aba40154e947d2a07bb499b3e310d6"},
{file = "httpx-0.23.0.tar.gz", hash = "sha256:f28eac771ec9eb4866d3fb4ab65abd42d38c424739e80c08d8d20570de60b0ef"}, {file = "httpx-0.23.3.tar.gz", hash = "sha256:9818458eb565bb54898ccb9b8b251a28785dd4a55afbc23d0eb410754fe7d0f9"},
] ]
[package.dependencies] [package.dependencies]
certifi = "*" certifi = "*"
httpcore = ">=0.15.0,<0.16.0" httpcore = ">=0.15.0,<0.17.0"
rfc3986 = {version = ">=1.3,<2", extras = ["idna2008"]} rfc3986 = {version = ">=1.3,<2", extras = ["idna2008"]}
sniffio = "*" sniffio = "*"
@ -1174,6 +1174,79 @@ files = [
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
] ]
[[package]]
name = "msgpack"
version = "1.0.5"
description = "MessagePack serializer"
category = "main"
optional = false
python-versions = "*"
files = [
{file = "msgpack-1.0.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:525228efd79bb831cf6830a732e2e80bc1b05436b086d4264814b4b2955b2fa9"},
{file = "msgpack-1.0.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4f8d8b3bf1ff2672567d6b5c725a1b347fe838b912772aa8ae2bf70338d5a198"},
{file = "msgpack-1.0.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cdc793c50be3f01106245a61b739328f7dccc2c648b501e237f0699fe1395b81"},
{file = "msgpack-1.0.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5cb47c21a8a65b165ce29f2bec852790cbc04936f502966768e4aae9fa763cb7"},
{file = "msgpack-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e42b9594cc3bf4d838d67d6ed62b9e59e201862a25e9a157019e171fbe672dd3"},
{file = "msgpack-1.0.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:55b56a24893105dc52c1253649b60f475f36b3aa0fc66115bffafb624d7cb30b"},
{file = "msgpack-1.0.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:1967f6129fc50a43bfe0951c35acbb729be89a55d849fab7686004da85103f1c"},
{file = "msgpack-1.0.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20a97bf595a232c3ee6d57ddaadd5453d174a52594bf9c21d10407e2a2d9b3bd"},
{file = "msgpack-1.0.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d25dd59bbbbb996eacf7be6b4ad082ed7eacc4e8f3d2df1ba43822da9bfa122a"},
{file = "msgpack-1.0.5-cp310-cp310-win32.whl", hash = "sha256:382b2c77589331f2cb80b67cc058c00f225e19827dbc818d700f61513ab47bea"},
{file = "msgpack-1.0.5-cp310-cp310-win_amd64.whl", hash = "sha256:4867aa2df9e2a5fa5f76d7d5565d25ec76e84c106b55509e78c1ede0f152659a"},
{file = "msgpack-1.0.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9f5ae84c5c8a857ec44dc180a8b0cc08238e021f57abdf51a8182e915e6299f0"},
{file = "msgpack-1.0.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:9e6ca5d5699bcd89ae605c150aee83b5321f2115695e741b99618f4856c50898"},
{file = "msgpack-1.0.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5494ea30d517a3576749cad32fa27f7585c65f5f38309c88c6d137877fa28a5a"},
{file = "msgpack-1.0.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ab2f3331cb1b54165976a9d976cb251a83183631c88076613c6c780f0d6e45a"},
{file = "msgpack-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:28592e20bbb1620848256ebc105fc420436af59515793ed27d5c77a217477705"},
{file = "msgpack-1.0.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fe5c63197c55bce6385d9aee16c4d0641684628f63ace85f73571e65ad1c1e8d"},
{file = "msgpack-1.0.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ed40e926fa2f297e8a653c954b732f125ef97bdd4c889f243182299de27e2aa9"},
{file = "msgpack-1.0.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:b2de4c1c0538dcb7010902a2b97f4e00fc4ddf2c8cda9749af0e594d3b7fa3d7"},
{file = "msgpack-1.0.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:bf22a83f973b50f9d38e55c6aade04c41ddda19b00c4ebc558930d78eecc64ed"},
{file = "msgpack-1.0.5-cp311-cp311-win32.whl", hash = "sha256:c396e2cc213d12ce017b686e0f53497f94f8ba2b24799c25d913d46c08ec422c"},
{file = "msgpack-1.0.5-cp311-cp311-win_amd64.whl", hash = "sha256:6c4c68d87497f66f96d50142a2b73b97972130d93677ce930718f68828b382e2"},
{file = "msgpack-1.0.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:a2b031c2e9b9af485d5e3c4520f4220d74f4d222a5b8dc8c1a3ab9448ca79c57"},
{file = "msgpack-1.0.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f837b93669ce4336e24d08286c38761132bc7ab29782727f8557e1eb21b2080"},
{file = "msgpack-1.0.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1d46dfe3832660f53b13b925d4e0fa1432b00f5f7210eb3ad3bb9a13c6204a6"},
{file = "msgpack-1.0.5-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:366c9a7b9057e1547f4ad51d8facad8b406bab69c7d72c0eb6f529cf76d4b85f"},
{file = "msgpack-1.0.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:4c075728a1095efd0634a7dccb06204919a2f67d1893b6aa8e00497258bf926c"},
{file = "msgpack-1.0.5-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:f933bbda5a3ee63b8834179096923b094b76f0c7a73c1cfe8f07ad608c58844b"},
{file = "msgpack-1.0.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:36961b0568c36027c76e2ae3ca1132e35123dcec0706c4b7992683cc26c1320c"},
{file = "msgpack-1.0.5-cp36-cp36m-win32.whl", hash = "sha256:b5ef2f015b95f912c2fcab19c36814963b5463f1fb9049846994b007962743e9"},
{file = "msgpack-1.0.5-cp36-cp36m-win_amd64.whl", hash = "sha256:288e32b47e67f7b171f86b030e527e302c91bd3f40fd9033483f2cacc37f327a"},
{file = "msgpack-1.0.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:137850656634abddfb88236008339fdaba3178f4751b28f270d2ebe77a563b6c"},
{file = "msgpack-1.0.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0c05a4a96585525916b109bb85f8cb6511db1c6f5b9d9cbcbc940dc6b4be944b"},
{file = "msgpack-1.0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56a62ec00b636583e5cb6ad313bbed36bb7ead5fa3a3e38938503142c72cba4f"},
{file = "msgpack-1.0.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ef8108f8dedf204bb7b42994abf93882da1159728a2d4c5e82012edd92c9da9f"},
{file = "msgpack-1.0.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1835c84d65f46900920b3708f5ba829fb19b1096c1800ad60bae8418652a951d"},
{file = "msgpack-1.0.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:e57916ef1bd0fee4f21c4600e9d1da352d8816b52a599c46460e93a6e9f17086"},
{file = "msgpack-1.0.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:17358523b85973e5f242ad74aa4712b7ee560715562554aa2134d96e7aa4cbbf"},
{file = "msgpack-1.0.5-cp37-cp37m-win32.whl", hash = "sha256:cb5aaa8c17760909ec6cb15e744c3ebc2ca8918e727216e79607b7bbce9c8f77"},
{file = "msgpack-1.0.5-cp37-cp37m-win_amd64.whl", hash = "sha256:ab31e908d8424d55601ad7075e471b7d0140d4d3dd3272daf39c5c19d936bd82"},
{file = "msgpack-1.0.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:b72d0698f86e8d9ddf9442bdedec15b71df3598199ba33322d9711a19f08145c"},
{file = "msgpack-1.0.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:379026812e49258016dd84ad79ac8446922234d498058ae1d415f04b522d5b2d"},
{file = "msgpack-1.0.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:332360ff25469c346a1c5e47cbe2a725517919892eda5cfaffe6046656f0b7bb"},
{file = "msgpack-1.0.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:476a8fe8fae289fdf273d6d2a6cb6e35b5a58541693e8f9f019bfe990a51e4ba"},
{file = "msgpack-1.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a9985b214f33311df47e274eb788a5893a761d025e2b92c723ba4c63936b69b1"},
{file = "msgpack-1.0.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48296af57cdb1d885843afd73c4656be5c76c0c6328db3440c9601a98f303d87"},
{file = "msgpack-1.0.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:addab7e2e1fcc04bd08e4eb631c2a90960c340e40dfc4a5e24d2ff0d5a3b3edb"},
{file = "msgpack-1.0.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:916723458c25dfb77ff07f4c66aed34e47503b2eb3188b3adbec8d8aa6e00f48"},
{file = "msgpack-1.0.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:821c7e677cc6acf0fd3f7ac664c98803827ae6de594a9f99563e48c5a2f27eb0"},
{file = "msgpack-1.0.5-cp38-cp38-win32.whl", hash = "sha256:1c0f7c47f0087ffda62961d425e4407961a7ffd2aa004c81b9c07d9269512f6e"},
{file = "msgpack-1.0.5-cp38-cp38-win_amd64.whl", hash = "sha256:bae7de2026cbfe3782c8b78b0db9cbfc5455e079f1937cb0ab8d133496ac55e1"},
{file = "msgpack-1.0.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:20c784e66b613c7f16f632e7b5e8a1651aa5702463d61394671ba07b2fc9e025"},
{file = "msgpack-1.0.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:266fa4202c0eb94d26822d9bfd7af25d1e2c088927fe8de9033d929dd5ba24c5"},
{file = "msgpack-1.0.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:18334484eafc2b1aa47a6d42427da7fa8f2ab3d60b674120bce7a895a0a85bdd"},
{file = "msgpack-1.0.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:57e1f3528bd95cc44684beda696f74d3aaa8a5e58c816214b9046512240ef437"},
{file = "msgpack-1.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:586d0d636f9a628ddc6a17bfd45aa5b5efaf1606d2b60fa5d87b8986326e933f"},
{file = "msgpack-1.0.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a740fa0e4087a734455f0fc3abf5e746004c9da72fbd541e9b113013c8dc3282"},
{file = "msgpack-1.0.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3055b0455e45810820db1f29d900bf39466df96ddca11dfa6d074fa47054376d"},
{file = "msgpack-1.0.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:a61215eac016f391129a013c9e46f3ab308db5f5ec9f25811e811f96962599a8"},
{file = "msgpack-1.0.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:362d9655cd369b08fda06b6657a303eb7172d5279997abe094512e919cf74b11"},
{file = "msgpack-1.0.5-cp39-cp39-win32.whl", hash = "sha256:ac9dd47af78cae935901a9a500104e2dea2e253207c924cc95de149606dc43cc"},
{file = "msgpack-1.0.5-cp39-cp39-win_amd64.whl", hash = "sha256:06f5174b5f8ed0ed919da0e62cbd4ffde676a374aba4020034da05fab67b9164"},
{file = "msgpack-1.0.5.tar.gz", hash = "sha256:c075544284eadc5cddc70f4757331d99dcbc16b2bbd4849d15f8aae4cf36d31c"},
]
[[package]] [[package]]
name = "multidict" name = "multidict"
version = "6.0.4" version = "6.0.4"
@ -1286,19 +1359,20 @@ files = [
setuptools = "*" setuptools = "*"
[[package]] [[package]]
name = "nonebot-adapter-ntchat" name = "nonebot-adapter-onebot"
version = "0.3.5" version = "2.2.1"
description = "a wechat adapter for nonebot2" description = "OneBot(CQHTTP) adapter for nonebot2"
category = "main" category = "main"
optional = false optional = false
python-versions = ">=3.8" python-versions = ">=3.8,<4.0"
files = [ files = [
{file = "nonebot-adapter-ntchat-0.3.5.tar.gz", hash = "sha256:52a19d9eeb71a534e5543f3804c5cb68997411f309d9b3c848f27f39de25301e"}, {file = "nonebot_adapter_onebot-2.2.1-py3-none-any.whl", hash = "sha256:db22c92a541f243ef427a7080096fb28751fec213bc75b111e2c9ed89e121d94"},
{file = "nonebot_adapter_ntchat-0.3.5-py3-none-any.whl", hash = "sha256:ee8851ac28b6463413066dc32ccae08f478df68c6b37e117d48c43698f5e5881"}, {file = "nonebot_adapter_onebot-2.2.1.tar.gz", hash = "sha256:2f77ff2345cc98e493c3bf00a5fd7112cf20e66ebeac062bbb8de56b4d07040e"},
] ]
[package.dependencies] [package.dependencies]
httpx = "0.23.0" msgpack = ">=1.0.3,<2.0.0"
nonebot2 = ">=2.0.0-beta.3,<3.0.0"
[[package]] [[package]]
name = "nonebot-plugin-apscheduler" name = "nonebot-plugin-apscheduler"
@ -1346,20 +1420,20 @@ websockets = ["websockets (>=10.0,<11.0)"]
[[package]] [[package]]
name = "nonebug" name = "nonebug"
version = "0.2.3" version = "0.3.1"
description = "nonebot2 test framework" description = "nonebot2 test framework"
category = "dev" category = "dev"
optional = false optional = false
python-versions = ">=3.8,<4.0" python-versions = ">=3.8,<4.0"
files = [ files = [
{file = "nonebug-0.2.3-py3-none-any.whl", hash = "sha256:5c83bd885899b2857323fa19eff6bbc3f160729453b2f289d8305a99b7b95fc9"}, {file = "nonebug-0.3.1-py3-none-any.whl", hash = "sha256:b33e93d486e3f187e890a516ad8d9432ea736e50b0270341ddc78fecfe080d5f"},
{file = "nonebug-0.2.3.tar.gz", hash = "sha256:3e59757b32b6b96cd8c36c4c9fd6050e611b1ffad058ec5fa82cba3f86495c61"}, {file = "nonebug-0.3.1.tar.gz", hash = "sha256:96637bbdc406e7673e625492fbe928a9db467cd630d6fd04cfde0999f58f9a7a"},
] ]
[package.dependencies] [package.dependencies]
asgiref = ">=3.4.0,<4.0.0" asgiref = ">=3.4.0,<4.0.0"
async-asgi-testclient = ">=1.4.8,<2.0.0" async-asgi-testclient = ">=1.4.8,<2.0.0"
nonebot2 = ">=2.0.0-beta.1,<3.0.0" nonebot2 = ">=2.0.0-rc.2,<3.0.0"
pytest = ">=7.0.0,<8.0.0" pytest = ">=7.0.0,<8.0.0"
typing-extensions = ">=4.0.0,<5.0.0" typing-extensions = ">=4.0.0,<5.0.0"
@ -2378,4 +2452,4 @@ multidict = ">=4.0"
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.8.1" python-versions = "^3.8.1"
content-hash = "c2a8ce5e8f1cc95b81fb90639eb323995941dd9bbd60372327e7e7067572e8c7" content-hash = "5de28f6fa03c9bf7e2207a3d3688e379c2c4aa7ed672718583c99f7f0907bc1c"

View File

@ -18,7 +18,7 @@ extra_standard_library = ["typing_extensions"]
asyncio_mode = "auto" asyncio_mode = "auto"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -28,7 +28,7 @@ description = "基于HoshinoBot/NoneBot2/QQ官方频道/微信Bot的原神面板
authors = ["KimigaiiWuyi <444835641@qq.com>"] authors = ["KimigaiiWuyi <444835641@qq.com>"]
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
readme = "README.md" readme = "README.md"
homepage = "https://github.com/KimigaiiWuyi/GenshinUID/tree/ntchat" homepage = "https://github.com/KimigaiiWuyi/GenshinUID/tree/nonebot2-beta1"
repository = "https://github.com/KimigaiiWuyi/GenshinUID" repository = "https://github.com/KimigaiiWuyi/GenshinUID"
documentation = "https://github.com/KimigaiiWuyi/GenshinUID/wiki" documentation = "https://github.com/KimigaiiWuyi/GenshinUID/wiki"
packages = [ packages = [
@ -42,7 +42,7 @@ exclude = ["tests", "deploy"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8.1" python = "^3.8.1"
nonebot2 = ">=2.0.0b4" nonebot2 = ">=2.0.0b4"
nonebot-adapter-ntchat = ">=0.3.4" nonebot-adapter-onebot = ">=2.1.1"
httpx = ">=0.23.0" httpx = ">=0.23.0"
beautifulsoup4 = ">=4.11.1" beautifulsoup4 = ">=4.11.1"
lxml = ">=4.9.2" lxml = ">=4.9.2"
@ -70,7 +70,9 @@ flake8 = "^6.0.0"
black = "^22.12.0" black = "^22.12.0"
isort = "^5.11.5" isort = "^5.11.5"
pre-commit = "^2.21.0" pre-commit = "^2.21.0"
nonebug = "^0.2.2" pycln = "^2.1.2"
[tool.poetry.group.test.dependencies]
nonebug = "^0.3.0"
pytest = "^7.2.0" pytest = "^7.2.0"
pytest-asyncio = "^0.20.3" pytest-asyncio = "^0.20.3"
pycln = "^2.1.2"

View File

@ -22,14 +22,15 @@ frozenlist==1.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitpython==3.1.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitpython==3.1.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
greenlet==2.0.2 ; python_full_version >= "3.8.1" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_full_version < "4.0.0" greenlet==2.0.2 ; python_full_version >= "3.8.1" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_full_version < "4.0.0"
h11==0.12.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
httpcore==0.15.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" httpcore==0.16.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
httpx==0.23.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" httpx==0.23.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
idna==3.4 ; python_full_version >= "3.8.1" and python_version < "4.0" idna==3.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
loguru==0.6.0 ; python_full_version >= "3.8.1" and python_version < "4.0" loguru==0.6.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
lxml==4.9.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" lxml==4.9.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
msgpack==1.0.5 ; python_full_version >= "3.8.1" and python_version < "4.0"
multidict==6.0.4 ; python_full_version >= "3.8.1" and python_version < "4.0" multidict==6.0.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
nonebot-adapter-ntchat==0.3.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" nonebot-adapter-onebot==2.2.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
nonebot-plugin-apscheduler==0.2.0 ; python_full_version >= "3.8.1" and python_version < "4.0" nonebot-plugin-apscheduler==0.2.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
nonebot2==2.0.0rc3 ; python_full_version >= "3.8.1" and python_version < "4.0" nonebot2==2.0.0rc3 ; python_full_version >= "3.8.1" and python_version < "4.0"
openpyxl==3.1.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" openpyxl==3.1.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"

View File

@ -1,4 +1,5 @@
LOG_LEVEL=TRACE LOG_LEVEL=TRACE
NICKNAME=["test"] NICKNAME=["test"]
SUPERUSERS=["10000"] SUPERUSERS=["onebot:10000","10001","other:10002","abcdef"]
COMMAND_START=["", "/"] COMMAND_START=["", "/"]
DRIVER="~none"

View File

@ -1,34 +1,23 @@
from typing import TYPE_CHECKING, Optional
import pytest import pytest
if TYPE_CHECKING:
from nonebot.plugin import Plugin
@pytest.fixture
def load_metadata(nonebug_init: None) -> Optional["Plugin"]:
import nonebot import nonebot
from nonebug import NONEBOT_INIT_KWARGS
from nonebot.adapters.onebot.v11 import Adapter
return nonebot.load_plugin("GenshinUID.genshinuid_meta") PLUGINS = ["meta", "adv", "etcimg", "guide"]
@pytest.fixture @pytest.fixture(scope="session", autouse=True)
def load_adv(nonebug_init: None) -> Optional["Plugin"]: def load_bot():
import nonebot driver = nonebot.get_driver()
driver.register_adapter(Adapter)
return nonebot.load_plugin("GenshinUID.genshinuid_adv") nonebot.load_all_plugins(
[f"GenshinUID.genshinuid_{name}" for name in PLUGINS], []
)
@pytest.fixture def pytest_configure(config: pytest.Config):
def load_etc(nonebug_init: None) -> Optional["Plugin"]: config.stash[NONEBOT_INIT_KWARGS] = {
import nonebot "genshinuid_disabled_plugins": {"xkdata", "abyss", "adv"},
"genshinuid_priority": 5,
return nonebot.load_plugin("GenshinUID.genshinuid_etcimg") }
@pytest.fixture
def load_guide(nonebug_init: None) -> Optional["Plugin"]:
import nonebot
return nonebot.load_plugin("GenshinUID.genshinuid_guide")

View File

@ -6,12 +6,18 @@ MESSAGE = """「安柏」
推荐5★武器阿莫斯之弓、天空之翼、终末嗟叹之诗 推荐5★武器阿莫斯之弓、天空之翼、终末嗟叹之诗
推荐4★武器绝弦 推荐4★武器绝弦
推荐圣遗物搭配: 推荐圣遗物搭配:
[昔日宗室之仪]四件套""" [昔日宗室之仪]四件套
-=-=-=-=-=-=-=-=-=-
备注:
原神御三家之一,必胜客联动看板角色之一;
身份西风骑士团侦查骑士,蒙德飞行冠军,柏菈图的拼图(误);
人送外号解谜点火真君/打火姬
通常情况下,安柏的大世界解谜意义大于其深渊实战意义,建议根据实际需求选择投入资源培养"""
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize(argnames="alias", argvalues=["安柏用什么", "安柏怎么养"]) @pytest.mark.parametrize(argnames="alias", argvalues=["安柏用什么", "安柏怎么养"])
async def test_adv_char_chat(app: App, alias, load_adv: None): async def test_adv_char_chat(app: App, alias):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message from nonebot.adapters.onebot.v11 import Bot, Message

8
tests/test_base.py Normal file
View File

@ -0,0 +1,8 @@
from nonebug import App
def test_config(app: App):
from GenshinUID import config
assert config.config.disabled_plugins == {"xkdata", "abyss", "adv"}
assert config.priority == 5

View File

@ -6,7 +6,7 @@ from nonebug import App
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize(argnames="alias", argvalues=["版本规划", "原石预估"]) @pytest.mark.parametrize(argnames="alias", argvalues=["版本规划", "原石预估"])
async def test_get_primogems_data(app: App, alias, load_etc: None): async def test_get_primogems_data(app: App, alias):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment
@ -37,7 +37,7 @@ async def test_get_primogems_data(app: App, alias, load_etc: None):
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_primogems_version(app: App, load_etc: None): async def test_primogems_version(app: App):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment
@ -68,7 +68,7 @@ async def test_primogems_version(app: App, load_etc: None):
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_primogems_failed(app: App, load_etc: None): async def test_primogems_failed(app: App):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message from nonebot.adapters.onebot.v11 import Bot, Message
@ -100,7 +100,7 @@ async def test_primogems_failed(app: App, load_etc: None):
"伤害乘区", "伤害乘区",
], ],
) )
async def test_get_img_data(app: App, alias, load_etc: None): async def test_get_img_data(app: App, alias):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment

View File

@ -3,72 +3,72 @@ from pathlib import Path
import pytest import pytest
from nonebug import App from nonebug import App
# TODO: update guide tests
# @pytest.mark.asyncio
# @pytest.mark.parametrize(
# argnames="alias",
# argvalues=[
# "钟离推荐",
# "钟离攻略",
# "岩王爷攻略", # alias
# ],
# )
# async def test_get_guide_pic(app: App, alias ):
# from utils import make_event
# from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment
@pytest.mark.asyncio # from GenshinUID.genshinuid_guide import get_guide_pic
@pytest.mark.parametrize(
argnames="alias",
argvalues=[
"钟离推荐",
"钟离攻略",
"岩王爷攻略", # alias
],
)
async def test_get_guide_pic(app: App, alias, load_guide: None):
from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment
from GenshinUID.genshinuid_guide import get_guide_pic # async with app.test_matcher(get_guide_pic) as ctx:
# bot = ctx.create_bot(base=Bot)
async with app.test_matcher(get_guide_pic) as ctx: # event = make_event(message=Message(alias))
bot = ctx.create_bot(base=Bot) # ctx.receive_event(bot, event)
# ctx.should_call_send(
event = make_event(message=Message(alias)) # event,
ctx.receive_event(bot, event) # MessageSegment.image(
ctx.should_call_send( # "https://file.microgg.cn/MiniGG/guide/钟离.jpg"
event, # ),
MessageSegment.image( # True,
"https://file.microgg.cn/MiniGG/guide/钟离.jpg" # )
), # ctx.should_finished()
True,
)
ctx.should_finished()
@pytest.mark.asyncio # @pytest.mark.asyncio
async def test_get_guide_pic_traveler(app: App, load_guide: None): # async def test_get_guide_pic_traveler(app: App ):
from utils import make_event # from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment # from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment
from GenshinUID.genshinuid_guide import get_guide_pic # from GenshinUID.genshinuid_guide import get_guide_pic
async with app.test_matcher(get_guide_pic) as ctx: # async with app.test_matcher(get_guide_pic) as ctx:
bot = ctx.create_bot(base=Bot) # bot = ctx.create_bot(base=Bot)
event = make_event(message=Message("旅行者风推荐")) # event = make_event(message=Message("旅行者风推荐"))
ctx.receive_event(bot, event) # ctx.receive_event(bot, event)
ctx.should_call_send( # ctx.should_call_send(
event, # event,
MessageSegment.image( # MessageSegment.image(
"https://file.microgg.cn/MiniGG/guide/旅行者-风.jpg" # "https://file.microgg.cn/MiniGG/guide/旅行者-风.jpg"
), # ),
True, # True,
) # )
ctx.should_finished() # ctx.should_finished()
@pytest.mark.asyncio # @pytest.mark.asyncio
async def test_get_guide_pic_failed(app: App, load_guide: None): # async def test_get_guide_pic_failed(app: App ):
from utils import make_event # from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message # from nonebot.adapters.onebot.v11 import Bot, Message
from GenshinUID.genshinuid_guide import get_guide_pic # from GenshinUID.genshinuid_guide import get_guide_pic
async with app.test_matcher(get_guide_pic) as ctx: # async with app.test_matcher(get_guide_pic) as ctx:
bot = ctx.create_bot(base=Bot) # bot = ctx.create_bot(base=Bot)
event = make_event(message=Message("蔡徐坤攻略")) # event = make_event(message=Message("蔡徐坤攻略"))
ctx.receive_event(bot, event) # ctx.receive_event(bot, event)
ctx.should_finished() # ctx.should_finished()
@pytest.mark.asyncio @pytest.mark.asyncio
@ -79,7 +79,7 @@ async def test_get_guide_pic_failed(app: App, load_guide: None):
"参考面板岩王爷", # alias "参考面板岩王爷", # alias
], ],
) )
async def test_get_bluekun_pic(app: App, alias, load_guide: None): async def test_get_bluekun_pic(app: App, alias):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment
@ -104,7 +104,7 @@ async def test_get_bluekun_pic(app: App, alias, load_guide: None):
"", "",
], ],
) )
async def test_get_bluekun_pic_element(app: App, alias, load_guide: None): async def test_get_bluekun_pic_element(app: App, alias):
from utils import make_event from utils import make_event
from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment

View File

@ -3,7 +3,7 @@ from nonebug import App
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_metadata(app: App, load_metadata: None): async def test_metadata(app: App):
from GenshinUID.genshinuid_meta import __plugin_meta__ from GenshinUID.genshinuid_meta import __plugin_meta__
assert __plugin_meta__.name == 'GenshinUID' assert __plugin_meta__.name == 'GenshinUID'
@ -13,7 +13,7 @@ async def test_metadata(app: App, load_metadata: None):
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_register_menu(app: App, load_metadata: None): async def test_register_menu(app: App):
from GenshinUID.genshinuid_meta import sub_menus, register_menu from GenshinUID.genshinuid_meta import sub_menus, register_menu
@register_menu( @register_menu(
@ -26,10 +26,11 @@ async def test_register_menu(app: App, load_metadata: None):
async def _example() -> None: async def _example() -> None:
pass pass
assert len(sub_menus) == 1 menu = {
menu = sub_menus[0] "func": "test",
assert menu['func'] == 'test' "trigger_condition": "trigger",
assert menu['trigger_condition'] == 'trigger' "trigger_method": "114514",
assert menu['trigger_method'] == '114514' "brief_des": "test register_menu",
assert menu['brief_des'] == 'test register_menu' "detail_des": "test register_menu",
assert menu['detail_des'] == 'test register_menu' }
assert menu in sub_menus

View File

@ -0,0 +1,9 @@
from nonebug import App
def test_get_superusers(app: App):
from GenshinUID.utils.nonebot2.utils import get_superusers
superusers = get_superusers()
assert len(superusers) == 2
assert set(superusers) == {10000, 10001}

View File

@ -104,6 +104,5 @@ def make_event(
"anonymous": anonymous, "anonymous": anonymous,
**kwargs, **kwargs,
}, },
str(self_id),
), ),
) )