chore: gocq接口完成

This commit is contained in:
手瓜一十雪 committed 2024-08-09 17:27:44 +08:00
1 parent 26cb728e9c
commit 6dbc5fc5a0
22 files changed
+579 -51

No files matched your search

+2 -2
View File
@@ -32,7 +32,7 @@ export default class GoCQHTTPDownloadFile extends BaseAction<Payload, FileRespon
protected async _handle(payload: Payload): Promise<FileResponse> {
const isRandomName = !payload.name;
const name = payload.name || randomUUID();
const filePath = joinPath(getTempDir(), name);
const filePath = joinPath(this.CoreContext.NapCatTempPath, name);
if (payload.base64) {
fs.writeFileSync(filePath, payload.base64, 'base64');
@@ -48,7 +48,7 @@ export default class GoCQHTTPDownloadFile extends BaseAction<Payload, FileRespon
if (isRandomName) {
// 默认实现要名称未填写时文件名为文件 md5
const md5 = await calculateFileMD5(filePath);
const newPath = joinPath(getTempDir(), md5);
const newPath = joinPath(this.CoreContext.NapCatTempPath, md5);
fs.renameSync(filePath, newPath);
return { file: newPath };
}