Upped the stream check delay

Temporary "fix". Will check for multiple streams in a single request in
the future.
This commit is contained in:
Twentysix 2016-02-17 14:09:09 +01:00
parent 5bf4b6a888
commit cf10822b6e

View File

@ -18,7 +18,6 @@ class Streams:
self.bot = bot self.bot = bot
self.twitch_streams = fileIO("data/streams/twitch.json", "load") self.twitch_streams = fileIO("data/streams/twitch.json", "load")
self.hitbox_streams = fileIO("data/streams/hitbox.json", "load") self.hitbox_streams = fileIO("data/streams/hitbox.json", "load")
self.pattern = {"CHANNELS" : [], "NAME" : "", "ALREADY_ONLINE" : False}
@commands.command() @commands.command()
async def hitbox(self, stream : str): async def hitbox(self, stream : str):
@ -191,7 +190,7 @@ class Streams:
return False return False
async def stream_checker(self): async def stream_checker(self):
CHECK_DELAY = 10 CHECK_DELAY = 60
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))
@ -205,7 +204,7 @@ class Streams:
await self.bot.send_message(self.bot.get_channel(channel), "http://www.twitch.tv/{} is online!".format(stream["NAME"])) 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(1) await asyncio.sleep(0.5)
for stream in self.hitbox_streams: for stream in self.hitbox_streams:
online = await self.hitbox_online(stream["NAME"]) online = await self.hitbox_online(stream["NAME"])
@ -216,7 +215,7 @@ class Streams:
await self.bot.send_message(self.bot.get_channel(channel), "http://www.hitbox.tv/{} is online!".format(stream["NAME"])) 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(1) await asyncio.sleep(0.5)
if old != (self.twitch_streams, self.hitbox_streams): if old != (self.twitch_streams, self.hitbox_streams):
fileIO("data/streams/twitch.json", "save", self.twitch_streams) fileIO("data/streams/twitch.json", "save", self.twitch_streams)