Add placeholder code for getting previous runs

This commit is contained in:
Marc Di Luzio 2024-09-22 15:47:28 +01:00
parent dabd0d9b18
commit 455f202364

View file

@ -210,15 +210,23 @@ class MatcherCog(commands.Cog):
async def run_hourly_tasks(self):
"""Run any hourly tasks we have"""
# Send a reminder for anything that will be active in 1 day
for (channel, _) in state.State.get_active_match_tasks(datetime.now() + timedelta(days=1)):
logger.info("Reminding about scheduled task in %s", channel)
msg_channel = self.bot.get_channel(int(channel))
await msg_channel.send(strings.reminder())
# Match groups for anything active right now
for (channel, min) in state.State.get_active_match_tasks():
logger.info("Scheduled match task triggered in %s", channel)
msg_channel = self.bot.get_channel(int(channel))
await match_groups_in_channel(msg_channel, min)
for (channel, _) in state.State.get_active_match_tasks(datetime.now() + timedelta(days=1)):
logger.info("Reminding about scheduled task in %s", channel)
# Send a reminder to threads for a match that happened two days ago
for (channel, min) in state.State.get_active_match_tasks(datetime.now() - timedelta(days=2)):
logger.info("Sending reminders to threads in %s", channel)
msg_channel = self.bot.get_channel(int(channel))
await msg_channel.send(strings.reminder())
# TODO: Send a reminder per thread
# Increment when adjusting the custom_id so we don't confuse old users