我正尝试使我的机器人正常工作。
这是我的播放功能。

function play(connection, message) {
        var server = servers[message.guild.id];
        server.dispatcher = connection.play(
          ytdl(server.queue[0], { filter: "audioonly" })
        );
        server.queue.shift();

        server.dispatcher.on("end", function() {
          if (server.queue[0]) {
            play(connection, message);
          } else {
            connection.disconnect();
          }
        });
      }
它确实可以播放。
if (!message.guild.voiceConnection)
        message.member.voice.channel.join().then(function(connection) {
          message.channel.send("Playing tune now, Enjoy!");
          play(connection, message);
          console.log("Playing tune now!");
        });
我得到它正在播放的日志,几秒钟后,我收到一条错误消息

还有一些东西

我无法安装的discord.js文档中也提到了其他脚本,并且我已尝试了所有可能想到的方法。

最佳答案

如在此github thread上建议的那样,您应该尝试使用@discordjs/opusnode-opus而不是opusscript

关于javascript - 尝试播放链接后,Discord bot崩溃(Node.js),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60693009/

10-12 12:29
查看更多