为什么不和谐机器人看不到用户?

使用命令时,机器人必须连接到语音通道,但为了进行连接,它必须看到此语音通道中使用命令调用它的用户。但是,这不会发生,机器人返回负面结果,它看不到用户。怎么了?


法典:


const queue = new Map();


async function execute(message, serverQueue) {

 const args = message.content.split(' ');

 const voiceChannel = message.member.voiceChannel;

 if (!voiceChannel) return message.channel.send('You need to be in a voice channel to play music!');

  const permissions = voiceChannel.permissionsFor(message.client.user);

 if (!permissions.has('CONNECT') || !permissions.has('SPEAK')) {

  return message.channel.send('I need the permissions to join and speak in your voice channel!');

 }

}


蝴蝶刀刀
浏览 70回答 1
1回答

德玛西亚99

由于不和谐.js v12,你需要使用而不是voice.channelvoiceChannelconst queue = new Map();async function execute(message, serverQueue) { const args = message.content.split(' '); const voiceChannel = message.member.voice.channel; if (!voiceChannel) return message.channel.send('You need to be in a voice channel to play music!');  const permissions = voiceChannel.permissionsFor(message.client.user); if (!permissions.has('CONNECT') || !permissions.has('SPEAK')) {  return message.channel.send('I need the permissions to join and speak in your voice channel!'); }}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript