Lockdown Mode
Restrict all bot commands to moderators during emergencies
Lockdown mode blocks all bot commands for non-moderators. When enabled, only users with the ModerateMembers permission can use any command — not just moderation commands, but all commands registered with your Robo.
Enabling lockdown
Toggle lockdown mode from the /mod setup panel. The lockdown button turns red when active.
When lockdown is enabled:
- Any command from a user without
ModerateMemberspermission is blocked - The user sees an ephemeral message: "Sorry, this command is currently disabled."
- The
/mod setupcommand is always exempt, so administrators can disable lockdown
How it works
Lockdown is implemented as Robo.js middleware. It intercepts every command execution before the handler runs:
- Checks if the interaction is a command (events and other types pass through)
- Reads the guild's lockdown setting
- If lockdown is off, does nothing
- If lockdown is on, checks the user's
ModerateMemberspermission - If the user lacks the permission, replies with an ephemeral message and aborts the command
The /mod setup command is explicitly exempted so that moderators can always toggle lockdown off.
getLockdown API
The plugin exports a function to check lockdown status programmatically. This is the plugin's only exported API.
import { getLockdown } from '@robojs/moderation'
const { enabled } = getLockdown('123456789012345678')
if (enabled) {
// Server is in lockdown mode
}import { getLockdown } from '@robojs/moderation'
const { enabled } = getLockdown('123456789012345678')
if (enabled) {
// Server is in lockdown mode
}Signature
function getLockdown(guildId: string): { enabled: boolean }function getLockdown(guildId): { enabled: boolean }| Parameter | Type | Description |
|---|---|---|
guildId | string | The Discord guild/server ID |
Returns: { enabled: boolean } — true if lockdown mode is active for the guild, false otherwise.
Use this in your own commands or plugins to respect lockdown status:
import { getLockdown } from '@robojs/moderation'
import type { CommandResult } from '@robojs/discordjs'
import type { ChatInputCommandInteraction } from 'discord.js'
export default (interaction: ChatInputCommandInteraction): CommandResult => {
const { enabled } = getLockdown(interaction.guildId!)
if (enabled) {
return {
content: 'This command is disabled during lockdown.',
ephemeral: true
}
}
return 'Command executed.'
}import { getLockdown } from '@robojs/moderation'
export default (interaction) => {
const { enabled } = getLockdown(interaction.guildId)
if (enabled) {
return {
content: 'This command is disabled during lockdown.',
ephemeral: true
}
}
return 'Command executed.'
}The lockdown middleware already blocks all commands for non-moderators. Use getLockdown when you need to adjust behavior rather than block entirely — for example, limiting a command's output or disabling optional features during lockdown.
