mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix voice record type
This commit is contained in:
parent
907c9053c7
commit
6364f90b20
@ -114,7 +114,7 @@ export type SendMessage = {
|
||||
text: string, // 纯文本
|
||||
}
|
||||
} | {
|
||||
type: "image" | "voice",
|
||||
type: "image" | "voice" | "record",
|
||||
file: string, // 本地路径
|
||||
data?: {
|
||||
file: string // 本地路径
|
||||
|
@ -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}`
|
||||
|
Loading…
x
Reference in New Issue
Block a user