Undoing changes to stream module

This commit is contained in:
Twentysix 2016-02-29 13:59:09 +01:00
parent 22514af4d9
commit 58e0b6d46a

View File

@ -191,9 +191,7 @@ class Streams:
async def stream_checker(self): async def stream_checker(self):
CHECK_DELAY = 60 CHECK_DELAY = 60
old_alerts = []
last_twitch_alert = None
last_hitbox_alert = None
while "Streams" in self.bot.cogs: while "Streams" in self.bot.cogs:
old = (deepcopy(self.twitch_streams), deepcopy(self.hitbox_streams)) old = (deepcopy(self.twitch_streams), deepcopy(self.hitbox_streams))
@ -204,9 +202,7 @@ class Streams:
stream["ALREADY_ONLINE"] = True stream["ALREADY_ONLINE"] = True
for channel in stream["CHANNELS"]: for channel in stream["CHANNELS"]:
if self.bot.get_channel(channel): if self.bot.get_channel(channel):
if last_twitch_alert: await self.bot.send_message(self.bot.get_channel(channel), "http://www.twitch.tv/{} is online!".format(stream["NAME"]))
old_alerts.append(last_twitch_alert)
last_twitch_alert = await self.bot.send_message(self.bot.get_channel(channel), "http://www.twitch.tv/{} is online!".format(stream["NAME"]))
else: else:
if stream["ALREADY_ONLINE"] and not online: stream["ALREADY_ONLINE"] = False if stream["ALREADY_ONLINE"] and not online: stream["ALREADY_ONLINE"] = False
await asyncio.sleep(0.5) await asyncio.sleep(0.5)
@ -217,9 +213,7 @@ class Streams:
stream["ALREADY_ONLINE"] = True stream["ALREADY_ONLINE"] = True
for channel in stream["CHANNELS"]: for channel in stream["CHANNELS"]:
if self.bot.get_channel(channel): if self.bot.get_channel(channel):
if last_hitbox_alert: await self.bot.send_message(self.bot.get_channel(channel), "http://www.hitbox.tv/{} is online!".format(stream["NAME"]))
old_alerts.append(last_hitbox_alert)
last_hitbox_alert = await self.bot.send_message(self.bot.get_channel(channel), "http://www.hitbox.tv/{} is online!".format(stream["NAME"]))
else: else:
if stream["ALREADY_ONLINE"] and not online: stream["ALREADY_ONLINE"] = False if stream["ALREADY_ONLINE"] and not online: stream["ALREADY_ONLINE"] = False
await asyncio.sleep(0.5) await asyncio.sleep(0.5)
@ -228,10 +222,6 @@ class Streams:
fileIO("data/streams/twitch.json", "save", self.twitch_streams) fileIO("data/streams/twitch.json", "save", self.twitch_streams)
fileIO("data/streams/hitbox.json", "save", self.hitbox_streams) fileIO("data/streams/hitbox.json", "save", self.hitbox_streams)
for msg in old_alerts:
await self.bot.delete_message(msg)
old_alerts = []
await asyncio.sleep(CHECK_DELAY) await asyncio.sleep(CHECK_DELAY)
def check_folders(): def check_folders():