我想让我的不和谐机器人播放音乐,但我不断收到“找不到FFMPEG”错误。
我的机器人主要是用ping制作的,因此我不会上传该部分。音乐代码应该是这个。
const Discord = require('discord.js');
const bot = new Discord.Client();
var bm = message.content.toLowerCase()
bot.on('message',(message) => {
if (bm == "pray") {
var VC = message.member.voiceChannel;
if (!VC)
return message.reply("You are not in the church my son.")
VC.join()
.then(connection => {
const dispatcher = connection.playFile('d:/mp3.MP3');
dispatcher.on("end", end => {VC.leave()});
})
.catch(console.error); )
P.S。 :我知道我应该以某种方式导入FFMPEG,因为我已经下载了它。但是我不知道怎么办。
答案 0 :(得分:0)
我在http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/找到了答案。在这里,您可以看到如何添加FFMPEG以进行下载,解压缩,路径和使用它。
答案 1 :(得分:0)
您应该从NPM安装所有与ffmpeg相关的模块,然后对其进行定义(例如const ffmpeg = require("ffmpeg-extra")
。
这对我有用。
答案 2 :(得分:0)
观看:How to set Environment variables in Windows。
这是理解以下方法所必需的。
bin
文件夹内容。ffmpeg_bins
驱动器中创建一个名为C:
的目录。恭喜您,,您刚刚学会了在Windows操作系统中安装FFmpeg。