Skip to content

Commit 68e3050

Browse files
committed
feat: add independent cover message auto-recall option
1 parent c58ec29 commit 68e3050

6 files changed

Lines changed: 87 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
所有版本更新记录。
44

5+
## **v2.6.5** (2026-01-09)
6+
7+
### 新增功能
8+
- **封面消息自动撤回** - 新增 `cover_recall_enabled` 配置项
9+
- 与文件撤回独立控制,可单独开启
10+
- 仅支持 QQ/NapCat 平台
11+
- 共用 `auto_recall_delay` 延迟设置
12+
13+
### 改进
14+
- **配置项分组优化** - 重新排序配置项,按功能分组
15+
- 基础设置、网络设置、下载设置、打包设置
16+
- 发送设置(含封面撤回、文件撤回、撤回延迟)
17+
- 权限设置、账号设置、其他设置
18+
19+
---
20+
521
## **v2.6.4** (2026-01-05)
622

723
### 新增功能

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<br>
1212
<div align="center">
13-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/VERSION-v2.6.4-E91E63?style=for-the-badge" alt="Version"></a>
13+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/VERSION-v2.6.5-E91E63?style=for-the-badge" alt="Version"></a>
1414
<a href="https://github.com/GEMILUXVII/astrbot_plugin_jm_cosmos/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0-009688?style=for-the-badge" alt="License"></a>
1515
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/PYTHON-3.10+-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python"></a>
1616
<a href="https://github.com/AstrBotDevs/AstrBot"><img src="https://img.shields.io/badge/AstrBot-Compatible-00BFA5?style=for-the-badge&logo=robot&logoColor=white" alt="AstrBot Compatible"></a>
@@ -19,7 +19,7 @@
1919
<div align="center">
2020
<a href="https://pypi.org/project/jmcomic/"><img src="https://img.shields.io/badge/JMCOMIC-≥2.5.0-9C27B0?style=for-the-badge" alt="JMComic"></a>
2121
<a href="https://github.com/botuniverse/onebot-11"><img src="https://img.shields.io/badge/OneBotv11-AIOCQHTTP-FF5722?style=for-the-badge&logo=qq&logoColor=white" alt="OneBot v11 Support"></a>
22-
<a href="https://github.com/GEMILUXVII/astrbot_plugin_jm_cosmos"><img src="https://img.shields.io/badge/UPDATED-2026.01.05-2196F3?style=for-the-badge" alt="Updated"></a>
22+
<a href="https://github.com/GEMILUXVII/astrbot_plugin_jm_cosmos"><img src="https://img.shields.io/badge/UPDATED-2026.01.09-2196F3?style=for-the-badge" alt="Updated"></a>
2323
</div>
2424

2525
## 介绍
@@ -254,16 +254,17 @@ pip install -r requirements.txt
254254
| `filename_show_password` | 文件名显示密码提示 | `false` | 开启后文件名末尾添加 #PWxxx |
255255
| `auto_delete_after_send` | 发送后自动删除 | `true` | |
256256
| `send_cover_preview` | 发送封面预览 | `true` | |
257-
| `auto_recall_enabled` | 自动撤回文件消息 | `false` | 仅支持 QQ/NapCat 平台 |
258-
| `auto_recall_delay` | 自动撤回延迟 (秒) | `60` | 建议 30-120 |
257+
| `cover_recall_enabled` | 封面消息自动撤回 | `false` | 仅支持 QQ/NapCat 平台 |
258+
| `auto_recall_enabled` | 文件消息自动撤回 | `false` | 仅支持 QQ/NapCat 平台 |
259+
| `auto_recall_delay` | 撤回延迟 (秒) | `60` | 建议 30-120 |
259260
| `enabled_groups` | 启用的群列表 || 逗号分隔,空=全部启用 |
260261
| `admin_only` | 仅管理员可用 | `false` | |
261262
| `admin_list` | 管理员 ID 列表 || 逗号分隔,不受下载限制 |
263+
| `jm_username` | JM账号用户名 || 面板配置可自动登录 |
264+
| `jm_password` | JM账号密码 || 命令登录重启后失效 |
262265
| `search_page_size` | 搜索结果数量 | `5` | |
263266
| `daily_download_limit` | 每日下载限制 | `0` | 0=不限,管理员豁免 |
264267
| `debug_mode` | 调试模式 | `false` | |
265-
| `jm_username` | JM账号用户名 || 面板配置可自动登录 |
266-
| `jm_password` | JM账号密码 || 命令登录重启后失效 |
267268

268269
## 文件结构
269270

@@ -374,7 +375,7 @@ proxy_url: http://127.0.0.1:7890
374375

375376
查看完整更新日志:[CHANGELOG.md](./CHANGELOG.md)
376377

377-
**当前版本:v2.6.4** - 新增每日下载次数限制,插件管理员不受此限制
378+
**当前版本:v2.6.5** - 新增封面消息自动撤回功能,配置项按功能分组重排
378379

379380
## 注意事项
380381

