Open ShikieikiC opened 5 months ago
好像解决了,把renderer.js中
if (document.querySelector(".audio-msg-input") != undefined) {
e.dataTransfer.files.forEach(async file => {
这两行改为
if (document.querySelector(".audio-msg-input") != undefined) {
const files = Array.from(e.dataTransfer.files);
for (const file of files) {
这对我是有效的
卧槽用这方法直接整个llnt加载不了了,差点重装
解决renderer.js完整改动:
import { Contact, Audio } from '../LiteLoaderQQNT-Euphony/src/index.js';
document.addEventListener('drop', async e => {
if (document.querySelector(".audio-msg-input") != undefined) {
const files = Array.from(e.dataTransfer.files);
for (const file of files) {
if (await audio_sender.isFileSilk(file.path)) {
Contact.getCurrentContact().sendMessage(new Audio(file.path));
return;
}
const getSampleRateResult = await audio_sender.getSampleRate(file.path);
if (getSampleRateResult.error) {
console.error(getSampleRateResult.error);
return;
}
const convertToPcmResult = await audio_sender.convertToPcm(file.path);
if (convertToPcmResult.error) {
console.error(convertToPcmResult.error);
return;
}
const convertToSilkResult = await audio_sender.convertToSilk(convertToPcmResult.data, getSampleRateResult.data);
if (convertToSilkResult.error) {
console.error(convertToSilkResult.error);
return;
}
const silkPath = `${ file.path }.silk`;
const writeFileError = await audio_sender.writeFile(silkPath, convertToSilkResult.data.data);
if (writeFileError) {
console.error(writeFileError);
return;
}
await Contact.getCurrentContact().sendMessage(new Audio(silkPath, convertToSilkResult.data.duration / 1000));
const deleteFileError = await audio_sender.deleteFile(silkPath);
if (deleteFileError) {
console.error(deleteFileError);
return;
}
};
}
});
解决renderer.js完整改动:
import { Contact, Audio } from '../LiteLoaderQQNT-Euphony/src/index.js'; document.addEventListener('drop', async e => { if (document.querySelector(".audio-msg-input") != undefined) { const files = Array.from(e.dataTransfer.files); for (const file of files) { if (await audio_sender.isFileSilk(file.path)) { Contact.getCurrentContact().sendMessage(new Audio(file.path)); return; } const getSampleRateResult = await audio_sender.getSampleRate(file.path); if (getSampleRateResult.error) { console.error(getSampleRateResult.error); return; } const convertToPcmResult = await audio_sender.convertToPcm(file.path); if (convertToPcmResult.error) { console.error(convertToPcmResult.error); return; } const convertToSilkResult = await audio_sender.convertToSilk(convertToPcmResult.data, getSampleRateResult.data); if (convertToSilkResult.error) { console.error(convertToSilkResult.error); return; } const silkPath = `${ file.path }.silk`; const writeFileError = await audio_sender.writeFile(silkPath, convertToSilkResult.data.data); if (writeFileError) { console.error(writeFileError); return; } await Contact.getCurrentContact().sendMessage(new Audio(silkPath, convertToSilkResult.data.duration / 1000)); const deleteFileError = await audio_sender.deleteFile(silkPath); if (deleteFileError) { console.error(deleteFileError); return; } }; } });
能问下为啥我改完报错么
renderer.zip 试试直接用这个改好的? 我这边没啥问题可以正常使用。
renderer.zip 直接尝试用这个改好了吗? 我的香料没啥问题可以正常使用。
感谢,可以使用了
把音频拖拽到语音框后,没有任何反应