diff --git a/src/common/types.ts b/src/common/types.ts index fdd9b62..351f4a6 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -114,7 +114,7 @@ export type SendMessage = { text: string, // 纯文本 } } | { - type: "image" | "voice", + type: "image" | "voice" | "record", file: string, // 本地路径 data?: { file: string // 本地路径 diff --git a/src/renderer.ts b/src/renderer.ts index 72ab177..3f25bce 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -225,7 +225,7 @@ async function listenSendMessage(postData: PostDataSendMsg) { message.content = `@${atMember.cardName || atMember.nick}` } else if (message.type == "text") { message.content = message.data?.text || message.content - } else if (message.type == "image" || message.type == "voice") { + } else if (message.type == "image" || message.type == "voice" || message.type == "record") { // todo: 收到的应该是uri格式的,需要转成本地的, uri格式有三种,http, file, base64 let url = message.data?.file || message.file let uri = new URL(url); @@ -233,7 +233,8 @@ async function listenSendMessage(postData: PostDataSendMsg) { if (message.type == "image") { ext = ".png" } - if (message.type == "voice") { + if (message.type == "voice" || message.type == "record") { + message.type = "voice" ext = ".amr" } let localFilePath = `${Date.now()}${ext}`