mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54:20 +00:00
Properly fix find_voice_player
This commit is contained in:
parent
c091898724
commit
49c1b39a53
5 changed files with 8 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "royalnet"
|
name = "royalnet"
|
||||||
version = "5.6.4"
|
version = "5.6.5"
|
||||||
description = "A multipurpose bot and web framework"
|
description = "A multipurpose bot and web framework"
|
||||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||||
license = "AGPL-3.0+"
|
license = "AGPL-3.0+"
|
||||||
|
|
|
@ -237,7 +237,7 @@ class DiscordSerf(Serf):
|
||||||
|
|
||||||
return channels[0]
|
return channels[0]
|
||||||
|
|
||||||
def find_voice_player(self, guild: "discord.Guild") -> Optional[VoicePlayer]:
|
def find_voice_players(self, guild: "discord.Guild") -> List[VoicePlayer]:
|
||||||
candidate_players: List[VoicePlayer] = []
|
candidate_players: List[VoicePlayer] = []
|
||||||
for player in self.voice_players:
|
for player in self.voice_players:
|
||||||
player: VoicePlayer
|
player: VoicePlayer
|
||||||
|
@ -246,4 +246,6 @@ class DiscordSerf(Serf):
|
||||||
if guild is not None and guild != player.voice_client.guild:
|
if guild is not None and guild != player.voice_client.guild:
|
||||||
continue
|
continue
|
||||||
candidate_players.append(player)
|
candidate_players.append(player)
|
||||||
return candidate_players[0] if len(candidate_players) > 0 else None
|
if guild:
|
||||||
|
assert len(candidate_players) <= 1
|
||||||
|
return candidate_players
|
||||||
|
|
|
@ -38,5 +38,5 @@ class PlayerNotConnectedError(VoicePlayerError):
|
||||||
Use :meth:`VoicePlayer.connect` first!"""
|
Use :meth:`VoicePlayer.connect` first!"""
|
||||||
|
|
||||||
|
|
||||||
class PlayerAlreadyPlaying(VoicePlayerError):
|
class PlayerAlreadyPlayingError(VoicePlayerError):
|
||||||
"""The :class:`VoicePlayer` is already playing audio and cannot start playing audio again."""
|
"""The :class:`VoicePlayer` is already playing audio and cannot start playing audio again."""
|
||||||
|
|
|
@ -86,7 +86,7 @@ class VoicePlayer:
|
||||||
if self.voice_client is None or not self.voice_client.is_connected():
|
if self.voice_client is None or not self.voice_client.is_connected():
|
||||||
raise PlayerNotConnectedError()
|
raise PlayerNotConnectedError()
|
||||||
if self.voice_client.is_playing():
|
if self.voice_client.is_playing():
|
||||||
raise PlayerAlreadyPlaying()
|
raise PlayerAlreadyPlayingError()
|
||||||
log.debug("Getting next AudioSource...")
|
log.debug("Getting next AudioSource...")
|
||||||
next_source: Optional["discord.AudioSource"] = await self.playing.next()
|
next_source: Optional["discord.AudioSource"] = await self.playing.next()
|
||||||
if next_source is None:
|
if next_source is None:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
semantic = "5.6.4"
|
semantic = "5.6.5"
|
||||||
|
|
Loading…
Reference in a new issue