Skip to content

feat(mod): add /mod cleanup command to reset #access-help - #103

Closed
IbrahimCart wants to merge 1 commit into
pesu-dev:devfrom
IbrahimCart:llokri/mod-cleanup
Closed

IbrahimCart wants to merge 1 commit into
pesu-dev:devfrom
IbrahimCart:llokri/mod-cleanup

Conversation

@IbrahimCart

Copy link
Copy Markdown

📌 Description

Adds a new moderation slash command, /mod cleanup <channel>, as requested in #92.

It resets the #access-help channel: it purges all messages, reposts the two standard onboarding / authentication-checklist messages from the issue, pins them, removes the "pinned a message" system notices Discord adds, and sends an audit embed to the mod-logs channel. For now only #access-help is accepted; any other channel gets an ephemeral error.

  • Command lives in src/cogs/mod/commands.py, modelled on /mod purge (same defer / location / role / error decorators: admin, mod, junior mod).
  • The two message texts are constants in src/cogs/mod/helpers.py; a test checks each stays under Discord's 2000-character limit.
  • Added to the /help mod menu.

Closes #92


🧱 Type of Change

  • ✨ New feature – Adds functionality without breaking existing commands or APIs
  • 🧪 Test suite change – Adds/updates unit, integration, or manual tests

🧪 How Has This Been Tested?

  • Unit Tests (tests/unit/)
  • Integration Tests (tests/integration/)
  • Manual testing in Discord
  • CI

Test Environment:

  • OS: macOS (Apple Silicon)
  • Python: 3.15.2 locally (project targets 3.13, so please let CI confirm)
  • Discord.py version: 2.7.1
  • Docker build tested

New unit tests cover: a channel other than #access-help is rejected and nothing is purged; a user without a moderator role cannot run it; purge is called with limit=None, both messages are sent and pinned, and the audit embed is sent; the message lengths; and the pin-notice cleanup.

I have not run the command in a live Discord server (no MongoDB / bot token / test guild set up on my machine), so the Discord-side behaviour (purging more than 14-day-old messages, pin permissions) is untested beyond mocks. Happy to adjust if you see anything off.


✅ Checklist

  • My code follows repo CONTRIBUTING.md guidelines
  • Self-review completed
  • Added/updated comments and docstrings
  • Updated relevant docs (README, help text, etc.)
  • No new warnings or errors introduced
  • Added/updated tests
  • All tests pass locally
  • Ran linting and formatting
  • Docker image builds and runs
  • Changes are backwards compatible (if applicable)
  • Feature flags or .env vars updated (if applicable)
  • Tested in multiple environments (if applicable)

🛠️ Affected Bot Areas

  • Commands (e.g., /ping, /help)
  • Permissions/roles

📸 Screenshots / Demos (if applicable)

None yet, since I have not been able to run it in a Discord server.


🧠 Additional Notes

  • The bot needs Manage Messages and Read Message History in #access-help, as noted in the issue.
  • The messages embed the /link command ID (1532610288950448129) and the admin mention from the issue; please check they match production.
  • The pin-notice cleanup looks at the last 10 messages for Discord's system "pinned a message" notices. Easy to drop if you would rather not have it.
  • I'm a UW student doing this as a class project (TCSS 490). Thanks for the clear issue.

Adds a moderation slash command that purges #access-help, reposts the two
onboarding messages, pins them, removes the pin notices and logs the cleanup
to the mod-logs channel. Only #access-help is accepted for now.

Closes pesu-dev#92
@IbrahimCart
IbrahimCart requested a review from a team as a code owner November 1, 2026 13:53
@achyu-dev

Copy link
Copy Markdown
Contributor

@IbrahimCart were you even assigned the issue? are you part of PES university?
Closing your PR as you were not even assigned

@achyu-dev achyu-dev closed this Nov 1, 2026
@IbrahimCart

Copy link
Copy Markdown
Author

Hi @achyu-dev, thanks for replying, and sorry for opening the PR before being assigned. I'm not part of PES University. I'm a student at the University of Washington, and I'm doing this as a class project (TCSS 490) where I contribute to an open-source project. I should have waited for an answer on #92 before opening it. If you're open to it, I'd be glad to be assigned and reopen it. Otherwise I understand if this issue is meant for your own community.

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.

Clean up access help

2 participants