From 8787861a318aabd89d0f00f81c207a2ff64dba2b Mon Sep 17 00:00:00 2001 From: SXP-Simon Date: Sat, 21 Feb 2026 16:36:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(onebot):=20=E4=BF=AE=E5=A4=8D=20NapCat=20?= =?UTF-8?q?=E7=BE=A4=E7=9B=B8=E5=86=8C=E4=B8=8A=E4=BC=A0=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20must=20have=20required=20property=20'album=5Fid'=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BF=AE=E5=A4=8D=20NapCat?= =?UTF-8?q?=20=E7=BE=A4=E7=9B=B8=E5=86=8C=E4=B8=8A=E4=BC=A0=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=20must=20have=20required=20property=20'album?= =?UTF-8?q?=5Fid'=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/adapters/onebot_adapter.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/infrastructure/platform/adapters/onebot_adapter.py b/src/infrastructure/platform/adapters/onebot_adapter.py index 340598a..be93fae 100644 --- a/src/infrastructure/platform/adapters/onebot_adapter.py +++ b/src/infrastructure/platform/adapters/onebot_adapter.py @@ -862,6 +862,19 @@ class OneBotAdapter(PlatformAdapter): bool: 上传是否成功 """ try: + # 如果没有 album_id,尝试获取该群的第一个相册作为默认目标 + # 注意:某些 API (如 upload_image_to_qun_album) 强制要求 album_id + if not album_id: + albums = await self.get_group_album_list(group_id) + if albums: + album_id = str( + albums[0].get("album_id") or albums[0].get("id") or "" + ) + if album_id: + logger.debug( + f"未指定有效的相册,自动选择默认相册 ID: {album_id}" + ) + # 策略 1: 尝试 upload_image_to_qun_album (参考 astrbot_plugin_qun_album) try: params = {