蝴蝶刀刀
2022-09-23 21:34:01
使用命令時,機(jī)器人必須連接到語音通道,但為了進(jìn)行連接,它必須看到此語音通道中使用命令調(diào)用它的用戶。但是,這不會發(fā)生,機(jī)器人返回負(fù)面結(jié)果,它看不到用戶。怎么了?法典: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貢獻(xiàn)1770條經(jīng)驗 獲得超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
提交
取消