diff options
author | 2020-12-01 23:04:30 +0100 | |
---|---|---|
committer | 2020-12-01 23:04:30 +0100 | |
commit | 3e5cff49f40158acb6417d948c2155daed2e4c29 (patch) | |
tree | 1d99b366e6f58c57ae2f8649bc9cc5fefe65da19 /bot/constants.py | |
parent | Ensure status countdown waits for bot start-up (diff) |
Let puzzle notification sleep until AoC starts
Instead of cancelling the task when it starts up outside of the
boundaries of the Advent of Code, the task will now hibernate until just
before the event starts if starts up before December. This allows it to
actually announce the first puzzle.
After the announcement for the last day of the current event is made, it
will terminate itself. It will only start hibernating again when we've
updated the environment variables for next year's event, ensuring that
it does not run unnecessarily.
To prevent issues with the guild cache not being available, I've added
our new `wait_until_guild_available` waiting function. I've also moved
the calls that get teh role/channel to before the loop, as there's no
need to get them each time the loop goes around.
I've also changed the way we calculate the time we need to sleep, as the
old way used truncated seconds, meaning that we would always wake up
relatively early. Instead, I'm now using fractional seconds, which means
we can reduce the safety padding to a fraction of second. More accurate
announcement timing!
Diffstat (limited to 'bot/constants.py')
0 files changed, 0 insertions, 0 deletions