Send a reminder message a day before a scheduled run

This commit is contained in:
Marc Di Luzio 2024-08-12 23:29:40 +01:00
parent 50f94b284b
commit 503e899f19
3 changed files with 15 additions and 9 deletions

View file

@ -285,14 +285,15 @@ class State():
if reactivate and datetime.now() > ts_to_datetime(reactivate):
channel[_Key.ACTIVE] = True
def get_active_channel_match_tasks(self) -> Generator[str, int]:
def get_active_match_tasks(self, time: datetime | None = None) -> Generator[str, int]:
"""
Get any currently active match tasks
Get any active match tasks at the given time
returns list of channel,members_min pairs
"""
now = datetime.now()
weekday = now.weekday()
hour = now.hour
if not time:
time = datetime.now()
weekday = time.weekday()
hour = time.hour
for channel, tasks in self._tasks.items():
for match in tasks.get(_Key.MATCH_TASKS, []):