Make Your Own Discord Moderation Bot
Keep your server clean with a moderation bot that you control. It includes kick, ban, timeout, clear and warn commands, a chat filter and a mod log. Customize it below and download the code.
Choose features
Your files
Your invite link
🔒 We never ask for your bot token. You add it to a file on your own computer. Everything on this page runs in your browser.
🔒 Everything you type stays in your browser. Nothing is sent to a server.
By Shah Rukh, software developer · Last updated:
Moderation commands included
| Command | What it does | Who can use it |
|---|---|---|
/kick member reason | Removes a member; they can rejoin with an invite. | Kick Members |
/ban member reason | Removes a member and blocks them from rejoining. | Ban Members |
/timeout member minutes | Mutes a member for 1 minute up to 28 days. | Moderate Members |
/clear amount | Deletes the last 1–100 messages in a channel. | Manage Messages |
/warn member reason | Sends the member a warning by DM and records it in the log. | Moderate Members |
Discord hides each command from members who don’t have the matching permission, so regular members can’t use or even see them.
Automatic chat filter
Add words you don’t allow and the bot deletes messages containing them, with a short warning that disappears after a few seconds. You can also block Discord invite links, a common kind of spam. Moderators are never filtered.
Why make your own instead of using a public bot?
- Privacy: your server’s messages aren’t processed by a third-party service.
- No paywalls: every feature is free, forever.
- Your branding: your bot’s name and avatar, not someone else’s.
- Full control: change any message or rule in
config.json.
Public bots are easier because someone else hosts them. With your own bot, you need to keep it running (see below).
How to set up your bot (5 steps)
- Design it. Tick the features above, change the messages, then press Download ZIP and unzip the folder.
- Create the bot in Discord. Open the Discord Developer Portal, click New Application, then open the Bot tab. Press Reset Token and copy the token. If you use welcome messages or auto-role, turn on Server Members Intent; for the chat filter, turn on Message Content Intent.
- Add your token. In the folder, rename
.env.exampleto.env, open it in Notepad, and paste your token afterDISCORD_TOKEN=. - Invite the bot. Paste your Application ID in the box above to get your invite link. Open it, pick your server and click Authorize. Then drag the bot’s role above the roles it should manage in Server Settings → Roles.
- Run it. Install Python 3.10+ (tick “Add Python to PATH” on Windows), then double-click
start.baton Windows, or runsh start.shon Mac or Linux. When you see “Logged in as…”, type/in your server to use the commands.
The same steps are in the README.md file inside your download.
Keeping your bot online
A Discord bot is a program, and it’s only online while that program is running. This site writes the code for you; it doesn’t run the bot. You have three options:
- Your own computer: free and fine for testing, but the bot goes offline when you close the window or shut down.
- A spare PC or Raspberry Pi: a low-cost way to stay online all the time at home.
- A cloud server (VPS): the usual choice for always-on bots. Upload the folder, set
DISCORD_TOKENas an environment variable and startpython bot.py.
Keep your token secret
Your bot token is like a password: anyone who has it can control your bot. That’s why this tool never asks for it. Don’t post it in chats, screenshots or GitHub. If it ever leaks, press Reset Token in the Developer Portal and update your .env file.
ToolsCloset is not affiliated with or endorsed by Discord. Use your bot in line with Discord’s Terms of Service and Developer Policy: no spam, no unsolicited mass DMs.
Want every feature? Open the full Discord bot maker.
Frequently asked questions
Can members abuse the moderation commands?
No. Each command needs the matching Discord permission, such as Kick Members, and is hidden from everyone else.
Why can’t the bot kick or ban someone?
The bot’s role must be higher than the member’s highest role. Drag it up in Server Settings → Roles. It can never act on the server owner.
Does the filter read all messages?
It checks messages for your blocked words on your own machine. Nothing is stored or sent anywhere.
How long can a timeout last?
From 1 minute to 28 days, which is Discord’s maximum.
Related tools
QR Code Generator
Free QR codes for links, Wi-Fi, text and contacts.
Discord Server Template
Design channels and roles, then build them in one click.
Discord Bot Maker
Build a custom Discord bot without coding.
Discord Welcome Bot
Custom welcome messages and auto-roles for new members.
Color Picker & Palette
HEX, RGB and HSL codes plus matching palettes.
Contrast Checker
Check WCAG AA/AAA colour contrast for text.