Automate dFunk roles#196
Open
crystopherross wants to merge 101 commits intomainfrom
Open
Conversation
RafDevX
requested changes
May 22, 2025
Co-authored-by: Rafael Oliveira <rmfseo@kth.se>
Collaborator
|
It now reports to a log channel specified beforehand by the `/log channel` command.
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
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.
Summary
This PR automates the process of updating Discord roles based on data from the dfunkt API, which addresses #41. The task runs automatically every Saturday at 12:00 AM, adjusting roles accordingly. This update reduces manual effort previously required to elect new posts and manage roles. The current functionary roles are automatically updated using Hive, the rest using data from dfunk. The update is done to every server the bots is in, but it is inactive by default, can be activated/deactivated using the
/dfunk togglecommand. However the command at this moment globally turns on/off the cronjob, this should be okay since the cronjob is only instantiated in the normal bot (not light).Technical Details
dFunk,D-rekon Discord).dFunkt).dfunk.ts.update-dfunk-roles.ts, in global variablesgroupRoleNames,specialRoleNames,dfunkGroupToDiscordRoleMapping.dfunk-interfaces.tshive.ts./dfunk update) is introduced for administrators to trigger the update manually.dfunkGroupToDiscordRoleMappingandgroupRoleNamesaccordingly./dfunk updatecommand, the following are implemented:/dfunk status: Returns the current status of the automatic update, whether it is active or not, when was the last update done, and if active, when the next update will take place (in UTC time)..
/dfunk toggle: Turns on/off the automatic role update for all servers. By default the automatic update is inactive, thus, to use this feature, this command has to be run.CronJobs
This PR introduces basic cron job functionality for automated tasks. It uses the
cronpackage to create and manage scheduled tasks, which can be expanded in the future for other automated features. This also introduces new dependencies inpackage.json.Side Effects
cronpackage and related dependencies have been added topackage.jsonfor cron job functionality./dfunkcommand is now available for administrators to manage the automatic role updates.