Build an AI Discord Moderation Bot: Ban, Kick, Timeout (No Code) Quickchat AI released a guide for building a no-code AI Discord moderation bot using its platform, enabling moderators to ban, kick, or timeout users via plain language commands. The bot uses AI Actions to translate natural language into Discord API calls, with destructive actions locked to admins via a deterministic gate. The guide provides seven pre-built actions for moderation, role assignment, and server management. Your AI Agent already talks to your community on Discord. This guide turns it into an AI Discord moderation bot , no code required. With a handful of custom AI Actions , a moderator types “timeout @spammer for 10 minutes” , “ban @user for scam links” , or “set slowmode in general to 30 seconds” , and the Agent performs the action through the Discord API, from plain language. We make conversational Agents, not slash-command bots. So the goal here is not to rebuild a classic rule-based moderation bot like MEE6 or Dyno how Quickchat compares https://quickchat.ai/post/best-ai-discord-bots . It is to let a moderator drive moderation in plain language , with the Agent translating intent into the right Discord API call, asking for confirmation before anything destructive, and writing a reason to the audit log every time. You need two things, both free: - a Quickchat AI Agent sign up here and use for https://app.quickchat.ai/register , connected to your Discord server free - a Discord server where you are an admin The mechanism is AI Actions : custom HTTP requests your Agent makes during a conversation. There is no one-click Discord moderation pack; you add these actions by hand. It is the same approach as wiring an Agent to the Telegram Bot API https://quickchat.ai/post/connect-ai-agent-to-telegram-bot-api or to Google Sheets https://quickchat.ai/post/connect-ai-agent-to-google-sheets , pointed at Discord. By the end you will have seven working actions , with the destructive ones locked to admins by a deterministic gate a run-condition on a Discord-verified flag, so a prompt can never talk the bot past it , and you will have tested each one yourself . This is a long, exact walkthrough. The canonical reference for AI Actions lives in the docs at docs.quickchat.ai/ai-agent/actions . The screenshots below come from a test Agent called Orbit , the moderation co-pilot for a fictional community server, Nebula Lounge . The server is invented so the example stays neutral, but every conversation, every API call, and every effect shown here was produced by a real Agent running the real reply pipeline against a real Discord server. Use your own server’s details when you follow along. What you will build Seven actions, grouped into three jobs. Two of them kick and ban are destructive, so the Agent will confirm before running them. | Group | Action | What the moderator says | Discord call | |---|---|---|---| | Moderation | timeout member | ”timeout @user for 10 minutes” | PATCH guild member | | Moderation | kick member | ”kick @user” destructive | DELETE guild member | | Moderation | ban member | ”ban @user” destructive | PUT guild ban | | Moderation | unban member | ”unban 123…” | DELETE guild ban | | Roles | assign role | ”give @user the Verified role” | PUT member role | | Server | set slowmode | ”set slowmode in general to 30s” | PATCH channel | | Server | send announcement | ”post in announcements: …” | POST channel message | Each action is a described HTTP request the Agent can call during a conversation. A chat message can come from anyone, so the natural worry is whether a regular member could talk the bot into banning someone. They cannot. The destructive actions are locked to admins by a run-condition on a Discord-verified flag, evaluated on our side before any request goes out, never by the prompt. You wire that gate in Step 7 step-7-lock-the-destructive-actions-to-admins . The same building blocks reach past a moderator co-pilot. With one more piece you can let the whole community talk to the Agent: little games and challenges where saying the right thing earns a reward, like a self-claim role behind a passphrase. We build a safe version at the end, in Going further going-further-an-agent-the-whole-community-can-talk-to . How AI Actions call Discord, and how your server’s values flow in An AI Action is a described HTTP request. When the Agent decides an action applies, it fills in the parameters and Quickchat sends the request. Three pieces of information have to reach Discord, and they arrive in three different ways . The token comes from the connected bot, the server ID from the live conversation, and the target from the moderator’s message. You wire each one once. 1. The bot token comes from a System Token. Discord authenticates every request with your bot token. You do not paste it into each action. Once your bot is connected in the Discord integration, the token is available as the System Token {{discord bot token}} . Select it from the Add AI Data menu and put it in the Authorization header. It is injected into the outgoing request at send time, and it is never exposed to the model, never written into a conversation, and never returned by an API. It is the safe equivalent of a secrets vault for your actions. Select {{discord bot token}} from the Add AI Data menu, under System Tokens. It is injected into the request at send time and never shown to the model. 2. The server ID comes from conversation metadata. When your Agent is talking inside a Discord server, Quickchat already knows which server guild the conversation is in. That value rides along as conversation metadata, and you reference it as {{metadata guild id}} . You never hardcode your server ID; the action reads it from the live conversation. This is the same mechanism that carries a visitor’s page URL or language into an action, and you pick it from the same Add AI Data menu. 3. The target comes from the moderator, as a parameter. Who to timeout, which channel to slow down, which role to grant: these change every time, so they are parameters the Agent fills from the conversation. A moderator tags the member or channel the normal way, typing @username or general and picking it from Discord’s autocomplete. Discord delivers that tag to the bot as the wrapped numeric ID <@123456789 for a member, < 123456789 for a channel , so the parameter description tells the Agent to use only the digits, which is what the Discord API needs. Moderators never type a raw ID by hand. One detail to get right: the auth scheme is Bot, not Bearer , a common mistake when calling Discord by hand. The header value is literally Bot {{discord bot token}} . Before you start: connect the bot and grant the right permissions Connecting an Agent to Discord is covered step by step in our Discord docs https://docs.quickchat.ai/channels/discord and in the Create an AI Discord bot https://quickchat.ai/post/create-ai-bot-for-discord guide, so we will not repeat it here. Do that first, then come back. There is one thing those guides do not cover, because they are about chatting, not moderating: permissions . A chat bot only needs to read and send messages. A moderation bot needs to kick, ban, time members out, manage roles, and manage channels. Discord will reject every moderation call with a 403 until the bot’s role actually holds those permissions. Grant them by re-inviting the bot with a permission integer that includes them: https://discord.com/api/oauth2/authorize?client id=YOUR APPLICATION ID&permissions=1409017777174&scope=bot That integer is least-privilege for exactly these seven actions : View Channels, Send Messages, Read Message History, Create and Send in Threads, plus Kick Members, Ban Members, Moderate Members timeout , Manage Roles, and Manage Channels . Replace YOUR APPLICATION ID with the Application ID from your bot’s page in the Discord Developer Portal https://discord.com/developers/applications . You can also tick the same boxes by hand in Server Settings, Roles. There is a second, subtler rule: role hierarchy . A bot can only act on members and roles that sit below its own highest role . If the bot’s role is at the bottom of the list, it cannot timeout anyone or assign any role, even with the right permissions. After inviting it, open Server Settings, Roles, and drag the bot’s role near the top. The bot’s role sits above the roles it manages, so Discord lets it act on those members. If an action ever returns 403 , it is almost always one of these two: a missing permission, or the bot’s role sitting too low. The Agent is told to say which one, rather than silently retrying. Step 1: Create the Agent and give it its job Create your Agent here it is Orbit and connect it to your server. Orbit needs almost no knowledge base; its job is to act on instructions, not to answer questions from documents. What it does need is a clear Identity describing how to behave as a moderator. We will paste the full prompt in a later step the-full-prompt-block-to-copy ; for now, create the Agent and connect the bot. Step 2: Restrict who can command the bot This is the most important safety decision, so we settle it before building any action. The Agent cannot tell who is talking to it. Nothing in the words of a message proves the sender is a moderator, so the prompt can never be the thing that decides who may ban. You need a check that does not run through the model at all. Quickchat gives you two, and you use both: A deterministic gate on a verified flag the real boundary . On every Discord message, Quickchat records whether the sender is a server admin as the conversation metadata author is admin . Discord sets it from the sender’s permissions; nobody can type it or argue it into existence. In Step 7 step-7-lock-the-destructive-actions-to-admins you add a run-condition to each destructive action: run only when It is checked on our side, at call time, before any request reaches Discord, so a non-moderator is refused no matter what the conversation says. author is admin is true. A moderators-only channel defense in depth . Create a private mod-commands channel that only your moderator role can see, and restrict the bot to read and reply there deny View Channel for @everyone , allow it for the bot and your mods . Fewer people can even reach the bot, and the gate above stops anyone who does but should not. We also add a prompt rule in the prompt block the-full-prompt-block-to-copy that makes kick and ban confirm first , so even a moderator never fires an irreversible action on a single ambiguous line. The gate is the boundary; the confirmation is the seatbelt. Three layers, one real boundary. The moderators-only channel limits who can reach the bot, and the prompt shapes how it replies, but only the run-condition on the Discord-verified author is admin flag actually stops a non-admin, because it is checked on our side, before any Discord call, and cannot be argued with. How to read each recipe: the anatomy of an action Every recipe below is the same six fields in the action editor, with different values. Learn the layout once here and the rest is fill-in-the-blanks. This is assign role the role-granting action with all six fields filled in: The whole action on one screen: a name, the parameters, the endpoint with its headers and body, and the description. You insert any colored chip with the Add AI Data button next to a field. A closer look at the endpoint URL. The chips are color-coded: orange is injected for you, purple is what you define and the Agent fills. | Field in the editor | What it does | In this assign role example | |---|---|---| API Action Name | The short name the Agent sees. | assign role | What to ask the user first | The parameters the Agent fills on each call. Each row has a Format, a Name, a Description this is what tells the Agent what to put in it , and a Required toggle. | user id , role id | API Endpoint | The request itself: a method dropdown the HTTP verb next to the URL field, with the Headers and Body tabs below it. Insert {{metadata guild id}} and your parameters with the Add AI Data button; type the rest as plain text. | PUT + .../guilds/{{metadata guild id}}/members/{{user id}}/roles/{{role id}} | Headers under API Endpoint | Key/value rows. Authorization always carries Bot {{discord bot token}} ; moderation actions add X-Audit-Log-Reason . | Authorization, X-Audit-Log-Reason | Body under API Endpoint | A small JSON payload, for the actions that send one. | none; assign role has no body | API Action Description | Plain-language text telling the Agent what the action does and when to call it. The single most important field: it is what decides when the Agent fires. | ”Give a member a role. Use when…” | So for every action below, open Actions & MCPs , create an HTTP Request action, and fill in exactly the API Action Name , What to ask the user first , method and URL , Headers , Body , and API Action Description shown. Each recipe is exactly one action; build them one at a time. Step 3: Your first action, post an announcement We start with the one action that needs no special permission every bot can already send messages , so you see a green result before touching anything destructive. In the app, go to Actions & MCPs and create an HTTP Request action. Each bold label below is the exact field name in the editor, listed in the order you meet it on screen, so paste each value straight into the matching field. API Action Name: send announcement What to ask the user first the parameters the Agent fills : | Format | Name | Description | Required | |---|---|---|---| | Text | channel id | Numeric Discord ID of the target channel. If given a mention like < 123 , use only the digits. | yes | | Text | content | The message text to post, 2000 characters max. | yes | API Endpoint: POST https://discord.com/api/v10/channels/{{channel id}}/messages Headers select {{discord bot token}} from the Add AI Data menu, under System Tokens : | Authorization | Content-Type | |---|---| Bot {{discord bot token}} | application/json | Body JSON : { "content": "{{content}}" } API Action Description: Post a message to a specific channel as the bot. Use when a moderator asks to announce, post, send, or share something in a named channel, or to share the server invite. Put the exact text to post at most 2000 characters in content. The finished action: two parameters, a POST endpoint with {{channel id}} in the URL, and the Authorization header carrying the System Token. Enable the action and test it from AI Preview . In a real Discord mod channel you tag the target announcements and Discord hands the bot its ID; AI Preview has no autocomplete, so paste the channel’s numeric ID in its place. Type: post in channel 123456789012345678: Welcome to Nebula Lounge Please read the rules before chatting. Orbit replies “Posted in 123456789012345678.” and the message appears in the channel. The bot posts the message to the channel. The Agent never touched a token or a server ID. Behind the scenes it called: POST https://discord.com/api/v10/channels/123456789012345678/messages { "content": "Welcome to Nebula Lounge Please read the rules before chatting." } Notice there is nothing to fill in for the token or the server . The Authorization header carried {{discord bot token}} , injected at send time. That same header is reused by every action below, so copy it once. Step 4: Moderation, timeout, kick, ban, unban These are the core moderation actions. Each is one more HTTP Request action with the same Authorization header. Moderation actions add one extra header, X-Audit-Log-Reason , so every action the Agent takes is recorded in your server’s audit log with a reason. Four actions follow, each a self-contained block; build them one at a time. Action 1 of 4: timeout member A timeout mute stops a member from talking for up to 28 days. Discord expects an absolute end time, so the Agent computes one from the duration the moderator asked for. API Action Name: timeout member What to ask the user first the parameters the Agent fills : | Format | Name | Description | Required | |---|---|---|---| | Text | user id | Numeric Discord ID of the member to time out digits only; strip <@ from a mention . | yes | | Text | until | The moment the timeout ends, as an absolute UTC ISO8601 timestamp; the Agent computes it. | yes | | Text | reason | Short reason, written to the audit log. Defaults to Timed out by AI moderator . | no | API Endpoint: PATCH https://discord.com/api/v10/guilds/{{metadata guild id}}/members/{{user id}} Headers: | Authorization | Content-Type | X-Audit-Log-Reason | |---|---|---| Bot {{discord bot token}} | application/json | {{reason}} | Body JSON : { "communication disabled until": "{{until}}" } API Action Description: Time out mute a member so they cannot send messages or speak, for up to 28 days. Use when a moderator asks to timeout, mute, silence, or put a member on a cooldown, or to remove an existing timeout. Compute until as an absolute UTC ISO8601 timestamp that is the requested duration from now for "10 minutes", add 10 minutes to the current time ; if no duration is given, default to 60 minutes. To remove a timeout, set until to the literal null. Always set a short reason. Test it: timeout @space samurai for 10 minutes for spamming invite links Orbit extracts the numeric ID from the mention, computes the end time, and calls: PATCH .../guilds/