mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Update msg.ts
This commit is contained in:
@@ -996,24 +996,17 @@ export class OneBotMsgApi {
|
|||||||
this.core.context.logger.logError('文件消息缺少参数', inputdata);
|
this.core.context.logger.logError('文件消息缺少参数', inputdata);
|
||||||
throw new Error('文件消息缺少参数');
|
throw new Error('文件消息缺少参数');
|
||||||
}
|
}
|
||||||
|
realUri = await this.handleObfuckName(realUri) ?? realUri;
|
||||||
const downloadFile = async (uri: string) => {
|
|
||||||
const { path, fileName, errMsg, success } = await uriToLocalFile(this.core.NapCatTempPath, uri);
|
|
||||||
if (!success) {
|
|
||||||
this.core.context.logger.logError('文件下载失败', errMsg);
|
|
||||||
throw new Error('文件下载失败: ' + errMsg);
|
|
||||||
}
|
|
||||||
return { path, fileName };
|
|
||||||
};
|
|
||||||
try {
|
try {
|
||||||
const { path, fileName } = await downloadFile(realUri);
|
const { path, fileName, errMsg, success } = await uriToLocalFile(this.core.NapCatTempPath, realUri);
|
||||||
deleteAfterSentFiles.push(path);
|
if (!success) {
|
||||||
return { path, fileName: inputdata.name ?? fileName };
|
this.core.context.logger.logError('文件处理失败', errMsg);
|
||||||
} catch {
|
throw new Error('文件处理失败: ' + errMsg);
|
||||||
realUri = await this.handleObfuckName(realUri);
|
}
|
||||||
const { path, fileName } = await downloadFile(realUri);
|
|
||||||
deleteAfterSentFiles.push(path);
|
deleteAfterSentFiles.push(path);
|
||||||
return { path, fileName: inputdata.name ?? fileName };
|
return { path, fileName: inputdata.name ?? fileName };
|
||||||
|
} catch (e: unknown) {
|
||||||
|
throw new Error((e as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1038,7 +1031,7 @@ export class OneBotMsgApi {
|
|||||||
}
|
}
|
||||||
return url !== '' ? url : await this.core.apis.FileApi.downloadMedia(msgId, peer.chatType, peer.peerUid, elementId, '', '');
|
return url !== '' ? url : await this.core.apis.FileApi.downloadMedia(msgId, peer.chatType, peer.peerUid, elementId, '', '');
|
||||||
}
|
}
|
||||||
throw new Error('文件名解析失败');
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
groupChangDecreseType2String(type: number): GroupDecreaseSubType {
|
groupChangDecreseType2String(type: number): GroupDecreaseSubType {
|
||||||
|
Reference in New Issue
Block a user