我正在尝试编写一个不和谐的音乐机器人,这是我的代码:
const config = require('config.json')
const Discord = require('discord.js');
const ffmpeg = require('ffmpeg-extra')
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if(message.content.toLocaleLowerCase() === "elevator"){
if(message.member.voice.channel){
message.channel.send("Thanks to https://www.bensound.com for supplying us with this music.")
play(message.member.voice.channel)
}
else {
message.channel.send("Yo, please join a VC first.")
}
}
});
async function play(voiceChannel) {
const connection = await voiceChannel.join();
connection.play('elevator.mp3');
}
client.login(config.token);
出于某种原因,即使我通过 npm install ffmpeg 安装了 ffmpeg,它也会说:
Error: Cannot find module 'ffmpeg-extra'
编辑:当我使用 const ffmpeg = require("ffmpeg") 我得到这个错误:
UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
最佳答案
关于javascript - 为什么我已经安装了错误查找模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61777601/