Back to Blog
Discord AI Bot: Complete Setup Guide with OpenClaw (2026)
discorddiscord botdiscord ai botai discord botdiscord ai chatbotai bottutorialopenclawclawdbotmoltbot

Discord AI Bot: Complete Setup Guide with OpenClaw (2026)

Want a Discord AI bot? This guide covers everything — bot creation, intents, allowlists, and security. Set up an AI-powered Discord chatbot with OpenClaw, no coding required.


A Discord AI bot turns your server from a place people check into a place people use. You can keep it in one channel for quick questions, let it help with moderation, or run it as an always-on AI assistant for your community.

This guide shows you how to set up a Discord AI bot using OpenClaw — an open-source AI agent with 179K+ GitHub stars. No coding required. But Discord is noisy, so we'll also cover how to configure it properly so it doesn't respond to everything in every channel.

The full setup: creating the bot, enabling the right intents, locking it down with allowlists, and making sure your Discord AI chatbot only talks where you want it to.

📋 Choose your path: Self-hosted setup ↓Managed setup with ClawdHost (60 sec)


What Is a Discord AI Bot?

A Discord AI bot is a bot that uses a large language model (Claude, GPT, etc.) to have real conversations instead of just responding to slash commands. Unlike traditional bots that follow scripted rules, a Discord AI chatbot can answer questions, summarize threads, help with code, and handle open-ended requests.

You don't need to write any Discord bot code. You create a Discord application in the Developer Portal, turn on a couple of intents, invite it to your server, and give OpenClaw the bot token. OpenClaw connects through Discord's official Bot API and your allowlists decide where it can talk.

The goal isn't "bot everywhere." The goal is "bot in the right places." Most people start with one channel and require a mention. Then expand from there.

Before You Start

  • Admin access to the Discord server you want the bot in
  • OpenClaw running on a VPS or local machine (setup guide)
  • Discord Developer Portal access at discord.com/developers/applications
  • Your LLM API key configured in OpenClaw (Anthropic, OpenAI, OpenRouter, etc.)

Keep the bot token private. If it leaks, reset it immediately in the Developer Portal.

Create the Discord Bot and Copy the Token

