diff --git a/pyproject.toml b/pyproject.toml index ac1555cc..f4abab34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "royalnet" - version = "5.6.4" + version = "5.6.5" description = "A multipurpose bot and web framework" authors = ["Stefano Pigozzi "] license = "AGPL-3.0+" diff --git a/royalnet/serf/discord/discordserf.py b/royalnet/serf/discord/discordserf.py index 690fdafe..d548a3a7 100644 --- a/royalnet/serf/discord/discordserf.py +++ b/royalnet/serf/discord/discordserf.py @@ -237,7 +237,7 @@ class DiscordSerf(Serf): 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] = [] for player in self.voice_players: player: VoicePlayer @@ -246,4 +246,6 @@ class DiscordSerf(Serf): if guild is not None and guild != player.voice_client.guild: continue 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 diff --git a/royalnet/serf/discord/errors.py b/royalnet/serf/discord/errors.py index 680e84e8..8afe0cd9 100644 --- a/royalnet/serf/discord/errors.py +++ b/royalnet/serf/discord/errors.py @@ -38,5 +38,5 @@ class PlayerNotConnectedError(VoicePlayerError): Use :meth:`VoicePlayer.connect` first!""" -class PlayerAlreadyPlaying(VoicePlayerError): +class PlayerAlreadyPlayingError(VoicePlayerError): """The :class:`VoicePlayer` is already playing audio and cannot start playing audio again.""" diff --git a/royalnet/serf/discord/voiceplayer.py b/royalnet/serf/discord/voiceplayer.py index cbcf583d..73a15ba8 100644 --- a/royalnet/serf/discord/voiceplayer.py +++ b/royalnet/serf/discord/voiceplayer.py @@ -86,7 +86,7 @@ class VoicePlayer: if self.voice_client is None or not self.voice_client.is_connected(): raise PlayerNotConnectedError() if self.voice_client.is_playing(): - raise PlayerAlreadyPlaying() + raise PlayerAlreadyPlayingError() log.debug("Getting next AudioSource...") next_source: Optional["discord.AudioSource"] = await self.playing.next() if next_source is None: diff --git a/royalnet/version.py b/royalnet/version.py index e868075a..496196ea 100644 --- a/royalnet/version.py +++ b/royalnet/version.py @@ -1 +1 @@ -semantic = "5.6.4" +semantic = "5.6.5"