Skip to content

Commit

Permalink
Simplify this.
Browse files Browse the repository at this point in the history
  • Loading branch information
PredaaA committed Feb 20, 2022
1 parent cad3144 commit 412203a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lavalink/player_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,18 @@ async def on_voice_state_update(self, data: dict) -> None:
await self._send_lavalink_voice_update({**self._voice_state, "event": data})

async def _send_lavalink_voice_update(self, voice_state: dict):
if voice_state.keys() == {"sessionId", "event"}:
if voice_state["event"].keys() == {"token", "guild_id", "endpoint"}:
await self.node.send(
{
"op": LavalinkOutgoingOp.VOICE_UPDATE.value,
"guildId": str(self.guild.id),
"sessionId": voice_state["sessionId"],
"event": voice_state["event"],
}
)
if voice_state.keys() != {"sessionId", "event"}:
return

if voice_state["event"].keys() == {"token", "guild_id", "endpoint"}:
await self.node.send(
{
"op": LavalinkOutgoingOp.VOICE_UPDATE.value,
"guildId": str(self.guild.id),
"sessionId": voice_state["sessionId"],
"event": voice_state["event"],
}
)

async def wait_until_ready(
self, timeout: Optional[float] = None, no_raise: bool = False
Expand Down

0 comments on commit 412203a

Please sign in to comment.