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

CommandWhat it doesWho can use it
/kick member reasonRemoves a member; they can rejoin with an invite.Kick Members
/ban member reasonRemoves a member and blocks them from rejoining.Ban Members
/timeout member minutesMutes a member for 1 minute up to 28 days.Moderate Members
/clear amountDeletes the last 1–100 messages in a channel.Manage Messages
/warn member reasonSends 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?

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)

  1. Design it. Tick the features above, change the messages, then press Download ZIP and unzip the folder.
  2. 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.
  3. Add your token. In the folder, rename .env.example to .env, open it in Notepad, and paste your token after DISCORD_TOKEN=.
  4. 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.
  5. Run it. Install Python 3.10+ (tick “Add Python to PATH” on Windows), then double-click start.bat on Windows, or run sh start.sh on 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:

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.

See all Developer Tools →