How to Set Up Clawdbot on Discord: Server Bot Guide
Discord isn't just for gaming anymore. Communities, teams, and friend groups all use it daily. Adding an AI assistant to your Discord server means everyone gets access to a powerful helper โ right where they're already hanging out.
Here's how to get Clawdbot running on Discord.
What you'll need
- A server with at least 2GB RAM and Docker
- A Discord account
- Admin access to the Discord server where you want the bot
- An AI API key (OpenAI, Anthropic, etc.)
Step 1: Create a Discord application
- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section in the left sidebar
- Click "Add Bot"
- Under the bot's username, click "Reset Token" and copy the Bot Token โ save this somewhere safe
Important settings while you're here:
- Turn on "Message Content Intent" under Privileged Gateway Intents (required for reading messages)
- Turn on "Server Members Intent" if you want the bot to see member lists
Step 2: Invite the bot to your server
- Go to "OAuth2" > "URL Generator" in the sidebar
- Under Scopes, check
botandapplications.commands - Under Bot Permissions, select:
- Send Messages
- Read Message History
- Embed Links
- Attach Files
- Use Slash Commands
- Copy the generated URL and open it in your browser
- Select your server and authorize
Your bot should now appear in your server's member list (offline for now).
Step 3: Install OpenClaw
git clone https://github.com/openclaw/openclaw.git
cd openclaw
cp .env.example .envEdit .env:
# Discord bot token
DISCORD_BOT_TOKEN=your_bot_token_here
# AI API key
OPENAI_API_KEY=your_api_key_hereStep 4: Start the bot
docker compose up -dYour bot should come online in Discord within a few seconds.
Step 5: Test it
In any channel where the bot has access, try:
- Mention the bot:
@YourBot what can you do? - Use a slash command:
/ask what's the weather like? - Send a DM to the bot directly
Channel configuration
You probably don't want the bot responding in every channel. Here's how to control that:
Option 1: Channel permissions In Discord server settings, remove the bot's "View Channel" permission from channels where you don't want it active.
Option 2: Dedicated channel
Create a #ai-assistant channel and restrict the bot to only that channel. This keeps things organized and prevents noise.
Option 3: Mention-only mode
Configure the bot to only respond when directly mentioned with @. This works well in busy servers.
Tips for Discord
- Thread support: The bot can respond in threads, keeping conversations organized without cluttering the main channel.
- Slash commands: Set up custom slash commands for common tasks. Users can type
/to see available commands. - Embeds: Discord supports rich embeds โ the bot can format responses with colors, fields, and images for a polished look.
- Rate limits: Discord has rate limits on messages. The bot handles this automatically, but be aware if you're in a very active server.
- Multiple servers: One bot instance can serve multiple Discord servers simultaneously.
Running in a community server
If you're running a community, Clawdbot can help with:
- Q&A: Members can ask questions and get instant answers
- Moderation assistance: Flag suspicious content or summarize long discussions
- Welcome messages: Greet new members with personalized messages
- Knowledge base: Train the bot on your community's FAQ and documentation
Common issues
Bot is online but doesn't respond?
- Make sure "Message Content Intent" is enabled in the Developer Portal
- Check that the bot has permission to read and send messages in the channel
- Verify the bot token in your
.envfile
Bot responds slowly?
- This is usually the AI API latency, not Discord
- Check your server's resources:
docker stats
Slash commands not showing up?
- It can take up to an hour for slash commands to propagate globally
- For instant testing, commands appear immediately in the development server
Permission errors?
- Re-invite the bot with the correct permissions using the OAuth2 URL generator
- Check channel-specific permission overrides in Discord
What's next?
Your Discord bot is live. Here are some ideas:
- Connect WhatsApp or Telegram for personal use alongside your Discord community bot
- Set up custom commands for your server's specific needs
- Create a feedback channel where members can suggest bot improvements
- Explore webhook integrations for automated notifications
Need a hand? Contact us โ we'll help you get everything set up for free.