remove announcement job after we fully check the db for live streams

This commit is contained in:
deflax 2024-01-17 04:26:42 +02:00
parent 0bbc81e50f
commit 7dcac2f191

View file

@ -82,17 +82,18 @@ async def update_database():
logger_discord.info(f'{name} live stream detected!')
scheduler.add_job(func=announce_live_channel, seconds=60, id='announce_live_channel', args=(name))
return
try:
job = scheduler.get_job('announce_live_channel')
if job:
scheduler.remove_job('announce_live_channel')
live_channel = bot.get_channel(announce_channel_id)
logger_discord.info(f'{name} finished')
await live_channel.send(f'{name} finished')
else:
return
except JobLookupError:
try:
job = scheduler.get_job('announce_live_channel')
if job:
scheduler.remove_job('announce_live_channel')
live_channel = bot.get_channel(announce_channel_id)
logger_discord.info(f'{name} finished')
await live_channel.send(f'{name} finished')
else:
return
except JobLookupError:
return
async def announce_live_channel(name):
if announce_channel_id == 'disabled':