nonebot-plugin-daily-attendance 0.1.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.
- nonebot_plugin_daily_attendance-0.1.0/.gitignore +9 -0
- nonebot_plugin_daily_attendance-0.1.0/LICENSE +21 -0
- nonebot_plugin_daily_attendance-0.1.0/PKG-INFO +126 -0
- nonebot_plugin_daily_attendance-0.1.0/README.md +95 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/__init__.py +567 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config.py +12 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config_data/Things.json +642 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config_data/apis.json +4 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config_data/fortuneData.json +14 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config_data/levelData.json +53 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config_data/specialDates.json +145 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/config_data/timeGreetings.json +11 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/data_manager.py +297 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/hitokoto.py +159 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/paths.py +24 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/render.py +62 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/resources/templates/attendance.html +384 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/resources/templates/attendance_special.html +368 -0
- nonebot_plugin_daily_attendance-0.1.0/nonebot_plugin_daily_attendance/utils.py +163 -0
- nonebot_plugin_daily_attendance-0.1.0/pyproject.toml +62 -0
- nonebot_plugin_daily_attendance-0.1.0/tests/conftest.py +4 -0
- nonebot_plugin_daily_attendance-0.1.0/tests/test_load.py +9 -0
- nonebot_plugin_daily_attendance-0.1.0/tests/test_units.py +134 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 QingYingX
|
|
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,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nonebot-plugin-daily-attendance
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 移植自 Daily-Attendance-plugin 的每日运势签到插件:运势生成、等级系统、随机一言、搞怪黄历
|
|
5
|
+
Project-URL: Homepage, https://github.com/TonyLiangP2010405/nonebot-plugin-daily-attendance
|
|
6
|
+
Project-URL: Repository, https://github.com/TonyLiangP2010405/nonebot-plugin-daily-attendance
|
|
7
|
+
Author: TonyLiangP2010405
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: attendance,daily,fortune,level-system,nonebot,nonebot2,plugin,sign-in
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: httpx>=0.24.0
|
|
20
|
+
Requires-Dist: nonebot-adapter-onebot>=2.4.0
|
|
21
|
+
Requires-Dist: nonebot-plugin-apscheduler>=0.3.0
|
|
22
|
+
Requires-Dist: nonebot-plugin-htmlrender>=0.3.0
|
|
23
|
+
Requires-Dist: nonebot2>=2.2.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: nonebot2[fastapi]>=2.2.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: nonebug>=0.3; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# nonebot-plugin-daily-attendance
|
|
33
|
+
|
|
34
|
+
移植自 [Daily-Attendance-plugin](https://gitee.com/qingyingxbot/Daily-Attendance-plugin)(TRSS-Yunzai 插件)的 NoneBot2 每日运势签到插件。
|
|
35
|
+
|
|
36
|
+
## 功能
|
|
37
|
+
|
|
38
|
+
- **每日运势生成** —— 基于用户ID和日期的伪随机运势(Beta 分布),确保每日不同
|
|
39
|
+
- **等级系统** —— 经验值累积,50 个等级等你挑战
|
|
40
|
+
- **随机一言** —— 来自一言 API 的精选语录,支持本地备用库
|
|
41
|
+
- **搞怪黄历** —— 每日宜忌事项,趣味十足
|
|
42
|
+
- **时间问候** —— 根据当前时间智能问候
|
|
43
|
+
- **特殊日期** —— 支持特定日期自定义运势、一言、黄历、经验加成
|
|
44
|
+
- **美观渲染** —— 基于 HTML 模板的精美图片展示(nonebot-plugin-htmlrender)
|
|
45
|
+
- **自动清理** —— 快照数据每日 00:00 自动清理,60 天未签到用户数据自动归档
|
|
46
|
+
|
|
47
|
+
## 安装
|
|
48
|
+
|
|
49
|
+
### 使用 nb-cli 安装
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
nb plugin install nonebot-plugin-daily-attendance
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 使用 pip 安装
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install nonebot-plugin-daily-attendance
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 使用 poetry 安装
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
poetry add nonebot-plugin-daily-attendance
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
图片渲染依赖 Playwright,首次使用需要安装浏览器:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
playwright install chromium
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 配置
|
|
74
|
+
|
|
75
|
+
在 NoneBot 项目的 `.env` 文件中添加(可选,均有默认值):
|
|
76
|
+
|
|
77
|
+
```env
|
|
78
|
+
# 用户数据存储目录(默认为插件包内 data/ 目录)
|
|
79
|
+
DAILY_ATTENDANCE_DATA_DIR=/path/to/data
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
其他业务数据配置位于插件包 `config_data/` 目录下的 JSON 文件:
|
|
83
|
+
|
|
84
|
+
- `levelData.json` —— 等级数据配置
|
|
85
|
+
- `fortuneData.json` —— 运势描述配置
|
|
86
|
+
- `timeGreetings.json` —— 时间问候语配置
|
|
87
|
+
- `Things.json` —— 黄历事件配置(包含宜忌事项)
|
|
88
|
+
- `apis.json` —— API 地址配置(一言 API、背景图 API)
|
|
89
|
+
- `specialDates.json` —— 特殊日期配置(可选,用于设置特定日期的运势、一言等)
|
|
90
|
+
|
|
91
|
+
备用一言库 `hitokotoBackup.json` 会在数据目录中自动生成,无需手动配置。
|
|
92
|
+
|
|
93
|
+
## 使用方法
|
|
94
|
+
|
|
95
|
+
| 指令 | 权限 | 范围 | 说明 |
|
|
96
|
+
|---|---|---|---|
|
|
97
|
+
| #今日运势 / #jrys / #孑然一身 | 所有人 | 群聊/私聊 | 获取今日运势并签到 |
|
|
98
|
+
| #运势统计 / #ystj | 所有人 | 群聊/私聊 | 查看个人统计信息 |
|
|
99
|
+
| #运势数据 / #yssj | 所有人 | 仅群聊 | 查询当前群聊今日签到情况 |
|
|
100
|
+
| #运势总数据 / #yszsj | 所有人 | 群聊/私聊 | 查询总的今日签到情况(仅当日数据) |
|
|
101
|
+
| #运势排行榜 / #ysphb | 所有人 | 群聊/私聊 | 查看全局运势排行榜 |
|
|
102
|
+
| #一言统计 / #yytj | 所有人 | 群聊/私聊 | 查看备用一言库统计信息 |
|
|
103
|
+
| #运势帮助 / #ysbz | 所有人 | 群聊/私聊 | 查看帮助 |
|
|
104
|
+
|
|
105
|
+
所有指令的 `#` 前缀均可省略。
|
|
106
|
+
|
|
107
|
+
## 示例
|
|
108
|
+
|
|
109
|
+
用户:#今日运势
|
|
110
|
+
机器人:[运势图片](运势值、等级进度、今日宜忌、一言)
|
|
111
|
+
|
|
112
|
+
用户:#运势统计
|
|
113
|
+
机器人:📊 个人统计信息 ……
|
|
114
|
+
|
|
115
|
+
## 数据存储
|
|
116
|
+
|
|
117
|
+
- 用户签到数据:`{数据目录}/user_signs/{user_id}.json`
|
|
118
|
+
- 每日快照数据:`{数据目录}/snapshot/{user_id}_{date}.json`(每日 00:00 自动清空)
|
|
119
|
+
- 过期用户数据:`{数据目录}/expired/`(60 天未签到自动归档,再次签到时自动恢复)
|
|
120
|
+
- 备用一言库:`{数据目录}/hitokotoBackup.json`(自动生成)
|
|
121
|
+
|
|
122
|
+
## 许可证
|
|
123
|
+
|
|
124
|
+
MIT(与原项目一致)
|
|
125
|
+
|
|
126
|
+
**免责声明**:本插件仅供娱乐使用,运势内容为随机生成,请勿迷信。
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# nonebot-plugin-daily-attendance
|
|
2
|
+
|
|
3
|
+
移植自 [Daily-Attendance-plugin](https://gitee.com/qingyingxbot/Daily-Attendance-plugin)(TRSS-Yunzai 插件)的 NoneBot2 每日运势签到插件。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- **每日运势生成** —— 基于用户ID和日期的伪随机运势(Beta 分布),确保每日不同
|
|
8
|
+
- **等级系统** —— 经验值累积,50 个等级等你挑战
|
|
9
|
+
- **随机一言** —— 来自一言 API 的精选语录,支持本地备用库
|
|
10
|
+
- **搞怪黄历** —— 每日宜忌事项,趣味十足
|
|
11
|
+
- **时间问候** —— 根据当前时间智能问候
|
|
12
|
+
- **特殊日期** —— 支持特定日期自定义运势、一言、黄历、经验加成
|
|
13
|
+
- **美观渲染** —— 基于 HTML 模板的精美图片展示(nonebot-plugin-htmlrender)
|
|
14
|
+
- **自动清理** —— 快照数据每日 00:00 自动清理,60 天未签到用户数据自动归档
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
### 使用 nb-cli 安装
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
nb plugin install nonebot-plugin-daily-attendance
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 使用 pip 安装
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install nonebot-plugin-daily-attendance
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 使用 poetry 安装
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
poetry add nonebot-plugin-daily-attendance
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
图片渲染依赖 Playwright,首次使用需要安装浏览器:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
playwright install chromium
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 配置
|
|
43
|
+
|
|
44
|
+
在 NoneBot 项目的 `.env` 文件中添加(可选,均有默认值):
|
|
45
|
+
|
|
46
|
+
```env
|
|
47
|
+
# 用户数据存储目录(默认为插件包内 data/ 目录)
|
|
48
|
+
DAILY_ATTENDANCE_DATA_DIR=/path/to/data
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
其他业务数据配置位于插件包 `config_data/` 目录下的 JSON 文件:
|
|
52
|
+
|
|
53
|
+
- `levelData.json` —— 等级数据配置
|
|
54
|
+
- `fortuneData.json` —— 运势描述配置
|
|
55
|
+
- `timeGreetings.json` —— 时间问候语配置
|
|
56
|
+
- `Things.json` —— 黄历事件配置(包含宜忌事项)
|
|
57
|
+
- `apis.json` —— API 地址配置(一言 API、背景图 API)
|
|
58
|
+
- `specialDates.json` —— 特殊日期配置(可选,用于设置特定日期的运势、一言等)
|
|
59
|
+
|
|
60
|
+
备用一言库 `hitokotoBackup.json` 会在数据目录中自动生成,无需手动配置。
|
|
61
|
+
|
|
62
|
+
## 使用方法
|
|
63
|
+
|
|
64
|
+
| 指令 | 权限 | 范围 | 说明 |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| #今日运势 / #jrys / #孑然一身 | 所有人 | 群聊/私聊 | 获取今日运势并签到 |
|
|
67
|
+
| #运势统计 / #ystj | 所有人 | 群聊/私聊 | 查看个人统计信息 |
|
|
68
|
+
| #运势数据 / #yssj | 所有人 | 仅群聊 | 查询当前群聊今日签到情况 |
|
|
69
|
+
| #运势总数据 / #yszsj | 所有人 | 群聊/私聊 | 查询总的今日签到情况(仅当日数据) |
|
|
70
|
+
| #运势排行榜 / #ysphb | 所有人 | 群聊/私聊 | 查看全局运势排行榜 |
|
|
71
|
+
| #一言统计 / #yytj | 所有人 | 群聊/私聊 | 查看备用一言库统计信息 |
|
|
72
|
+
| #运势帮助 / #ysbz | 所有人 | 群聊/私聊 | 查看帮助 |
|
|
73
|
+
|
|
74
|
+
所有指令的 `#` 前缀均可省略。
|
|
75
|
+
|
|
76
|
+
## 示例
|
|
77
|
+
|
|
78
|
+
用户:#今日运势
|
|
79
|
+
机器人:[运势图片](运势值、等级进度、今日宜忌、一言)
|
|
80
|
+
|
|
81
|
+
用户:#运势统计
|
|
82
|
+
机器人:📊 个人统计信息 ……
|
|
83
|
+
|
|
84
|
+
## 数据存储
|
|
85
|
+
|
|
86
|
+
- 用户签到数据:`{数据目录}/user_signs/{user_id}.json`
|
|
87
|
+
- 每日快照数据:`{数据目录}/snapshot/{user_id}_{date}.json`(每日 00:00 自动清空)
|
|
88
|
+
- 过期用户数据:`{数据目录}/expired/`(60 天未签到自动归档,再次签到时自动恢复)
|
|
89
|
+
- 备用一言库:`{数据目录}/hitokotoBackup.json`(自动生成)
|
|
90
|
+
|
|
91
|
+
## 许可证
|
|
92
|
+
|
|
93
|
+
MIT(与原项目一致)
|
|
94
|
+
|
|
95
|
+
**免责声明**:本插件仅供娱乐使用,运势内容为随机生成,请勿迷信。
|