6 defense layers. Every bypass vector closed. Ghost events caught. Slow-burn nukes tracked. Built by someone who's been stopping nukers since 2015.
v2.0.0 is a complete ground-up rewrite. The old single-file approach is gone. Every known anti-nuke bypass vector is now explicitly handled across 6 independent defense layers named after Mahabharata military formations.
| What was broken before | What v2.0.0 does |
|---|---|
| Whitelisted users had full bypass | Levels 1β2 get relaxed limits, not zero limits |
| No role-based whitelist | Full role + user whitelist with level inheritance |
@everyone perm escalation not caught |
Makara Vyuha detects and auto-reverts it |
| Webhook created but never deleted | Padma Vyuha deletes the webhook before punishing |
| Rogue bot added but never kicked | Padma Vyuha kicks the bot before punishing the adder |
| Slow-burn nukes evaded rate limits | Vajra Vyuha tracks weighted scores over 1 hour |
| Ghost events (token nukes) undetected | Garuda Vyuha escalates to ChakraView on 3+ ghost events |
| ChakraView broke server permanently | SnapshotManager saves and restores full guild state |
| No per-guild configuration | Full /setup, /limits, /bypass, /status commands |
npm install @intruder214/torque-antinukeRequirements:
- Node.js
>= 16.11.0 - discord.js
^14.14.1 - Bot permissions:
View Audit Log,Ban Members,Manage Roles,Manage Channels,Moderate Members
const { Client, GatewayIntentBits } = require('discord.js');
const TorqueAntiNuke = require('@intruder214/torque-antinuke');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMessages,
],
});
client.once('ready', () => {
new TorqueAntiNuke({ client });
console.log(`Online as ${client.user.tag}`);
});
client.login('YOUR_BOT_TOKEN');Zero config required. All 6 layers activate automatically with sane defaults.
const antinuke = new TorqueAntiNuke({
client,
// Path to the persistent JSON database (default: torque-data.json)
dbPath: './data/torque.json',
});
// Per-guild settings (also configurable via slash commands)
antinuke.setSetting('GUILD_ID', 'logChannel', 'CHANNEL_ID');
antinuke.setSetting('GUILD_ID', 'punishment', 'ban'); // ban | kick | strip | quarantine
antinuke.setSetting('GUILD_ID', 'window', 10000); // rolling window in ms
// Custom per-action limits
antinuke.setSetting('GUILD_ID', 'limits', {
channelDelete: 2,
channelCreate: 3,
roleDelete: 2,
roleCreate: 3,
roleDangerousUpdate: 1,
memberBan: 2,
memberKick: 3,
webhookCreate: 2,
botAdd: 1,
guildUpdate: 1,
emojiDelete: 4,
});Each layer is named after a military formation from the Mahabharata. They operate in sequence β every event passes through all relevant layers.
The first thing every gateway event hits. Runs a true rolling window rate limiter using timestamp arrays (not counters) so there's no reset-timer gaming.
The bypass fix: Whitelisted users are NOT fully bypassed here. They get relaxed limits:
- Level 1 (Mod): 2Γ base limit on ban/kick actions
- Level 2 (Admin): 2Γ base limit on structural actions
- Level 3 (Immune): only true bypass β and Vajra still watches them
A compromised Level 2 admin can still nuke if fully bypassed. Krauncha closes that hole.
Reconciles every gateway event against the Discord Audit Log to find the true executor.
Ghost event detection: If an action fires (channel deleted) but no fresh audit log entry exists within 3.5 seconds, Garuda flags it as a ghost event. This is the signature of token nukes and self-bot API abuse that bypasses the audit log entirely.
If 3+ ghost events fire on the same guild within 15 seconds, Garuda automatically escalates to ChakraView lockdown.
Handles the most dangerous bypass vectors that basic anti-nukes completely miss.
What it catches:
- Any role gaining
Administrator,ManageGuild,ManageRoles,ManageChannels,BanMembers,KickMembers,ManageWebhooks,MentionEveryone @everyonebeing given Administrator (flagged as CRITICAL β force ban regardless of punishment setting)- Vanity URL changes
- Verification level drops (opens server to raids)
Auto-revert: Makara reverts the role's permissions before punishing. If the revert fails, it still punishes. The damage is undone first.
Handles integration-based nuke vectors β the ones that make the attacker's account look clean.
Webhook nukes: Attacker creates a webhook, uses it to spam NSFW/raid content without touching their own token. Padma fetches and deletes the webhook immediately, then punishes the creator.
Bot-add nukes: Attacker adds a pre-built nuke bot. The bot does the damage, the attacker looks innocent. Padma kicks the bot immediately, then punishes the adder.
Level 2+ users can add bots and create webhooks freely (they're trusted admins).
Catches what every other layer misses: the slow-burn nuke.
A sophisticated attacker spaces actions out β delete one channel every 3 minutes, delete one role every 5 minutes. No single rate limit is hit. Over an hour, the server is destroyed.
Vajra tracks weighted action scores over a 1-hour rolling window:
| Action | Weight |
|---|---|
roleDangerousUpdate |
5 |
botAdd |
5 |
channelDelete |
4 |
roleDelete |
4 |
guildUpdate |
4 |
memberBan |
3 |
webhookCreate |
3 |
memberKick |
2 |
channelCreate |
1 |
roleCreate |
1 |
emojiDelete |
1 |
When a user's weighted score hits 30 within 1 hour, they're quarantined.
Level 2 admins are NOT exempt from Vajra. Only Level 3 (Immune/Owner) bypasses it.
The last resort. Named after the Chakravyuha β the inescapable spiral formation from the Mahabharata. Once engaged, there is no way out until the owner lifts it.
Engages automatically when:
- Garuda detects 3+ ghost events in 15 seconds
- Server owner runs
/chakraview engage
What it does:
- Takes a full snapshot of all role permissions and channel overwrites
- Strips all dangerous permissions from
@everyone - Applies deny overwrites on every channel (no view, no send, no connect)
- Sends an emergency alert to the system channel
On disengage: Restores the exact pre-attack snapshot. The server returns to its precise state before the lockdown. No manual permission restoration needed.
punishment: 'ban' // Permanent ban, deletes 7 days of messages (default)
punishment: 'kick' // Kick β they can rejoin
punishment: 'strip' // Strips ALL roles (not just admin ones)
punishment: 'quarantine' // 28-day timeout (max Discord allows)| Level | Name | What it bypasses |
|---|---|---|
| 0 | None | Nothing β full protection applies |
| 1 | Moderator | 2Γ rate limit on memberBan, memberKick |
| 2 | Admin | 2Γ rate limit on structural actions β Vajra still watches |
| 3 | Immune | Bypasses L1/L3/L4 β Garuda and Vajra still watch |
Both users and roles can be whitelisted. User level takes precedence over role level if higher.
@everyone cannot be whitelisted β that would bypass protection for the entire server.
const antinuke = new TorqueAntiNuke({ client });
// User whitelist
antinuke.setUserWhitelist('GUILD_ID', 'USER_ID', 2); // set level
antinuke.removeWhitelist('GUILD_ID', 'USER_ID'); // remove
// Role whitelist
antinuke.setRoleWhitelist('GUILD_ID', 'ROLE_ID', 1);
// Effective level check (accounts for role inheritance)
antinuke.getWhitelistLevel('GUILD_ID', 'USER_ID', member.roles.cache);
// Per-guild settings
antinuke.setSetting('GUILD_ID', 'logChannel', 'CHANNEL_ID');
antinuke.setSetting('GUILD_ID', 'punishment', 'ban');
antinuke.setSetting('GUILD_ID', 'window', 10000);
// Manual ChakraView control
await antinuke.activateChakraView(guild, 'reason');
await antinuke.disableChakraView(guild);The bot/ directory contains a ready-to-use Discord bot that exposes all anti-nuke controls as slash commands.
# 1. Copy the example env file
cp bot/.env.example bot/.env
# 2. Fill in your values
DISCORD_TOKEN=your_bot_token
CLIENT_ID=your_client_id
GUILD_ID=your_dev_guild_id # optional β leave blank for global deploy
# 3. Deploy slash commands
npm run deploy
# 4. Start the bot
npm start| Command | Description | Who can use |
|---|---|---|
/antinuke |
View the full Vyuha architecture overview | Everyone |
/status |
Full system status β all layers, config, whitelist count | Manage Guild |
/setup logs |
Set the log channel for anti-nuke alerts | Owner |
/setup punishment |
Set default punishment mode | Owner |
/setup window |
Set the rolling rate-limit window | Owner |
/setup view |
View current server configuration | Owner |
/limits set |
Set the threshold for a specific action | Owner |
/limits view |
View all limits vs defaults | Owner |
/limits reset |
Reset all limits to defaults | Owner |
/whitelist user |
Set whitelist level for a user | Owner |
/whitelist role |
Set whitelist level for a role | Owner |
/whitelist list |
List all whitelisted users and roles | Owner |
/bypass add |
Grant a role bypass clearance | Owner |
/bypass remove |
Remove bypass clearance from a role | Owner |
/bypass list |
List all roles with bypass clearance | Owner |
/bypass check |
Check a user's effective bypass level | Owner |
/reset |
Clear rate-limit counters for a user or all users | Owner |
/chakraview engage |
Manually trigger total server lockdown | Owner |
/chakraview disengage |
Lift lockdown and restore permissions | Owner |
/chakraview status |
Check if lockdown is active | Owner |
- Guild owner is always immune β hardcoded, cannot be overridden
- The bot itself is always immune
- Role hierarchy is respected β bot won't attempt to punish someone above it
- Audit log freshness β entries older than 3.5 seconds are ignored
- Ghost event escalation β 3+ untracked events in 15s triggers ChakraView automatically
- Auto-revert before punish β Makara reverts dangerous permission changes before executing punishment
- Snapshot restore β ChakraView saves full guild state and restores it exactly on disengage
- Graceful failures β every punishment and log send is wrapped in try/catch
- No event loop blocking β all validation runs through an async queue (EventManager)
- Persistent state β Vajra's slow-burn tracker and whitelist data survive bot restarts
@intruder214/torque-antinuke
βββ index.js # Main entry point
βββ update-check.js # Startup version notifier
βββ src/
β βββ layers/
β β βββ KraunchaVyuha.js # L1 β Rolling rate limiter
β β βββ GarudaVyuha.js # L2 β Audit log sentinel + ghost detection
β β βββ MakaraVyuha.js # L3 β Permission escalation guard
β β βββ PadmaVyuha.js # L4 β Webhook + bot integration shield
β β βββ VajraVyuha.js # L5 β Slow-burn weighted anomaly tracker
β β βββ ChakraView.js # L6 β Total lockdown + snapshot restore
β βββ managers/
β βββ DatabaseManager.js # In-memory + disk-synced persistent store
β βββ EventManager.js # Async queue pipeline
β βββ LogManager.js # Rich embed log system
β βββ PunishmentManager.js# Punishment execution with fallback
β βββ SnapshotManager.js # Guild state save/restore for ChakraView
β βββ WhitelistManager.js # User + role multi-tier whitelist
βββ bot/
βββ index.js # Bot entry point
βββ deploy.js # Slash command deployment
βββ config.json # Client ID, Guild ID, Developer IDs
βββ .env.example # Environment variable template
βββ handlers/
β βββ SlashHandler.js # Auto-loads all commands
βββ structures/
β βββ SecureCommand.js # Abstract base with lockdown + DM guards
βββ commands/antinuke/
βββ antinuke.js # Architecture overview
βββ bypass.js # Role bypass management
βββ limits.js # Per-action threshold config
βββ lockdown.js # ChakraView engage/disengage
βββ reset.js # Counter reset
βββ setup.js # Server configuration
βββ status.js # System status
βββ whitelist.js # User + role whitelist management
Torque checks npm for newer versions on startup:
[TorqueAntiNuke] update available 2.0.0 β 2.1.0
npm install @intruder214/torque-antinuke@latest
Silent, non-blocking, zero dependencies (uses Node's built-in https://www.npmjs.com/package/@intruder214/torque-antinuke).
MIT Β© Jlaj Jain