mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: send voice
This commit is contained in:
parent
2c7e5ad090
commit
c7e41ad5c4
@ -7,7 +7,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2023 by Night-stars-1, All Rights Reserved.
|
* Copyright (c) 2023 by Night-stars-1, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
import path from "node:path";
|
|
||||||
|
|
||||||
const plugin_path = LiteLoader.plugins.LLAPI.path.plugin;
|
const plugin_path = LiteLoader.plugins.LLAPI.path.plugin;
|
||||||
const ipcRenderer = LLAPI_PRE.ipcRenderer_LL;
|
const ipcRenderer = LLAPI_PRE.ipcRenderer_LL;
|
||||||
@ -823,9 +822,10 @@ const destructor = new Destructor();
|
|||||||
|
|
||||||
class Media {
|
class Media {
|
||||||
async prepareVoiceElement(file) {
|
async prepareVoiceElement(file) {
|
||||||
const type = await ntCall("ns-fsApi", "getFileType", [file]);
|
// const type = await ntCall("ns-fsApi", "getFileType", [file]);
|
||||||
|
const ext = file.split(".").pop(); // 支持amr
|
||||||
const md5 = await ntCall("ns-fsApi", "getFileMd5", [file]);
|
const md5 = await ntCall("ns-fsApi", "getFileMd5", [file]);
|
||||||
const fileName = `${md5}.${type.ext}`;
|
const fileName = `${md5}.${ext}`;
|
||||||
const filePath = await ntCall("ns-ntApi", "nodeIKernelMsgService/getRichMediaFilePath", [
|
const filePath = await ntCall("ns-ntApi", "nodeIKernelMsgService/getRichMediaFilePath", [
|
||||||
{
|
{
|
||||||
md5HexStr: md5,
|
md5HexStr: md5,
|
||||||
@ -837,6 +837,7 @@ class Media {
|
|||||||
fileType: 1, // 这个未知
|
fileType: 1, // 这个未知
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
await ntCall("ns-fsApi", "copyFile", [{ fromPath: file, toPath: filePath }]);
|
||||||
const fileSize = await ntCall("ns-fsApi", "getFileSize", [file]);
|
const fileSize = await ntCall("ns-fsApi", "getFileSize", [file]);
|
||||||
return {
|
return {
|
||||||
canConvert2Text: true,
|
canConvert2Text: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user