Record users with high input sensitivity

I use the next code for recording speaking users
const connection = getVoiceConnection(<guild ID>);
const receiver = connection.receiver;

receiver.speaking.on('start', (userId) => {
log.debug(`User ${userId} started speaking`);
createListeningStream(receiver, channel, userId);
});
const connection = getVoiceConnection(<guild ID>);
const receiver = connection.receiver;

receiver.speaking.on('start', (userId) => {
log.debug(`User ${userId} started speaking`);
createListeningStream(receiver, channel, userId);
});
But my question how can I (If it is possible) record users with low input sensitivity? Because in this case they are active always (the green circle is ON always) and Discord doesn't send the 'start' event at all. Maybe exists some workaround for such cases? Thanks.
No description
7 Replies
d.js toolkit
d.js toolkit3mo 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! - Marked as resolved by OP
duck
duck3mo ago
connection.receiver.speaking.users would contain users who are already speaking at the time of connecting
Chiko0401
Chiko04013mo ago
@duck It is not. I checked it. This map doesn't contain these users, because there are no event "user started/ended speaking"
duck
duck3mo ago
this map should be populated as the connection becomes ready regardless of the start and end events if this collection is not populated, you should ensure that your connection is ready when you're checking
Chiko0401
Chiko04013mo ago
@duck You are right, I don't know how I missed it on the first time. So, the possible solution can be like a scheduled thread that checks who is in this Map and still is not being recorded, correct?
duck
duck3mo ago
At that point you could just set the end behavior to Manual and only stop recording if you receive the end event. That way you'd only need to check connection.receiver.speaking.users once upon joining a new channel
Chiko0401
Chiko04013mo ago
Ok. Thanks!