From a267535096840ee492cc5e3749c0cca1e3c3d467 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 25 Oct 2019 13:42:07 +0200 Subject: [PATCH] Change exception type in !play, !sc and !yt --- royalnet/packs/royal/commands/play.py | 7 +++---- royalnet/packs/royal/commands/soundcloud.py | 6 +++--- royalnet/packs/royal/commands/youtube.py | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/royalnet/packs/royal/commands/play.py b/royalnet/packs/royal/commands/play.py index 844d5a99..5740385f 100644 --- a/royalnet/packs/royal/commands/play.py +++ b/royalnet/packs/royal/commands/play.py @@ -26,14 +26,13 @@ class PlayCommand(Command): else: guilds = bot.client.guilds if len(guilds) == 0: - raise CommandError("No guilds with the specified name found.") + raise CommandError("Server non trovato.") if len(guilds) > 1: - raise CommandError("Multiple guilds with the specified name found.") + raise CommandError("Il nome del server è ambiguo.") guild = list(bot.client.guilds)[0] # Ensure the guild has a PlayMode before adding the file to it if not bot.music_data.get(guild): - # TODO: change Exception - raise Exception("No music_data for this guild") + raise CommandError("Il bot non è in nessun canale vocale.") # Create url ytdl_args = { "format": "bestaudio/best", diff --git a/royalnet/packs/royal/commands/soundcloud.py b/royalnet/packs/royal/commands/soundcloud.py index 6245b660..7b648ca2 100644 --- a/royalnet/packs/royal/commands/soundcloud.py +++ b/royalnet/packs/royal/commands/soundcloud.py @@ -25,13 +25,13 @@ class SoundcloudCommand(Command): else: guilds = bot.client.guilds if len(guilds) == 0: - raise CommandError("No guilds with the specified name found.") + raise CommandError("Server non trovato.") if len(guilds) > 1: - raise CommandError("Multiple guilds with the specified name found.") + raise CommandError("Il nome del server è ambiguo.") guild = list(bot.client.guilds)[0] # Ensure the guild has a PlayMode before adding the file to it if not bot.music_data.get(guild): - raise KeyError("No music data available for this guild.") + raise CommandError("Il bot non è in nessun canale vocale.") # Create url ytdl_args = { "format": "bestaudio/best", diff --git a/royalnet/packs/royal/commands/youtube.py b/royalnet/packs/royal/commands/youtube.py index ed608765..8d853dca 100644 --- a/royalnet/packs/royal/commands/youtube.py +++ b/royalnet/packs/royal/commands/youtube.py @@ -25,13 +25,13 @@ class YoutubeCommand(Command): else: guilds = bot.client.guilds if len(guilds) == 0: - raise CommandError("No guilds with the specified name found.") + raise CommandError("Server non trovato.") if len(guilds) > 1: - raise CommandError("Multiple guilds with the specified name found.") + raise CommandError("Il nome del server è ambiguo.") guild = list(bot.client.guilds)[0] # Ensure the guild has a PlayMode before adding the file to it if not bot.music_data.get(guild): - raise KeyError("No music data available for this guild.") + raise CommandError("Il bot non è in nessun canale vocale.") # Create url ytdl_args = { "format": "bestaudio/best",