系统版本
版本 Windows 11 专业工作站版 版本号 26H1 操作系统版本 28000.2113 功能包 Windows 功能体验包 1000.26100.298.0
QQNT 版本
版本: 9.9.30-48762 (64位)
LLBot 版本
7.12.15
Milky 客户端
nonebot-adapter-milky=1.2.0、nonebot2=2.5.0
发生了什么?
[ERROR] nonebot_plugin_test | 发送群公告失败,操作被拒绝: ActionFailed(status='failed', retcode=-500, message='pic format is incorrect')
如何复现
经调试验证后非应用端(nonebot2以及milky适配器)问题,URL、Path、Base64都发不出去
code
async def _resolve_image_path(image: UniImage) -> Path | None:
raw = getattr(image, "raw", None)
if raw is not None:
raw_bytes = raw.getvalue() if isinstance(raw, BytesIO) else raw
cache_dir = plugin_config.cache_dir / "announcement_images"
cache_dir.mkdir(parents=True, exist_ok=True)
md5 = hashlib.md5(raw_bytes).hexdigest()
cache_path = cache_dir / f"{md5}.png"
cache_path.write_bytes(raw_bytes)
return cache_path
path = getattr(image, "path", None)
if path is not None:
return Path(path)
url = getattr(image, "url", None)
if url is not None:
driver = get_driver()
get_session = getattr(driver, "get_session", None)
if get_session is not None:
async with get_session() as session:
request = Request("GET", url)
response = await session.request(request)
content = response.content
cache_dir = plugin_config.cache_dir / "announcement_images"
cache_dir.mkdir(parents=True, exist_ok=True)
md5 = hashlib.md5(content).hexdigest()
cache_path = cache_dir / f"{md5}.png"
cache_path.write_bytes(content)
return cache_path
return None
send_group_announcement_cmd: type[AlconnaMatcher] = on_alconna(
command=Alconna("发送群公告", Args["content", str]["image?", UniImage, None]),
aliases={"发群公告", "群公告"},
priority=5,
block=True,
use_cmd_sep=True,
use_cmd_start=True,
)
@send_group_announcement_cmd.handle()
async def milkybot_send_group_announcement(
content: str,
image: UniImage,
bot: MilkyBot,
event: MilkyGroupMessageEvent,
) -> Any:
image_path = await _resolve_image_path(image)
await run_group_action(
send_group_announcement_cmd,
await _("发送群公告"),
lambda: bot.send_group_announcement(
group_id=event.data.peer_id,
content=content,
path=image_path,
),
await _("群公告已发送"),
)
期望的结果?
成功发布群公告
LLBot 运行日志
2026-05-25 01:18:07 [I] core [收-群] 测试群(86825****) [用户昵称](13305****):
群公告 测试[图片]ABC1D2E3F4A5B6C7D8E9F0A1B2C3D4E5.jpg
2026-05-25 01:18:07 [I] ntqq-file-api 发包获取rkey成功, private:&rkey=CAISMCovykMUV94ZDz9z...[PROTECTED]...8g, group:&rkey=CAESMCG-E9NuZifkDHE...[PROTECTED]...fw
2026-05-25 01:18:07 [W] milky-adapter Milky Error while handling API /send_group_announcement: pic format is incorrect
2026-05-25 01:18:07 [I] milky-adapter MilkyHttp 127.0.0.1 -> /api/send_group_announcement (-500 98ms) { group_id: 86825****, content: '测试', image_uri: 'file:///[LOCAL_PATH]/cache/nonebot_plugin_lingchu_bot/announcement_images/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6.png' }
2026-05-25 01:18:08 [I] core [发-群] 测试群(86825****) Canary(32160****):
发送群公告失败,操作被拒绝: ActionFailed(status='failed', retcode=-500, message='pic format is incorrect')
2026-05-25 01:18:08 [I] milky-adapter 消息发送 { chatType: 2, peerUid: '86825****', guildId: '' }
2026-05-25 01:18:08 [I] milky-adapter MilkyHttp 127.0.0.1 -> /api/send_group_message (OK 520ms) { group_id: 86825****, message: [ { type: 'text', data: { text: "发送群公告失败,操作被拒绝: ActionFailed(status='failed', retcode=-500, message='pic format is incorrect')" } } ] }
Milky 客户端运行日志
05-25 00:36:07 [SUCCESS] nonebot | NoneBot is initializing...
05-25 00:36:07 [INFO] nonebot | Current Env: dev
05-25 00:36:07 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi+~httpx+~websockets', 'host': IPv4Address('0.0.0.0'), 'port': 8080, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': {'987654321', '654321098'}, 'nickname': set(), 'command_start': {'/', ''}, 'command_sep': {'.', ' '}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'environment': 'dev', 'localstore_use_cwd': True, 'milky_clients': [{'host': '127.0.0.1', 'port': '8716'}], 'alembic_startup_check': False, 'fastapi_openapi_url': '/openapi.json', 'fastapi_docs_url': '/docs', 'fastapi_redoc_url': '/redoc'}
05-25 00:36:07 [DEBUG] nonebot | Succeeded to load adapter "Milky"
05-25 00:36:07 [INFO] nonebot_plugin_docs | Nonebot docs will be running at: http://localhost:8080/website/
05-25 00:36:07 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_docs"
05-25 00:36:07 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
05-25 00:36:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
05-25 00:36:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna:uniseg" from "nonebot_plugin_alconna.uniseg"
05-25 00:36:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_waiter"
05-25 00:36:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna"
05-25 00:36:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_bot_core" from "src.plugins.nonebot_plugin_bot_core"
05-25 00:36:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlkit"
05-25 00:36:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
05-25 00:36:09 [SUCCESS] nonebot | Running NoneBot...
05-25 00:36:09 [SUCCESS] nonebot | Loaded adapters: Milky
05-25 00:36:09 [INFO] uvicorn | Started server process [25396]
05-25 00:36:09 [INFO] uvicorn | Waiting for application startup.
05-25 00:36:09 [WARNING] nonebot_plugin_orm | 跳过启动检查, 正在同步数据库模式...
05-25 00:36:09 [DEBUG] alembic | Context impl SQLiteImpl.
05-25 00:36:09 [DEBUG] alembic | Will assume non-transactional DDL.
05-25 00:36:09 [DEBUG] alembic | setting up autogenerate plugin alembic.autogenerate.schemas
05-25 00:36:09 [DEBUG] alembic | setting up autogenerate plugin alembic.autogenerate.tables
05-25 00:36:09 [DEBUG] alembic | setting up autogenerate plugin alembic.autogenerate.types
05-25 00:36:09 [DEBUG] alembic | setting up autogenerate plugin alembic.autogenerate.constraints
05-25 00:36:09 [DEBUG] alembic | setting up autogenerate plugin alembic.autogenerate.defaults
05-25 00:36:09 [DEBUG] alembic | setting up autogenerate plugin alembic.autogenerate.comments
05-25 00:36:09 [INFO] nonebot_plugin_htmlkit | Initializing fontconfig...
Fontconfig error: Cannot load default config file: No such file: (null)
05-25 00:36:09 [INFO] nonebot_plugin_htmlkit | Fontconfig initialized.
05-25 00:36:09 [INFO] nonebot_plugin_htmlkit | Got HTTP session.
05-25 00:36:09 [INFO] nonebot_plugin_apscheduler | Scheduler Started
05-25 00:36:09 [INFO] uvicorn | Application startup complete.
05-25 00:36:09 [INFO] uvicorn | Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
05-25 00:36:09 [DEBUG] nonebot | Milky | WebSocket Connection to ws://127.0.0.1:8716/event established
05-25 00:36:09 [INFO] nonebot | Milky | Bot 1122334455 connected
05-25 00:55:21 [SUCCESS] nonebot | Milky 1122334455 | [message:group]: Message 16690 from 987654321 in 123456789: 群公告 测试[image: {'resource_id': 'ResourceID_Placeholder_B', 'temp_url': 'https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=ResourceID_Placeholder_B&spec=0&rkey=RKey_Placeholder_B', 'width': 579, 'height': 819, 'summary': '[图片]', 'sub_type': 'normal'}]
05-25 00:55:21 [DEBUG] nonebot | Checking for matchers in priority 5...
05-25 00:55:21 [DEBUG] nonebot | Plugin-Alconna | Alconna::发送群公告 对 "群公告 测试[image]" 的解析结果是 (matched=True, header_match=(origin='群公告' result='发送群公告' matched=True groups={}), main_args={'content': '测试', 'image': Image(id='ResourceID_Placeholder_B', url='https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=ResourceID_Placeholder_B&spec=0&rkey=RKey_Placeholder_B', path=None, raw=None, mimetype=None, name='image.png', width=None, height=None, sticker=False)})
05-25 00:55:21 [INFO] nonebot | Event will be handled by AlconnaMatcherMeta(type='', command=Alconna::发送群公告, module=src.plugins.nonebot_plugin_bot_core.handle.command.group.announcement, lineno=53)
05-25 00:55:21 [DEBUG] nonebot | Running AlconnaMatcher(type='', command=Alconna::发送群公告, module=src.plugins.nonebot_plugin_bot_core.handle.command.group.announcement, lineno=53)
05-25 00:55:21 [DEBUG] nonebot | Running handler Dependent(call=milkybot_send_group_announcement)
05-25 00:55:22 [DEBUG] nonebot | Milky | Bot 1122334455 calling API send_group_announcement
05-25 00:55:22 [ERROR] nonebot_plugin_bot_core | 发送群公告失败,操作被拒绝: ActionFailed(status='failed', retcode=-500, message='pic format is incorrect')
05-25 00:55:22 [DEBUG] nonebot | Milky | Bot 1122334455 calling API send_group_message
05-25 00:55:23 [INFO] nonebot | AlconnaMatcher(type='', command=Alconna::发送群公告, module=src.plugins.nonebot_plugin_bot_core.handle.command.group.announcement, lineno=53) running complete
05-25 00:55:23 [SUCCESS] nonebot | Milky 1122334455 | [message:group]: Message 16691 from 1122334455 in 123456789: 发送群公告失败,操作被拒绝: ActionFailed(status='failed', retcode=-500, message='pic format is incorrect')
05-25 00:55:23 [DEBUG] nonebot | Checking for matchers in priority 5...
05-25 00:55:23 [DEBUG] nonebot | Stop event propagation
05-25 00:55:23 [DEBUG] nonebot | Checking for matchers completed
05-25 00:55:23 [DEBUG] nonebot | Checking for matchers completed
系统版本
版本 Windows 11 专业工作站版 版本号 26H1 操作系统版本 28000.2113 功能包 Windows 功能体验包 1000.26100.298.0
QQNT 版本
版本: 9.9.30-48762 (64位)
LLBot 版本
7.12.15
Milky 客户端
nonebot-adapter-milky=1.2.0、nonebot2=2.5.0
发生了什么?
如何复现
经调试验证后非应用端(nonebot2以及milky适配器)问题,URL、Path、Base64都发不出去
code
期望的结果?
成功发布群公告
LLBot 运行日志
Milky 客户端运行日志