From 40678f6a65fda7034945a73eaa637c6002ca0337 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sun, 10 Jul 2016 13:06:56 -0500 Subject: [PATCH] Added a feature to turn off 'live' when a channel goes offline --- cogs/twitch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cogs/twitch.py b/cogs/twitch.py index 17e803f..27f0f95 100644 --- a/cogs/twitch.py +++ b/cogs/twitch.py @@ -29,6 +29,9 @@ async def checkChannels(bot): if not live and notify and channelOnline(user): cursor.execute('update twitch set live=1 where user_id="{}"'.format(r['user_id'])) await bot.send_message(server,"{} has just gone live! View their stream at {}".format(member.name,url)) + elif live and not channelOnline(user): + cursor.execute('update twitch set live=0 where user_id="{}"'.format(r['user_id'])) + await bot.send_message(server,"{} has just gone offline! Catch them next time they stream at {}".format(member.name,url)) config.closeConnection() await asyncio.sleep(180)