使用命令时,机器人必须连接到语音通道,但为了进行连接,它必须看到此语音通道中使用命令调用它的用户。但是,这不会发生,机器人返回负面结果,它看不到用户。怎么了?法典: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!');
}
}
添加回答
举报
0/150
提交
取消