Together-Java / TJ-Bot

TJ-Bot is a Discord Bot used on the Together Java server. It is maintained by the community, anyone can contribute.
https://togetherjava.org
GNU General Public License v3.0
100 stars 83 forks source link

Feature: Cake Day #1042

Open christolis opened 4 months ago

christolis commented 4 months ago

I know that this is not a certain feature to be added, but I still wanted to experiment and see what I could come up with :)

Description

This pull request introduces the addition of the cake day feature to the server, allowing members to commemorate their annual membership anniversary with a unique "Cake day" role, with which they can celebrate within the community.

This feature uses the database and makes a cake_days table in order to store each member's joined date, as well the guild in which they joined (in case the bot ever gets to handle multiple guilds). The date stored in the database is split into two columns: the month and the day in one (joined_month_day), and the year in an other (joined_year). The reason the join date is split into these two columns is so that an index can be added for the joined_month_day column in order to make reading from the database faster. Therefore, it will be easier for the bot to find all cake days by the month and day, a search that would occur daily by this feature's routine.

If the bot finds that the cake_days table has no records, then it attempts to populate the table from all members of all guilds in a separate thread with batched insert queries in order to optimize the table population task.

Configuration changes

Property Description Type Default
cakeDayConfig.rolePattern A pattern of the cake day
role to give to members.
String "Cake Day"

Diagram

image

TODO

Closes #1035.

ankitsmt211 commented 4 months ago

It would be nice if one of the @Together-Java/moderators can review some of the critical parts of this feature when you can.