Skip to content

Staff management System#186

Open
Kevinking500 wants to merge 23 commits intoScootKit:mainfrom
Kevinking500:staff-management-system
Open

Staff management System#186
Kevinking500 wants to merge 23 commits intoScootKit:mainfrom
Kevinking500:staff-management-system

Conversation

@Kevinking500
Copy link
Copy Markdown
Contributor

@Kevinking500 Kevinking500 commented Mar 16, 2026

Staff Management System: a new module designed for management, by management

(Idk that sounded cool)

This PR introduces the Staff Management System, which directly also correlates to Seppe's suggestion.

Features in this module:

  • Infractions with custom infraction types
  • Promotions
  • Activity checks, with automation possibilities and results.
  • Staff profiles, which also show some status information autmatically (such as LoA/RA)
  • Leave of Abscence and Reduced Activity status - Staff can request an LoA/RA for a specified duration, and the bot configurator can also set a custom max duration for each type.
  • Reviews system: Users can now review staff, or everyone if enabled, without the need of custom commands. This feature also includes a history command, which calculates your average rating and you can view all reviews history.
  • Shifts system: Staff can go on-duty, on break or go off-duty again. Shift time gets saved, and set to a staff shfit leaderboard, which the bot configurator can set a custom timeframe to see it. Additionally, this feature also includes custom shift types.
  • Centralized User Panel: Just like in PP, this module includes a user panel, but improved with a dropdown for each feature, and each feature includes small extra details that normal embeds do not show. This dropdown also includes the data deletion side, which has been reworked from PP to be more clear, and when deleting all data for the user, it also includes a small timed second confirmation. This has been done since this is done by staff users, and not the bot configurator directly in the dashboard.

This time, unlike the PP module, data will be kept until deleted manually by management roles and above. Though this might be changed.

AI usage in this module:

  1. Gemini: Some debugging and small optimizations
  2. ChatGPT: Some planning and idea's
  3. Claude: Some debugging when Gemini wasn't able to fix it

SCDerox and others added 10 commits January 9, 2026 14:33
* Added the base module folders and module.json

* Added all folders necessary and the configuration files for each folder

* Added a test command

* removed the manage file

* Added, renamed and deleted some files as necessary and coded the models.

* Renamed action.js to moderation.js, coded multiple things, added a new file for correct tracking.

* Forgot to update module.json, now updated aswell

* Added additional information in ping-protection.js

* Disabled allowing reply pings, added the enable moderation and enable advanced configuration in moderation.json and made the choices inside depend on it because I forgot to :/ Added the options to enable/disable pings/modlogs/logs kept after leave and made the choices depend on it + made those choices with numbers select instead of integers for almost 0 user-error issues.

* Added support for actually correct parameters and those parameters added into the message editor for the warning message

* Added proper support for localization, and coded the events

* Completed the full module and fixed some critical bugs that caused the bot to crash

* Cleaned up some code notes I used for debugging

* Completely finished the module and worked tirelessly for many hours to debug code, has been tested and is currently ongoing extensive testing to ensure absolutely everythig works as supposed to

* Debugged absolutely everything, removed like 300 lines of code for polish while remaining the same functions. Removed a few locales that are unused and updated some locales for better understanding. Fully tested extensively. Not verified by GitHub because I code in VSCode.

* Added the option to lower mod actions history

* Made the deault value of pings to trigger action 10 instead of 5 in basic pings count config

* Added the commands warnings for most commands

Listed the warnings for all commands except the panel command as the bot already checks for administrator perms.

* Almost completely rewrote the module to make sure the modules works as supposed to with SCNX.

* Added "automod" abilities - Will now delete the original message by default with the message content and allows to configure both options

* (not working correctly) added automod integration and some small changes

* Fixed the

* Removed the feature that didn't work (reposting), adds a custom message to the automod message block. Also the bot now deletes the rule it created if automod enabled = false

* Fixed the bug of the bot still sending the warning and punishing if limit reached with reply pings even when it's allowed in config

* Added a funny easter egg

* Some QOL improvements, including merging the list commands

* Added some new options  in the config

* Update configuration.json

