From 32809ab53f565489a70a936ff28427c8afbfe901 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 14 Oct 2019 00:05:20 +0200 Subject: [PATCH] Change error messages --- royalnet/commands/royalmusic/play.py | 3 ++- royalnet/commands/royalmusic/soundcloud.py | 9 +++++---- royalnet/commands/royalmusic/youtube.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/royalnet/commands/royalmusic/play.py b/royalnet/commands/royalmusic/play.py index 154afaeb..3def487f 100644 --- a/royalnet/commands/royalmusic/play.py +++ b/royalnet/commands/royalmusic/play.py @@ -71,7 +71,8 @@ class PlayCommand(Command): raise CommandError("PlayCommand only accepts URLs.\n" "If you want to search a song on YouTube or Soundcloud, please use YoutubeCommand" " or SoundcloudCommand!") - response = await self.interface.net_request(Request("music_play", {"url": url, "guild_name": guild_name}), "discord") + response = await self.interface.net_request(Request("music_play", {"url": url, "guild_name": guild_name}), + "discord") if len(response["videos"]) == 0: raise CommandError(f"Nessun file trovato.") for video in response["videos"]: diff --git a/royalnet/commands/royalmusic/soundcloud.py b/royalnet/commands/royalmusic/soundcloud.py index 4ed646d4..89c0d671 100644 --- a/royalnet/commands/royalmusic/soundcloud.py +++ b/royalnet/commands/royalmusic/soundcloud.py @@ -10,6 +10,7 @@ from ...utils import NetworkHandler, asyncify from ...network import Request, ResponseSuccess from ..commanderrors import CommandError from ...audio import YtdlDiscord + if typing.TYPE_CHECKING: from ...bots import DiscordBot @@ -39,8 +40,8 @@ class SoundcloudNH(NetworkHandler): "outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s" } # Start downloading - dfiles: typing. List[YtdlDiscord] = await asyncify(YtdlDiscord.create_from_url, f'scsearch:{data["search"]}', - **ytdl_args) + dfiles: typing.List[YtdlDiscord] = await asyncify(YtdlDiscord.create_from_url, f'scsearch:{data["search"]}', + **ytdl_args) await bot.add_to_music_data(dfiles, guild) # Create response dictionary response = { @@ -71,10 +72,10 @@ class SoundcloudCommand(Command): raise CommandError("SoundcloudCommand only accepts search queries, and you've sent an URL.\n" "If you want to add a song from an url, please use PlayCommand!") response = await self.interface.net_request(Request("music_soundcloud", {"search": search, - "guild_name": guild_name}), + "guild_name": guild_name}), "discord") if len(response["videos"]) == 0: - raise CommandError(f"Nessun audio trovato.") + raise CommandError(f"Il video non può essere scaricato a causa di un blocco imposto da Soundcloud.") for video in response["videos"]: if self.interface.name == "discord": # This is one of the unsafest things ever diff --git a/royalnet/commands/royalmusic/youtube.py b/royalnet/commands/royalmusic/youtube.py index 888c00b1..1f3948e2 100644 --- a/royalnet/commands/royalmusic/youtube.py +++ b/royalnet/commands/royalmusic/youtube.py @@ -73,7 +73,7 @@ class YoutubeCommand(Command): "guild_name": guild_name}), "discord") if len(response["videos"]) == 0: - raise CommandError(f"Il bot non è riuscito a scaricare il video richiesto a causa di un blocco imposto da YouTube.") + raise CommandError(f"Il video non può essere scaricato a causa di un blocco imposto da YouTube.") for video in response["videos"]: if self.interface.name == "discord": # This is one of the unsafest things ever