1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Limit stand time

This commit is contained in:
Steffo 2019-09-10 01:54:45 +02:00
parent 7405d47536
commit 8e3bab0c6c

View file

@ -51,15 +51,15 @@ class ZawarudoNH(NetworkHandler):
# Get voice client # Get voice client
vc: discord.VoiceClient = bot.client.find_voice_client_by_guild(guild) vc: discord.VoiceClient = bot.client.find_voice_client_by_guild(guild)
channel: discord.VoiceChannel = vc.channel 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) await bot.add_to_music_data(zw_start, guild)
for member in channel.members: for member in affected:
member: typing.Union[discord.User, discord.Member]
if member.bot: if member.bot:
continue continue
await member.edit(mute=True) await member.edit(mute=True)
await asyncio.sleep(data["time"]) await asyncio.sleep(data["time"])
await bot.add_to_music_data(zw_end, guild) 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] member: typing.Union[discord.User, discord.Member]
if member.bot: if member.bot:
continue continue
@ -84,5 +84,7 @@ class ZawarudoCommand(Command):
time = 5 time = 5
else: else:
time = int(time) 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 data.reply(f"🕒 ZA WARUDO! TOKI WO TOMARE!")
await self.interface.net_request(Request(ZawarudoNH.message_type, {"time": time, "guild_name": guild_name}), "discord") await self.interface.net_request(Request(ZawarudoNH.message_type, {"time": time, "guild_name": guild_name}), "discord")