From 74dc33fee694d25158814f950829de84b1753614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Sun, 5 Jul 2026 11:10:44 +0800 Subject: [PATCH] fix: return real used_space/total_space for get_group_file_system_info (#1944) The action hardcoded used_space=0 and total_space=10GiB. The kernel's getGroupFileList call already returns the group's space usage in its groupSpaceResult, so read it (a single-item fetch) instead of the placeholders. Falls back to the previous constants when the field is absent, so there is no regression. Also relax the empty-count guard from `!groupFileCount` to `=== undefined` so a group with zero files is not mistaken for "Group not found". --- packages/napcat-core/apis/group.ts | 18 ++++++++++++++++++ .../action/go-cqhttp/GetGroupFileSystemInfo.ts | 15 +++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/napcat-core/apis/group.ts b/packages/napcat-core/apis/group.ts index 3400a9d98..93b34fb09 100644 --- a/packages/napcat-core/apis/group.ts +++ b/packages/napcat-core/apis/group.ts @@ -430,6 +430,24 @@ export class NTQQGroupApi { return this.context.session.getRichMediaService().batchGetGroupFileCount(groupCodes); } + // getGroupFileList also carries the group's used/total space in its call + // result's `groupSpaceResult`; a single-item fetch is enough to read it. + async getGroupFileSpace (groupCode: string) { + const [result] = await this.core.eventWrapper.callNormalEventV2( + 'NodeIKernelRichMediaService/getGroupFileList', + 'NodeIKernelMsgListener/onGroupFileInfoUpdate', + [ + groupCode, + { sortType: 1, fileCount: 1, startIndex: 0, sortOrder: 1, showOnlinedocFolder: 0 }, + ], + () => true, + () => true, + 1, + 5000 + ); + return result?.groupSpaceResult; + } + async getArkJsonGroupShare (groupCode: string) { const ret = await this.core.eventWrapper.callNoListenerEvent( 'NodeIKernelGroupService/getGroupRecommendContactArkJson', diff --git a/packages/napcat-onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts b/packages/napcat-onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts index 1a01b61e9..25bc476b7 100644 --- a/packages/napcat-onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts +++ b/packages/napcat-onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts @@ -29,15 +29,22 @@ export class GetGroupFileSystemInfo extends OneBotAction