mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Fix find_voice_player
This commit is contained in:
parent
d6b2e71a1a
commit
bbd49d1544
1 changed files with 8 additions and 6 deletions
|
@ -238,10 +238,12 @@ class DiscordSerf(Serf):
|
||||||
return channels[0]
|
return channels[0]
|
||||||
|
|
||||||
def find_voice_player(self, guild: "discord.Guild") -> Optional[VoicePlayer]:
|
def find_voice_player(self, guild: "discord.Guild") -> Optional[VoicePlayer]:
|
||||||
for voice_player in self.voice_players:
|
candidate_players: List[VoicePlayer] = []
|
||||||
if not voice_player.voice_client.is_connected():
|
for player in self.voice_players:
|
||||||
|
player: VoicePlayer
|
||||||
|
if not player.voice_client.is_connected():
|
||||||
continue
|
continue
|
||||||
if voice_player.voice_client.guild == guild:
|
if guild is not None and guild != player.voice_client.guild:
|
||||||
return voice_player
|
continue
|
||||||
else:
|
candidate_players.append(player)
|
||||||
return None
|
return candidate_players[0] if len(candidate_players) > 0 else None
|
||||||
|
|
Loading…
Reference in a new issue