nonebot-plugin-yrr-fortune 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. nonebot_plugin_yrr_fortune-1.0.0/LICENSE +21 -0
  2. nonebot_plugin_yrr_fortune-1.0.0/MANIFEST.in +6 -0
  3. nonebot_plugin_yrr_fortune-1.0.0/PKG-INFO +135 -0
  4. nonebot_plugin_yrr_fortune-1.0.0/README.md +103 -0
  5. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/__init__.py +703 -0
  6. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/config.py +244 -0
  7. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/core.py +437 -0
  8. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/help.jpg +0 -0
  9. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/preview-1.jpg +0 -0
  10. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/preview-2.jpg +0 -0
  11. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/preview-3.jpg +0 -0
  12. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/preview-4.jpg +0 -0
  13. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/preview-5.jpg +0 -0
  14. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/preview-6.jpg +0 -0
  15. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/templates/1.html +1 -0
  16. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/templates/2.html +1 -0
  17. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/templates/3.html +402 -0
  18. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/templates/4.html +287 -0
  19. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/templates/5.html +366 -0
  20. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune/templates/6.html +1 -0
  21. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune.egg-info/PKG-INFO +135 -0
  22. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune.egg-info/SOURCES.txt +27 -0
  23. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune.egg-info/dependency_links.txt +1 -0
  24. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune.egg-info/requires.txt +7 -0
  25. nonebot_plugin_yrr_fortune-1.0.0/nonebot_plugin_yrr_fortune.egg-info/top_level.txt +1 -0
  26. nonebot_plugin_yrr_fortune-1.0.0/pyproject.toml +52 -0
  27. nonebot_plugin_yrr_fortune-1.0.0/setup.cfg +4 -0
  28. nonebot_plugin_yrr_fortune-1.0.0/setup.py +3 -0
  29. nonebot_plugin_yrr_fortune-1.0.0/tests/test_core.py +127 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 YRR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ include setup.py
