【问题标题】:Discord.js v13 bot won't join voice channelsDiscord.js v13 机器人不会加入语音频道
【发布时间】:2021-12-06 03:47:04
【问题描述】:

已经排查了好几个小时了。问题是我没有从中得到任何错误日志,因为代码运行“正常”。该机器人只是不加入语音频道。我从 YouTube 教程中几乎 1:1 复制了代码,我也尝试了官方的 Discord 指南,结果都一样。

这是我的代码:

const discordVoice = require('@discordjs/voice');

const player = discordVoice.createAudioPlayer();
const resource = discordVoice.createAudioResource(`/sounds/happy/${happySoundsRandom}`);
                    
const connection = discordVoice.joinVoiceChannel({
  channelId: channel.id,
  guildId: message.guild.id,
  adapterCreator: message.guild.voiceAdapterCreator,
});
                        
player.play(resource);
connection.subscribe(player);

console.log("Bot sent to voice")

当我通过发送消息运行它时,我确实得到了 console.log,但在 Discord 端没有结果。我以管理员身份阅读了该机器人,并 100% 确定该机器人具有语音通道权限。

【问题讨论】:

    标签: javascript discord.js


    【解决方案1】:

    你必须使用message.member.voice.channel.id 而不是你的channel.id

    【讨论】:

    • 不幸的是仍然无法正常工作。编辑:现在可以了,但我的机器人加入时充耳不闻……
    猜你喜欢
    • 2020-10-24
    • 2021-11-29
    • 2023-02-25
    • 2021-05-03
    • 1970-01-01
    • 2020-07-17
    • 2020-07-16
    • 1970-01-01
    • 2021-07-13
    相关资源
    最近更新 更多