Skip to content

Hotfix for Staff Management & Ping Protection modules#193

Open
Kevinking500 wants to merge 2 commits into
ScootKit:mainfrom
Kevinking500:main
Open

Hotfix for Staff Management & Ping Protection modules#193
Kevinking500 wants to merge 2 commits into
ScootKit:mainfrom
Kevinking500:main

Conversation

@Kevinking500
Copy link
Copy Markdown
Contributor

This PR consists of a hotfix for multiple bugs in my 2 modules - these bugs are fairly critical.
Besides it being a hotfix, it prepares the SMG module for the V2 development.

Bug fixes in this PR:

  • [Ping protection]: Added a fallback behaviour if a localized modal key has more characters than Discord's limits, which causes the bot to not respond (currently)
  • [Ping Protection] Added a '}' in the main logic file to fix a crash upon startup
  • [Staff Management] Added a fallback behaviour if a localized modal key has more characters than Discord's limits, which causes the bot to not respond (currently)
  • [Staff Management] Fixed that the reviews config didn't have an elementToggle, causing the module to be disabled internally if a reviews channel was not set (even if reviews are disabled)
  • [Staff Management] Fixed incorrect staff permission checks that caused it to always decline permission unless the user has administrator perms (and raised it from staff > supervisor)
  • [Staff Management] Added a staff permission check for promoting, as I somehow forgot that before allowing everyone to promote
  • [Staff Management] Cleared JSON.parse/stringify because it's unnecessary
  • [Staff Management] Changed tag from moderation > administration

I think this is a fairly urgent PR, but take your time as personal life is still the biggest priority ^^

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

Hotfix bundle for the Staff Management and Ping Protection modules. It tightens permission checks, adds a Discord-limits fallback for localized confirmation modals, fixes a crash in the Ping Protection command file, makes the Reviews config behave correctly when no channel is set, retags the Staff Management module, and drops JSON.parse/JSON.stringify wrappers that the author considers unnecessary.

Changes:

  • Add length-based fallback locale keys/values for destructive-confirmation modals (Ping Protection and Staff Management), and add the corresponding strings to locales/en.json.
  • Move/repair staff-permission checks (issueInfraction, issueSuspension, promoteUser) to supervisor level using the general configuration, give reviews.json an elementToggle, and switch the Staff Management module tag to administration.
  • Remove JSON.parse/JSON.stringify around suspendedRoles, targetRoles, and embed templates; close the broken subcommands object in ping-protection.js.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
modules/ping-protection/events/interactionCreate.js Adds length checks and fallback locale keys for the deletion modal.
modules/ping-protection/commands/ping-protection.js Adds a closing brace meant to fix a startup crash in the subcommands object.
modules/staff-management-system/staff-management.js Reworks permission checks, drops JSON (de)serialization around role arrays and embed templates.
modules/staff-management-system/events/interactionCreate.js Adds modal-length fallbacks; drops JSON.parse on targetRoles.
modules/staff-management-system/events/botReady.js Replaces JSON parsing of suspendedRoles with an Array.isArray check.
modules/staff-management-system/commands/staff-management.js Removes unused JSON.parse on the profile embed template.
modules/staff-management-system/commands/duty.js Adds modal-length fallbacks for the "void all" confirmation modal.
modules/staff-management-system/configs/reviews.json Marks enableReviews as the elementToggle field.
modules/staff-management-system/module.json Retags the module from moderation to administration.
locales/en.json Adds fallback locale strings for both modules.

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

Comment thread modules/ping-protection/events/interactionCreate.js Outdated
Comment thread modules/ping-protection/events/interactionCreate.js Outdated
Comment thread modules/ping-protection/commands/ping-protection.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
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/events/interactionCreate.js Outdated
@Kevinking500
Copy link
Copy Markdown
Contributor Author

Either Claude that reviewed previously was yapping about JSON.parse/stringify wasn't needed was lying, or copilot is lying. Though Copilot sounds more confident so I am trusting copilot here lol

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.

2 participants