fix voice record type

This commit is contained in:
linyuchen 2024-01-20 23:22:44 +08:00
parent 907c9053c7
commit 6364f90b20
2 changed files with 4 additions and 3 deletions

View File

@ -114,7 +114,7 @@ export type SendMessage = {
text: string, // 纯文本
}
} | {
type: "image" | "voice",
type: "image" | "voice" | "record",
file: string, // 本地路径
data?: {
file: string // 本地路径

View File

@ -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}`