From fd89fd6263ba3dd68df2a5c31b2a75697dfb4654 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 10 Sep 2019 13:33:23 +0200 Subject: [PATCH] Resume playlist after ZA WARUDO --- royalnet/commands/royalgames/zawarudo.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/royalnet/commands/royalgames/zawarudo.py b/royalnet/commands/royalgames/zawarudo.py index deb53fd1..e12f5910 100644 --- a/royalnet/commands/royalgames/zawarudo.py +++ b/royalnet/commands/royalgames/zawarudo.py @@ -44,9 +44,7 @@ class ZawarudoNH(NetworkHandler): zw_end: typing.List[YtdlDiscord] = await asyncify(YtdlDiscord.create_and_ready_from_url, "https://scaleway.steffo.eu/jojo/zawarudo_outro.mp3", **cls.ytdl_args) - # Clear playlist - if bot.music_data[guild] is not None: - bot.music_data[guild].delete() + old_playlist = bot.music_data[guild] bot.music_data[guild] = Playlist() # Get voice client vc: discord.VoiceClient = bot.client.find_voice_client_by_guild(guild) @@ -64,6 +62,8 @@ class ZawarudoNH(NetworkHandler): if member.bot: continue await member.edit(mute=False) + bot.music_data[guild] = old_playlist + await bot.advance_music_data(guild) return ResponseSuccess() @@ -72,7 +72,7 @@ class ZawarudoCommand(Command): description: str = "Ferma il tempo!" - syntax = "[ [guild] ] [durata]" + syntax = "[ [guild] ] [1-9]" def __init__(self, interface: CommandInterface): super().__init__(interface) @@ -84,7 +84,9 @@ class ZawarudoCommand(Command): time = 5 else: time = int(time) - if time > 9: - raise ValueError("The World can stop time only for 9 seconds.") + if time < 1: + raise InvalidInputError("The World can't stop time for less than a second.") + if time > 10: + raise InvalidInputError("The World can stop time only for 10 seconds.") await data.reply(f"🕒 ZA WARUDO! TOKI WO TOMARE!") await self.interface.net_request(Request(ZawarudoNH.message_type, {"time": time, "guild_name": guild_name}), "discord")