From ff5cb2fd528cb7c61a09ef61d3e5b9b584dd3bf4 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sun, 31 Jul 2016 06:36:00 -0500 Subject: [PATCH] Added an exception in case we could not connect to twitch at the time --- cogs/twitch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cogs/twitch.py b/cogs/twitch.py index 0236db6..09bf7ef 100644 --- a/cogs/twitch.py +++ b/cogs/twitch.py @@ -14,7 +14,10 @@ async def channel_online(channel: str): async with s.get(url) as r: response = await r.text() data = json.loads(response) - return data['stream'] is not None + try: + return data['stream'] is not None + except KeyError: + return False class Twitch: