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!') logger_discord.info(f'{name} live stream detected!')
scheduler.add_job(func=announce_live_channel, seconds=60, id='announce_live_channel', args=(name)) scheduler.add_job(func=announce_live_channel, seconds=60, id='announce_live_channel', args=(name))
return return
try:
job = scheduler.get_job('announce_live_channel') try:
if job: job = scheduler.get_job('announce_live_channel')
scheduler.remove_job('announce_live_channel') if job:
live_channel = bot.get_channel(announce_channel_id) scheduler.remove_job('announce_live_channel')
logger_discord.info(f'{name} finished') live_channel = bot.get_channel(announce_channel_id)
await live_channel.send(f'{name} finished') logger_discord.info(f'{name} finished')
else: await live_channel.send(f'{name} finished')
return else:
except JobLookupError:
return return
except JobLookupError:
return
async def announce_live_channel(name): async def announce_live_channel(name):
if announce_channel_id == 'disabled': if announce_channel_id == 'disabled':