Borgli / SimulaBot

A Discord bot for the Simula Master student Discord channel
MIT License
3 stars 0 forks source link

Cake Thursday notification #2

Open KGHustad opened 5 years ago

KGHustad commented 5 years ago

There should be a notification on Cake Thursdays. Since Cake Thursdays are highly regular events with a period of two weeks, this could be implemented by checking the week number every Thursday. The downside to this approach is that the bot might need manual syncing after holidays.

Another approach would be to look for "Cake" in https://intranet.simula.no/news and post the content of any matching posts as they are published.

asadsa92 commented 5 years ago

We could probably use information from simula-info email notification. The email notification is somewhat reliable, so maybe make it more accurate if we combine several solutions.

We need to add functionality to the bot to parse a webpage or an email. The bot could also be "smart" and guess if there is a cake Thursday now based on the last time. What if we give out a probability each Thursday based on information available to the bot.

E.g. If the bot has not received any email notification or a post on the intranet and last Thursday had cake then the bot could post:

No cake today :( (I am 99% sure)

Otherwise:

Cake Today =) (I am 99% sure)

Borgli commented 5 years ago

Love the enthusiasm!

However:

  1. While scraping the intranet page is possible, it is not a viable solution as it requires posts to follow a format and the web scraper must be fairly advanced. A web scraping approach is viable if we create a web scraper for all posts from the intranet, but this is a separate issue/feature.

  2. Using emails for determining cake day is too inconsistent. Additionally, it is not clear to me how to do it without creating too much complexity in communicating to/polling a email server/service.

To my knowledge, the cake-day follows a fairly consistent schedule of every 2 weeks. Therefore, the easiest solution is to create a 2 week interval post notifying of cake-day. If the bot is wrong, and there is not cake-day that week, we could allow for a command to resync the bot to the correct schedule. Example:

Bot: There is cake today at 14:00 in Pusterommet at Simula!

Option 1:

Rune: !nocake
Bot: Disregard last message. There is not cake this week after all.

Option 2:

Rune: !nocake 29.11.18
Bot: Disregard last message. I was out of sync. Next cake is 29.11.18.