I'm trying to have my bot recognize when any guild member joins a specific voice channel and then react to it. I tried to do this by subscribing to the UserVoiceStateUpdated event. This basically works as expected, however when a user first joins any voice channel, the event is not fired. When the user then switches from one voice channel to another, it works fine. As soon as you completely disconnect the user from voice and reconnect it once again requires changing the voice channel before my event handler is executed.
Am I doing something wrong? Is this the intended behavior? If so, can I somehow achieve this in another way?
Just to clarify again, this is what I'm doing and how the bot reacts to it:
Tried with both a .net Framework 4.7 and .net Core 2.0, as well as Discord.net versions 1.0, 1.0.1 and 1.0.2. Always the same.
So after adding some more logging I found that every time the event did not trigger this message was logged: "A UserVoiceStateUpdated handler is blocking the gateway task."
I then started completely from scratch, created a new discord app, bot user, etc. and it worked. I can't really explain how that solved the problem but it did.