diff options
author | 2021-11-29 10:49:28 +0000 | |
---|---|---|
committer | 2021-11-29 10:49:28 +0000 | |
commit | 790bcdf2fedc8dd7aac8c5a2610dc8395852bce0 (patch) | |
tree | 35fbdd3eb0c07c3df0ade093df700792a73e0ae4 | |
parent | Swap conditional in aoc count (diff) |
Use a Discord timestamp to show countdown
This gives the user the ability to hover the timestamp with their mouse to get an exact date and time.
-rw-r--r-- | bot/exts/events/advent_of_code/_cog.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py index c91a5019..94722005 100644 --- a/bot/exts/events/advent_of_code/_cog.py +++ b/bot/exts/events/advent_of_code/_cog.py @@ -115,15 +115,11 @@ class AdventOfCode(commands.Cog): deltas = (dec_first - datetime_now for dec_first in (this_year, next_year)) delta = min(delta for delta in deltas if delta >= timedelta()) # timedelta() gives 0 duration delta - # Add a finer timedelta if there's less than a day left - if delta.days == 0: - delta_str = f"approximately {delta.seconds // 3600} hours" - else: - delta_str = f"{delta.days} days" + next_aoc_timestamp = int((datetime_now + delta).timestamp()) await ctx.send( "The Advent of Code event is not currently running. " - f"The next event will start in {delta_str}." + f"The next event will start <t:{next_aoc_timestamp}:R>." ) @adventofcode_group.command(name="about", aliases=("ab", "info"), brief="Learn about Advent of Code") |