Skip to content

feat: add /nuke slash command#32

Merged
DysektAI merged 1 commit into
mainfrom
feat/nuke-command
Jul 9, 2026
Merged

feat: add /nuke slash command#32
DysektAI merged 1 commit into
mainfrom
feat/nuke-command

Conversation

@DysektAI

@DysektAI DysektAI commented Jul 9, 2026

Copy link
Copy Markdown
Member

User description

Summary

  • Adds /nuke, an admin-only slash command that clones the current channel (carrying over all permissions/overwrites, topic, nsfw, rate limit, parent category, and auto-archive duration) and then deletes the old channel — appearing as a fresh chat while preserving configuration.
  • gated via hasAdminRole (ADMIN_ROLE_ID), matching the /wipe pattern.
  • Confirm/cancel buttons with a 15s timeout before any destructive action.
  • Bot-channel detection: if the target channel matches WELCOME_CHANNEL_ID or HONEYPOT_CHANNEL_ID, the confirm warning names the affected features and warns that the new channel ID will break them.
  • Transactional error handling: clone failure leaves the original channel untouched; delete failure after a successful clone reports a "partially complete" state and tells the admin to remove the old channel manually.
  • Position restored via setPosition so the clone sits in the same spot.
  • Final outcome reported in the new channel (the ephemeral reply dies with the deleted channel).

Design notes

  • Follows the existing /wipe command structure exactly: executeNuke(interaction) in src/commands/nukeCommand.js, confirm/cancel buttons, createCardEmbed, shared colors.warning.
  • getAffectedBotFeatures(channelId) is exported and unit-tested so the bot-channel warning logic is covered without needing a live Discord interaction.
  • Verified the guild.channels.create clone options against discord.js v14.26.4 typings (CategoryCreateChannelOptions) and the official permissions guide (permission overwrites can be passed as a Collection directly from the old channel's cache).

Test plan

  • npm test — 9/9 pass (4 env + 2 honeypot + 3 nuke helper tests)
  • node --check syntax sweep passes on all JS files
  • No new required env vars — feature uses existing ADMIN_ROLE_ID for gating and existing channel IDs for the bot-channel warning
  • Manual: run /nuke in a test channel, confirm clone carries permissions, confirm old channel is deleted, confirm position is preserved
  • Manual: run /nuke in the welcome channel, confirm the bot-channel warning appears naming "welcome messages (WELCOME_CHANNEL_ID)"

CodeAnt-AI Description

Add a confirmable /nuke command to replace a channel in place

What Changed

  • Added /nuke for admins to clone the current text channel with its permissions, settings, and position, then delete the old channel
  • The command now warns before acting, supports canceling, and times out if no choice is made
  • If the channel is tied to welcome messages or honeypot handling, the warning now names those features and tells admins to update the channel ID afterward
  • Added tests for the bot-channel warning helper and documented /nuke in the command list

Impact

✅ Faster channel resets
✅ Fewer accidental channel deletions
✅ Clearer warnings for bot-linked channels

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Adds an admin-only /nuke command that clones the current channel (with
all permissions, overwrites, topic, nsfw, rate limit, category, and
auto-archive duration) and then deletes the old channel — appearing as
a fresh chat while preserving the channel's configuration.

- Admin-gated via hasAdminRole (ADMIN_ROLE_ID), matching /wipe.
- Confirm/cancel buttons with a 15s timeout before any destructive action.
- Detects bot-related channels (WELCOME_CHANNEL_ID, HONEYPOT_CHANNEL_ID)
  and surfaces an extra warning naming the affected features, since the
  new channel ID will break anything referencing the old one.
- Transactional error handling: if the clone fails the original channel
  is left untouched; if the delete fails after a successful clone, the
  admin is told to remove the old channel manually.
- Position is restored via setPosition so the clone sits in the same spot.
- Final outcome is reported in the new channel (the ephemeral reply dies
  with the deleted channel).
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 07cc1914-039f-4502-a4c9-3b050e343192

📥 Commits

Reviewing files that changed from the base of the PR and between a52657e and 024f563.

📒 Files selected for processing (5)
  • README.md
  • src/commands/nukeCommand.js
  • src/commands/registerSlashCommands.js
  • src/interactions/slashHandlers.js
  • test/nuke.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/nuke-command

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jul 9, 2026
Comment thread src/commands/nukeCommand.js
Comment thread src/interactions/slashHandlers.js
Comment thread src/commands/nukeCommand.js
@kilo-code-bot

kilo-code-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • README.md
  • src/commands/nukeCommand.js
  • src/commands/registerSlashCommands.js
  • src/interactions/slashHandlers.js
  • test/nuke.test.js

Reviewed by hy3-20260706:free · Input: 76.6K · Output: 9.7K · Cached: 118.4K

@DysektAI

DysektAI commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Hey @Nivmizz7 — PR #32 (/nuke command) is ready for review and merge.

All CI checks pass: check (syntax + 9/9 tests), CodeQL, Kilo Code Review, Socket Security. The only failing check is the pre-existing code/snyk org quota issue ("Code test limit reached") unrelated to this PR.

3 CodeAnt suggestions were reviewed and replied to — all are false positives or non-actionable style preferences (details in the inline replies). No code changes needed.

What /nuke does:

  • Admin-only (requires ADMIN_ROLE_ID), clones the current channel with all permissions/settings, then deletes the old one
  • Confirm/cancel buttons with a 15s timeout before acting
  • Detects bot-related channels (WELCOME_CHANNEL_ID, HONEYPOT_CHANNEL_ID) and warns which features will break from the new channel ID
  • Transactional: clone failure leaves the original untouched; delete failure reports partial state

Post-merge verification:

  1. Run /nuke in a throwaway test channel — confirm the clone carries permissions/topic/category, the old channel is deleted, and position is preserved
  2. Run /nuke in the welcome channel — confirm the warning names "welcome messages (WELCOME_CHANNEL_ID)"
  3. Test cancel button and the 15s timeout
  4. Confirm the bot has Manage Channels permission in the guild

@DysektAI
DysektAI merged commit 96404d5 into main Jul 9, 2026
10 of 11 checks passed
@DysektAI
DysektAI deleted the feat/nuke-command branch July 10, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant