【问题标题】:Discord.js bot joins then leavesDiscord.js 机器人加入然后离开
【发布时间】:2021-07-06 13:04:40
【问题描述】:

我构建了一个 discord.js 机器人,当有人使用它的命令时它会加入,但它只有在视频观看次数高时才有效,我尝试使用未列出的 YouTube 视频、我上传的一些视频和观看次数低的视频,但事实并非如此工作,它只是加入语音通道然后离开。

 if (message.content == "!sodium") {
     if (!message.member.voice.channel) return message.reply("You have to be in a voice channel");
     message.member.voice.channel.join().then(VoiceConnection => {
         VoiceConnection.play(ytdl("https://youtu.be/30p-iRH9z2c")).on("finish", () => 
         VoiceConnection.disconnect());
         message.reply("started...");
     }).catch(e => console.log(e))
 };

【问题讨论】:

  • 控制台有错误吗?
  • 不,我没有收到任何错误
  • 旁注VoiceConnection.disconnect()); message.reply("started...");应该比VoiceConnection.play(ytdl("https://youtu.be/30p-iRH9z2c")).on("finish", () => 缩进更多

标签: javascript discord discord.js bots ytdl


【解决方案1】:

我通过添加 { filter: 'audioonly' } 解决了这个问题。

【讨论】:

    猜你喜欢
    • 2021-06-16
    • 2018-07-28
    • 2020-07-17
    • 2020-10-24
    • 2019-09-04
    • 1970-01-01
    • 2021-08-17
    • 2019-06-24
    • 2021-11-13
    相关资源
    最近更新 更多