From d66f0b2c6bc6c1baecf78d027b73937d76f6bd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= <74231782+sj817@users.noreply.github.com> Date: Sat, 16 May 2026 15:32:26 +0800 Subject: [PATCH] fix(bridge): point at file-upload actions in video-too-large error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQ's short-video element protocol hard-limits a single video at 100 MB (NapCat enforces the same cap in highwayContext.uploadVideo with the same threshold and tells operators to switch to file upload). Mirror that hint so OneBot bot authors who hit the cap immediately see the correct alternative — `upload_group_file` / `upload_private_file`, which ride the FtnUpload path and go up to 4 GiB — instead of having to read the docs to figure out why a send_msg with a 200 MB video silently 'won't work'. --- packages/core/src/bridge/highway/video-upload.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/bridge/highway/video-upload.ts b/packages/core/src/bridge/highway/video-upload.ts index 79ddf949..a0778c6e 100644 --- a/packages/core/src/bridge/highway/video-upload.ts +++ b/packages/core/src/bridge/highway/video-upload.ts @@ -286,7 +286,7 @@ async function stageVideoSource(element: MessageElement, tempDir: string, cleanu // local path still OOMs us before the check fires). const stat = fs.statSync(local); if (stat.size > MAX_VIDEO_SIZE) { - throw new Error(`video file too large: ${(stat.size / (1024 * 1024)).toFixed(2)} MB > ${MAX_VIDEO_SIZE / (1024 * 1024)} MB`); + throw new Error(`video file too large: ${(stat.size / (1024 * 1024)).toFixed(2)} MB > ${MAX_VIDEO_SIZE / (1024 * 1024)} MB. Use upload_group_file / upload_private_file for files larger than 100 MB.`); } return { bytes: new Uint8Array(fs.readFileSync(local)), @@ -383,7 +383,7 @@ async function loadVideo(element: MessageElement): Promise { const staged = await stageVideoSource(element, tempDir, cleanups); if (staged.bytes.length === 0) throw new Error('video file is empty'); if (staged.bytes.length > MAX_VIDEO_SIZE) { - throw new Error(`video file too large: ${(staged.bytes.length / (1024 * 1024)).toFixed(2)} MB > 100 MB`); + throw new Error(`video file too large: ${(staged.bytes.length / (1024 * 1024)).toFixed(2)} MB > 100 MB. Use upload_group_file / upload_private_file for files larger than 100 MB.`); } const hashes = computeHashes(staged.bytes);