nonebot-plugin-bugu 0.2.1__tar.gz → 0.4.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_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/PKG-INFO +30 -41
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/README.md +28 -39
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/__init__.py +2 -3
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/commands.py +8 -22
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/config.py +0 -4
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/draw.py +10 -25
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/common.py +33 -32
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/flowers/data.py +0 -3
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/flowers/render.py +0 -8
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/flowers/reply.py +0 -2
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/neighbors/render.py +0 -1
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/recipes/render.py +130 -17
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/recipes/reply.py +105 -10
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/starsea/render.py +280 -24
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/starsea/reply.py +199 -52
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/runtime.py +5 -35
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/pyproject.toml +2 -2
- nonebot_plugin_bugu-0.2.1/nonebot_plugin_bugu/collection.py +0 -166
- nonebot_plugin_bugu-0.2.1/nonebot_plugin_bugu/features/collection.py +0 -247
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/LICENSE +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/api.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/__init__.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/flowers/__init__.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/neighbors/__init__.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/neighbors/data.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/neighbors/reply.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/recipes/__init__.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/recipes/data.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/recipes/search.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/starsea/__init__.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/starsea/data.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/starsea/search.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/fonts.py +0 -0
- {nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/values.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nonebot-plugin-bugu
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: 布谷工具箱(星布谷地小助手):菜谱、星海地图、友邻备忘与鲜花培育
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: nonebot,nonebot2,onebot,bugu,starsea,recipe,星布谷地,星海地图,菜谱
|
|
@@ -37,11 +37,10 @@ Description-Content-Type: text/markdown
|
|
|
37
37
|
|
|
38
38
|
| 模块 | 能干什么 |
|
|
39
39
|
| --- | --- |
|
|
40
|
-
| 🍳 **菜谱查询** | 121 道菜谱的食材 / 厨具 / 力气 / 特殊效果 /
|
|
41
|
-
| 🗺 **星海地图** | 3 张地图 43 个点位,底图自动编号 +
|
|
40
|
+
| 🍳 **菜谱查询** | 121 道菜谱的食材 / 厨具 / 力气 / 特殊效果 / 获取途径;支持按食材、类型、厨具、效果、特征搜索,也能按目录一页页翻 |
|
|
41
|
+
| 🗺 **星海地图** | 3 张地图 43 个点位,底图自动编号 + 图例;点位详情是带品质色的图标墙;物种图鉴可按大类翻页;还能按物种反查「在哪几个岛」 |
|
|
42
42
|
| 🧑🤝🧑 **友邻备忘** | 10 位友邻的立绘、资料、介绍和喜爱 / 好感 / 反感 / 关于词条与友邻能力 |
|
|
43
43
|
| 🌷 **鲜花培育** | 13 个品种 87 种花色的杂交配方表 + 花色图鉴(品质、颜色、产地) |
|
|
44
|
-
| ✅ **收集进度** | 按 QQ 号记录已收集的物种 / 鲜花 / 菜谱,卡片上直接打勾,进度只存在本机 |
|
|
45
44
|
|
|
46
45
|

|
|
47
46
|
|
|
@@ -53,6 +52,12 @@ Description-Content-Type: text/markdown
|
|
|
53
52
|
|
|
54
53
|

|
|
55
54
|
|
|
55
|
+
不知道菜名 / 物种名也能查——目录是图片,用页码翻:
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
56
61
|
## 安装
|
|
57
62
|
|
|
58
63
|
需要 Python 3.9+ 和 NoneBot2(OneBot V11 适配器)。
|
|
@@ -99,7 +104,6 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
99
104
|
| `BUGU_FONT_INDEX` | `0` | 字体索引(`.ttc` 集合文件用) |
|
|
100
105
|
| `BUGU_BOLD_FONT_PATH` | `(空)` | 粗体字体路径,留空用常规体加描边模拟 |
|
|
101
106
|
| `BUGU_BOLD_FONT_INDEX` | `0` | 粗体字体索引 |
|
|
102
|
-
| `BUGU_COLLECTION_PATH` | `(空)` | 收集进度文件路径,留空用 localstore 的 data 目录 |
|
|
103
107
|
|
|
104
108
|
### 关于字体
|
|
105
109
|
|
|
@@ -118,16 +122,17 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
118
122
|
| 指令 | 权限 | 说明 |
|
|
119
123
|
| --- | --- | --- |
|
|
120
124
|
| `/布谷` | 所有人 | 全部指令一览 |
|
|
125
|
+
| `/菜谱 列表 [类型/厨具/词] [页码]` | 所有人 | 菜谱目录卡片,可翻页 |
|
|
121
126
|
| `/菜谱 [菜名 / 编号]` | 所有人 | 不带参数看统计;带参数出菜谱卡片 |
|
|
122
|
-
| `/菜谱
|
|
127
|
+
| `/菜谱 随机 [条件]` | 所有人 | 随手看一道(可按类型/厨具限定) |
|
|
123
128
|
| `/菜谱查 <关键词>` | 所有人 | 搜索 / 筛选(关键词可混写) |
|
|
124
129
|
| `/星海 <任意词>` | 所有人 | 智能识别区域 / 点位 / 物种 |
|
|
125
130
|
| `/星海地图 [区域]` | 所有人 | 区域地图卡片,不带参数列所有区域 |
|
|
126
|
-
|
|
|
131
|
+
| `/星海 列表 [大类] [页码]` | 所有人 | 物种图鉴卡片;不带大类先出大类索引 |
|
|
132
|
+
| `/星海点位 [区域 / 点位名]` | 所有人 | 给区域出点位清单卡片,给点位名出详情 |
|
|
127
133
|
| `/星海查 <物种 / 大类>` | 所有人 | 跨区域搜索 |
|
|
128
134
|
| `/友邻 [名字] [分区]` | 所有人 | 友邻名单 / 档案卡;分区可填 喜爱 / 好感 / 反感 / 关于 / 介绍 |
|
|
129
135
|
| `/鲜花 [品种 / 花名]` | 所有人 | 品种列表 / 培育配方卡 / 单朵花详情 |
|
|
130
|
-
| `/收藏 [名字 / 类型]` | 所有人 | 标记收集进度 |
|
|
131
136
|
| `/布谷刷新` | 超级用户 | 强制刷新四个模块的数据并清空图片缓存 |
|
|
132
137
|
|
|
133
138
|
### 菜谱搜索
|
|
@@ -135,25 +140,36 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
135
140
|
一个查询里可以同时混写食材、菜名、类型、厨具、效果、特征,规则和站点一致:
|
|
136
141
|
|
|
137
142
|
```
|
|
143
|
+
/菜谱 列表 → 目录第 1 页(每页 15 道,5×3)
|
|
144
|
+
/菜谱 列表 2 → 第 2 页
|
|
145
|
+
/菜谱 列表 简单 → 只看简单类型
|
|
146
|
+
/菜谱 列表 煮锅 3 → 煮锅分类的第 3 页
|
|
138
147
|
/菜谱 炒鲜蔬 → 精确菜名出卡片
|
|
139
148
|
/菜谱 12 → 按编号出卡片
|
|
149
|
+
/菜谱 随机 汤羹 → 在汤羹里随机
|
|
140
150
|
/菜谱查 苹果 → 「可用苹果烹饪」+「名称含苹果」两组
|
|
141
151
|
/菜谱查 煮锅 苹果 → 用苹果做的煮锅菜谱
|
|
142
152
|
/菜谱查 秘制 → 只看秘制菜谱
|
|
143
153
|
/菜谱查 甜点 煮锅 → 甜点特征 + 煮锅
|
|
144
154
|
```
|
|
145
155
|
|
|
156
|
+
打错字也有救:没命中时会用编辑距离给几个相近的菜名。
|
|
157
|
+
|
|
146
158
|
支持的筛选值:菜品类型(简单 / 招牌 / 宴客 / 秘制 / 奇迹盛宴)、厨具(煮锅 / 烤箱 / 榨汁机)、
|
|
147
159
|
特殊效果(大力播洒 / 大力敲伐 / 钓鱼之力……)、菜品特征(荤菜 / 素菜 / 主食 / 汤羹……)。
|
|
148
160
|
|
|
149
161
|
### 星海地图
|
|
150
162
|
|
|
151
163
|
```
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
/星海 → 星海用法
|
|
165
|
+
/星海 列表 → 图鉴大类索引(11 个大类 + 数量 + 代表物种)
|
|
166
|
+
/星海 列表 河鱼 → 河鱼图鉴(27 种,每页 32 个,带品质/特产/采集点数量)
|
|
167
|
+
/星海 列表 鱼 2 → 口语别名 + 翻页
|
|
168
|
+
/星海地图 → 三个区域列表
|
|
169
|
+
/星海地图 H83 → 禾夏 H83 区地图卡片(点位 1~15 编号 + 图例)
|
|
170
|
+
/星海点位 H83 → 这个区域的点位清单(编号/类型/物种数)
|
|
154
171
|
/星海点位 迷途小屋之屿 → 点位详情(昆虫 12 / 树木 3 / 鲜花 3 / 创想卡 1 / 种子 1)
|
|
155
172
|
/星海查 三色锦鲤 → 这个物种出现在哪几个点位
|
|
156
|
-
/星海 河鱼 → 智能识别
|
|
157
173
|
```
|
|
158
174
|
|
|
159
175
|
搜索支持物种名、大类(`鱼`→河鱼/海鱼,`生物`→昆虫/河鱼/海鱼/海岸生物,也认 `树`、`花`、`矿`、`特产`)和点位名。
|
|
@@ -166,26 +182,6 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
166
182
|
/鲜花 黄百合 → 单朵花:品质、颜色、产地、由谁培育、能培育出什么
|
|
167
183
|
```
|
|
168
184
|
|
|
169
|
-
## 收集进度
|
|
170
|
-
|
|
171
|
-
站点自己的「我已获得 / 我已解锁」要邮箱 + 密码登录才能同步。
|
|
172
|
-
**在 bot 里保存用户的站点密码是不合适的**,所以插件做了一份本机进度:
|
|
173
|
-
|
|
174
|
-
- 按 QQ 号分开,存在 `localstore` 的 data 目录(`collection.json`)
|
|
175
|
-
- 三类进度互不影响:星海物种、鲜花、菜谱
|
|
176
|
-
- 标记后,点位卡片 / 鲜花卡片 / 菜谱卡片上会直接出现绿勾或「已解锁」
|
|
177
|
-
- 同名条目跨图鉴时(例如「紫罗兰」既是星海物种又是鲜花)会提示按类型再发一次:
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
/收藏 疆星步甲 → 切换星海物种
|
|
181
|
-
/收藏 鲜花 紫罗兰 → 指明类型
|
|
182
|
-
/收藏 星海 → 每个点位的收集进度
|
|
183
|
-
/收藏 鲜花 / 菜谱 → 分类进度
|
|
184
|
-
/收藏 清空 → 清空自己的进度
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
> 如果以后站点开放了 token 形式的公开进度接口,可以再考虑和站点账号打通。
|
|
188
|
-
|
|
189
185
|
## 数据来源
|
|
190
186
|
|
|
191
187
|
- 站点:<https://bugu.nsun200512.cc>
|
|
@@ -207,11 +203,6 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
207
203
|
四个接口都是按需拉取并缓存 6 小时,图片按 URL 缓存 30 天,正常使用打不了几发请求。
|
|
208
204
|
遇到 429 会提示「请求太频繁」,等一会儿再试。
|
|
209
205
|
|
|
210
|
-
**Q:为什么收集进度不能和网页同步?**
|
|
211
|
-
|
|
212
|
-
网页同步依赖账号密码,插件不保存用户密码。需要的只是「我收集了哪些」,
|
|
213
|
-
本机记录已经够用,也不会因为换 bot 环境而泄露账号。
|
|
214
|
-
|
|
215
206
|
## 开发
|
|
216
207
|
|
|
217
208
|
```bash
|
|
@@ -228,9 +219,8 @@ nonebot_plugin_bugu/
|
|
|
228
219
|
├── config.py # 配置项
|
|
229
220
|
├── api.py # 四个接口的客户端 + 内存 / 磁盘缓存
|
|
230
221
|
├── values.py # 字段兜底与通用小工具
|
|
231
|
-
├── draw.py #
|
|
222
|
+
├── draw.py # 共用绘制:画布、字体、折行、胶囊、页脚、分页卡片
|
|
232
223
|
├── fonts.py # 中文字体探测
|
|
233
|
-
├── collection.py # 收集进度存储(按 QQ 号)
|
|
234
224
|
├── runtime.py # 单例:客户端 / 字体 / 进度
|
|
235
225
|
├── commands.py # 命令注册与分发
|
|
236
226
|
└── features/
|
|
@@ -238,8 +228,7 @@ nonebot_plugin_bugu/
|
|
|
238
228
|
├── starsea/ # data / search / render / reply
|
|
239
229
|
├── recipes/ # data / search / render / reply
|
|
240
230
|
├── neighbors/ # data / render / reply
|
|
241
|
-
|
|
242
|
-
└── collection.py # 收藏命令逻辑
|
|
231
|
+
└── flowers/ # data / render / reply
|
|
243
232
|
```
|
|
244
233
|
|
|
245
234
|
## 许可证
|
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
| 模块 | 能干什么 |
|
|
11
11
|
| --- | --- |
|
|
12
|
-
| 🍳 **菜谱查询** | 121 道菜谱的食材 / 厨具 / 力气 / 特殊效果 /
|
|
13
|
-
| 🗺 **星海地图** | 3 张地图 43 个点位,底图自动编号 +
|
|
12
|
+
| 🍳 **菜谱查询** | 121 道菜谱的食材 / 厨具 / 力气 / 特殊效果 / 获取途径;支持按食材、类型、厨具、效果、特征搜索,也能按目录一页页翻 |
|
|
13
|
+
| 🗺 **星海地图** | 3 张地图 43 个点位,底图自动编号 + 图例;点位详情是带品质色的图标墙;物种图鉴可按大类翻页;还能按物种反查「在哪几个岛」 |
|
|
14
14
|
| 🧑🤝🧑 **友邻备忘** | 10 位友邻的立绘、资料、介绍和喜爱 / 好感 / 反感 / 关于词条与友邻能力 |
|
|
15
15
|
| 🌷 **鲜花培育** | 13 个品种 87 种花色的杂交配方表 + 花色图鉴(品质、颜色、产地) |
|
|
16
|
-
| ✅ **收集进度** | 按 QQ 号记录已收集的物种 / 鲜花 / 菜谱,卡片上直接打勾,进度只存在本机 |
|
|
17
16
|
|
|
18
17
|

|
|
19
18
|
|
|
@@ -25,6 +24,12 @@
|
|
|
25
24
|
|
|
26
25
|

|
|
27
26
|
|
|
27
|
+
不知道菜名 / 物种名也能查——目录是图片,用页码翻:
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
28
33
|
## 安装
|
|
29
34
|
|
|
30
35
|
需要 Python 3.9+ 和 NoneBot2(OneBot V11 适配器)。
|
|
@@ -71,7 +76,6 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
71
76
|
| `BUGU_FONT_INDEX` | `0` | 字体索引(`.ttc` 集合文件用) |
|
|
72
77
|
| `BUGU_BOLD_FONT_PATH` | `(空)` | 粗体字体路径,留空用常规体加描边模拟 |
|
|
73
78
|
| `BUGU_BOLD_FONT_INDEX` | `0` | 粗体字体索引 |
|
|
74
|
-
| `BUGU_COLLECTION_PATH` | `(空)` | 收集进度文件路径,留空用 localstore 的 data 目录 |
|
|
75
79
|
|
|
76
80
|
### 关于字体
|
|
77
81
|
|
|
@@ -90,16 +94,17 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
90
94
|
| 指令 | 权限 | 说明 |
|
|
91
95
|
| --- | --- | --- |
|
|
92
96
|
| `/布谷` | 所有人 | 全部指令一览 |
|
|
97
|
+
| `/菜谱 列表 [类型/厨具/词] [页码]` | 所有人 | 菜谱目录卡片,可翻页 |
|
|
93
98
|
| `/菜谱 [菜名 / 编号]` | 所有人 | 不带参数看统计;带参数出菜谱卡片 |
|
|
94
|
-
| `/菜谱
|
|
99
|
+
| `/菜谱 随机 [条件]` | 所有人 | 随手看一道(可按类型/厨具限定) |
|
|
95
100
|
| `/菜谱查 <关键词>` | 所有人 | 搜索 / 筛选(关键词可混写) |
|
|
96
101
|
| `/星海 <任意词>` | 所有人 | 智能识别区域 / 点位 / 物种 |
|
|
97
102
|
| `/星海地图 [区域]` | 所有人 | 区域地图卡片,不带参数列所有区域 |
|
|
98
|
-
|
|
|
103
|
+
| `/星海 列表 [大类] [页码]` | 所有人 | 物种图鉴卡片;不带大类先出大类索引 |
|
|
104
|
+
| `/星海点位 [区域 / 点位名]` | 所有人 | 给区域出点位清单卡片,给点位名出详情 |
|
|
99
105
|
| `/星海查 <物种 / 大类>` | 所有人 | 跨区域搜索 |
|
|
100
106
|
| `/友邻 [名字] [分区]` | 所有人 | 友邻名单 / 档案卡;分区可填 喜爱 / 好感 / 反感 / 关于 / 介绍 |
|
|
101
107
|
| `/鲜花 [品种 / 花名]` | 所有人 | 品种列表 / 培育配方卡 / 单朵花详情 |
|
|
102
|
-
| `/收藏 [名字 / 类型]` | 所有人 | 标记收集进度 |
|
|
103
108
|
| `/布谷刷新` | 超级用户 | 强制刷新四个模块的数据并清空图片缓存 |
|
|
104
109
|
|
|
105
110
|
### 菜谱搜索
|
|
@@ -107,25 +112,36 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
107
112
|
一个查询里可以同时混写食材、菜名、类型、厨具、效果、特征,规则和站点一致:
|
|
108
113
|
|
|
109
114
|
```
|
|
115
|
+
/菜谱 列表 → 目录第 1 页(每页 15 道,5×3)
|
|
116
|
+
/菜谱 列表 2 → 第 2 页
|
|
117
|
+
/菜谱 列表 简单 → 只看简单类型
|
|
118
|
+
/菜谱 列表 煮锅 3 → 煮锅分类的第 3 页
|
|
110
119
|
/菜谱 炒鲜蔬 → 精确菜名出卡片
|
|
111
120
|
/菜谱 12 → 按编号出卡片
|
|
121
|
+
/菜谱 随机 汤羹 → 在汤羹里随机
|
|
112
122
|
/菜谱查 苹果 → 「可用苹果烹饪」+「名称含苹果」两组
|
|
113
123
|
/菜谱查 煮锅 苹果 → 用苹果做的煮锅菜谱
|
|
114
124
|
/菜谱查 秘制 → 只看秘制菜谱
|
|
115
125
|
/菜谱查 甜点 煮锅 → 甜点特征 + 煮锅
|
|
116
126
|
```
|
|
117
127
|
|
|
128
|
+
打错字也有救:没命中时会用编辑距离给几个相近的菜名。
|
|
129
|
+
|
|
118
130
|
支持的筛选值:菜品类型(简单 / 招牌 / 宴客 / 秘制 / 奇迹盛宴)、厨具(煮锅 / 烤箱 / 榨汁机)、
|
|
119
131
|
特殊效果(大力播洒 / 大力敲伐 / 钓鱼之力……)、菜品特征(荤菜 / 素菜 / 主食 / 汤羹……)。
|
|
120
132
|
|
|
121
133
|
### 星海地图
|
|
122
134
|
|
|
123
135
|
```
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
/星海 → 星海用法
|
|
137
|
+
/星海 列表 → 图鉴大类索引(11 个大类 + 数量 + 代表物种)
|
|
138
|
+
/星海 列表 河鱼 → 河鱼图鉴(27 种,每页 32 个,带品质/特产/采集点数量)
|
|
139
|
+
/星海 列表 鱼 2 → 口语别名 + 翻页
|
|
140
|
+
/星海地图 → 三个区域列表
|
|
141
|
+
/星海地图 H83 → 禾夏 H83 区地图卡片(点位 1~15 编号 + 图例)
|
|
142
|
+
/星海点位 H83 → 这个区域的点位清单(编号/类型/物种数)
|
|
126
143
|
/星海点位 迷途小屋之屿 → 点位详情(昆虫 12 / 树木 3 / 鲜花 3 / 创想卡 1 / 种子 1)
|
|
127
144
|
/星海查 三色锦鲤 → 这个物种出现在哪几个点位
|
|
128
|
-
/星海 河鱼 → 智能识别
|
|
129
145
|
```
|
|
130
146
|
|
|
131
147
|
搜索支持物种名、大类(`鱼`→河鱼/海鱼,`生物`→昆虫/河鱼/海鱼/海岸生物,也认 `树`、`花`、`矿`、`特产`)和点位名。
|
|
@@ -138,26 +154,6 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
138
154
|
/鲜花 黄百合 → 单朵花:品质、颜色、产地、由谁培育、能培育出什么
|
|
139
155
|
```
|
|
140
156
|
|
|
141
|
-
## 收集进度
|
|
142
|
-
|
|
143
|
-
站点自己的「我已获得 / 我已解锁」要邮箱 + 密码登录才能同步。
|
|
144
|
-
**在 bot 里保存用户的站点密码是不合适的**,所以插件做了一份本机进度:
|
|
145
|
-
|
|
146
|
-
- 按 QQ 号分开,存在 `localstore` 的 data 目录(`collection.json`)
|
|
147
|
-
- 三类进度互不影响:星海物种、鲜花、菜谱
|
|
148
|
-
- 标记后,点位卡片 / 鲜花卡片 / 菜谱卡片上会直接出现绿勾或「已解锁」
|
|
149
|
-
- 同名条目跨图鉴时(例如「紫罗兰」既是星海物种又是鲜花)会提示按类型再发一次:
|
|
150
|
-
|
|
151
|
-
```
|
|
152
|
-
/收藏 疆星步甲 → 切换星海物种
|
|
153
|
-
/收藏 鲜花 紫罗兰 → 指明类型
|
|
154
|
-
/收藏 星海 → 每个点位的收集进度
|
|
155
|
-
/收藏 鲜花 / 菜谱 → 分类进度
|
|
156
|
-
/收藏 清空 → 清空自己的进度
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
> 如果以后站点开放了 token 形式的公开进度接口,可以再考虑和站点账号打通。
|
|
160
|
-
|
|
161
157
|
## 数据来源
|
|
162
158
|
|
|
163
159
|
- 站点:<https://bugu.nsun200512.cc>
|
|
@@ -179,11 +175,6 @@ nonebot.load_plugin("nonebot_plugin_bugu")
|
|
|
179
175
|
四个接口都是按需拉取并缓存 6 小时,图片按 URL 缓存 30 天,正常使用打不了几发请求。
|
|
180
176
|
遇到 429 会提示「请求太频繁」,等一会儿再试。
|
|
181
177
|
|
|
182
|
-
**Q:为什么收集进度不能和网页同步?**
|
|
183
|
-
|
|
184
|
-
网页同步依赖账号密码,插件不保存用户密码。需要的只是「我收集了哪些」,
|
|
185
|
-
本机记录已经够用,也不会因为换 bot 环境而泄露账号。
|
|
186
|
-
|
|
187
178
|
## 开发
|
|
188
179
|
|
|
189
180
|
```bash
|
|
@@ -200,9 +191,8 @@ nonebot_plugin_bugu/
|
|
|
200
191
|
├── config.py # 配置项
|
|
201
192
|
├── api.py # 四个接口的客户端 + 内存 / 磁盘缓存
|
|
202
193
|
├── values.py # 字段兜底与通用小工具
|
|
203
|
-
├── draw.py #
|
|
194
|
+
├── draw.py # 共用绘制:画布、字体、折行、胶囊、页脚、分页卡片
|
|
204
195
|
├── fonts.py # 中文字体探测
|
|
205
|
-
├── collection.py # 收集进度存储(按 QQ 号)
|
|
206
196
|
├── runtime.py # 单例:客户端 / 字体 / 进度
|
|
207
197
|
├── commands.py # 命令注册与分发
|
|
208
198
|
└── features/
|
|
@@ -210,8 +200,7 @@ nonebot_plugin_bugu/
|
|
|
210
200
|
├── starsea/ # data / search / render / reply
|
|
211
201
|
├── recipes/ # data / search / render / reply
|
|
212
202
|
├── neighbors/ # data / render / reply
|
|
213
|
-
|
|
214
|
-
└── collection.py # 收藏命令逻辑
|
|
203
|
+
└── flowers/ # data / render / reply
|
|
215
204
|
```
|
|
216
205
|
|
|
217
206
|
## 许可证
|
|
@@ -8,8 +8,8 @@ from .config import Config
|
|
|
8
8
|
__plugin_meta__ = PluginMetadata(
|
|
9
9
|
name="布谷工具箱",
|
|
10
10
|
description=(
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"星布谷地小助手:菜谱查询、星海地图、友邻备忘、鲜花培育。"
|
|
12
|
+
"数据来自布谷工具箱"
|
|
13
13
|
),
|
|
14
14
|
usage=(
|
|
15
15
|
"/布谷 —— 查看全部指令\n"
|
|
@@ -17,7 +17,6 @@ __plugin_meta__ = PluginMetadata(
|
|
|
17
17
|
"/星海 <词> —— 星海智能查询;/星海地图 / /星海点位 / /星海查\n"
|
|
18
18
|
"/友邻 [名字] [喜爱/好感/反感/关于] —— 友邻档案\n"
|
|
19
19
|
"/鲜花 [品种 / 花名] —— 培育配方与花色\n"
|
|
20
|
-
"/收藏 [名字] —— 标记收集进度\n"
|
|
21
20
|
"/布谷刷新 —— 超管:刷新数据并清空图片缓存"
|
|
22
21
|
),
|
|
23
22
|
type="application",
|
|
@@ -16,14 +16,13 @@ from nonebot.params import CommandArg
|
|
|
16
16
|
from nonebot.permission import SUPERUSER
|
|
17
17
|
|
|
18
18
|
from .api import BuguError
|
|
19
|
-
from .features import collection as collection_feature
|
|
20
19
|
from .features.common import Reply, ReplyEnv, command_start
|
|
21
20
|
from .features.flowers import reply as flower_feature
|
|
22
21
|
from .features.neighbors import reply as neighbor_feature
|
|
23
22
|
from .features.recipes import reply as recipe_feature
|
|
24
23
|
from .features.starsea import reply as starsea_feature
|
|
25
24
|
from .fonts import FontError, FontSet
|
|
26
|
-
from .runtime import get_client, get_config, get_fonts
|
|
25
|
+
from .runtime import get_client, get_config, get_fonts
|
|
27
26
|
|
|
28
27
|
PRIORITY = 12
|
|
29
28
|
|
|
@@ -38,7 +37,6 @@ recipe = on_command("菜谱", priority=PRIORITY, block=True)
|
|
|
38
37
|
recipe_search = on_command("菜谱查", aliases={"菜谱搜索"}, priority=PRIORITY, block=True)
|
|
39
38
|
neighbor = on_command("友邻", aliases={"友邻备忘"}, priority=PRIORITY, block=True)
|
|
40
39
|
flower = on_command("鲜花", aliases={"花谱", "鲜花培育"}, priority=PRIORITY, block=True)
|
|
41
|
-
collection = on_command("收藏", aliases={"布谷收藏"}, priority=PRIORITY, block=True)
|
|
42
40
|
refresh = on_command("布谷刷新", priority=PRIORITY, block=True, permission=SUPERUSER)
|
|
43
41
|
|
|
44
42
|
|
|
@@ -66,18 +64,16 @@ class Cooldown:
|
|
|
66
64
|
_cooldown = Cooldown()
|
|
67
65
|
|
|
68
66
|
|
|
69
|
-
def _env(
|
|
67
|
+
def _env() -> ReplyEnv:
|
|
70
68
|
config = get_config()
|
|
71
69
|
client = get_client(config)
|
|
72
|
-
store = get_store(config)
|
|
73
70
|
fonts: Optional[FontSet] = None
|
|
74
71
|
if config.bugu_image_enabled:
|
|
75
72
|
try:
|
|
76
73
|
fonts = get_fonts(config)
|
|
77
74
|
except FontError as exc:
|
|
78
75
|
logger.warning(f"布谷工具箱没有可用字体,改为纯文字:{exc}")
|
|
79
|
-
|
|
80
|
-
return ReplyEnv(client=client, config=config, fonts=fonts, user_id=user_id, store=store)
|
|
76
|
+
return ReplyEnv(client=client, config=config, fonts=fonts)
|
|
81
77
|
|
|
82
78
|
|
|
83
79
|
def _as_segment(reply: Reply):
|
|
@@ -95,11 +91,13 @@ def help_text() -> str:
|
|
|
95
91
|
"",
|
|
96
92
|
"【星海地图】",
|
|
97
93
|
f" {start}星海 <词> 智能识别区域 / 点位 / 物种",
|
|
94
|
+
f" {start}星海 列表 [大类] [页码] 物种图鉴(出图)",
|
|
98
95
|
f" {start}星海地图 [区域] 区域地图卡片",
|
|
99
|
-
f" {start}星海点位
|
|
96
|
+
f" {start}星海点位 [区域 / 点位名] 区域点位清单 / 点位详情",
|
|
100
97
|
f" {start}星海查 <物种 / 大类> 跨区域搜索",
|
|
101
98
|
"",
|
|
102
99
|
"【菜谱】",
|
|
100
|
+
f" {start}菜谱 列表 [类型 / 厨具 / 词] [页码] 翻目录(出图)",
|
|
103
101
|
f" {start}菜谱 <菜名 / 编号> 菜谱卡片",
|
|
104
102
|
f" {start}菜谱查 <食材 / 类型 / 厨具> 搜索筛选",
|
|
105
103
|
f" {start}菜谱 随机 随手看一道",
|
|
@@ -112,11 +110,6 @@ def help_text() -> str:
|
|
|
112
110
|
f" {start}鲜花 品种列表",
|
|
113
111
|
f" {start}鲜花 <品种 / 花名> 杂交配方与花色",
|
|
114
112
|
"",
|
|
115
|
-
"【收集进度】",
|
|
116
|
-
f" {start}收藏 总览",
|
|
117
|
-
f" {start}收藏 <名字> 标记 / 取消",
|
|
118
|
-
f" {start}收藏 星海 / 鲜花 / 菜谱 分类进度",
|
|
119
|
-
"",
|
|
120
113
|
"数据来源:布谷工具箱 bugu.nsun200512.cc",
|
|
121
114
|
]
|
|
122
115
|
)
|
|
@@ -134,12 +127,10 @@ async def _run(
|
|
|
134
127
|
matcher_name: str,
|
|
135
128
|
cooldown: bool = True,
|
|
136
129
|
) -> None:
|
|
137
|
-
env = _env(
|
|
138
|
-
if env.store is not None:
|
|
139
|
-
await env.store.ensure_loaded()
|
|
130
|
+
env = _env()
|
|
140
131
|
|
|
141
132
|
if cooldown and env.config.bugu_cooldown_seconds:
|
|
142
|
-
left = _cooldown.remaining(f"{
|
|
133
|
+
left = _cooldown.remaining(f"{event.get_user_id()}:{matcher_name}", env.config.bugu_cooldown_seconds)
|
|
143
134
|
if left > 0:
|
|
144
135
|
await matcher.finish(f"慢一点,{left:.0f} 秒后再试")
|
|
145
136
|
|
|
@@ -205,11 +196,6 @@ async def _handle_flower(event: MessageEvent, arg: Message = CommandArg()) -> No
|
|
|
205
196
|
await _run(flower, event, arg, flower_feature.reply_flowers, matcher_name="flower")
|
|
206
197
|
|
|
207
198
|
|
|
208
|
-
@collection.handle()
|
|
209
|
-
async def _handle_collection(event: MessageEvent, arg: Message = CommandArg()) -> None:
|
|
210
|
-
await _run(collection, event, arg, collection_feature.reply_collection, matcher_name="collection", cooldown=False)
|
|
211
|
-
|
|
212
|
-
|
|
213
199
|
@refresh.handle()
|
|
214
200
|
async def _handle_refresh() -> None:
|
|
215
201
|
config = get_config()
|
|
@@ -58,10 +58,6 @@ class Config(BaseModel):
|
|
|
58
58
|
default=0,
|
|
59
59
|
description="粗体字体文件内的索引(.ttc 集合文件用)",
|
|
60
60
|
)
|
|
61
|
-
bugu_collection_path: str = Field(
|
|
62
|
-
default="",
|
|
63
|
-
description="收集进度文件路径,留空用 nonebot-plugin-localstore 的 data 目录",
|
|
64
|
-
)
|
|
65
61
|
|
|
66
62
|
@field_validator("bugu_api_base")
|
|
67
63
|
@classmethod
|
|
@@ -38,7 +38,6 @@ BADGE_BLUE = (32, 52, 92)
|
|
|
38
38
|
BADGE_BLUE_LINE = (108, 148, 210)
|
|
39
39
|
TYPE_CHIP_INK = (42, 33, 24)
|
|
40
40
|
SPECIALTY_BLUE = (59, 130, 196)
|
|
41
|
-
GREEN = (76, 175, 98)
|
|
42
41
|
|
|
43
42
|
GRADE_COLORS = {
|
|
44
43
|
"S": (198, 158, 58),
|
|
@@ -314,30 +313,6 @@ def number_badge(
|
|
|
314
313
|
draw.text((cx, cy), str(number), font=font, fill=ink, anchor="mm")
|
|
315
314
|
|
|
316
315
|
|
|
317
|
-
def check_mark(
|
|
318
|
-
draw: ImageDraw.ImageDraw,
|
|
319
|
-
cx: float,
|
|
320
|
-
cy: float,
|
|
321
|
-
radius: int,
|
|
322
|
-
*,
|
|
323
|
-
fill=GREEN,
|
|
324
|
-
outline=(11, 16, 36),
|
|
325
|
-
) -> None:
|
|
326
|
-
"""右上角的绿色对勾(收集进度)。"""
|
|
327
|
-
draw.ellipse(
|
|
328
|
-
[cx - radius, cy - radius, cx + radius, cy + radius],
|
|
329
|
-
fill=fill,
|
|
330
|
-
outline=outline,
|
|
331
|
-
width=2,
|
|
332
|
-
)
|
|
333
|
-
r = radius * 0.5
|
|
334
|
-
draw.line(
|
|
335
|
-
[(cx - r * 0.8, cy + r * 0.1), (cx - r * 0.2, cy + r * 0.7), (cx + r, cy - r * 0.68)],
|
|
336
|
-
fill=(255, 255, 255),
|
|
337
|
-
width=max(2, radius // 5),
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
|
|
341
316
|
def icon_disc(
|
|
342
317
|
canvas: Image.Image,
|
|
343
318
|
draw: ImageDraw.ImageDraw,
|
|
@@ -378,6 +353,16 @@ def encode(image: Image.Image) -> bytes:
|
|
|
378
353
|
return buffer.getvalue()
|
|
379
354
|
|
|
380
355
|
|
|
356
|
+
def flatten(content: Image.Image, width: int) -> bytes:
|
|
357
|
+
"""把透明内容层贴到渐变底上并编码(目录类卡片没有额外页脚时用)。"""
|
|
358
|
+
bbox = content.getbbox()
|
|
359
|
+
height = bbox[3] if bbox else 1
|
|
360
|
+
height = max(1, min(height, content.height))
|
|
361
|
+
canvas = background(width, height)
|
|
362
|
+
canvas.alpha_composite(content.crop((0, 0, width, height)))
|
|
363
|
+
return encode(canvas)
|
|
364
|
+
|
|
365
|
+
|
|
381
366
|
def finish(
|
|
382
367
|
content: Image.Image,
|
|
383
368
|
width: int,
|
{nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/common.py
RENAMED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
|
+
import math
|
|
6
7
|
from dataclasses import dataclass
|
|
7
|
-
from typing import Callable, Optional,
|
|
8
|
+
from typing import Callable, List, Optional, Sequence, Tuple, Union
|
|
8
9
|
|
|
9
10
|
import nonebot
|
|
10
11
|
from nonebot.log import logger
|
|
11
12
|
|
|
12
13
|
from ..api import BuguClient
|
|
13
|
-
from ..collection import KINDS, CollectionStore
|
|
14
14
|
from ..config import Config
|
|
15
15
|
from ..draw import DrawError
|
|
16
16
|
from ..fonts import FontError, FontSet
|
|
@@ -25,36 +25,6 @@ class ReplyEnv:
|
|
|
25
25
|
client: BuguClient
|
|
26
26
|
config: Config
|
|
27
27
|
fonts: Optional[FontSet]
|
|
28
|
-
user_id: str = ""
|
|
29
|
-
store: Optional[CollectionStore] = None
|
|
30
|
-
|
|
31
|
-
def collected(self, kind: str) -> Set[str]:
|
|
32
|
-
"""当前用户某一类的收集集合(没有登录态 / 没存过就是空集)。"""
|
|
33
|
-
if self.store is None or not self.user_id:
|
|
34
|
-
return set()
|
|
35
|
-
return self.store.items(self.user_id, kind)
|
|
36
|
-
|
|
37
|
-
def collected_ids(self, kind: str) -> Set[int]:
|
|
38
|
-
"""星海物种 / 菜谱的 key 是数字,这里直接转好。"""
|
|
39
|
-
out: Set[int] = set()
|
|
40
|
-
for value in self.collected(kind):
|
|
41
|
-
try:
|
|
42
|
-
out.add(int(value))
|
|
43
|
-
except (TypeError, ValueError):
|
|
44
|
-
continue
|
|
45
|
-
return out
|
|
46
|
-
|
|
47
|
-
@property
|
|
48
|
-
def collected_totals(self) -> dict:
|
|
49
|
-
"""各类进度条数(用于「收藏」概览)。"""
|
|
50
|
-
if self.store is None or not self.user_id:
|
|
51
|
-
return {}
|
|
52
|
-
return {kind: len(self.store.items(self.user_id, kind)) for kind in KINDS}
|
|
53
|
-
|
|
54
|
-
def is_collected(self, kind: str, key) -> bool:
|
|
55
|
-
if self.store is None or not self.user_id:
|
|
56
|
-
return False
|
|
57
|
-
return self.store.has(self.user_id, kind, key)
|
|
58
28
|
|
|
59
29
|
@property
|
|
60
30
|
def can_render(self) -> bool:
|
|
@@ -98,3 +68,34 @@ async def render_card(
|
|
|
98
68
|
except Exception:
|
|
99
69
|
logger.opt(exception=True).error(f"{label}渲染异常")
|
|
100
70
|
return None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# ------------------------------------------------------------------ 分页
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def paginate(
|
|
77
|
+
items: Sequence,
|
|
78
|
+
page: int,
|
|
79
|
+
per_page: int = 15,
|
|
80
|
+
) -> Tuple[List, int, int]:
|
|
81
|
+
"""按页切片,返回 ``(当前页内容, 实际页码, 总页数)``。"""
|
|
82
|
+
total_pages = max(1, math.ceil(len(items) / max(1, per_page)))
|
|
83
|
+
page = min(max(1, int(page or 1)), total_pages)
|
|
84
|
+
start = (page - 1) * per_page
|
|
85
|
+
return list(items[start : start + per_page]), page, total_pages
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def split_page(tokens: Sequence[str]) -> Tuple[List[str], int]:
|
|
89
|
+
"""最后一个纯数字 token 当作页码:``["简单", "2"]`` → ``(["简单"], 2)``。"""
|
|
90
|
+
items = [token for token in tokens if token]
|
|
91
|
+
if items and items[-1].isdigit():
|
|
92
|
+
return items[:-1], int(items[-1])
|
|
93
|
+
return items, 1
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def page_footer(current: int, total: int, command: str, spec: str = "") -> str:
|
|
97
|
+
"""分页页脚:告诉用户怎么翻页 / 看详情。"""
|
|
98
|
+
suffix = f" {spec}" if spec else ""
|
|
99
|
+
if current < total:
|
|
100
|
+
return usage(f"{command}{suffix} {current + 1} 看下一页")
|
|
101
|
+
return usage(f"{command}{suffix} 1 回到第一页")
|
{nonebot_plugin_bugu-0.2.1 → nonebot_plugin_bugu-0.4.0}/nonebot_plugin_bugu/features/flowers/data.py
RENAMED
|
@@ -110,9 +110,6 @@ class FlowerBook:
|
|
|
110
110
|
def is_star_seed(self, species: str) -> bool:
|
|
111
111
|
return self.area_of(species).startswith("星海花种")
|
|
112
112
|
|
|
113
|
-
def collected_names(self, species: str) -> List[str]:
|
|
114
|
-
return [f.name for f in self.flowers_of(species)]
|
|
115
|
-
|
|
116
113
|
|
|
117
114
|
def parse_flowers(payload: Dict[str, Any], base: str) -> FlowerBook:
|
|
118
115
|
if not isinstance(payload, dict):
|
|
@@ -14,7 +14,6 @@ from ...draw import (
|
|
|
14
14
|
YELLOW,
|
|
15
15
|
Draw,
|
|
16
16
|
bold_text,
|
|
17
|
-
check_mark,
|
|
18
17
|
chip,
|
|
19
18
|
finish,
|
|
20
19
|
fit_text,
|
|
@@ -136,8 +135,6 @@ def _draw_tile(
|
|
|
136
135
|
cy: float,
|
|
137
136
|
radius: int,
|
|
138
137
|
fonts: FontSet,
|
|
139
|
-
*,
|
|
140
|
-
done: bool = False,
|
|
141
138
|
) -> None:
|
|
142
139
|
icon = open_image(icon_bytes, "鲜花图标")
|
|
143
140
|
icon_disc(
|
|
@@ -163,9 +160,6 @@ def _draw_tile(
|
|
|
163
160
|
)
|
|
164
161
|
draw.text((bx, by), flower.grade, font=fonts.get(13, True), fill=TYPE_CHIP_INK, anchor="mm")
|
|
165
162
|
|
|
166
|
-
if done:
|
|
167
|
-
check_mark(draw, cx + radius * 0.72, cy - radius * 0.72, 11)
|
|
168
|
-
|
|
169
163
|
font = fonts.get(15)
|
|
170
164
|
for i, line in enumerate(wrap_text(draw, flower.name, font, radius * 3, max_lines=1)):
|
|
171
165
|
draw.text((cx, cy + radius + 8 + i * 19), line, font=font, fill=CREAM, anchor="mt")
|
|
@@ -193,7 +187,6 @@ def render_flower_card(
|
|
|
193
187
|
*,
|
|
194
188
|
fonts: Optional[FontSet] = None,
|
|
195
189
|
width: int = 1040,
|
|
196
|
-
collected: Optional[set] = None,
|
|
197
190
|
) -> bytes:
|
|
198
191
|
require_pillow()
|
|
199
192
|
font_set = resolve_fontset(fonts)
|
|
@@ -288,7 +281,6 @@ def render_flower_card(
|
|
|
288
281
|
cy,
|
|
289
282
|
38,
|
|
290
283
|
font_set,
|
|
291
|
-
done=bool(collected and flower.name in collected),
|
|
292
284
|
)
|
|
293
285
|
|
|
294
286
|
return finish(
|
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from typing import List
|
|
6
6
|
|
|
7
|
-
from ...collection import KIND_FLOWER
|
|
8
7
|
from ...values import grade_text
|
|
9
8
|
from ..common import Reply, ReplyEnv, render_card, usage
|
|
10
9
|
from .data import Flower, FlowerBook
|
|
@@ -89,7 +88,6 @@ async def _species_reply(book: FlowerBook, species: str, env: ReplyEnv) -> Reply
|
|
|
89
88
|
species,
|
|
90
89
|
{name: fetched.get(url) for name, url in url_map.items()},
|
|
91
90
|
fonts=env.fonts,
|
|
92
|
-
collected=env.collected(KIND_FLOWER) or None,
|
|
93
91
|
label="鲜花培育卡片",
|
|
94
92
|
)
|
|
95
93
|
return png if png is not None else species_text(book, species)
|