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
e4d8c5e72e
commit
ddd60a6a79
@ -114,7 +114,7 @@ export type SendMessage = {
|
|||||||
text: string, // 纯文本
|
text: string, // 纯文本
|
||||||
}
|
}
|
||||||
} | {
|
} | {
|
||||||
type: "image" | "voice",
|
type: "image" | "voice" | "record",
|
||||||
file: string, // 本地路径
|
file: string, // 本地路径
|
||||||
data?: {
|
data?: {
|
||||||
file: string // 本地路径
|
file: string // 本地路径
|
||||||
|
@ -227,7 +227,7 @@ async function listenSendMessage(postData: PostDataSendMsg) {
|
|||||||
message.content = `@${atMember.cardName || atMember.nick}`
|
message.content = `@${atMember.cardName || atMember.nick}`
|
||||||
} else if (message.type == "text") {
|
} else if (message.type == "text") {
|
||||||
message.content = message.data?.text || message.content
|
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
|
// todo: 收到的应该是uri格式的,需要转成本地的, uri格式有三种,http, file, base64
|
||||||
let url = message.data?.file || message.file
|
let url = message.data?.file || message.file
|
||||||
let uri = new URL(url);
|
let uri = new URL(url);
|
||||||
@ -235,7 +235,8 @@ async function listenSendMessage(postData: PostDataSendMsg) {
|
|||||||
if (message.type == "image") {
|
if (message.type == "image") {
|
||||||
ext = ".png"
|
ext = ".png"
|
||||||
}
|
}
|
||||||
if (message.type == "voice") {
|
if (message.type == "voice" || message.type == "record") {
|
||||||
|
message.type = "voice"
|
||||||
ext = ".amr"
|
ext = ".amr"
|
||||||
}
|
}
|
||||||
let localFilePath = `${Date.now()}${ext}`
|
let localFilePath = `${Date.now()}${ext}`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user