Conversation
* 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
|
"too complex to solve in the web edditor" what else am I supposed to do 😭 |
|
Oh, the latest commit for module name list cleaner temp removed locales which causes this.. |
There was a problem hiding this comment.
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-systemmodule: 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.
|
All changes have been fixed that Copilot mentioned here |
|
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
left a comment
There was a problem hiding this comment.
Great PR! Some small rather important things:
| } = require('../staff-management'); | ||
| const { localize } = require('../../../src/functions/localize'); | ||
| const dutyHandlers = require('../commands/duty.js').buttonHandlers; | ||
| const configuration = require('../configuration.json'); |
There was a problem hiding this comment.
What exactly will cause a crash? Never experienced it during testing 🫠
| if (base === 'end-submit') return handleStatusEndSubmit(interaction, type); | ||
| if (base === 'extend') return handleStatusExtend(interaction, type); | ||
| if (base === 'extend-submit') return handleStatusExtendSubmit(interaction, type); | ||
| if (base === 'hist') return handleStatusHistPage(interaction, type); | ||
| } |
There was a problem hiding this comment.
Function calls do not match function signature
There was a problem hiding this comment.
What do you mean exactly?
| if (['del_shifts', 'del_all'].includes(dataType)) { | ||
| await models['StaffShift'].destroy({ | ||
| where: { userId: targetId } | ||
| }); | ||
| await models['StaffProfile'].destroy({ | ||
| where: { userId: targetId } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Deleting shift history also wipes the profile row (suspension state, custom nickname, etc.). A suspended user could escape suspension.
| // Activity checks page | ||
| async function generatePanelActivity(client, targetUser, page = 1) { | ||
| const ActivityCheck = client.models['staff-management-system']['ActivityCheck']; | ||
| const allChecks = await ActivityCheck.findAll(); |
There was a problem hiding this comment.
Full table scan every time someone views the activity panel. Will degrade over months, particularly in big teams, consider only last 90 days or something.
|
|
||
| for (const susp of activeSuspensions) { | ||
| const startDate = new Date(susp.createdAt); | ||
| const expireDate = new Date(startDate.getTime() + (susp.durationDays * 24 * 60 * 60 * 1000)); |
There was a problem hiding this comment.
null * milliseconds = 0, making suspensions expire immediately. Should use the stored expiresAt field instead of recomputing.
| const finalMessage = { embeds: [embed.toJSON()] }; | ||
| if (pingText) finalMessage.content = pingText; | ||
|
|
||
| await logChannel.send(finalMessage); |
| client.intervals.push(job); | ||
| }; | ||
|
|
||
| async function checkExpiredSuspensions(client, guild) { |
There was a problem hiding this comment.
This function never queries StaffProfile records that are on break. a bot restarted mid-break means break durations is siletnly wrong since breakStartTime is stored but never recalculated on startup.
| }); | ||
|
|
||
| const generalConfig = getConfig(client, 'configuration'); | ||
| const canManage = interaction.member.roles.cache.some(r => [...(generalConfig.supervisorRoles || []), ...(generalConfig.managementRoles || [])].includes(r.id)) || interaction.member.permissions.has('Administrator'); |
There was a problem hiding this comment.
This pattern (and it's combinations) is being repeated multiple times across the module, consider helper function (hasStaffPermissions) for example
| } | ||
|
|
||
| const lookbackLabel = config.leaderboardLookback || 'Weekly'; | ||
| const embed = new EmbedBuilder() |
There was a problem hiding this comment.
This (and many other embeds in your module) is missing the applyFooter call. I'm guessing this is intentional due to the pagination, but this is the only module that does this that way, so you might want to consider displaying the footer instead and putting the pagination in the description.
| } | ||
|
|
||
| if (selection === 'del_all') { | ||
| const embed = new EmbedBuilder() |
There was a problem hiding this comment.
Embeds is missing the applyFooter
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:
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: