Closed ryankhart closed 2 years ago
Actually, this bug was on me in my locally changed code. I was trying to print to the chat box as to which preset I've switched to, but that screwed up both your code for toggling and mine. So I'll close this issue since I already created an "enhancement" issue for what I was working on.
This one has gone unnoticed by me for a long time because I had set my hotkeys in the config, and then I had assigned those hotkeys to combinations on the back paddles of my Xbox Elite 2 controller, set those not to repeat, so I had completely forgot or was unaware that if I press the hotkeys on my keyboard, I get multiple TTS toggle messages in the chat box, and it's a 50/50 chance if it lands on enabled or disabled depending on what I want.
I can see that there was an attempt to prevent this from happening in the code here, but it doesn't seem to help.
I tried tinkering a bit with the code myself and ran out of ideas, so I searched for inspiration. QoLBar has hotkey functionality in that plugin, so I looked at its source code, and it has an entire class file devoted just to keybinds. It might be overkill for what we need, but I'm going to link it here for inspiration.