Skip to content

Staff Management System V1.1#190

Open
Kevinking500 wants to merge 6 commits intoScootKit:mainfrom
Kevinking500:main
Open

Staff Management System V1.1#190
Kevinking500 wants to merge 6 commits intoScootKit:mainfrom
Kevinking500:main

Conversation

@Kevinking500
Copy link
Copy Markdown
Contributor

This updates the SMG module according to user feedbacks (latest 24 - 48hrs) and other bug reports

Changes:

  • [Bug fix] Fixed default parameters not being updated to the new ones
  • [Bug fix] Fixed the activity check message being empty if it was amde with Components V2
  • [QoL] Completely rewrote the activity check embed and added new parameters
  • [QoL] Minor locales improvements
  • [QoL] Made the logic previously yapped by Claude (and during more usage being found annoying) that the duty admin command now refreshes the reply instead of replying again ephemerally
  • [QoL] Made the add role on promotion default to false since it's recommended to be off and I forgot to change it before
  • [QoL] Updated some config descriptions and moved a config up where it makes more sense
  • [QoL] Added a staff permission check to issueInfraction and issueSuspension

No AI usage in this PR

@SCDerox
Copy link
Copy Markdown
Member

SCDerox commented Apr 27, 2026

Thanks for the PR! One thing on the Components V2 activity-check fix — endActivityCheckProcess in staff-management.js (around the if (msg && msg.embeds.length > 0) guard) still skips the update path for V2 messages.

When the activity-check message was sent via embedTypeV2 with _schema: "v4", the IsComponentsV2 flag means there's no top-level embed in msg.embeds, so the guard is false and the message isn't edited at end-of-check. The default config ships _schema: "v3" so most servers won't notice, but anyone who switched their template to V2 still hits the original empty-message bug this PR is meant to fix.

A couple of fix options: clear the components unconditionally regardless of whether embeds are present, or branch on the V2 flag and rebuild the V2 component tree to mark the check as ended.

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Thanks for the reply! This should be the fix.

Comment thread modules/staff-management-system/staff-management.js Outdated
@Kevinking500
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, just fixed that one specified one. I will also actually apply it to some other places if you don't mind.

Co-authored-by: Copilot <copilot@github.com>
@Kevinking500 Kevinking500 requested a review from SCDerox April 28, 2026 11:29
@SCDerox
Copy link
Copy Markdown
Member

SCDerox commented Apr 28, 2026

Thanks for the quick turnaround! One more thing on this path — for V2 templates the new code does run, but the resulting msg.edit({ components: [] }) clears the container components too, so the message ends up visually empty (since V2 messages have no top-level embed to fall back on, all the title/description content lives inside the containers).

Two ways to keep the body visible:

  1. Filter the response button by its customId instead of wiping all components — the button is added as a top-level row with a stable id, so something like:

    const kept = msg.components
        .map(row => row.toJSON ? row.toJSON() : row)
        .filter(row => !(row.components || []).some(c => c.custom_id === 'staff-mgmt_ac-respond'));
    await msg.edit({ components: kept });
  2. Re-render through embedTypeV2 with the same template (or a "check ended" variant) and pass an empty components: [] as the third argument so no button is appended:

    const ended = await embedTypeV2(endedTemplate, placeholders, { components: [] });
    await msg.edit(ended);

Both keep the original check context visible to users while removing the live button. The first is the smaller change; the second lets you also tweak the styling/title to indicate the check has ended.

@Kevinking500
Copy link
Copy Markdown
Contributor Author

Actually just came to this solution, I think it would be great if the user can configure the end message to their liking to like show other text and maybe other custom buttons etc. I will implement that logic which would probably also simplify this a bit

Co-authored-by: Copilot <copilot@github.com>
@Kevinking500
Copy link
Copy Markdown
Contributor Author

I changed logic for this, though to make this reliable I had to add 2 new columns to a DB model, though I am interested to know if the migration process with the SCNX hosted bots will work to update it properly.
Otherwise, I think this should now work ^^

Comment thread modules/staff-management-system/models/ActivityCheck.js
Co-authored-by: Copilot <copilot@github.com>
@Kevinking500 Kevinking500 requested a review from SCDerox April 28, 2026 19:29
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