Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 循环播放音频文件discord.js_Javascript_Discord.js - Fatal编程技术网

Javascript 循环播放音频文件discord.js

Javascript 循环播放音频文件discord.js,javascript,discord.js,Javascript,Discord.js,我一直在为我的discord机器人编写代码,让它播放音频文件,效果很好,但我不知道如何循环播放曲目,有人能帮忙吗 const channel = client.channels.cache.get("CHANNEL ID") if (!channel) return console.error("The channel does not exist!"); channel.join().then(connection => {

我一直在为我的discord机器人编写代码,让它播放音频文件,效果很好,但我不知道如何循环播放曲目,有人能帮忙吗

const channel = client.channels.cache.get("CHANNEL ID")
    if (!channel) return console.error("The channel does not exist!");
    channel.join().then(connection => {
        connection.play(path.join(__dirname, 'FILE NAME'))
    }).catch(e => {
      console.error(e);
    });

这回答了你的问题吗?这回答了你的问题吗?