加入后,我的不和谐JS机器人在语音通道中没有说话

时间:2019-11-23 23:10:52

标签: node.js ffmpeg bots discord discord.js

我的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

0 个答案:

没有答案