python-discord / sir-robin

Our event bot, for managing community events.
MIT License
18 stars 14 forks source link

`.aoc day` command #83

Open Shom770 opened 2 years ago

Shom770 commented 2 years ago

Description

A command that will fetch information about a certain day (can be filtered by the year too) for AOC puzzles.

Reasoning

I've seen a lot of people including myself have trouble remembering what day had what. Especially with puzzles from past years when people didn't participate, you have to look up the day every time to see what happened on that day.

In addition, being able to pull up the day from Discord rather than exiting into your browser to search up the day every time is a lot easier to do.

Proposed Implementation

Every day after 12:00 AM if an AOC puzzle has been released, Sir Lancebot will scrape the contents of that day's webpage and store it in a Redis cache. That way when the user requests that certain day, the contents will already be in the cache. If the user requests a day that isn't in the cache, it will send a request to the webpage, scrape it, return the information the user wants and then cache it.

For example: if the day is December 6th, 2021, when the AOC puzzle for Day 6 of 2021 is released, it will add it to the cache. That way when someone does .aoc day 6 it will display an embed with the title "Lanternfish" (the title of the day's challenge), with an excerpt from the page If someone does .aoc day 2018 6 It wouldn't be in the cache yet so it fetches information on that day, returns what the day was about and then adds it to the cache.

Would you like to implement this yourself?