fix(bridge): point at file-upload actions in video-too-large error
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'.
This commit is contained in:
1 parent
b40cee18cc
commit
d66f0b2c6b
1 file changed
+2
-2
@@ -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<VideoPayload> {
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user