From 0443a95c99f8b4e89add8167b479c0987dbf0088 Mon Sep 17 00:00:00 2001 From: Twentysix Date: Tue, 16 Feb 2016 18:09:46 +0100 Subject: [PATCH] Minor adjustments --- cogs/audio.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cogs/audio.py b/cogs/audio.py index a04e02882..acee9d163 100644 --- a/cogs/audio.py +++ b/cogs/audio.py @@ -248,10 +248,14 @@ class Audio: self.queue.append(link) msg = ctx.message result = await self.get_song_metadata(link) - if result["title"] != []: - await self.bot.say("{} has been put into the queue by {}.".format(result["title"], msg.author)) - else: - await self.bot.say("The song has been put into the queue by {}, however it may error.".format(msg.author)) + try: # In case of invalid SOUNDCLOUD ID + if result["title"] != []: + await self.bot.say("{} has been put into the queue by {}.".format(result["title"], msg.author)) + else: + await self.bot.say("The song has been put into the queue by {}, however it may error.".format(msg.author)) + except: + await self.bot.say("A song has been put into the queue by {}.".format(msg.author)) + else: await self.bot.say("I'm already playing a playlist.") @@ -405,7 +409,7 @@ class Audio: @audioset.command() @checks.is_owner() - async def soundcloud(self, ID : str): + async def soundcloud(self, ID : str=None): """Sets the SoundCloud Client ID """ self.settings["SOUNDCLOUD_CLIENT_ID"] = ID @@ -678,7 +682,7 @@ class Audio: url = "http://api.soundcloud.com/resolve.json?url={0}&client_id={1}".format(song_url, self.settings["SOUNDCLOUD_CLIENT_ID"]) result = await self.get_json(url) else: - result = {"title": "Couldn't get title"} + result = {"title": "A song "} return result class EmptyPlayer(): #dummy player