mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
优化发送语音或者不支持的消息类型错误提示
This commit is contained in:
parent
fe3ac3060a
commit
b5ab717634
@ -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) {
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user