fix(protocol): get_group_file_system_info returns real counts + space (#196)
file_count 恒为 0(且 used_space/limit_count/total_space 是占位/写死值)。根因: 0x6D8 view 命令分三个 subcommand(1=List, 2=Count, 3=Space),但 getCount 错发到 **subCommand 3(Space)** 且 busId=0,并从 pb<1>/pb<2> 读计数——服务端根本没返回 Count 块,于是恒 0。 真机 RE(bot 在测试群传/删文件核对): - Count 走 **0x6D8_2 + busId=6**,响应 Count 块里 fileCount=**field 4**、maxCount(文件 数上限,如 1500)=**field 6**(旧 pb<1>/pb<2> 全落空)。 - Space 走 **0x6D8_3**,响应 Space 块 totalSpace=**field 4**、usedSpace=**field 5**(64 位)。 - 实测:fileCount=4、limitCount=1500、usedSpace=20103729、totalSpace=10737418240。 修复:改 GetGroupFileCount 到 subCommand 2 + busId 6 + 正确 tag;新增 GetGroupFileSpace (0x6D8_3);action 并发查两者,四个字段全返回**服务端实际值**(优于 NapCat 的写死占位)。 含 count/space 编解码回归测试。catalog regen。 typecheck 12 包;protocol 591 / onebot 521 / core 472 全绿。
This commit is contained in:
9 files changed
+146
-32
No files matched your search
@@ -1,7 +1,8 @@
|
||||
// 0x6D8_3 — fetch group file slot usage. Returns the current count
|
||||
// alongside the server-side ceiling (NTQQ's `maxCount` default is
|
||||
// 10000; we surface that fallback so the OneBot action can render
|
||||
// the gauge without a second call when the server elides the field).
|
||||
// 0x6D8_2 — fetch the group file slot count. The 0x6D8 view command splits
|
||||
// into three subcommands: 1=List, 2=Count, 3=Space (see GetGroupFileSpace).
|
||||
// This was previously mis-wired to subCommand 3 (Space) with busId=0, so the
|
||||
// Count block was never returned and file_count always came back 0 (#196).
|
||||
// The count request needs busId=6.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
@@ -17,13 +18,13 @@ export interface GroupFileCount {
|
||||
|
||||
export namespace GetGroupFileCount {
|
||||
export const command = 0x6D8;
|
||||
export const subCommand = 3;
|
||||
export const subCommand = 2;
|
||||
|
||||
export interface Params { groupId: number; }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbGroupFileCountViewReq => ({
|
||||
count: { groupUin: p.groupId, appId: 7, busId: 0 },
|
||||
count: { groupUin: p.groupId, appId: 7, busId: 6 },
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: OidbGroupFileCountViewResp): GroupFileCount => ({
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// 0x6D8_3 — fetch the group file space usage (used / total bytes). Sibling of
|
||||
// GetGroupFileCount (0x6D8_2): the 0x6D8 view command's subCommand 3 = Space.
|
||||
// RE'd from a live query (#196) — the response carries a Space block at field 4
|
||||
// with totalSpace at field 4 and usedSpace at field 5 (both 64-bit).
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
OidbGroupFileCountViewReq, OidbGroupFileCountViewResp,
|
||||
} from '@snowluma/proto-defs/oidb-actions/group-file';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export interface GroupFileSpace {
|
||||
usedSpace: number;
|
||||
totalSpace: number;
|
||||
}
|
||||
|
||||
export namespace GetGroupFileSpace {
|
||||
export const command = 0x6D8;
|
||||
export const subCommand = 3;
|
||||
|
||||
export interface Params { groupId: number; }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (_ctx: Deps, p: Params): OidbGroupFileCountViewReq => ({
|
||||
space: { groupUin: p.groupId, appId: 7 },
|
||||
});
|
||||
|
||||
export const deserialize = (_ctx: Deps, body: OidbGroupFileCountViewResp): GroupFileSpace => ({
|
||||
usedSpace: Number(body.space?.usedSpace ?? 0),
|
||||
totalSpace: Number(body.space?.totalSpace ?? 0),
|
||||
});
|
||||
|
||||
export const encode = (env: OidbBase<OidbGroupFileCountViewReq>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<OidbGroupFileCountViewReq>>(env);
|
||||
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbGroupFileCountViewResp> =>
|
||||
protobuf_decode<OidbBase<OidbGroupFileCountViewResp>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<GroupFileSpace> =>
|
||||
invokeOidb(deps, GetGroupFileSpace, params);
|
||||
}
|
||||
Reference in new issue
Block a user