OpenClaw Discord Bot Hosting: Deploy Your AI Bot on Your Own Server
How to host an OpenClaw Discord bot on your own VPS. Covers bot creation, OAuth scopes, slash commands, channel permissions, and keeping it live 24/7.
# OpenClaw Discord Bot Hosting: Deploy Your AI Bot on Your Own Server
You can host an OpenClaw Discord bot on a $6/month VPS and have it live in your server within 30 minutes. This guide covers the Discord developer portal setup, OpenClaw config, slash commands, channel access controls, and keeping the bot online permanently.
The bot runs on your infrastructure. Your Discord server members interact with an AI assistant you control — not a third-party service with usage caps and data policies you didn't write.
Why Host Your Own Discord AI Bot
Most hosted AI bots charge per seat, limit responses per day, or own your conversation data. A self-hosted OpenClaw bot changes the math:
- Flat cost: $6–15/month VPS + your AI API usage
- No per-seat pricing: as many server members can use it as you configure
- Your AI key: use GPT-4o, Claude Sonnet, Gemini — whichever model you want
- Full control: custom SOUL.md personality, custom skills, custom commands
- Data stays yours: conversation logs live on your server, nowhere else
For a gaming community, developer team, or private Discord server, this is significantly cheaper than subscriptions to hosted AI bots. A team of 10 using a hosted AI bot service at $10/user/month pays $100/month. Self-hosted with OpenClaw runs $20–30/month total.
What You Need Before Starting
- OpenClaw installed:
npm install -g openclawthenopenclaw onboard - A Discord account with server creation or admin permissions
- A VPS or always-on machine (optional for testing, required for 24/7 uptime)
- 15–30 minutes
If you're testing locally first, that's fine — the bot will work on your laptop. For production, a VPS keeps it running when your laptop is off. A Hetzner CX11 at €3.79/month or DigitalOcean's basic droplet at $4/month both work.
Part 1: Create Your Discord Bot Application
Step 1: Go to the Discord Developer Portal
Open discord.com/developers/applications and click New Application.
Name it something clear. "MyServer AI Assistant" or "Atlas Bot" — this name shows in the Discord UI.
Step 2: Create a Bot
In the left sidebar, click Bot. Then click Add Bot.
On the Bot page:
- 1. Copy the bot token — click "Reset Token" if no token is shown, then copy it. This is your OpenClaw auth token.
- 2. Enable Privileged Gateway Intents:
- Toggle ON: Message Content Intent
- Toggle ON: Server Members Intent (if you want member-aware features)
- 3. Uncheck "Public Bot" if you don't want strangers adding your bot to their servers.
The Message Content Intent is required. Without it, your bot receives slash commands but can't read regular messages — which breaks the conversational AI functionality.
Step 3: Generate the Invite URL
Go to OAuth2 → URL Generator in the left sidebar.
Scopes to check:
botapplications.commands
Bot Permissions to check:
- Read Messages/View Channels
- Send Messages
- Read Message History
- Use Slash Commands
- Add Reactions (optional, for emoji reactions)
- Embed Links (recommended, for formatted responses)
Copy the generated URL at the bottom of the page.
Step 4: Add the Bot to Your Server
Paste the invite URL into your browser. Select your Discord server. Click Authorize.
The bot now appears in your server member list — but it's offline until you connect OpenClaw.
Part 2: Configure OpenClaw for Discord
Step 1: Open Your Config
nano ~/.openclaw/openclaw.json
Step 2: Add the Discord Config Block
{
channels: {
discord: {
enabled: true,
botToken: "YOUR_DISCORD_BOT_TOKEN_HERE",
defaultPolicy: "pairing",
guilds: {
"*": {
requireMention: false,
channelAllowlist: ["ai-chat", "bot-commands"]
}
}
}
}
}
Config options explained:
botToken— the token from the Discord Developer PortaldefaultPolicy: "pairing"— new users DM'ing the bot must be approvedrequireMention: false— bot responds to all messages in allowed channels (not just @mentions)channelAllowlist— bot only responds in these channels (by name or channel ID)
Channel Allowlist Options
You have three approaches for controlling where the bot responds:
Option A: Specific channels by name
channelAllowlist: ["ai-chat", "bot-commands", "ask-the-bot"]
Option B: All channels (not recommended for large servers)
// Omit channelAllowlist entirely
Option C: Exclude specific channels
channelDenylist: ["#announcements", "#rules", "#general"]
For most setups, a dedicated #ai-chat channel with requireMention: false gives members the best experience. They go to one place to chat with the bot, and the bot doesn't interrupt other channels.
Part 3: Start the Gateway and Test
Step 1: Start OpenClaw
openclaw gateway
Watch the startup output. You should see:
Discord: connected as MyBot#1234
Discord: registered in 1 guild(s)
OpenClaw gateway running on port 18789
If you see "Invalid token" — re-copy the token from the Discord Developer Portal. Bot tokens are case-sensitive and easy to mis-copy.
Step 2: Test in Discord
Go to your #ai-chat channel (or whatever you named it). Send a message:
Hey, are you there?
The bot should respond within 2–4 seconds. Response time depends on your AI model and server location. Claude Sonnet on a European VPS typically responds in 1.5–3 seconds for short queries.
Test a more complex query:
What's 15% of $347?
If you get a correct answer quickly, the bot is working properly.
Part 4: Slash Commands
OpenClaw supports Discord's native slash commands. Users type / and see available commands in an autocomplete menu.
Default Slash Commands
OpenClaw registers these commands automatically:
/ask [question]— ask the AI a direct question/status— check if the bot is running correctly/help— list available commands and capabilities
Custom Slash Commands
You can add custom slash commands by creating skills. Example workflow:
- 1. Install a skill:
openclaw skills install weather - 2. The skill registers a
/weather [location]command - 3. Discord users can now type
/weather New Yorkfor instant weather responses
To register custom commands from a skill:
openclaw skills install weather
openclaw gateway restart
After restart, the new slash commands appear in Discord's autocomplete.
Command Deployment Timing
Discord can take up to 1 hour to propagate new global slash commands across all servers. Guild-specific commands (registered to one server) update in under 1 minute.
If you test a new command and it doesn't show up in autocomplete, wait 5 minutes. Still missing? Check gateway logs for registration errors.
Part 5: Per-Server Access Controls
OpenClaw's Discord integration supports fine-grained access controls per guild.
Role-Based Access
Restrict bot access to specific Discord roles:
{
channels: {
discord: {
enabled: true,
botToken: "YOUR_TOKEN",
guilds: {
"YOUR_GUILD_ID": {
requireMention: false,
channelAllowlist: ["ai-chat"],
allowRoles: ["Premium", "Staff", "Members"]
}
}
}
}
}
Only users with the "Premium", "Staff", or "Members" role can interact with the bot.
Finding Your Guild ID
Right-click your server name in Discord → Copy Server ID. You need Developer Mode enabled: User Settings → Advanced → Developer Mode.
Multiple Server Configuration
If your bot is in multiple servers (guilds), configure each one separately:
guilds: {
"111111111111": {
channelAllowlist: ["ai-chat"],
allowRoles: ["Member"]
},
"222222222222": {
channelAllowlist: ["general", "bot-spam"],
requireMention: true
}
}
Each server gets independent configuration. One server can require @mentions while another allows free conversation in specific channels.
Part 6: Host the Bot 24/7
Option A: Systemd on Linux VPS (Recommended)
This is the most reliable approach for a VPS.
Create the service file:
sudo nano /etc/systemd/system/openclaw.service
[Unit]
Description=OpenClaw Discord Bot
After=network.target
[Service]
Type=simple
User=YOUR_USERNAME
WorkingDirectory=/home/YOUR_USERNAME
ExecStart=/usr/local/bin/openclaw gateway
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
Check it's running:
sudo systemctl status openclaw
You should see "active (running)".
View logs:
journalctl -u openclaw -f
The -f flag follows the log in real time. Useful for debugging.
Option B: PM2 (Easier, Cross-Platform)
PM2 is a Node.js process manager that handles restarts, logging, and startup:
npm install -g pm2
pm2 start "openclaw gateway" --name "openclaw-discord"
pm2 startup
pm2 save
pm2 status shows running processes and their memory/CPU usage.
VPS Recommendations for Discord Bots
Hetzner CX11 — €3.79/month, 1 vCPU, 2GB RAM, Helsinki or Nuremberg. Best value for EU-based Discord servers.
DigitalOcean Droplet — $4/month, 1 vCPU, 512MB RAM. Reliable, good documentation, US or EU locations.
Vultr — $3.50/month for the smallest tier. Good if you need specific geographic regions.
For a Discord bot running OpenClaw with moderate traffic (50–200 daily active users), 1GB RAM is sufficient. Go to 2GB if you plan heavy multi-agent workflows.
Part 7: Keep the Bot's Personality Consistent
The SOUL.md file controls how your bot behaves. For a Discord server, customize it for your community:
nano ~/.openclaw/workspace/SOUL.md
Example for a gaming community:
## Identity
You are Atlas, the AI assistant for [Server Name].
## Personality
- Casual, friendly tone
- Can discuss gaming topics
- Keep responses under 300 words unless asked for more
- Use Discord formatting (bold, code blocks) appropriately
## Rules
- Never generate NSFW content
- Don't share personal information about members
- If asked about server rules, refer users to #rules channel
The bot reads this on every session. Changes take effect on the next gateway restart.
Troubleshooting
Bot shows as offline in Discord
The gateway isn't running. Start it: openclaw gateway or sudo systemctl start openclaw
Bot doesn't respond in channels
Check channelAllowlist — the channel name must match exactly, including capitalization. Try using channel IDs instead of names to avoid ambiguity.
"Missing Permissions" error
The bot needs "Send Messages" permission in that channel. Check channel-level permission overrides in Discord server settings.
Message Content Intent error
Enable the Message Content Intent in the Discord Developer Portal → your application → Bot settings. This is a common miss.
Bot stops after a few hours
Usually a memory issue on a small VPS, or the gateway process is getting killed. Use systemd (not screen or tmux) for reliable process management. Check free -h to verify available RAM.
What's Possible with an Autonomous Discord Bot
An OpenClaw Discord bot isn't just a Q&A tool. With the right skills and configuration, it can:
- Moderate content — flag messages matching patterns you define
- Answer support tickets — route questions and provide documented answers
- Generate summaries — summarize a channel's last 50 messages on demand
- Run background tasks — scheduled announcements, daily briefings, server stats
- Execute multi-step workflows — user asks a complex question, bot spawns sub-agents to research, then compiles a response
These capabilities run on your server. There's no monthly per-feature fee.
Ready to get your Discord bot hosted today? MrDelegate deploys OpenClaw with Discord pre-configured — bot token, channel config, systemd service, SOUL.md setup, and 24/7 uptime monitoring included.
Already have OpenClaw running and want to add Telegram too? Read the OpenClaw Telegram bot tutorial — takes about 10 minutes to add a second channel.
Questions about advanced Discord configuration? Reach out to MrDelegate — we've set up OpenClaw Discord bots for communities ranging from 50 to 5,000 members.