From 9f6ae93762536837b25cb8147ab9c59963b1e79e Mon Sep 17 00:00:00 2001 From: deflax Date: Wed, 17 Jan 2024 05:49:25 +0200 Subject: [PATCH] execute the announcement job immediately after first run --- src/discordbot/discordbot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/discordbot/discordbot.py b/src/discordbot/discordbot.py index 30b94cc..b6f3916 100644 --- a/src/discordbot/discordbot.py +++ b/src/discordbot/discordbot.py @@ -87,6 +87,8 @@ async def update_database(): # Job doesn't exist, so add it logger_discord.info(f'{stream_name} live stream detected!') scheduler.add_job(func=announce_live_channel, trigger='interval', seconds=60, id='announce_live_channel', args=(stream_name,)) + # Manually execute the job once immediately + scheduler.get_job('announce_live_channel').modify(next_run_time=datetime.now()) # Exit since we found one return else: