fix(file): route group publish through OIDB 0x6d9_4 and cache upload meta for c2c resend
The chat-publish step after upload_group_file used to ship a PbSendMsg
with a transElem(elemType=24) — but that wire shape is RECEIVE-side
only, and current QQ-NT rejects it on send with `result=79`. Lagrange.
Core V2 uses a dedicated `OidbSvcTrpcTcp.0x6d9_4` for the publish
(`GroupSendFileService.cs`); mirror that. Send_group_msg with a
`{type:'file', file_id}` segment now routes through the same path
after the OneBot layer splits file segments out (matching the c2c
file split pattern).
Separately, send_private_msg with just `{file_id}` was shipping a 0 B
file because the wire packet for c2c file send needs fileSize/fileMd5/
fileName/fileHash but the OneBot caller only echoes the file_id from
upload_private_file. Add a bounded (1024-entry, FIFO) bridge cache
populated at upload time so the send-message path can rehydrate the
full tuple; inline segment fields still take precedence so callers
that track the metadata themselves can bypass the cache. Parser now
also accepts `file_hash`/`fileHash` on file segments.
Also: file segments no longer get a `[空消息]` log line — the format
string now shows `[文件:<name-or-id>]`.
This commit is contained in:
12 files changed
+634
-158
No files matched your search
@@ -22,6 +22,7 @@ import type {
|
||||
SendMessageReceipt,
|
||||
DownloadRKeyInfo,
|
||||
ClientKeyInfo,
|
||||
UploadedFileMeta,
|
||||
} from './bridge';
|
||||
import type { SendPacketResult } from '../protocol/packet-sender';
|
||||
|
||||
@@ -89,6 +90,16 @@ export interface BridgeInterface {
|
||||
// ─── Files ───
|
||||
uploadGroupFile(groupId: number, file: string, name?: string, folderId?: string, uploadFile?: boolean): Promise<{ fileId: string | null }>;
|
||||
uploadPrivateFile(userId: number, file: string, name?: string, uploadFile?: boolean): Promise<{ fileId: string | null }>;
|
||||
/**
|
||||
* Publish a previously-uploaded group file as a chat message via
|
||||
* `OidbSvcTrpcTcp.0x6d9_4`. The atomic upload+publish flow inside
|
||||
* `uploadGroupFile` already does this, but the OneBot send-message
|
||||
* path needs it too for {type:'file', file_id} segments.
|
||||
*/
|
||||
sendGroupFileMessage(groupId: number, fileId: string): Promise<void>;
|
||||
/** Cache file metadata so a later send_msg with just `file_id` can rehydrate it. */
|
||||
rememberUploadedFile(meta: UploadedFileMeta): void;
|
||||
recallUploadedFile(fileId: string): UploadedFileMeta | undefined;
|
||||
fetchGroupFiles(groupId: number, folderId?: string): Promise<GroupFilesResult>;
|
||||
fetchGroupFileUrl(groupId: number, fileId: string, busId?: number): Promise<string>;
|
||||
fetchPrivateFileUrl(userId: number, fileId: string, fileHash: string): Promise<string>;
|
||||
|
||||
Reference in new issue
Block a user