优化发送语音或者不支持的消息类型错误提示

This commit is contained in:
linyuchen 2024-04-28 09:19:14 +08:00
parent fe3ac3060a
commit b5ab717634
2 changed files with 4 additions and 1 deletions

View File

@ -216,6 +216,9 @@ export class SendMsgElementConstructor {
static async ptt(pttPath: string): Promise<SendPttElement> {
const {converted, path: silkPath, duration} = await encodeSilk(pttPath);
if (!silkPath){
throw '语音转换失败, 请检查语音文件是否正常';
}
// log("生成语音", silkPath, duration);
const {md5, fileName, path, fileSize} = await NTQQFileApi.uploadFile(silkPath, ElementType.PTT);
if (fileSize === 0) {

View File

@ -244,7 +244,7 @@ export async function createSendElements(messageData: OB11MessageData[], target:
export async function sendMsg(peer: Peer, sendElements: SendMessageElement[], deleteAfterSentFiles: string[], waitComplete = true) {
if (!sendElements.length) {
throw ("消息体无法解析")
throw ("消息体无法解析,请检查是否发送了不支持的消息类型")
}
const returnMsg = await NTQQMsgApi.sendMsg(peer, sendElements, waitComplete, 20000);
log("消息发送结果", returnMsg)