_conf_schema.json

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,24 @@
8585
"hint": "下载前是否发送漫画封面图片预览",
8686
"default": true
8787
},
88+
"cover_recall_enabled": {
89+
"type": "bool",
90+
"description": "封面消息自动撤回",
91+
"hint": "开启后封面预览消息会自动撤回(仅支持 QQ/NapCat 平台)",
92+
"default": false
93+
},
94+
"auto_recall_enabled": {
95+
"type": "bool",
96+
"description": "文件消息自动撤回",
97+
"hint": "发送文件后自动撤回(仅支持 QQ/NapCat 平台)",
98+
"default": false
99+
},
100+
"auto_recall_delay": {
101+
"type": "int",
102+
"description": "撤回延迟(秒)",
103+
"hint": "发送后多少秒自动撤回,建议30-120",
104+
"default": 60
105+
},
88106
"enabled_groups": {
89107
"type": "string",
90108
"description": "启用的群列表",
@@ -103,18 +121,6 @@
103121
"hint": "以逗号分隔的用户ID列表,这些用户拥有管理员权限",
104122
"default": ""
105123
},
106-
"search_page_size": {
107-
"type": "int",
108-
"description": "搜索结果每页数量",
109-
"hint": "每次搜索返回的结果数量",
110-
"default": 5
111-
},
112-
"debug_mode": {
113-
"type": "bool",
114-
"description": "调试模式",
115-
"hint": "开启后会输出详细的调试日志",
116-
"default": false
117-
},
118124
"jm_username": {
119125
"type": "string",
120126
"description": "JM账号用户名",
@@ -127,22 +133,22 @@
127133
"hint": "配合用户名使用,支持自动登录(可选)",
128134
"default": ""
129135
},
130-
"auto_recall_enabled": {
131-
"type": "bool",
132-
"description": "自动撤回文件消息",
133-
"hint": "发送文件后自动撤回(仅支持 QQ/NapCat 平台)",
134-
"default": false
135-
},
136-
"auto_recall_delay": {
136+
"search_page_size": {
137137
"type": "int",
138-
"description": "撤回延迟(秒)",
139-
"hint": "发送后多少秒自动撤回,建议30-120",
140-
"default": 60
138+
"description": "搜索结果每页数量",
139+
"hint": "每次搜索返回的结果数量",
140+
"default": 5
141141
},
142142
"daily_download_limit": {
143143
"type": "int",
144144
"description": "每日下载次数限制",
145145
"hint": "每个用户每天最多下载次数,0 表示不限制",
146146
"default": 0
147+
},
148+
"debug_mode": {
149+
"type": "bool",
150+
"description": "调试模式",
151+
"hint": "开启后会输出详细的调试日志",
152+
"default": false
147153
}
148154
}

core/base/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def send_cover_preview(self) -> bool:
9696
"""是否发送封面预览"""
9797
return self.plugin_config.get("send_cover_preview", True)
9898

99+
@property
100+
def cover_recall_enabled(self) -> bool:
101+
"""是否启用封面消息自动撤回"""
102+
return self.plugin_config.get("cover_recall_enabled", False)
103+
99104
@property
100105
def admin_only(self) -> bool:
101106
"""是否仅管理员可用"""

main.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"jm_cosmos2",
3030
"GEMILUXVII",
3131
"JM漫画下载插件 - 支持搜索、下载禁漫天堂的漫画本子,支持加密PDF/ZIP打包",
32-
"2.6.4",
32+
"2.6.5",
3333
"https://github.com/GEMILUXVII/astrbot_plugin_jm_cosmos",
3434
)
3535
class JMCosmosPlugin(Star):
@@ -152,12 +152,25 @@ async def download_album_command(
152152
cover_path = await self.browser.get_album_cover(album_id, cover_dir)
153153

154154
if cover_path and cover_path.exists():
155-
yield event.chain_result(
155+
# 构建封面消息链
156+
from astrbot.api.event import MessageChain
157+
158+
cover_chain = MessageChain(
156159
[
157160
Comp.Image(file=str(cover_path)),
158161
Comp.Plain(MessageFormatter.format_album_info(detail)),
159162
]
160163
)
164+
165+
# 根据配置决定是否对封面消息自动撤回
166+
if self.config_manager.cover_recall_enabled:
167+
await send_with_recall(
168+
event,
169+
cover_chain,
170+
self.config_manager.auto_recall_delay,
171+
)
172+
else:
173+
yield event.chain_result(cover_chain.chain)
161174
else:
162175
yield event.plain_result(
163176
MessageFormatter.format_album_info(detail)
@@ -496,12 +509,25 @@ async def info_command(self, event: AstrMessageEvent, album_id: str = None):
496509
cover_path = await self.browser.get_album_cover(album_id, cover_dir)
497510

498511
if cover_path and cover_path.exists():
499-
yield event.chain_result(
512+
# 构建封面消息链
513+
from astrbot.api.event import MessageChain
514+
515+
cover_chain = MessageChain(
500516
[
501517
Comp.Image(file=str(cover_path)),
502518
Comp.Plain(MessageFormatter.format_album_info(detail)),
503519
]
504520
)
521+
522+
# 根据配置决定是否对封面消息自动撤回
523+
if self.config_manager.cover_recall_enabled:
524+
await send_with_recall(
525+
event,
526+
cover_chain,
527+
self.config_manager.auto_recall_delay,
528+
)
529+
else:
530+
yield event.chain_result(cover_chain.chain)
505531
else:
506532
yield event.plain_result(MessageFormatter.format_album_info(detail))
507533
else:

metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: JM-Cosmos II
22
desc: JM漫画下载插件 - 支持搜索、下载禁漫天堂的漫画本子,基于jmcomic库,支持加密PDF/ZIP打包
3-
version: v2.6.4
3+
version: v2.6.5
44
author: GEMILUXVII
55
repo: https://github.com/GEMILUXVII/astrbot_plugin_jm_cosmos

0 commit comments

Comments
 (0)