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

Change exception type in !play, !sc and !yt

This commit is contained in:
Steffo 2019-10-25 13:42:07 +02:00
parent 9cafd17b16
commit a267535096
3 changed files with 9 additions and 10 deletions

View file

@ -26,14 +26,13 @@ class PlayCommand(Command):
else: else:
guilds = bot.client.guilds guilds = bot.client.guilds
if len(guilds) == 0: if len(guilds) == 0:
raise CommandError("No guilds with the specified name found.") raise CommandError("Server non trovato.")
if len(guilds) > 1: 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] guild = list(bot.client.guilds)[0]
# Ensure the guild has a PlayMode before adding the file to it # Ensure the guild has a PlayMode before adding the file to it
if not bot.music_data.get(guild): if not bot.music_data.get(guild):
# TODO: change Exception raise CommandError("Il bot non è in nessun canale vocale.")
raise Exception("No music_data for this guild")
# Create url # Create url
ytdl_args = { ytdl_args = {
"format": "bestaudio/best", "format": "bestaudio/best",

View file

@ -25,13 +25,13 @@ class SoundcloudCommand(Command):
else: else:
guilds = bot.client.guilds guilds = bot.client.guilds
if len(guilds) == 0: if len(guilds) == 0:
raise CommandError("No guilds with the specified name found.") raise CommandError("Server non trovato.")
if len(guilds) > 1: 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] guild = list(bot.client.guilds)[0]
# Ensure the guild has a PlayMode before adding the file to it # Ensure the guild has a PlayMode before adding the file to it
if not bot.music_data.get(guild): 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 # Create url
ytdl_args = { ytdl_args = {
"format": "bestaudio/best", "format": "bestaudio/best",

View file

@ -25,13 +25,13 @@ class YoutubeCommand(Command):
else: else:
guilds = bot.client.guilds guilds = bot.client.guilds
if len(guilds) == 0: if len(guilds) == 0:
raise CommandError("No guilds with the specified name found.") raise CommandError("Server non trovato.")
if len(guilds) > 1: 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] guild = list(bot.client.guilds)[0]
# Ensure the guild has a PlayMode before adding the file to it # Ensure the guild has a PlayMode before adding the file to it
if not bot.music_data.get(guild): 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 # Create url
ytdl_args = { ytdl_args = {
"format": "bestaudio/best", "format": "bestaudio/best",