Clean and minimal Discord.js security and moderation bot with:
- Global slash command sync on startup
- Prefix and slash commands from the same command files
- Subcommand-based command design
- Local JSON database storage
- Minimal Components V2 response UI
- Security tools for lockdown and whitelist management
- Moderation tools for warnings, timeouts, kicks, bans, and unbans
- Case history tracking with local storage
- Channel tools for slowmode, clear, hide, and unhide
- Global application commands without a separate deploy script
- Node.js
20.11.0+ discord.jsv14dotenv
src/
commands/
events/
lib/
index.js
data/
guilds/
- Install dependencies:
npm install- Create a
.envfile:
DISCORD_TOKEN=your_discord_token_here
CLIENT_ID=your_client_id_here
PREFIX=!- Start the bot:
npm startWhen the bot becomes ready, it automatically syncs global slash commands using your CLIENT_ID.
Make sure your bot has the permissions needed for the commands you want to use, such as:
Manage GuildManage ChannelsManage MessagesModerate MembersKick MembersBan MembersView ChannelsSend MessagesRead Message History
Also enable these gateway intents in the Discord Developer Portal if needed:
MESSAGE CONTENT INTENTSERVER MEMBERS INTENT
pinghelp
security statussecurity lockdown <channel|server> [reason]security unlock <channel|server>security whitelist add <user|role|channel> <target>security whitelist remove <user|role|channel> <target>security whitelist list
member warn <user> [reason]member warnings <user>member clearwarns <user>member timeout <user> <minutes> [reason]member untimeout <user>member kick <user> [reason]member ban <user> [reason]member unban <user_id> [reason]
case view <id>case recent [limit]case user <user> [limit]
channel slowmode <seconds>channel clear <amount>channel hidechannel unhide
This bot supports both:
- Prefix commands like
!member warn @user spam - Slash commands like
/member warn
Each command is defined in a single file, so prefix and slash logic stay together.
This project uses a local JSON database instead of an external service.
Data is stored in:
data/guilds/<guild-id>.json
Stored data includes:
- Security whitelist state
- Lockdown snapshots
- Moderation cases
- User warnings
- Global slash commands can take a little time to update across Discord.
channel clearcan only bulk delete messages supported by Discord's API rules.- Some actions depend on the bot's role being high enough in the server role list.
This project is licensed under the MIT License.
See LICENSE for details.