1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Resume playlist after ZA WARUDO

This commit is contained in:
Steffo 2019-09-10 13:33:23 +02:00
parent 57ac8b5579
commit fd89fd6263

View file

@ -44,9 +44,7 @@ class ZawarudoNH(NetworkHandler):
zw_end: typing.List[YtdlDiscord] = await asyncify(YtdlDiscord.create_and_ready_from_url, zw_end: typing.List[YtdlDiscord] = await asyncify(YtdlDiscord.create_and_ready_from_url,
"https://scaleway.steffo.eu/jojo/zawarudo_outro.mp3", "https://scaleway.steffo.eu/jojo/zawarudo_outro.mp3",
**cls.ytdl_args) **cls.ytdl_args)
# Clear playlist old_playlist = bot.music_data[guild]
if bot.music_data[guild] is not None:
bot.music_data[guild].delete()
bot.music_data[guild] = Playlist() bot.music_data[guild] = Playlist()
# 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)
@ -64,6 +62,8 @@ class ZawarudoNH(NetworkHandler):
if member.bot: if member.bot:
continue continue
await member.edit(mute=False) await member.edit(mute=False)
bot.music_data[guild] = old_playlist
await bot.advance_music_data(guild)
return ResponseSuccess() return ResponseSuccess()
@ -72,7 +72,7 @@ class ZawarudoCommand(Command):
description: str = "Ferma il tempo!" description: str = "Ferma il tempo!"
syntax = "[ [guild] ] [durata]" syntax = "[ [guild] ] [1-9]"
def __init__(self, interface: CommandInterface): def __init__(self, interface: CommandInterface):
super().__init__(interface) super().__init__(interface)
@ -84,7 +84,9 @@ class ZawarudoCommand(Command):
time = 5 time = 5
else: else:
time = int(time) time = int(time)
if time > 9: if time < 1:
raise ValueError("The World can stop time only for 9 seconds.") 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 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")