bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.11k stars 812 forks source link

Skipping VoiceSpeakingUpdate #1554

Open YeahNotSewerSide opened 3 months ago

YeahNotSewerSide commented 3 months ago

How to reproduce: If there is a user in the voice channel and this user has talking status at all times and the bot connects with ChannelVoiceJoin, after this function is called AddHandler, setting a handler for VoiceSpeakingUpdate, it skips updates for the already speaking user.

After some digging, the problem lies in WaitUntilConnected function, this line in fact.

I made a simple work-around by injecting a handler directly to the ChannelVoiceJoin function(attached image) but that's not an optimal solution. Using a raw ChannelVoiceJoinManual didn't get any results, since VoiceConnection has private fields, mute, deaf, session etc and cannot be properly created outside of the module, I assume.

The proper fix should do something with WaitUntilConnected function, I think.

work-around