guide~12 min read

How to Build a Discord Bot with OpenClaw

Most Discord bots are either too dumb (keyword matching) or too complex (custom code, hosting, database). OpenClaw sits in the middle. You write a SOUL.md describing what you want, install the message skill, and your agent handles the rest.

What you are building

A Discord bot that monitors your server, answers common questions, welcomes new members, flags spam, and gives you a daily moderation summary. No custom code. No hosting to manage. Your OpenClaw agent connects to Discord through the message skill and follows the instructions in your SOUL.md.

What you end up with:

  • • Auto-answers for common questions from your FAQ
  • • Welcome messages for new members
  • • Spam detection with mod-log alerts (no auto-deletion)
  • • Daily moderation summary in #mod-log
  • • Customizable tone and behavior via SOUL.md

Before you start

  1. 1OpenClaw installed and running.
  2. 2The message skill installed. This connects your agent to Discord (and Telegram, Slack, etc).
  3. 3A Discord server where you have admin permissions.
  4. 4A Discord bot token. Create one at discord.com/developers, add it to your server with message read/write permissions.
# Install the message skill
clawhub install message

# Configure Discord connection
openclaw config set discord.token YOUR_BOT_TOKEN
openclaw config set discord.server YOUR_SERVER_ID

Step 1: Write your SOUL.md

SOUL.md defines the bot personality and rules. This is what makes your bot sound like a community member instead of a corporate chatbot.

SOUL.md
You are a Discord community assistant. You monitor the server and help keep things organized.

Behavior:
- Answer common questions by checking pinned messages and docs first
- Flag spam or rule-breaking messages for mod review
- Welcome new members with a short intro message
- Never argue with users. Escalate to a human mod if things get heated.

Tone: friendly, concise, helpful. No corporate speak. Sound like a real community member.

Step 2: Add the HEARTBEAT.md

HEARTBEAT.md defines the scheduled behavior. The bot checks for unanswered questions, new members, and spam on a 15-minute loop, then posts a daily summary.

HEARTBEAT.md
Every 15 minutes during active hours (9am-11pm):
1. Check #general and #help for unanswered questions older than 10 minutes
   - If a question matches FAQ topics, post the answer with a link to docs
   - If it does not match, skip it (a human will answer)
2. Check #introductions for new member posts
   - Reply with a welcome message and link to #getting-started
3. Scan last 15 minutes of messages for spam patterns
   - Repeated links, @everyone abuse, known spam phrases
   - Flag to #mod-log if detected. Do not delete automatically.

Every weekday at 9am:
4. Post a daily summary in #mod-log:
   - New members joined yesterday
   - Messages flagged for review
   - Most active channels
   - Any unanswered questions still open

What else you can do

The templates above are a starting point. Here are patterns other people use:

Support ticket router

When someone posts in #support, the bot categorizes the issue (bug, feature request, billing) and creates a thread with the right label.

Release announcer

Connected to GitHub via the github skill. When a new release is tagged, the bot posts a changelog summary in #announcements.

Event reminder

Post reminders for community events 24 hours and 1 hour before they start. Pull event data from Google Calendar via gog.

Onboarding flow

DM new members with a getting-started guide. Ask them what they are building and suggest relevant channels.

Templates that work with Discord

These runbooks from the gallery pair well with a Discord bot setup:

Ready to build yours?

Copy the SOUL.md and HEARTBEAT.md above, install the message skill, and your Discord bot is live. Customize the behavior by editing the templates.

Quick facts

Use caseDiscord bot
File typesSOUL.md + HEARTBEAT.md
Skill requiredmessage
ModelHaiku
Cost~$0.25/day
Setup time~15 min

Spending too much?

Model token usage before enabling a workflow.

Try Clawback →

Related guides