Caught failed voice handshake and now leaves channel on error.
@@ -154,6 +154,7 @@ class VoiceComponentImpl(voice.IVoiceComponent):
state_event.state.session_id,
)
+ try:
voice_connection = await voice_connection_type.initialize(
channel_id=snowflake.Snowflake(int(channel)),
debug=self._app.debug,
@@ -167,6 +168,12 @@ class VoiceComponentImpl(voice.IVoiceComponent):
user_id=user_id,
**kwargs,
)
+ except Exception:
+ _LOGGER.debug(
+ "error occurred in initialization, leaving voice channel %s in guild %s again", channel, guild
+ )
+ await asyncio.wait_for(shard.update_voice_state(guild, None), timeout=5.0)
+ raise
self._connections[guild_id] = voice_connection
return voice_connection
