Поэтому я создаю бот-диск для моего сервера, и у меня возникают некоторые проблемы с моим музыкальным кодом! Код находится здесь.
Когда я запускаю бота, он работает хорошо, но когда я делаю команду !play
Он выдает следующую ошибку:
Error: FFMPEG not found
Если бы кто-то мог мне помочь, я был бы благодарен. Спасибо за ваше время.
client.on('message', async msg => {
if (msg.author.bot) return undefined;
if (!msg.content.startsWith(prefix)) return undefined;
const args = msg.content.split(' ');
if (msg.content.startsWith('${prefix}play')) {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel) return msg.channel.send('Tens de estár numa sala para eu poder entrar!');
const permissions = voiceChannel.permissionsFor(msg.client.user);
if (!permissions.has('CONNECT')) {
return msg.channel.send('Só podes tocar musica no canal de Musica!')
}
if (!permissions.has('SPEAK')) {
return msg.channel.send('Não posso tocar musica nesse canal!')
}
try {
var connection = await voiceChannel.join();
} catch (error) {
console.error('Não consigo entrar no canal porque: ${error}');
return msg.channel.send('Não consigo entrar no canal de voz: ${error}');
}
const dispatcher = connection.playStream(ytdl(args[1]))
.on('end', () => {
console.log('Acabou a musica');
voiceChannel.leave();
})
.on('error', error => {
console.error(error);
});
dispatcher.setVolumeLogarithmic(5 / 5);
} else if (msg.content.startsWith('${prefix}stop')) {
if (msg.member.voiceChannel) return msg.channel.send('Não estás no canal');
msg.member.voiceChannel.leave();
return undefined;
}
});
client.login(token);'
Кажется, что вы не установили ffmpeg.
Вы можете найти простой учебник по установке и добавлению ffmpeg в путь здесь:
https://www.wikihow.com/Install-FFmpeg-on-Windows
После того, как вы установили ffmpeg, его также нужно будет установить с помощью npm:
npm install ffmpeg