Reputation: 31
I know there are following option in the documentation like .speaking
I'm trying to find a handler, like
client.on('start/stop speaking', ...)
but I didn't find anything about something like this. Can someone help me with this please? I don't like to set an interval with a 0 delay and check all members in channel every time. I know how to get user and channel, but I can't figure out how make a handler for speaking
Upvotes: 3
Views: 3168
Reputation: 4925
There is an event called voiceStateUpdate
according to the documentation. There is also a read only key called .speaking
. The oldState
and newState
are members of the VoiceState class.
And this is how it works:
client.on("voiceStateUpdate", (oldState, newState) => {
// Do anything here with the updated state.
if(oldState.speaking !== newState.speaking) {
// User started speaking
}
});
Upvotes: 0