0

I'm trying to make a discord bot that automatically mutes a user when they begin speaking (prank on a friend). However, I'm having a hard time determining how to use the 'speaking' portion of this code:

client.on('guildMemberSpeaking', (member, speaking) => {
console.log(member, speaking);
if (member.id == 'id-here' && speaking){
    member.voice.setMute(true);
}

I found out that speaking is no longer a boolean in discord.js v12, and has been changed to a class. My question is: how can I read this value and use it in a logical statement to determine if a user is speaking? Thanks

  • The boolean form would be [`member.voice.speaking`](https://discord.js.org/#/docs/main/stable/class/VoiceState?scrollTo=speaking) – Lioness100 Nov 07 '20 at 02:15
  • Member.voice.speaking returns null, even when the bot is in the voice channel? Any idea why? – Nerotrashminter Nov 07 '20 at 02:50
  • Do you have both [privileged intents enabled](https://stackoverflow.com/questions/64559390/none-of-my-discord-js-guildmember-events-are-emitting-my-user-caches-are-basica)? – Lioness100 Nov 07 '20 at 12:03
  • I just enabled both of them in the developer portal, but the problem appears to have persisted. – Nerotrashminter Nov 07 '20 at 20:54

0 Answers0