* Fix self-ping condition to allow self-pinging

* Ping protection V1, in Discord.JS V14

* Ping Protection V1

* Changed code to the requested changes, and adjusted code logic to actually properly support multiple moderation actions (not tested before, and didn't work during testing)

* Made adjustments to code as requested, and added an intent to main.js to make it work properly.

* Fixed the missing footer on embeds. Fixed a small typo in the default waning message configuration and added an emoji to the why easter egg.

---------

Co-authored-by: Kevinking500 <Kevinking500>
* Added the base module folders and module.json

* Added all folders necessary and the configuration files for each folder

* Added a test command

* removed the manage file

* Added, renamed and deleted some files as necessary and coded the models.

* Renamed action.js to moderation.js, coded multiple things, added a new file for correct tracking.

* Forgot to update module.json, now updated aswell

* Added additional information in ping-protection.js

* Disabled allowing reply pings, added the enable moderation and enable advanced configuration in moderation.json and made the choices inside depend on it because I forgot to :/ Added the options to enable/disable pings/modlogs/logs kept after leave and made the choices depend on it + made those choices with numbers select instead of integers for almost 0 user-error issues.

* Added support for actually correct parameters and those parameters added into the message editor for the warning message

* Added proper support for localization, and coded the events

* Completed the full module and fixed some critical bugs that caused the bot to crash

* Cleaned up some code notes I used for debugging

* Completely finished the module and worked tirelessly for many hours to debug code, has been tested and is currently ongoing extensive testing to ensure absolutely everythig works as supposed to

* Debugged absolutely everything, removed like 300 lines of code for polish while remaining the same functions. Removed a few locales that are unused and updated some locales for better understanding. Fully tested extensively. Not verified by GitHub because I code in VSCode.

* Added the option to lower mod actions history

* Made the deault value of pings to trigger action 10 instead of 5 in basic pings count config

* Added the commands warnings for most commands

Listed the warnings for all commands except the panel command as the bot already checks for administrator perms.

* Almost completely rewrote the module to make sure the modules works as supposed to with SCNX.

* Added "automod" abilities - Will now delete the original message by default with the message content and allows to configure both options

* (not working correctly) added automod integration and some small changes

* Fixed the

* Removed the feature that didn't work (reposting), adds a custom message to the automod message block. Also the bot now deletes the rule it created if automod enabled = false

* Fixed the bug of the bot still sending the warning and punishing if limit reached with reply pings even when it's allowed in config

* Added a funny easter egg

* Some QOL improvements, including merging the list commands

* Added some new options  in the config

* Update configuration.json

* Fix self-ping condition to allow self-pinging

* Ping protection V1, in Discord.JS V14

* Ping Protection V1

* Changed code to the requested changes, and adjusted code logic to actually properly support multiple moderation actions (not tested before, and didn't work during testing)

* Made adjustments to code as requested, and added an intent to main.js to make it work properly.

* Fixed the missing footer on embeds. Fixed a small typo in the default waning message configuration and added an emoji to the why easter egg.

* Ping Protection V1.1

* Quickly updated locales for better explanation about exceptions for whitelisted

* Ping Protection V1.1 remastered

* Another remastered version

* Added categories in 2 configs

* Used proper emoji's that SCNX supports

* Used the new updated ones I suggested that were added (and hopefully also work)

* Updated some small changes from Copilot

---------

Co-authored-by: Kevinking500 <Kevinking500>
* feat(economy): implements "Artikel bearbeiten"
Implements https://featureboard.net/suggestions/95f5a741-6d35-4b86-9c67-abd900dca76e

* fix(economy): Adressed the issues copilot pointed out and also fixed them in createShopItem
* Weird things are happening. Tried to rebuild it

* Weird things are happening. Tried to rebuild it

* Next try, please work this time

* temp-removed locales
@Kevinking500
Copy link
Copy Markdown
Contributor Author

"too complex to solve in the web edditor" what else am I supposed to do 😭

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Oh, the latest commit for module name list cleaner temp removed locales which causes this..

@SCDerox SCDerox changed the base branch from beta-discordjs14 to main March 16, 2026 11:37
@SCDerox SCDerox requested a review from Copilot March 16, 2026 11:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Staff Management System module that adds management workflows (infractions/suspensions, promotions, staff reviews, activity checks, LoA/RA status handling, and shift tracking) plus supporting configs, models, commands, events, and locale strings. It also includes a small core interaction handler tweak to support commands that use subcommand groups.

Changes:

  • Add the staff-management-system module: logic layer, commands, component interaction handlers, scheduled jobs, and Sequelize models.
  • Add dashboard config schemas for the module’s features (infractions, promotions, reviews, shifts, status, profiles, activity checks).
  • Extend localization (locales/en.json) with staff-management-system strings (and unrelated guess-the-number strings).

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/events/interactionCreate.js Treats SUB_COMMAND_GROUP as a subcommand container when dispatching slash commands.
modules/staff-management-system/staff-management.js Core logic for staff management features (infractions, promotions, reviews, statuses, panels, activity checks).
modules/staff-management-system/module.json Module metadata and config file registration.
modules/staff-management-system/models/ActivityCheck.js Sequelize model for activity check records.
modules/staff-management-system/models/Infraction.js Sequelize model for infractions/suspensions.
modules/staff-management-system/models/LoaRequest.js Sequelize model for LoA/RA requests.
modules/staff-management-system/models/Promotion.js Sequelize model for promotions.
modules/staff-management-system/models/StaffProfile.js Sequelize model for staff profile + duty/status fields.
modules/staff-management-system/models/StaffReview.js Sequelize model for staff reviews.
modules/staff-management-system/models/StaffShift.js Sequelize model for shift logs.
modules/staff-management-system/events/interactionCreate.js Component interaction routing for staff management UI, duty UI, LoA/RA actions, deletion.
modules/staff-management-system/events/guildMemberRemove.js Auto-closes open shifts when a member leaves.
modules/staff-management-system/events/botReady.js Schedules LoA/RA expiry jobs and checks expired suspensions periodically.
modules/staff-management-system/configs/configuration.json Base roles + general log channel config schema.
modules/staff-management-system/configs/infractions.json Infractions/suspensions config schema + templates.
modules/staff-management-system/configs/promotions.json Promotions config schema + templates.
modules/staff-management-system/configs/reviews.json Reviews config schema + templates.
modules/staff-management-system/configs/shifts.json Shifts/leaderboard/quota config schema.
modules/staff-management-system/configs/status.json LoA/RA status config schema + logging options.
modules/staff-management-system/configs/profiles.json Staff profiles config schema + template.
modules/staff-management-system/configs/activity-checks.json Activity check + automation config schema.
modules/staff-management-system/commands/staff-management.js Slash command entrypoint for most staff management actions.
modules/staff-management-system/commands/status.js Slash command for LoA/RA request/view/list/admin manage.
modules/staff-management-system/commands/duty.js Slash command + button handlers for duty/shift tracking UX.
locales/en.json Adds staff-management-system strings (and new guess-the-number strings).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread locales/en.json Outdated
Comment thread modules/staff-management-system/configs/status.json Outdated
Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
Comment thread modules/staff-management-system/module.json Outdated
Comment thread modules/staff-management-system/configs/infractions.json Outdated
Comment thread modules/staff-management-system/configs/promotions.json
Comment thread modules/staff-management-system/configs/promotions.json
Comment thread locales/en.json Outdated
@Kevinking500
Copy link
Copy Markdown
Contributor Author

All changes have been fixed that Copilot mentioned here

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Just a quick note, I am quite the bit less available and more busy the last few days, and would likely stay like this for roughly the next week(s) as I am preparing and planning for my trip next month ^^

@SCDerox SCDerox self-requested a review March 26, 2026 14:15
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! Some small rather important things:

Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/events/botReady.js Outdated
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/events/botReady.js
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/commands/duty.js Outdated
Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
@Kevinking500
Copy link
Copy Markdown
Contributor Author

Due to a sudden finding of a critical bug (duty time still being recorded even while being on break) during the testing after changes, the next commit will unfortunately be delayed by quite the bit until I fix this ^^

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Actually, no big delay (I sent that fairly late, I was working for this for more than 1 hour now). Will be committing it shortly

@Kevinking500 Kevinking500 requested a review from SCDerox March 26, 2026 20:29
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Found 9 issues (4 critical bugs, 1 security issue, 4 logic/data bugs):

  1. del_all confirmation bypassed — data deleted immediately without waiting for user confirmation (missing return after collector setup)
  2. interaction.update() called on ModalSubmitInteraction in LOA deny handler (method doesn't exist on modal submits)
  3. handleStatusEnd called with wrong arguments — client passed where interaction expected, crashes on every "End Early" button press
  4. interaction.update() called on ModalSubmitInteraction in duty admin add-time handler (same root cause as #2)
  5. Break recovery corrupts shift startTime on every bot restart by double-counting elapsed break time
  6. guildMemberRemove uses findOne instead of findAll — orphans multiple open shifts
  7. No authorization re-check on admin duty button handlers (force-end, void, add-time)
  8. initActivityCheckAutomation never called in botReady — automated checks never fire
  9. Suspension isSuspended: true upsert only runs conditionally — leaves inconsistent state

Generated with Claude Code

Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
Comment thread modules/staff-management-system/commands/duty.js Outdated
Comment thread modules/staff-management-system/events/botReady.js Outdated
Comment thread modules/staff-management-system/events/guildMemberRemove.js Outdated
Comment thread modules/staff-management-system/commands/duty.js
Comment thread modules/staff-management-system/events/botReady.js
Comment thread modules/staff-management-system/staff-management.js
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Agentic Code Review

Hey Kevin, thanks for your contribution on the staff management system -- this is a big module and a lot of solid work!

Heads up: This is an automated agentic review test that Simon is running. An AI agent (Claude Code) independently reviewed every file in this PR using multiple parallel review passes (bug scanning, security audit, UX review, cross-file consistency, and code quality analysis). Each finding was then independently scored for confidence, and only issues scoring above the threshold were included.

Found 9 high-priority issues (from the previous review comment) and 15 lower-priority issues (marked as "Minor" in this review).

The high-priority ones include 4 critical runtime crashes (wrong method calls on modal submits, argument mismatch, missing return), 1 security concern (missing auth re-checks on admin handlers), and 4 data integrity bugs. The minor ones cover validation gaps, UX improvements, i18n issues, and edge cases.

Please feel free to:

  • Dismiss any findings that are wrong or not applicable -- automated reviews can produce false positives
  • Ask for clarification on any comment if the reasoning isn't clear
  • Provide feedback on whether this type of agentic review is useful, too noisy, or could be improved

Simon is testing this workflow and your feedback would be valuable for tuning it.

Thanks again for the contribution!

Generated with Claude Code

Comment thread modules/staff-management-system/commands/status.js
Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/staff-management.js
Comment thread modules/staff-management-system/commands/duty.js Outdated
Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/commands/status.js
Comment thread modules/staff-management-system/models/StaffShift.js Outdated
Comment thread modules/staff-management-system/staff-management.js
Comment thread modules/staff-management-system/events/interactionCreate.js Outdated
Comment thread modules/staff-management-system/staff-management.js
@Kevinking500
Copy link
Copy Markdown
Contributor Author

There we go. Most things are fixed now.

@Kevinking500 Kevinking500 requested a review from SCDerox April 4, 2026 19:30
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review (post-fix)

Great job addressing all 9 high-priority issues and most of the minor ones. Found 3 remaining issues and a locale cleanup pass:

Bugs:

  1. Manage panel not updated after status end/extend — original message still shows enabled buttons to other supervisors
  2. Null crash in buildDutyAdminPayload when target member left the server — admin sees error despite operation succeeding
  3. Missing checkDutyAdminPermission on handleDutyAdminAddTimeSubmit modal handler (was added to the button handler but missed on the submission)

Locales:

  • 3 missing keys that will show raw key names at runtime
  • 39 unused keys (renamed leftovers) that can be cleaned up

Comment thread modules/staff-management-system/commands/duty.js
Comment thread modules/staff-management-system/commands/duty.js
Comment thread locales/en.json
@Fatih5252
Copy link
Copy Markdown

yo what is claude yapping

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Changes done from the feedback, and removed unused localeskeys. Surprisingly, even after the removal of many locales keys, the module still has 355 locales keys which will be annoying for translators like me to do lol

@Kevinking500 Kevinking500 requested a review from SCDerox April 5, 2026 07:21
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated AI Code Review

Great work addressing the previous 13 issues — all confirmed fixed. This follow-up review found 11 remaining issues (1 critical, 8 important, 2 minor). Most are interaction lifecycle issues (missing defers, stale panels) and one critical data integrity bug in voidInfraction.

Summary:

  • 1 critical: voidInfraction DB commit ordering
  • 8 important: defer/interaction lifecycle, audit log, pagination, race condition, performance
  • 2 minor: code consistency

See inline comments for details and suggested fixes.

Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/commands/status.js Outdated
Comment thread modules/staff-management-system/commands/status.js
Comment thread modules/staff-management-system/commands/status.js Outdated
Comment thread modules/staff-management-system/commands/duty.js Outdated
Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/staff-management.js Outdated
@Kevinking500 Kevinking500 requested a review from SCDerox April 11, 2026 07:05
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated AI Follow-up Review

Thanks for addressing 8 of the 11 issues — solid work. Two regressions were introduced in this commit that will cause crashes:

  1. voidInfraction permission check references undefined member — every void call fails
  2. endActivityCheckProcess deleted variable definitions still referenced — crashes on every activity check completion

Also, the status end/extend panel issue was misunderstood (see reply on that thread) — it's about the original non-ephemeral message not being updated, not the ephemeral reply itself.

Comment thread modules/staff-management-system/staff-management.js Outdated
Comment thread modules/staff-management-system/staff-management.js
@Kevinking500 Kevinking500 requested a review from SCDerox April 12, 2026 06:47
Copy link
Copy Markdown
Member

@SCDerox SCDerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran an AI-assisted code review over this module and want to flag three things I'm fairly confident about — all three are eyeballed against the PR source (e33fd701) to make sure they aren't hallucinated. Feel free to dismiss anything that's actually intended behaviour; you know this module better than me.

Nice work on the overall scope here, by the way.

Comment thread modules/staff-management-system/events/interactionCreate.js
Comment thread modules/staff-management-system/commands/status.js
Comment thread modules/staff-management-system/staff-management.js Outdated
@SCDerox
Copy link
Copy Markdown
Member

SCDerox commented Apr 14, 2026

Quick i18n pass on the current state of the module (not strictly from this PR — also includes some follow-up revisions we have queued on main's working tree): three localize() call sites reference keys that don't exist in locales/en.json, so they render the raw key in production.

  1. err-not-req — typo, modules/staff-management-system/events/interactionCreate.js:521 (ac-respond handler, the !hasRole branch). The key that already exists for this exact case is err-ac-not-req ("❌ You are not required to respond to this activity check."). Easiest fix is to swap the key name.
  2. err-no-case-ref — missing, modules/staff-management-system/staff-management.js:409, called with a {reference} placeholder when resolveInfractionReference returns nothing. Suggested en value: "❌ No infraction case found for \%reference%`."`
  3. general-req-reason — missing, modules/staff-management-system/commands/status.js:143, used as a log-embed field label for the original request reason of a LoA/Reduced-Activity that just ended. Suggested en value: "Request Reason".

If you'd like, I can push these directly to staff-management-system on your fork, along with the other review follow-ups we've accumulated locally — the placeholder renames (%userPfp%%user-avatar%, %issuerName%%issuer-name%, %caseId%%case-id%, etc.), the self-infraction guard, the DM-delivery logging, the break-count tracking, the shift change log, and a few interaction-handler deferUpdate/deferReply fixes.

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Oh thanks for the offer, as these are fairly small changes (and due to me being too laxy to sync the changes from Git to the local version), and some minor fixes to what Claude/your AI suggested as changes, same for localization, i'll probably spend the small 15-30 mins fixing those small mistakes ^^

@Kevinking500 Kevinking500 requested a review from SCDerox April 14, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants