Closed cannawen closed 1 year ago
When two people start speaking at the same time, we set discord enabled to false twice. When one person stops speaking (but the second person is still speaking) we set discord enabled to true. This means the bot may still play audio when the second person is speaking.
To handle this case, we need to 1) keep track of all people who are speaking separately - in their own db or in the student's db or 2) set discord enabled to false on data
and not on start
1 is probably more robust, 2 seems a bit hacky and prone to race conditions
Ended up keeping a tally of how many people are currently speaking in a given channel. On start, add one to the number. On end, subtract one. discord is only ready to play audio when the audio player is ready AND when there are 0 people speaking