From 5c20112ff30b704922e6015e247328ccee9fb95f Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Thu, 9 Mar 2017 22:22:44 -0600 Subject: [PATCH] Correct issue where the api URL shadowed the picarto URL --- cogs/picarto.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cogs/picarto.py b/cogs/picarto.py index 5dfe70b..96a67a9 100644 --- a/cogs/picarto.py +++ b/cogs/picarto.py @@ -134,6 +134,9 @@ class Picarto: payload = {'key': api_key} data = await utils.request(url, payload=payload) + if data is None: + await ctx.send("I couldn't connect to Picarto!") + return # Not everyone has all these settings, so use this as a way to print information if it does, otherwise ignore it things_to_print = ['channel', 'commissions_enabled', 'is_nsfw', 'program', 'tablet', 'followers', @@ -173,9 +176,10 @@ class Picarto: else: url = "https://www.{}".format(url) channel = re.search("https://www.picarto.tv/(.*)", url).group(1) - url = BASE_URL + '/channel/{}'.format(channel) + api_url = BASE_URL + '/channel/{}'.format(channel) payload = {'key': api_key} - data = await utils.request(url, payload=payload) + + data = await utils.request(api_url, payload=payload) if not data: await ctx.send("That Picarto user does not exist! What would be the point of adding a nonexistant Picarto " "user? Silly")