is it possible to detect when someone starts speaking in a voice channel

I don’t need to know what they are saying but that their mic is active.
7 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Cole
Cole10mo ago
Yeah, you can.
client.on('voiceStateUpdate', (oldState, newState) => {
// Check if the user started speaking
if (newState.streaming || newState.selfVideo || newState.selfMute || newState.selfDeaf || newState.suppress) {
console.log(`${newState.member.displayName} started speaking in the voice channel ${newState.channel.name}`);
}
});
client.on('voiceStateUpdate', (oldState, newState) => {
// Check if the user started speaking
if (newState.streaming || newState.selfVideo || newState.selfMute || newState.selfDeaf || newState.suppress) {
console.log(`${newState.member.displayName} started speaking in the voice channel ${newState.channel.name}`);
}
});
GhostFilms
GhostFilmsOP10mo ago
This would be if they started streaming/ joined channel/ left channel/ moved channels/ muted/ deafened/ or got suppressed doesn’t show if someone has activated their mic Think like when someone lights up cause they are talking that’s what I want
Erick
Erick10mo ago
thats not possible
GhostFilms
GhostFilmsOP10mo ago
That’s what I thought just wanted to confirm
duck
duck10mo ago
it is possible if your bot is connected to the given channel, the same way for normal users if you're using @discordjs/voice, <VoiceConnection>.receiver.speaking emits the start and end events for when they start and stop talking
GhostFilms
GhostFilmsOP10mo ago
Ohh interesting this may be what I’m looking for
Want results from more Discord servers?
Add your server