Discord support bot that answers help forum threads using OpenClaw AI, escalates to Telegram when unsure, and builds a knowledge base over time.
- Copy
.env.exampleto.envand fill in all values - Install dependencies:
npm install - Ensure Postgres is running and
DATABASE_URLis set (tables are created automatically on startup) - Start the bot:
npm start
- Monitors threads in the configured help forum channel
- Sends user questions + thread history + knowledge snippets to OpenClaw
/agent - If confidence is high enough, replies directly in-thread
- If confidence is low, contains escalation keywords, or OpenClaw flags escalation — sends to Telegram for manual review
- Aarav replies on Telegram with
A: <answer>(and optionallyKB: <snippet>) — bot posts the answer back to Discord and saves the snippet
Reply to an escalation message with:
A: Your answer here
KB: Optional knowledge snippet to save for future questions
| Variable | Description |
|---|---|
DISCORD_TOKEN |
Discord bot token |
TELEGRAM_TOKEN |
Telegram bot token |
TELEGRAM_CHAT_ID |
Telegram chat ID for escalations |
OPENCLAW_URL |
Base URL for OpenClaw API |
DATABASE_URL |
Postgres connection string |
HELP_FORUM_CHANNEL_ID |
Discord forum channel ID to monitor |
PORT |
Health endpoint port (default: 3000) |
Designed for Railway. The /health endpoint returns OK for health checks.