OpenClaw Discord Bot Setup Guide
Discord is where a lot of developer communities live. If you run OpenClaw and want your agent to be accessible to a team — not just yourself — Discord is the right channel. It supports multi-user conversations, role-based access controls, and threaded discussions that map well to how AI agents handle context.
This guide walks through everything required to connect OpenClaw to Discord: creating a bot application, configuring the necessary intents and permissions, pairing it with your OpenClaw gateway, and setting up user authorization so the right people can interact with your agents. If you have already set up the Telegram bot or connected OpenClaw to Slack, the concepts will feel familiar — Discord uses a similar bot token model but introduces guild-level permissions and slash commands.
What You Get with an OpenClaw Discord Bot
Before diving into the setup, it helps to understand what changes when you connect OpenClaw to Discord instead of a personal messaging channel like Telegram or WhatsApp.
With a Discord bot, multiple users in your server can interact with the agent simultaneously. Each user's conversation is isolated — OpenClaw maintains per-user session state, so two people can ask questions, trigger workflows, or request data without interfering with each other. This makes Discord ideal for teams that need shared access to an agent for operations monitoring, content review, deployment management, or any workflow where more than one person needs to talk to the system.
Discord also supports role-based permissions. You can configure which server roles are allowed to interact with the bot, restrict certain commands to admins, or limit the agent to specific channels. This control is particularly useful when the agent has access to sensitive infrastructure — you can keep it available to developers in a private channel while keeping it invisible in general chat.
If you are still getting oriented, read What Is OpenClaw? first. If you already understand the basics and want to see how multi-channel setup works, the Telegram bot guide covers another channel path with similar configuration patterns.
Prerequisites
Before you begin, make sure you have the following:
- OpenClaw installed and running on your machine or server (
openclaw gateway statusshould show active) - A Discord account with server administrator privileges (you need the "Manage Server" permission to add bots)
- Node.js 22 or higher (for the local dev workflow if you want to test your bot before deploying)
- Access to the Discord Developer Portal
If OpenClaw is not installed yet, the mac mini setup guide walks through the full installation on macOS, and the first steps guide covers the onboarding wizard that configures your API key and gateway.
Step 1: Create a Discord Application and Bot
Every Discord bot starts as an application in the Discord Developer Portal. This is where you configure the bot's identity, permissions, and authentication tokens.
Navigate to the Discord Developer Portal and click New Application. Give it a name — something like "My OpenClaw Agent" or whatever identifies your agent. Once created, you land on the General Information page where you can set an icon and description. These are cosmetic but help server members identify the bot.
On the left sidebar, click Bot. This is where the actual bot user lives. Click Add Bot and confirm. You will now see a bot user with a token field.
Under the Privileged Gateway Intents section, enable the following intents based on what you need:
- Message Content Intent: Required for OpenClaw to read message content in channels. Without this, the bot can only see mentions and embeds.
- Server Members Intent: Required if you want OpenClaw to know user roles and names for authorization.
- Presence Intent: Optional. Enables the bot to see member online status.
The Message Content Intent is mandatory for OpenClaw to function in Discord. The other two are optional but recommended if you plan to use role-based access control, which most production setups should.
Click Save Changes, then go back to the Bot page and click Reset Token to generate your bot token. Copy this token — it is the credential OpenClaw uses to authenticate with Discord's API. Store it somewhere secure. You will need it in Step 3.
Step 2: Invite the Bot to Your Server
With the bot application created, you need to generate an invite link and add the bot to your Discord server.
In the Developer Portal, go to OAuth2 > URL Generator. Select the following scopes:
- bot: Required. Allows the application to join servers as a bot user.
- applications.commands: Optional but recommended. Enables slash command support for future integrations.
After selecting the bot scope, a permissions section appears. Select the following permissions:
- Send Messages: The bot needs this to respond to user queries.
- Read Messages / View Channels: Required for the bot to see messages in channels.
- Read Message History: Allows OpenClaw to access conversation context when it starts or reconnects.
- Use Slash Commands: If you plan to implement slash command triggers.
- Embed Links: Lets the bot post rich embeds with formatted responses.
- Attach Files: Required if your OpenClaw agent generates images, PDFs, or other file outputs.
Copy the generated URL at the bottom of the page and open it in your browser. Select the server you want to add the bot to and click Authorize. You must have the "Manage Server" permission on that server to complete this step.
Discord recommends adding your bot to a private test server first. Create a new server for testing before deploying to your main community server. This lets you verify the connection and configure authorization without disrupting existing channels.
Step 3: Connect OpenClaw to Your Discord Bot
With the bot created and invited to your server, the next step is connecting it to OpenClaw. OpenClaw supports Discord as a channel plugin, configured through the same openclaw channels command family you may have used for Telegram or Slack.
Run the following command, replacing YOUR_BOT_TOKEN with the token you copied from the Discord Developer Portal:
openclaw channels add discord --token YOUR_BOT_TOKEN
OpenClaw validates the token by making a test request to the Discord API. If the token is valid, you will see a confirmation message with the bot's username and the number of servers it has joined. If the token is invalid or the bot has not been added to any servers, you will see an error describing the issue.
After adding the channel, restart the OpenClaw daemon to apply the changes:
openclaw daemon restart
Once the daemon restarts, verify the connection by checking the channel status:
openclaw channels list
The output should show discord as a configured channel with active status. If it shows "disconnected" or "error", check your openclaw logs for details — common issues include incorrect bot tokens, missing intents, or network restrictions.
Step 4: Authorize Users and Configure Access
By default, the OpenClaw Discord bot responds to all users in all channels where it has permission to read and send messages. For many setups, that is fine. But if your agent has access to deployment commands, sensitive data, or destructive operations, you should restrict who can interact with it.
OpenClaw handles Discord authorization through a pairing process similar to Telegram. When a user sends a message to the bot for the first time, OpenClaw registers them as unapproved. You then approve them using the pairing command from your own terminal:
# List pending pairing requests openclaw pairing list discord # Approve a specific user (use the code from the list) openclaw pairing approve discord CODE123
You can also configure channel-level restrictions. If you want the bot to only respond in a specific channel — for example, #agent-ops — you can set that in the OpenClaw configuration under the Discord channel plugin settings. This prevents the agent from being triggered in general chat channels where its responses might be disruptive.
For advanced setups, you can combine Discord role checks with OpenClaw routing rules to route different types of requests to different agents. For example, a "developer" role gets routed to an agent with deployment access, while a "viewer" role is limited to status checks and data lookups.
Step 5: Test the Connection
With the bot configured and approved users in place, send a message to the bot in a channel it can access. Start with something simple like a greeting or a direct question.
If the connection is working, the bot will respond within a few seconds. The first message may take slightly longer as OpenClaw initializes the session for that user. Subsequent messages use the cached session and should be faster.
Discord formats OpenClaw responses as regular messages rather than the traditional "bot is typing..." indicator in some other platforms. Responses include markdown formatting when applicable — code blocks, lists, and inline code render correctly in Discord's chat view.
If the bot does not respond, check the following:
- Is the bot online in the server member list? If it shows offline, the token may be invalid or the daemon is not running.
- Does the bot have permission to view the channel? Check channel-specific permissions.
- Are you approved? Check
openclaw pairing list discordto see your user's status. - Is the OpenClaw gateway running? Run
openclaw gateway statusto confirm.
Running the Bot on a Server (Not Your Laptop)
If you run OpenClaw on your personal machine, the Discord bot goes offline whenever your computer sleeps, restarts, or loses internet connectivity. For a team-facing bot that needs to be available 24/7, run OpenClaw on a dedicated machine — a VPS, a Raspberry Pi, or a Mac Mini that stays on.
The setup process is identical regardless of where OpenClaw runs. Install OpenClaw on the remote machine, run through the standard onboarding to configure your API key, then add the Discord channel. The bot token works from any machine — it is just an API credential.
Security note: store the bot token in a secure location on the remote machine, ideally as an environment variable or in a secrets manager. Do not hardcode it in configuration files that might be committed to version control.
For deployment guidance, the Raspberry Pi installation guide covers headless setup, and the cron scheduling guide explains how to keep your agent running reliably on remote hardware. If you need to run multiple agents on the same Discord server, the multi-agent workflow guide shows how to set up parent-child sessions across channels.
Scaling to Multiple Channels and Servers
OpenClaw supports running the same bot across multiple Discord servers. When you add the bot to additional servers using the same invite URL, OpenClaw automatically detects the new servers and begins accepting messages from approved users in those servers.
For multi-server setups, consider the following:
- Each server maintains independent approval lists. A user approved in one server is not automatically approved in another.
- Channel-level restrictions apply per server, so you can configure different allowed channels for different communities.
- Session state is per-user per-server, meaning the same user gets separate conversation contexts in different servers.
If you need multiple bots for different purposes (a development bot, a moderation bot, a data query bot), create separate Discord applications with different bot tokens and add each one to OpenClaw as a separate channel configuration. You can then use routing rules to direct messages from different Discord bots to different OpenClaw agents.
Troubleshooting Common Issues
Bot shows as offline in Discord
The most common cause is an invalid or expired bot token. Reset the token in the Discord Developer Portal and update the OpenClaw configuration with the new token. You can update the token without removing the channel by running openclaw channels update discord --token NEW_TOKEN.
Bot receives messages but does not respond
Check that the Message Content Intent is enabled in the Discord Developer Portal. Without this intent, Discord does not send message content to the bot — it only sends metadata like the author and channel ID. OpenClaw cannot process a message it cannot read.
Also verify that you have approved the user. Unapproved users can send messages that are received by OpenClaw but the agent will not respond to them. Check openclaw pairing list discord to confirm.
Bot responds in the wrong channel
If the bot is responding in channels where you do not want it active, configure channel permissions in Discord server settings to deny the bot's "Read Messages" permission in those channels. Alternatively, use OpenClaw's channel-level configuration to restrict the bot to specific channel IDs.
Rate limiting or slow responses
Discord enforces rate limits on bot API calls. If your agent processes a high volume of requests, you may hit these limits. OpenClaw handles Discord rate limits internally by queuing messages, but response times may increase during peak usage. If this is a persistent issue, consider moving to a dedicated server with better connectivity or reducing the number of concurrent user sessions.
From Personal Bot to Team Infrastructure
Connecting OpenClaw to Discord turns a single-user AI assistant into a team resource. The setup is straightforward — create a Discord application, configure intents, generate an invite link, and connect it to OpenClaw with a single command. The real value comes after setup: role-based access, per-user sessions, multi-server support, and the ability to integrate with Discord's thread and channel structure.
Start with a private test server. Get the bot responding to your own messages first. Then invite a few team members, configure role-based approval, and expand from there. If you hit a configuration issue, check the OpenClaw logs with openclaw logs --channel discord — they usually point directly at the problem.
Once the Discord connection is stable, explore what else OpenClaw can do. The cron scheduling guide shows how to make your agent run recurring tasks automatically, and the parallel execution guide covers running multiple agent workflows simultaneously — useful when your team starts depending on the bot for daily operations.