Skip to content

Commit

Permalink
Create slash command for &aoc countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
n0Oo0Oo0b committed Nov 8, 2023
1 parent 71bbd59 commit a381bd0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bot/exts/advent_of_code/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,25 @@ async def aoc_countdown(self, ctx: commands.Context) -> None:
f"The next event will start <t:{next_aoc_timestamp}:R>."
)

@aoc_slash_group.command(name="countdown", description="Return time left until next day")
@whitelist_override(channels=AOC_WHITELIST)
async def aoc_countdown_slash(self, interaction: discord.Interaction) -> None:
"""Return time left until next day."""
if _helpers.is_in_advent():
tomorrow, _ = _helpers.time_left_to_est_midnight()
next_day_timestamp = int(tomorrow.timestamp())

await interaction.response.send_message(f"Day {tomorrow.day} starts <t:{next_day_timestamp}:R>.")
return

next_aoc, _ = _helpers.time_left_to_next_aoc()
next_aoc_timestamp = int(next_aoc.timestamp())

await interaction.response.send_message(
"The Advent of Code event is not currently running. "
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")
@whitelist_override(channels=AOC_WHITELIST)
async def about_aoc(self, ctx: commands.Context) -> None:
Expand Down

0 comments on commit a381bd0

Please sign in to comment.