-
-
Notifications
You must be signed in to change notification settings - Fork 104
Add top-helpers command #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Member
|
Valid but parked, will be picked up by someone soonish (january maybe). |
Member
|
Will take this over but for the moment blocked by #345. |
e83c4f8 to
306f674
Compare
Member
3998789 to
3a76f0c
Compare
Zabuzard
previously approved these changes
Jan 27, 2022
* changed the layout of the methods * fixed style issues * fixed various design issues * streamlined the code more the logic itself merely changed
* with proper java.time computation instead of just "last 30 days"
a5bfabd to
1241d05
Compare
|
Kudos, SonarCloud Quality Gate passed! |
Member
|
No changes since a week, merging. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.









Overview
Implements and closes #65. Originally based on #117.
Adds the
/top-helperscommand that computes and displays the top helpers from the last month.Also has a fallback message if there is no data in the time range yet:
For now the command has no options but it was designed with optionally picking a time range (start and end) in mind. This can be done once Discord/JDA add date-pickers (currently in progress). A
TODOin the class keeps track of this.Details
The code is divided into three classes:
TopHelpersCommand- the slash command itself, will read the database, compute the message and display itTopHelpersMessageListener- the listener that receives all help messages and adjusts the database accordinglyTopHelpersPurgeMessagesRoutine- the routine that deletes old messages from the databaseSlash command
The
TopHelpersCommandclass is pretty straightforward:java.timeand not just last 30 days)groupBywithcountandorderBy, nothing fancy)Memberinformation about those users asyncAsciiTablelibraryMessage listener
The
TopHelpersMessageListenerclass has one simple jobs right now:latter should in the near future be replaced with #346 , aTODOkeeps track of it already.Help messages are identified by channel name regex (as per
MessageReceiverAdapter), the regex is:In the future,
FreeCommandcould be changed to utilize this config entry as well, instead of the channel ids.Message purging
The class
TopHelpersPurgeMessagesRoutineis a simpleRoutinewhich is executed once every 4 hours and deletes all top-helper message entries in the database that are older than 90 days.Database
The database table that supports all the magic is quite simple, its just:
Remarks for release
The config has changed, the following has been added:
(see the
config.json.templatefile in the code diff)