Answer the question
In order to leave comments, you need to log in
How to implement a recording of a conversation in the discord through your bot?
They recently suggested that I add the function of recording a voice channel, I started, but then I realized that I did not know how to implement the recording itself.
client.on('message', async message => {
if(message.content == `${prefix}join`) {
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
message.channel.bulkDelete(1)
message.channel.send(`${message.author} ку, я тебя слушаю!`)
}}
});
client.on('message', async message => {
if(message.content == `${prefix}leave`) {
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.leave();
message.channel.bulkDelete(1)
message.channel.send(`${message.author}, ну ладно, я пошёл(`)
}}
});
Answer the question
In order to leave comments, you need to log in
1) connect the native module of the node (fs) file system: 2) create a readable s16le PCM audio stream:
const fs = require('fs');
const audio = await connection.receiver.createStream(user, { mode: 'pcm' });
audio.pipe(fs.createWriteStream('audio'));
/*
в папке с вашим ботом будут появляться закодированные файлы, со звуком
типа "PCM" и с названием "audio".
*/
Check out this library, audio receiving is implemented here
https://discordjs.guide/voice/receiving-audio.html...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question