// moderation
Moderation
kesarAI’s core moderation toolkit is a set of slash commands for the everyday work of running a server: banning, kicking, muting, purging, verifying members, juggling roles, and pulling up a user’s history. Every command is gated by a role-based permission system and every enforcement action is written to the audit log.
Overview
Access to these commands is governed by the Standardpermission tier and by per-command mod permissions — not by Discord’s native channel permissions. A member with Discord Administrator (or the bot owner) always passes; everyone else needs an explicit grant. Discord’s native Administratorpermission is the only native permission consulted — “Ban Members”, “Kick Members”, and the rest are ignored. See permission tiers for the full model.
Two layers decide who can run what. The tier layer (/tier setup) is a coarse Standard / AI split. The finer-grained mod permission layer is a per-role grid set with /modpanel— it controls each enforcement command individually (ban, kick, mute, purge, role, verify, quarantine, slowuser, and more). The enforcement commands below check the mod-permission grid; /say checks the Standard tier.
Every command also honours Discord’s role hierarchy: a moderator cannot act on a member whose top role is equal to or above their own, and the bot cannot act on anyone above its own top role. The server owner is exempt from the moderator-side check; no one (not even an admin) can moderate the server owner.
The toolkit
Enforcement. The standard mod actions. Each one DMs the target where applicable, runs the hierarchy check, and logs the result.
/ban— ban a member, or a user by ID who isn’t in the server. Honours a configurable default reason and a 0–7 day message-purge window set in command settings./unban— lift a ban by user picker or by raw ID. Shares the ban command’s default-reason setting./kick— remove a member from the server. They can rejoin via invite./mute— Discord native timeout for a parsed duration (e.g.30s,5m,2h,1d12h; max 28 days)./unmute— clear an active timeout. Shares themutepermission./purge— bulk-delete up to 8008 messages, optionally filtered to one user, with a toggle to protect pinned messages. Messages older than 14 days are skipped (a Discord limit).
Verify & quarantine. Role-swap shortcuts wired to the roles you configure in the verify/quarantine setup. Each action adds one set of roles and removes another in a single click.
/v— verify a member (apply the verified role set)./unv— reverse a verify. Shares theverifypermission./q— quarantine a member (strip their roles and apply the quarantine role set)./unq— lift a quarantine. Shares thequarantinepermission.
Roles on a member. Direct role assignment, gated by the role mod permission and guarded by anti-nukeclearance so a non-whitelisted mod can’t launder a dangerous-permission role grant through the bot.
/roleadd— add a role to a member./roleremove— remove a role from a member.
Recently deleted, history & lockdown.
/snipe— show the most recently deleted message in the channel (up to the last five, by index). Mod-only; the buffer is in-memory and clears on bot restart./modhistory— pull a member’s complete audit history in this server, summarised by event type with the five most recent events listed./lockdown on— raid response. Raises the server’s verification level to High and stores the previous level. Takes an optional auto-revert duration (max 7 days). It does not mass-kick, mass-ban, or remove roles./lockdown off— restore the verification level saved when lockdown was engaged./transcript— generate a channel transcript in both HTML (for humans) and plain text (for AI) formats.
Permission tiers
The mod-permission grid is per role, not per Discord native permission. Open it with /modpanel and pass the role you want to configure; you get a button grid where each toggle grants that role one capability. The available toggles include ban, kick, mute, purge, role, verify, quarantine, slowuser, plus roleban, perm_role, and mod_ai (which unlocks the agentic AI mod planner).
/modpanel— open the per-role permission grid. Saving writes the role’s capabilities to disk; resetting clears them. Administrator-only./modperms— view a summary of every configured role and its granted capabilities./reloadperms— force-reload the permission caches from disk after an out-of-band edit.
The coarse Standard / AI split lives one level up in /tier setup: Standard defaults to everyone, AI is restricted until granted. /say is a Standard-tier command; the enforcement commands above use the mod-permission grid.
Per-user slowmode
Per-user slowmode is notDiscord’s channel-wide slowmode. It targets one member in one channel using a channel permission overwritethat briefly revokes their send-messages right after each message, then restores it. Everyone else in the channel is unaffected. If the bot can’t set the overwrite, it fails closed and deletes the offending message instead.
/slowuser— apply slowmode to a member. Duration accepts compact forms like5s,30s,2m, or5m30s(range: 2 seconds to 1 hour). Optional flags: a target channel (defaults to the current one), a reason, an auto-expiry (e.g.1h,7d), and a DM notification./slowusers— list every member currently under slowmode, paginated, with buttons to clear outdated entries (deleted channels, departed members, expired timers) or clear all./unslowuser— remove slowmode from a member in a channel and restore their permissions.
All three commands are gated by the slowuser mod permission. State is recovered on restart, so stale overwrites left behind by a crash are cleaned up automatically.
Speaking as the bot
/sayrelays a message through the bot. It can mention a user, reply to a linked message, attach a file, or embed an image URL, and it appends a plain-text attribution line naming the author so the feature can’t be used anonymously. @everyone, @here, and role pings are always stripped.
Every /saymessage passes through a content filter before it’s sent. The filter censors a small fixed set of slurs and is resistant to bypass tricks — leetspeak (n1gg3r), separator characters, Unicode look-alikes, and markdown obfuscation are all normalised before matching, and matches are replaced with [CENSORED]. Admins can also block individual users from the command entirely.
/say— send a message as the bot (Standard tier; works in servers, DMs, and group chats)./sayblock— block a user from using/say. Administrators can’t be blocked./sayunblock— lift a/sayblock./sayblocked— list every user blocked from/sayin this server.
What gets logged
Every enforcement action — ban, unban, kick, mute, unmute, purge, verify, unverify, quarantine, unquarantine, role add/remove, slowmode changes, and lockdown toggles — is written to the audit log under the Moderation category. Each entry records the moderator, the target, the reason, and any extra context (duration, affected roles, channel, message count). /say usage is logged separately, including whether content was censored.
The audit trail is what powers /modhistory, and it persists to audit.db with its own retention and export model. See the audit log guide for the full picture, including how to mirror moderation events to a channel in real time.