5
+ recursive-include nonebot_plugin_yrr_fortune *.html *.jpg
6
+ recursive-include tests *.py
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: nonebot-plugin-yrr-fortune
3
+ Version: 1.0.0
4
+ Summary: NoneBot 每日运势卡片:七档运势、六维雷达、幸运信息、宜忌与六套模板
5
+ Author: YRR
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/YRRLYB/nonebot-plugin-yrr-fortune
8
+ Project-URL: Repository, https://github.com/YRRLYB/nonebot-plugin-yrr-fortune
9
+ Project-URL: Issues, https://github.com/YRRLYB/nonebot-plugin-yrr-fortune/issues
10
+ Keywords: nonebot,nonebot2,plugin,fortune,运势,onebot
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Games/Entertainment
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: nonebot2>=2.2.0
25
+ Requires-Dist: nonebot-adapter-onebot>=2.4.0
26
+ Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
27
+ Requires-Dist: nonebot-plugin-htmlrender>=0.6.0
28
+ Requires-Dist: nonebot-plugin-localstore>=0.7.0
29
+ Requires-Dist: httpx>=0.24.0
30
+ Requires-Dist: pillow>=9.0.0
31
+ Dynamic: license-file
32
+
33
+ # YRR 运势
34
+
35
+ > 每日一张运势卡:七档运势、六维雷达、幸运色 / 数字 / 方位、宜忌活动,六套模板随意切换。
36
+
37
+ ![模板总览](https://raw.githubusercontent.com/YRRLYB/nonebot-plugin-yrr-fortune/main/nonebot_plugin_yrr_fortune/help.jpg)
38
+
39
+ ## 功能
40
+
41
+ - **今日运势**:每天 0 点后自动刷新,同一天重复发送结果稳定不变。
42
+ - **七档运势**:大凶 / 小凶 / 末吉 / 小吉 / 中吉 / 大吉 / 天命。
43
+ - **六维雷达**:财运、事业、健康、人缘、爱情、智慧。
44
+ - **幸运信息**:幸运色、幸运数字、幸运方位、宜做与忌做。
45
+ - **互斥宜忌**:同一维度不会同时出现在「宜」和「忌」,避免「宜早睡、忌熬夜」式矛盾。
46
+ - **六套模板**:鎏金流年、霓虹潮流、光影定格、水墨山河、星舰指挥、分镜奇谭。
47
+ - **背景图**:回复运势图发送 `/背景图` 可获取本次使用的原图。
48
+ - **无网络也能出图**:背景接口或头像失败时自动使用内置渐变与占位头像。
49
+
50
+ ## 安装
51
+
52
+ ```bash
53
+ nb plugin install nonebot-plugin-yrr-fortune
54
+ ```
55
+
56
+ 或者:
57
+
58
+ ```bash
59
+ pip install nonebot-plugin-yrr-fortune
60
+ ```
61
+
62
+ 依赖 `nonebot-plugin-htmlrender`,首次使用前请确保 Playwright 的 Chromium 已安装:
63
+
64
+ ```bash
65
+ playwright install chromium
66
+ ```
67
+
68
+ ## 指令
69
+
70
+ | 指令 | 说明 | 权限 |
71
+ | --- | --- | --- |
72
+ | `运势` / `今日运势` | 查看今日运势卡片 | 所有人 |
73
+ | `运势模板` | 查看六套模板总览 | 所有人 |
74
+ | `运势模板 1-6` | 切换自己的模板 | 所有人 |
75
+ | `/背景图` / `/运势背景图` | 回复运势图获取原图;不回复则随机取一张 | 所有人 |
76
+ | `/重置运势` | 清空所有人的今日运势(回复 `y` 确认) | 群管 / 群主 |
77
+
78
+ ## 模板
79
+
80
+ | 编号 | 名称 |
81
+ | --- | --- |
82
+ | 1 | 鎏金流年 |
83
+ | 2 | 霓虹潮流 |
84
+ | 3 | 光影定格 |
85
+ | 4 | 水墨山河 |
86
+ | 5 | 星舰指挥 |
87
+ | 6 | 分镜奇谭 |
88
+
89
+ ## 配置
90
+
91
+ 所有配置都有默认值,插件可以零配置加载。需要修改时在 `.env` 中写:
92
+
93
+ ```dotenv
94
+ # 背景图接口,返回图片字节即可
95
+ FORTUNE_BACKGROUND_URL=https://photo.yrrlyb.top/api.php?sort=mplyb
96
+
97
+ # 预加载背景图数量,0 表示关闭预加载
98
+ FORTUNE_PRELOAD_COUNT=4
99
+
100
+ # 背景图下载超时(秒)
101
+ FORTUNE_HTTP_TIMEOUT=30
102
+
103
+ # 记住多少条运势消息用于 /背景图 回复,默认 500
104
+ FORTUNE_MAX_MESSAGE_MAP=500
105
+
106
+ # 背景接口证书异常时才打开;默认校验 TLS
107
+ FORTUNE_INSECURE_SSL=false
108
+ ```
109
+
110
+ 数据与缓存由 `nonebot-plugin-localstore` 管理:
111
+
112
+ - 数据:`get_plugin_data_dir()/user_data.json`
113
+ - 缓存:`get_plugin_cache_dir()/backgrounds`、`/avatars`
114
+ - 字体:`数据目录/fonts/msyh.ttc`,找不到时使用系统字体
115
+
116
+ 从旧版 `data/YRR_database/user_data.json` 升级时,首次启动会自动迁移用户数据。
117
+
118
+ ## 兼容性
119
+
120
+ - NoneBot 2.2+
121
+ - OneBot V11 适配器
122
+ - Python 3.9+
123
+
124
+ ## 开发
125
+
126
+ ```bash
127
+ pip install -e .
128
+ python -m unittest discover -s tests -v
129
+ ```
130
+
131
+ 模板是 `nonebot_plugin_yrr_fortune/templates/*.html`,使用 Python `str.format` 占位符;修改模板时 CSS 花括号需要写成 `{{` 和 `}}`。
132
+
133
+ ## 许可
134
+
135
+ MIT
@@ -0,0 +1,103 @@
1
+ # YRR 运势
2
+
3
+ > 每日一张运势卡:七档运势、六维雷达、幸运色 / 数字 / 方位、宜忌活动,六套模板随意切换。
4
+
5
+ ![模板总览](https://raw.githubusercontent.com/YRRLYB/nonebot-plugin-yrr-fortune/main/nonebot_plugin_yrr_fortune/help.jpg)
6
+
7
+ ## 功能
8
+
9
+ - **今日运势**:每天 0 点后自动刷新,同一天重复发送结果稳定不变。
10
+ - **七档运势**:大凶 / 小凶 / 末吉 / 小吉 / 中吉 / 大吉 / 天命。
11
+ - **六维雷达**:财运、事业、健康、人缘、爱情、智慧。
12
+ - **幸运信息**:幸运色、幸运数字、幸运方位、宜做与忌做。
13
+ - **互斥宜忌**:同一维度不会同时出现在「宜」和「忌」,避免「宜早睡、忌熬夜」式矛盾。
14
+ - **六套模板**:鎏金流年、霓虹潮流、光影定格、水墨山河、星舰指挥、分镜奇谭。
15
+ - **背景图**:回复运势图发送 `/背景图` 可获取本次使用的原图。
16
+ - **无网络也能出图**:背景接口或头像失败时自动使用内置渐变与占位头像。
17
+
18
+ ## 安装
19
+
20
+ ```bash
21
+ nb plugin install nonebot-plugin-yrr-fortune
22
+ ```
23
+
24
+ 或者:
25
+
26
+ ```bash
27
+ pip install nonebot-plugin-yrr-fortune
28
+ ```
29
+
30
+ 依赖 `nonebot-plugin-htmlrender`,首次使用前请确保 Playwright 的 Chromium 已安装:
31
+
32
+ ```bash
33
+ playwright install chromium
34
+ ```
35
+
36
+ ## 指令
37
+
38
+ | 指令 | 说明 | 权限 |
39
+ | --- | --- | --- |
40
+ | `运势` / `今日运势` | 查看今日运势卡片 | 所有人 |
41
+ | `运势模板` | 查看六套模板总览 | 所有人 |
42
+ | `运势模板 1-6` | 切换自己的模板 | 所有人 |
43
+ | `/背景图` / `/运势背景图` | 回复运势图获取原图;不回复则随机取一张 | 所有人 |
44
+ | `/重置运势` | 清空所有人的今日运势(回复 `y` 确认) | 群管 / 群主 |
45
+
46
+ ## 模板
47
+
48
+ | 编号 | 名称 |
49
+ | --- | --- |
50
+ | 1 | 鎏金流年 |
51
+ | 2 | 霓虹潮流 |
52
+ | 3 | 光影定格 |
53
+ | 4 | 水墨山河 |
54
+ | 5 | 星舰指挥 |
55
+ | 6 | 分镜奇谭 |
56
+
57
+ ## 配置
58
+
59
+ 所有配置都有默认值,插件可以零配置加载。需要修改时在 `.env` 中写:
60
+
61
+ ```dotenv
62
+ # 背景图接口,返回图片字节即可
63
+ FORTUNE_BACKGROUND_URL=https://photo.yrrlyb.top/api.php?sort=mplyb
64
+
65
+ # 预加载背景图数量,0 表示关闭预加载
66
+ FORTUNE_PRELOAD_COUNT=4
67
+
68
+ # 背景图下载超时(秒)
69
+ FORTUNE_HTTP_TIMEOUT=30
70
+
71
+ # 记住多少条运势消息用于 /背景图 回复,默认 500
72
+ FORTUNE_MAX_MESSAGE_MAP=500
73
+
74
+ # 背景接口证书异常时才打开;默认校验 TLS
75
+ FORTUNE_INSECURE_SSL=false
76
+ ```
77
+
78
+ 数据与缓存由 `nonebot-plugin-localstore` 管理:
79
+
80
+ - 数据:`get_plugin_data_dir()/user_data.json`
81
+ - 缓存:`get_plugin_cache_dir()/backgrounds`、`/avatars`
82
+ - 字体:`数据目录/fonts/msyh.ttc`,找不到时使用系统字体
83
+
84
+ 从旧版 `data/YRR_database/user_data.json` 升级时,首次启动会自动迁移用户数据。
85
+
86
+ ## 兼容性
87
+
88
+ - NoneBot 2.2+
89
+ - OneBot V11 适配器
90
+ - Python 3.9+
91
+
92
+ ## 开发
93
+
94
+ ```bash
95
+ pip install -e .
96
+ python -m unittest discover -s tests -v
97
+ ```
98
+
99
+ 模板是 `nonebot_plugin_yrr_fortune/templates/*.html`,使用 Python `str.format` 占位符;修改模板时 CSS 花括号需要写成 `{{` 和 `}}`。
100
+
101
+ ## 许可
102
+
103
+ MIT