我正在尝试编写一个不和谐的音乐机器人,这是我的代码:
setState()
由于某种原因,即使我通过npm安装了ffmpeg,也安装了ffmpeg,它说:
setState()
编辑:当我使用const ffmpeg = require(“ ffmpeg”)时,出现此错误:
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);