Feature: Cake Day by christolis · Pull Request #1042 · Together-Java/TJ-Bot

@christolis self-assigned this

Mar 3, 2024

SquidXTV

SquidXTV

tj-wazei

SquidXTV

Co-authored-by: TheCodeMr <151576372+TheCodeMr@users.noreply.github.com>
Co-authored-by: cab <161495905+cabagbe@users.noreply.github.com>
Co-authored-by: Devansh Tiwari <65783463+devloves@users.noreply.github.com>

@christolis

@christolis

@christolis

@christolis

@christolis

This commit aims to fix a bug where the
CakeDayService#addTodayMembersCakeDayRole() method would add the cake day
role to all members who have been at least one year into the server,
disregarding the month and date in which they joined.

The documentation has also been made more clean and concise, while the
CakeDayService#addCakeDayRole() which required a UserSnowflake as one of
its inputs has been removed and now the other version of this function
is used which only requires a Member instance. Passing the Guild would
be unnecessary as it could be easily acquired from the Member instance,
and additionally it helps make sure that the right Member and Guild are
used to call this method.

Finally, this commit adds an extra condition in the select-from query
found in CakeDayService#findCakeDaysTodayFromDatabase() which makes sure
that we get all the cake days for the right guild, instead of getting
them all unconditionally.

@christolis

@christolis

Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>

ankitsmt211

@christolis

  - CakeDayListener.java: remove constructor JavaDoc
  - CakeDayRoutine.java: remove constructor JavaDoc
  - perf(findUserCakeDayFromDatabase): return one from DB
  - perf(CakeDayService): remove unnecessary call
  - Rename from handleUserLeft to removeUserCakeDay
  - perf(cakeDayRole): delegate role fetching to JDA
  - CakeDayService: make createMemberCakeDayQuery static
  - perf(CakeDayService): remove unneeded batch() call
  - CakeDayService: async insert member cake day to db
  - CakeDayService.java: rewrite removeRoleFromMembers()
  - perf: use Role that we have fetched for refreshing
  - CakeDayService: remove unnecessary call to get snowflake
  - perf: remove redundant check for if it's cake day
  - CakeDayService.java: simplify Optional unwrapping
  - CakeDayService.java: rename config to fullConfig
  - docs(CakeDayConfig): clarify with `@see`

Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>

@suryatejess

@christolis

Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>

tj-wazei

tj-wazei

Zabuzard

Zabuzard