Skip to main content
← Blog

August 23, 2026 · The Minely team

How to build a moderation bot with AI (warn, mute, ban, cases)

Every Discord server past fifty members needs real moderation: warnings that stick, mutes that expire, and a log that says who did what to whom and why. This is the bot most servers build first, and the one where small details — duration parsing, case numbers, escalation — make the difference between a tool and a liability.

What a moderation bot actually is

A moderation bot gives staff slash commands to warn, mute, kick, and ban members, with timed mutes that lift themselves and a persistent case log. Every action gets a case number, a moderator, a reason, and a timestamp, so any decision can be reviewed later without guesswork.

How it works under the hood

Slash commands take a user, a reason, and optional duration. Mutes use Discord's timeout feature with a parsed duration (10m, 2h, 7d) and a scheduler fallback in case the timeout must be lifted manually. Each action writes a case record (id, type, target, moderator, reason, timestamp) to storage and posts it to a mod-log channel with the case number. DMs to the punished user explain the action and the appeal path — most moderation drama dies in a polite DM.

The prompt that builds it

You do not have to write this yourself. A precise description is enough:

a moderation bot with /warn /mute /kick /ban, timed mutes, case numbers, a mod-log channel, DM notifications with reasons, and automatic escalation after 3 warns

Name the commands, the permissions, and the exact messages players see. Precision here is what makes the first build land close.

Building it in the right order

  1. Build /warn and /ban with reason recording and DM notices.
  2. Implement /mute with duration parsing and the timeout API.
  3. Write the case log: storage, numbers, and the mod-log channel format.
  4. Add /case lookup and /reason editing for staff.
  5. Layer escalation rules (auto-mute on 3 warns, auto-ban on 2 mutes).

The details that matter in production

In production, the first thing you learn is that the happy path is the easy half. The edges are where the work lives: restarts, protection interactions, full inventories, and players who treat every system like an exploit puzzle. Build for those from day one and the launch weekend is quiet instead of a fire drill.

Storage and cleanup deserve special attention. Write state as it changes rather than on shutdown, clear per-player state on quit and on world change, and make every admin-facing action leave an audit line. The first time something goes wrong, those records are the difference between a two-minute review and an evening of guessing.

Finally, test like a hostile user. Spam-click every GUI, rejoin mid-action, try the command with no permission and with every permission, and run it while the server is under load. The bugs that survive that pass are the ones worth shipping.

Tuning it after the first build

Escalation should be visible and boring: 3 warns is a 24h mute, 2 mutes in a week is a kick, a third strike is a ban. Post the rules publicly; moderation that follows a written ladder gets argued with far less.

Tips that save you a rebuild

  • Require a reason on every action; "no reason given" is how cases become fights.
  • DM the user before the action lands when possible — it defuses half the appeals.
  • Give staff /case to review their own history; self-auditing teams make fewer mistakes.
  • Log the command user's id on every case; accountability is the point.

Questions people ask

How do I unmute early?

An /unmute command that lifts the timeout and closes the case, with the lift logged like any action.

What about slowmode and lockdown?

Add /slowmode with a duration and /lockdown for raids — same case-log plumbing.

Can mods be immune?

A role-hierarchy check: the bot refuses to punish members at or above the caller's highest role.

Describe your version in the composer and see it built in minutes. Iterate with follow-up edits until it is exactly your server's flavor.