[Birthday] Cog model restructure #660
Open
+971
−827
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Restructure cog
Birthdayaccording to #608. No functional changes expected.Notes
Command handlers that utilize the
MonthDayConverternow perform a "typing cast" to inform static type checkers that the birthday being passed to the command handlers asMonthDayConverterwill be subsequently passed to the corresponding methods inCommandsCoreas typedatetime.datetimeinstead ofMonthDayConverter. Note that Python typing cast does not change or restrict any functionalities because it is only information to static type checkers.MonthDayConverternow exposes theInputTypeandOutputTypeas type aliases so that code utilizes the converted can be type-hinted better.The birth year constant 2020 is moved to
constants.pyasDEFAULT_YEAR.Tests
The testing for this PR is done a bit specially.
Automated testing will be done by #661, and manual testing will be gradually done within this PR's thread.
Help
Add birthday
After setting the role:
After the date display timeout:
Re-adding:
Channel
Delete
After setting the role:
List
After adding a birthday:
Role
Self
After enabling the self-birthday functionality:
(the above happens in DM)
Self birthday toggle
Test
Unassign
After setting the role:
Daily add
This tests the
_dailyAddfunction inCore. The local machine's time is manually adjusted to test this.Daily sweep
This tests the
_dailySweepfunction inCore. The local machine's time is manually adjusted to test this.(the role is no longer there)