我的Discord JS机器人加入时在语音通道中没有说话。我希望它播放测试(1).mp3文件。相反,它只是加入而什么也不做。如果有什么不同,我正在使用repl.it。
这是代码的一部分
if (!message.guild) return;
if (message.content === prefix + 'voice') {
// Only try to join the sender's voice channel if they are in one themselves
if (message.member.voiceChannel) {
const connection = await message.member.voiceChannel.join().then (connection =>{
message.channel.send("Joined!")
connection.playFile('test (1).mp3')
})
} else {
message.reply('You need to join a voice channel first!');
}
}
});
完整文件为here。