fix: 图片类型的大型群文件

This commit is contained in:
Clansty 2024-01-30 00:05:17 +08:00
parent 6b1676365e
commit 00a8e11e35
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
1 changed files with 7 additions and 1 deletions

View File

@ -194,6 +194,7 @@ export default class ForwardService {
const file = await helper.downloadToCustomFile(url, !(message || messageHeader));
files.push(file);
if (file instanceof CustomFile && elem.type === 'image' && file.size > 10 * 1024 * 1024) {
this.log.info('强制使用文件发送');
forceDocument = true;
}
buttons.push(Button.url(`${emoji.picture()} 查看原图`, url));
@ -225,7 +226,12 @@ export default class ForwardService {
}
this.log.info('正在发送媒体,长度', helper.hSize(elem.size));
try {
files.push(await helper.downloadToCustomFile(url, !(message || messageHeader), elem.name));
const file = await helper.downloadToCustomFile(url, !(message || messageHeader), elem.name);
if (file instanceof CustomFile && file.size > 10 * 1024 * 1024) {
this.log.info('强制使用文件发送');
forceDocument = true;
}
files.push(file);
}
catch (e) {
this.log.error('下载媒体失败', e);