Skip to main content

What is a Discord bot?

New to bots? Here's the short version before we get into the setup.

Think of it like adding a team member to your server

A Discord bot is just an account that's controlled by software instead of a human. You invite it to your server like you'd invite a friend, give it permission to read and send messages in specific channels, and then it listens for messages and responds. OpenClaw powers the bot's brain — every message you send it gets processed by your AI agent, which then replies.

What can OpenClaw do in Discord?

Once connected, your bot can do everything OpenClaw can do — from inside Discord.

Answer Questions

Ask your bot anything — it uses your OpenClaw agent's full knowledge and connected tools to respond.

"Hey @MyBot, summarize what we talked about in this channel last week"

Run Automations

Trigger scheduled tasks, check emails, run reports, or fetch data — all by messaging your bot.

"@MyBot check if my server is still running"

Manage Tasks

Add to-dos, set reminders, draft messages, or update notes without leaving Discord.

"@MyBot remind me at 3pm to review the pull request"

Search & Research

Ask the bot to look things up, summarize web pages, or research a topic and post the results.

"@MyBot what's the latest on OpenAI's new model?"

Serve Your Whole Server

Other members can talk to the bot too — great for communities, dev teams, or shared workspaces.

"@MyBot explain what a Docker container is"

Private DM Mode

Configure the bot to only respond to you via DMs, keeping your personal agent private.

DM the bot directly — no one else sees the conversation

Step-by-step setup

Takes about 15 minutes. You'll need a Discord account and OpenClaw already installed.

  1. Go to the Discord Developer Portal

    Open discord.com/developers/applications and log in with your Discord account. This is Discord's free developer dashboard — no credit card needed.

  2. Create a new application

    Click New Application in the top right. Give it a name — this becomes the bot's display name in your server (you can change it later). Click Create.

  3. Add a bot to the application

    In the left sidebar, click Bot. Then click Add BotYes, do it!. Your application now has a bot account attached to it.

    On this page you can also:

    • Upload a profile picture for the bot
    • Toggle Public Bot off if you want to be the only one who can add it to servers
  4. Enable required Privileged Gateway Intents

    Still on the Bot page, scroll down to Privileged Gateway Intents and enable:

    • Message Content Intent — lets the bot read message text (required for OpenClaw to understand what you're saying)
    • Server Members Intent — optional, needed if you want the bot to see member info

    Click Save Changes.

    Message Content Intent is required

    Without this, your bot will receive messages but won't be able to read what they say. OpenClaw will not be able to respond.

  5. Copy your bot token

    On the Bot page, click Reset Token → confirm → then click Copy. This is your bot's password — treat it like one.

    Never share your bot token

    Anyone with your token can control your bot. Never post it on GitHub, in a Discord message, or anywhere public. If it leaks, click Reset Token immediately to invalidate it.

  6. Invite the bot to your server

    In the left sidebar, go to OAuth2 → URL Generator. Under Scopes, check bot. Under Bot Permissions, check:

    • Read Messages / View Channels
    • Send Messages
    • Read Message History
    • Use Slash Commands (optional but recommended)

    Copy the generated URL at the bottom of the page, open it in your browser, select your server, and click Authorize. Your bot will appear in your server's member list.

  7. Add the token to openclaw.json

    Open your openclaw.json file and add the Discord section:

    openclaw.json
    {
      "channels": {
        "discord": {
          "enabled": true,
          "token": "YOUR_BOT_TOKEN_HERE",
          "prefix": "!",           // optional command prefix
          "allowed_channels": [],    // empty = all channels
          "allowed_users": [],       // empty = all users
          "respond_to_mentions": true, // @bot triggers a response
          "respond_to_dms": true      // bot responds to direct messages
        }
      }
    }

    Replace YOUR_BOT_TOKEN_HERE with the token you copied in Step 5.

  8. Restart OpenClaw and test it

    Save openclaw.json and restart OpenClaw. Your bot should now show as Online in your Discord server. Send it a message by mentioning it:

    @YourBot hello, are you there?

    If it replies, you're done. If not, check the troubleshooting section below.

Bot is live!

Mention your bot or DM it to start chatting. Every message is processed by your OpenClaw agent, so it has access to all your connected tools, memory, and skills.

Configuration options

Fine-tune how your bot behaves using these openclaw.json settings.

Key Type Default What it does
token string Your Discord bot token. Required.
prefix string "!" Command prefix for text commands (e.g. !help). Leave blank to disable.
allowed_channels array [] Channel IDs where the bot will respond. Empty array means all channels.
allowed_users array [] Discord user IDs that can talk to the bot. Empty array means anyone in the server.
respond_to_mentions boolean true Bot responds when someone @mentions it in a channel.
respond_to_dms boolean true Bot responds to direct messages.
typing_indicator boolean true Shows the bot "typing…" while generating a response.
max_message_length number 2000 Discord's message limit. Long responses are split automatically.

Restrict the bot to one channel or user

If you're running the bot on a shared server, you probably don't want everyone talking to your personal AI agent. Here's how to lock it down.

To find a channel ID: right-click the channel in Discord → Copy Channel ID (you may need to enable Developer Mode in Discord Settings → Advanced first).

openclaw.json — restricted config
{
  "channels": {
    "discord": {
      "enabled": true,
      "token": "YOUR_BOT_TOKEN",
      "allowed_channels": ["1234567890123456789"], // only this channel
      "allowed_users": ["9876543210987654321"],    // only you
      "respond_to_dms": true
    }
  }
}

Example prompts to try

Once your bot is online, mention it or DM it with any of these to get started.

General
"@MyBot what can you do?"
Research
"@MyBot give me a quick summary of what's happening with AI this week"
Tasks
"@MyBot add 'finish project proposal' to my task list"
Automation
"@MyBot every morning at 9am, post the weather forecast in #general"
Writing
"@MyBot draft an announcement for our server about next week's event"
Code
"@MyBot explain what this Python function does" [paste code]

Common problems & fixes