mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: 清理文件
This commit is contained in:
@@ -182,7 +182,7 @@ export class NTQQFileApi {
|
|||||||
filePath = newFilePath;
|
filePath = newFilePath;
|
||||||
|
|
||||||
const { fileName: _fileName, path, fileSize, md5 } = await this.core.apis.FileApi.uploadFile(filePath, ElementType.VIDEO);
|
const { fileName: _fileName, path, fileSize, md5 } = await this.core.apis.FileApi.uploadFile(filePath, ElementType.VIDEO);
|
||||||
context.deleteAfterSentFiles.push(_fileName);
|
context.deleteAfterSentFiles.push(path);
|
||||||
if (fileSize === 0) {
|
if (fileSize === 0) {
|
||||||
throw new Error('文件异常,大小为0');
|
throw new Error('文件异常,大小为0');
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ export class NTQQFileApi {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async createValidSendPttElement(pttPath: string): Promise<SendPttElement> {
|
async createValidSendPttElement(context: SendMessageContext, pttPath: string): Promise<SendPttElement> {
|
||||||
|
|
||||||
const { converted, path: silkPath, duration } = await encodeSilk(pttPath, this.core.NapCatTempPath, this.core.context.logger);
|
const { converted, path: silkPath, duration } = await encodeSilk(pttPath, this.core.NapCatTempPath, this.core.context.logger);
|
||||||
if (!silkPath) {
|
if (!silkPath) {
|
||||||
|
@@ -555,7 +555,7 @@ export class OneBotMsgApi {
|
|||||||
},
|
},
|
||||||
|
|
||||||
[OB11MessageDataType.voice]: async (sendMsg, context) =>
|
[OB11MessageDataType.voice]: async (sendMsg, context) =>
|
||||||
this.core.apis.FileApi.createValidSendPttElement(
|
this.core.apis.FileApi.createValidSendPttElement(context,
|
||||||
(await this.handleOb11FileLikeMessage(sendMsg, context)).path),
|
(await this.handleOb11FileLikeMessage(sendMsg, context)).path),
|
||||||
|
|
||||||
[OB11MessageDataType.json]: async ({ data: { data } }) => ({
|
[OB11MessageDataType.json]: async ({ data: { data } }) => ({
|
||||||
|
Reference in New Issue
Block a user