我正在开发一个不和谐项目,在该项目中我需要录制用户声音,我正在关注此文档。
到目前为止,这就是我写的:
const fs = require('fs');
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', async message => {
if (message.content === 'a' && message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
const audio = connection.receiver.createStream('user_id?', { mode: 'pcm' });
audio.pipe(fs.createWriteStream('user_audio'));
}
});
client.login('token');
但问题是 user_audio 文件总是空的!
Qyouu
相关分类