为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

蝴蝶刀刀 2022-09-23 21:34:01
使用命令时,机器人必须连接到语音通道,但为了进行连接,它必须看到此语音通道中使用命令调用它的用户。但是,这不会发生,机器人返回负面结果,它看不到用户。怎么了?法典: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!'); }}
查看完整描述

1 回答

?
德玛西亚99

TA贡献1770条经验 获得超3个赞

由于不和谐.js v12,你需要使用而不是voice.channelvoiceChannel


const 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!');

 }

}


查看完整回答
反对 回复 2022-09-23
  • 1 回答
  • 0 关注
  • 68 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信