diff --git a/pyproject.toml b/pyproject.toml index 23aceef2..0fe64829 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ [tool.poetry] name = "royalpack" - version = "5.6.9" + version = "5.6.10" description = "A Royalnet command pack for the Royal Games community" authors = ["Stefano Pigozzi "] license = "AGPL-3.0+" diff --git a/royalpack/events/discord_lazy_play.py b/royalpack/events/discord_lazy_play.py index 8b76a4ff..1f776769 100644 --- a/royalpack/events/discord_lazy_play.py +++ b/royalpack/events/discord_lazy_play.py @@ -6,7 +6,7 @@ import royalnet.commands as rc import royalnet.serf.discord as rsd import royalnet.bard.discord as rbd -from ..utils import RoyalQueue +from ..utils import RoyalQueue, RoyalPool class DiscordLazyPlayEvent(rc.Event): @@ -49,6 +49,16 @@ class DiscordLazyPlayEvent(rc.Event): voice_player.playing.contents.append(ytd) if not voice_player.voice_client.is_playing(): await voice_player.start() + elif isinstance(voice_player.playing, RoyalPool): + for index, ytd in enumerate(ytds): + if ytd.info.duration >= datetime.timedelta(seconds=self.config["Play"]["max_song_duration"]): + too_long.append(ytd) + continue + added.append(ytd) + voice_player.playing.full_pool.append(ytd) + voice_player.playing.remaining_pool.append(ytd) + if not voice_player.voice_client.is_playing(): + await voice_player.start() else: raise rc.CommandError(f"Non so come aggiungere musica a [c]{voice_player.playing.__class__.__qualname__}[/c]!") diff --git a/royalpack/events/discord_play.py b/royalpack/events/discord_play.py index f122f3a4..341830cf 100644 --- a/royalpack/events/discord_play.py +++ b/royalpack/events/discord_play.py @@ -6,7 +6,7 @@ import royalnet.commands as rc import royalnet.serf.discord as rsd import royalnet.bard.discord as rbd -from ..utils import RoyalQueue +from ..utils import RoyalQueue, RoyalPool class DiscordPlayEvent(rc.Event): @@ -50,6 +50,17 @@ class DiscordPlayEvent(rc.Event): voice_player.playing.contents.append(ytd) if not voice_player.voice_client.is_playing(): await voice_player.start() + elif isinstance(voice_player.playing, RoyalPool): + for index, ytd in enumerate(ytds): + if ytd.info.duration >= datetime.timedelta(seconds=self.config["Play"]["max_song_duration"]): + too_long.append(ytd) + continue + await ytd.convert_to_pcm() + added.append(ytd) + voice_player.playing.full_pool.append(ytd) + voice_player.playing.remaining_pool.append(ytd) + if not voice_player.voice_client.is_playing(): + await voice_player.start() else: raise rc.CommandError(f"Non so come aggiungere musica a [c]{voice_player.playing.__class__.__qualname__}[/c]!") diff --git a/royalpack/events/discord_playable.py b/royalpack/events/discord_playable.py index 2c395ad7..ecd61cd3 100644 --- a/royalpack/events/discord_playable.py +++ b/royalpack/events/discord_playable.py @@ -35,9 +35,9 @@ class DiscordPlaymodeEvent(rc.Event): "Invia il comando su Discord, per favore!") if playable_string.upper() == "QUEUE": - playable = RoyalQueue() + playable = await RoyalQueue.create() elif playable_string.upper() == "POOL": - playable = RoyalPool() + playable = await RoyalPool.create() else: raise rc.InvalidInputError(f"Unknown playable '{playable_string.upper()}'") diff --git a/royalpack/version.py b/royalpack/version.py index 4034bc9d..5aceca21 100644 --- a/royalpack/version.py +++ b/royalpack/version.py @@ -1 +1 @@ -semantic = "5.6.9" +semantic = "5.6.10"