【发布时间】:2019-07-06 13:47:25
【问题描述】:
我想让我的 Discord 机器人加入语音聊天,但每次我做到这一点时,我都会在 log(cmd) 中收到错误提示,FFMPEG not found,请帮助我。
错误图片:
这是代码:
client.on('message', message => {
// Voice only works in guilds, if the message does not come from a guild,
// we ignore it
if (!message.guild) return;
if (message.content === '/join') {
// Only try to join the sender's voice channel if they are in one themselves
if (message.member.voiceChannel) {
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('I have successfully connected to the channel!');
})
.catch(console.log);
} else {
message.reply('You need to join a voice channel first!');
}
}
});
这是我的 package.json 文件:
{
"name": "xxxtentacion",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"dependencies": {
"discord.js": "^11.4.2",
"dotenv": "^6.2.0",
"ffmpeg": "0.0.4",
"opusscript": "0.0.6"
},
"devDependencies": {
"nodemon": "^1.18.9"
}
}
【问题讨论】:
-
你有
package.json吗?您在该文件中有任何 ffmpeg 相关的依赖项吗?
标签: javascript ffmpeg discord discord.js