我想让机器人检测用户何时说话。在不和谐的文档中我看到我需要使用该事件guildMemberSpeaking。这是代码:
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Talkover is online!');
})
// Joins the voice channel with every tekst
client.on('message', async message => {
// Join the same voice channel of the author of the message
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
}
});
client.on('guildMemberSpeaking', (member, speaking) => {
if (speaking) {
console.log('speaking');
} else {
console.log('notspeaking');
}
});
由于某种原因,消息有效,但公会成员无法说话。我不知道我做错了什么。
桃花长相依
相关分类