From 957f7ffd8d6869cab9db6a4cc492e636fa03bd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 11 Sep 2024 22:28:28 +0800 Subject: [PATCH] build: debug --- src/common/audio.ts | 2 ++ src/core/apis/file.ts | 2 +- src/onebot/api/msg.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/audio.ts b/src/common/audio.ts index b45e7240..85df78fc 100644 --- a/src/common/audio.ts +++ b/src/common/audio.ts @@ -60,6 +60,7 @@ export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: Log const silk = await encode(input, 24000); await fsPromise.writeFile(pttPath, silk.data); logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration); + console.log('【Debug】文件处理为Slik格式,返回', pttPath, silk.duration / 1000); return { converted: true, path: pttPath, @@ -73,6 +74,7 @@ export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: Log logger.log('获取语音文件时长失败, 使用文件大小推测时长', filePath, e.stack); duration = await guessDuration(filePath, logger); } + console.log('【Debug】文件处理非Slik格式,直接返回', filePath, duration); return { converted: false, path: filePath, diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index de01aaec..c5b5ba65 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -70,7 +70,7 @@ export class NTQQFileApi { downloadType: 1, file_uuid: '', }); - + console.log('【Debug】文件路径Upload 处理', mediaPath); await this.copyFile(filePath, mediaPath!); const fileSize = await this.getFileSize(filePath); return { diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index 2a55cf4d..34b53abd 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -819,6 +819,7 @@ export class OneBotMsgApi { if (!isLocal) { // 只删除http和base64转过来的文件 deleteAfterSentFiles.push(path); } + console.log('【Debug】文件路径 处理', path, isLocal); return { path, fileName: inputdata.name ?? fileName }; }