【发布时间】:2021-02-22 19:20:20
【问题描述】:
我想让机器人检测用户何时说话。在我看到的不和谐文档中,我需要使用事件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');
}
});
由于某种原因,消息有效,但公会成员却没有。我不知道我做错了什么。
【问题讨论】:
-
看看这是否回答了你的问题,stackoverflow.com/questions/64739350/…
标签: javascript events discord opus