In the Developer Portal:

  1. Click New Application and name it something like "OpenClaw"
  2. Open the Bot section in the left menu
  3. Click Add Bot and confirm
  4. Under Token, click Reset Token (or Copy if it's visible), then store it somewhere safe

Treat the token like an SSH key. Anyone with it can impersonate your bot. Never commit it to a public repository, paste it in a Discord channel, or share it in a screenshot.

Enable the Intents OpenClaw Needs

Still in the Bot settings, scroll down to Privileged Gateway Intents and enable:

  • Message Content Intent — Required for OpenClaw to read message text
  • Server Members Intent — Needed for allowlists and member lookups
  • Presence Intent — Optional, useful for context-aware responses

Click Save Changes.

Without Message Content Intent enabled, your bot can see that messages were sent but can't read what they say. This is the most common setup mistake.

Invite the Bot to Your Server

In the Developer Portal, go to OAuth2URL Generator:

  1. Under Scopes, select:

    • bot
    • applications.commands (if you want slash commands)
  2. Under Bot Permissions, start minimal:

    • ✅ View Channels
    • ✅ Send Messages
    • ✅ Read Message History
    • ✅ Embed Links (optional, for rich responses)
    • ✅ Attach Files (optional)
  3. Copy the generated URL at the bottom

  4. Open it in your browser, select your server, and authorize

Avoid granting Administrator unless you're debugging and fully trust the setup. You can always add more permissions later. The bot should now appear offline in your server's member list.

Turn On Developer Mode and Copy IDs

To configure allowlists, you'll need IDs for your server and channels.

  1. In Discord, open User SettingsAdvanced
  2. Enable Developer Mode
  3. Right-click your server nameCopy Server ID
  4. Right-click the channel you want (e.g., #bot or #ai-help) → Copy Channel ID

Keep these handy for the next step.

Add the Bot Token to OpenClaw

You can pass the token as an environment variable or store it in the OpenClaw config file.

Option A: Environment variable (recommended for easier rotation)

export DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN"

Option B: OpenClaw config (~/.openclaw/config.json)

{
  "channels": {
    "discord": {
      "enabled": true,
      "token": "YOUR_BOT_TOKEN"
    }
  }
}

Environment variables are cleaner for production since rotating a leaked token doesn't require editing config files.

Lock It Down with Allowlists

This is the part most people skip, then wonder why OpenClaw is replying to everything in every channel.

Safe defaults:

  • Disable DMs unless you specifically need them
  • Allow only one server
  • Allow only one channel
  • Require a mention to trigger responses

Example config:

{
  "channels": {
    "discord": {
      "enabled": true,
      "dm": { "enabled": false },
      "guilds": {
        "YOUR_GUILD_ID": {
          "requireMention": true,
          "channels": {
            "YOUR_CHANNEL_ID": { "allow": true, "requireMention": true }
          }
        }
      }
    }
  }
}

Replace YOUR_GUILD_ID and YOUR_CHANNEL_ID with the IDs you copied earlier.

With requireMention enabled, OpenClaw only responds when someone tags the bot directly (@OpenClaw what's the status of...). This prevents it from jumping into every conversation.

If you later enable DMs, keep pairing enabled so unknown users can't spam your bot.

Start OpenClaw and Test

Start the gateway:

openclaw gateway --port 18789 --verbose

In Discord, go to your allowed channel and mention the bot:

@OpenClaw hello, are you working?

If it responds, you're done. If it doesn't, check the troubleshooting section below.

Good Defaults for Teams and Communities

Once Discord is connected, these practices will save you from headaches:

  • Create a dedicated channel like #openclaw or #ai-assistant — expand only when there's a real need
  • Keep mention gating on in any public or busy channel
  • Start with one server — get allowlists right before expanding to others
  • If you enable DMs, keep pairing enabled so strangers can't interact with your bot
  • For bots that run commands or access infrastructure, isolate those tools and keep them out of general chat areas
  • Set up billing alerts on your LLM provider dashboard — Discord servers with active communities can burn through tokens fast

Troubleshooting

The bot doesn't respond at all

  • Confirm the bot shows as online in your server's member list
  • Confirm the OpenClaw gateway is running (openclaw gateway --verbose)
  • Confirm the token is correct — reset and update if you're unsure
  • Check that your firewall isn't blocking outbound connections to Discord

It responds in some channels but not the one you want

  • Make sure that channel's ID is in the allowlist
  • Make sure the bot has View Channel and Send Messages permissions in that channel
  • Check Discord's role hierarchy — some server configs restrict bots by role

It only replies when mentioned

That's expected behavior if requireMention is enabled. It's a good default for busy servers. Remove requireMention from a specific channel's config if you want it to respond to all messages there.

Messages look empty or OpenClaw "can't see" content

Message Content Intent is a privileged intent. Make sure it's enabled in the Developer Portal under BotPrivileged Gateway Intents. Without it, Discord doesn't forward message text to bots.

Bot responds but the responses are slow

  • Check your LLM API response times (Claude Opus is slower than Sonnet/Haiku)
  • Reduce max_tokens in your OpenClaw config for faster responses
  • If using a VPS far from your LLM provider, latency adds up on every call

Bot keeps disconnecting

  • Ensure your VPS has a stable internet connection
  • Use a process manager like PM2 or systemd to auto-restart on crashes
  • Check OpenClaw logs for rate limit warnings from Discord

Security Considerations

Discord bots with AI capabilities require extra caution:

  • Never grant Administrator permission unless absolutely necessary
  • Rotate tokens immediately if you suspect a leak (Developer Portal → Bot → Reset Token)
  • Keep allowlists tight — one server, one channel to start
  • Disable DMs by default — they're the easiest vector for prompt injection
  • Monitor LLM costs — a popular Discord server can generate hundreds of API calls per hour
  • Run OpenClaw behind a firewall — the gateway port (18789) should not be publicly accessible

For a deep dive on security, see our Clawdbot security guide.

FAQ

How do I add an AI bot to Discord?

Create a bot in the Discord Developer Portal, enable Message Content Intent, invite it to your server, then connect it to an AI agent like OpenClaw. The full steps are covered above — no coding required.

Is there a free AI bot for Discord?

OpenClaw is free and open-source. You'll need hosting ($5-25/mo) and an LLM API key (pay-per-use), but the bot software itself is free. See our Discord bot hosting comparison for the cheapest options.

Can I make a Discord AI chatbot without coding?

Yes. OpenClaw handles all the Discord API integration. You configure it with JSON config files — no Python, JavaScript, or discord.js required.

Do I need to write any code for this?

No. You create the bot in Discord's Developer Portal and configure OpenClaw with JSON config files. OpenClaw handles the Discord API connection.

Should I enable Administrator permissions?

No. Start with the minimum: View Channels, Send Messages, Read Message History. Add more only when something is specifically blocked.

Can I run OpenClaw in multiple Discord servers?

Yes, but don't start there. Get one server working with proper allowlists first, then expand intentionally.

How do I rotate a leaked bot token?

In the Developer Portal, go to BotReset Token. Copy the new token, update your OpenClaw config or environment variable, and restart the gateway.

What's the safest setup for a company Discord?

One private channel, require mentions, disable DMs. If you later enable DMs, keep pairing on so unknown users go through verification first.

How much does running OpenClaw on Discord cost?

The Discord bot itself is free. Your costs are VPS hosting ($5-20/month) plus LLM API usage. A moderately active server might cost $30-100/month in API calls depending on the model and traffic.

Can I use this with Telegram and Slack too?

Yes. OpenClaw supports multiple platforms simultaneously. You can run Discord, Telegram, and Slack from the same instance. See the OpenClaw multi-channel docs for setup.


Skip the Setup: ClawdHost

If configuring Discord Developer Portal settings, managing allowlists, securing a VPS, and keeping OpenClaw updated sounds like more than you signed up for — there's a faster path.

ClawdHost deploys a fully managed OpenClaw instance with Discord already configured.

How It Works

  1. Sign up at clawdhost.net
  2. Add your LLM API key (Claude, GPT, OpenRouter, or others)
  3. Connect Discord — follow the guided setup to link your bot token
  4. Done — Your AI assistant is live in your Discord server

No VPS to manage. No config files to edit. No gateway to monitor.

What You Get

Self-HostedClawdHost
Setup time20-40 minutes60 seconds
Server managementYou handle itWe handle it
Security hardeningYour responsibilityPre-configured
OpenClaw updatesManualAutomatic
Multi-platformConfigure each yourselfBuilt-in (Discord + Telegram + Slack)
Cost$5-20/mo VPS + your time$29/mo

Built-In Features

  • Your Own VPS — Your instance runs in complete isolation
  • Pre-configured allowlists — Only your user IDs can access your bot
  • Automatic updates — Latest OpenClaw features without manual intervention
  • Encrypted API keys — AES-256 encryption for all credentials
  • Multi-platform support — Discord, Telegram, Slack from one dashboard
  • 24-hour money-back guarantee — Try it risk-free

When to Self-Host vs Use ClawdHost

Self-host if:

  • You enjoy managing infrastructure
  • You want maximum customization over every config detail
  • You already have a VPS running other services
  • You want to learn how OpenClaw works under the hood

Use ClawdHost if:

  • You want an AI assistant on Discord today, not this weekend
  • You'd rather spend time using the bot than maintaining it
  • You want multi-platform support without configuring each one
  • Security and updates handled for you matters more than full control

Get started with ClawdHost → | See how it works →


Sources

Related Articles