From 8e3bab0c6c8ad97f0ac4c8d122abdfe5a178efda Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 10 Sep 2019 01:54:45 +0200 Subject: [PATCH] Limit stand time --- royalnet/commands/royalgames/zawarudo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/royalnet/commands/royalgames/zawarudo.py b/royalnet/commands/royalgames/zawarudo.py index 05d91222..deb53fd1 100644 --- a/royalnet/commands/royalgames/zawarudo.py +++ b/royalnet/commands/royalgames/zawarudo.py @@ -51,15 +51,15 @@ class ZawarudoNH(NetworkHandler): # Get voice client vc: discord.VoiceClient = bot.client.find_voice_client_by_guild(guild) channel: discord.VoiceChannel = vc.channel + affected: typing.List[typing.Union[discord.User, discord.Member]] = channel.members await bot.add_to_music_data(zw_start, guild) - for member in channel.members: - member: typing.Union[discord.User, discord.Member] + for member in affected: if member.bot: continue await member.edit(mute=True) await asyncio.sleep(data["time"]) await bot.add_to_music_data(zw_end, guild) - for member in channel.members: + for member in affected: member: typing.Union[discord.User, discord.Member] if member.bot: continue @@ -84,5 +84,7 @@ class ZawarudoCommand(Command): time = 5 else: time = int(time) + if time > 9: + raise ValueError("The World can stop time only for 9 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")