Closed AmineAML closed 3 years ago
I don't know if this is specific to discord.ts or discordjs, but I've seen people manage to do it using the latter.
My issue with this, is no matter how I try to detect a user speaking, it doesn't work.
Here's a snippet of an example of what I've tried
const connection = await command.member!.voice.channel connection .then(conn => { command.channel.send('ready!') //Create our voice receiver const receiver = conn.receiver conn.on('speaking', (user, speaking) => { command.channel.send(`Channel ${user}'s speaking`) if (speaking) { command.channel.send(`I'm listening to ${user}`) const audioStream = receiver.createStream(user) const outputStream = generateOutputFile(VoiceChannel, user) audioStream.pipe(outputStream) outputStream.on("data", console.log) audioStream.on('end', () => { command.channel.send(`I'm no longer listening to ${user}`) conn.play(audioStream, { type: 'opus' }) }) } }) }) .catch((err) => { console.log(err) })
Managed to work it out! closed
I don't know if this is specific to discord.ts or discordjs, but I've seen people manage to do it using the latter.
My issue with this, is no matter how I try to detect a user speaking, it doesn't work.
Here's a snippet of an example of what I've tried