Skip to content

tddworks/MoatBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoatBot

License: MIT Kotlin

MoatBot is your secure gateway to Claude AI Claude. Like a castle moat protects what's inside, MoatBot keeps your AI conversations private and under your control—accessible only through your own Discord, Telegram, or IDE.

Features

  • Multi-platform: Discord, Telegram, and IDE support via ACP
  • Conversation persistence: Continue where you left off
  • Streaming responses: Real-time message updates
  • Built on Claude CLI: Leverages the official Claude Code CLI

Quick Start

Prerequisites

  1. Claude CLI - MoatBot uses the Claude CLI under the hood

    npm install -g @anthropic-ai/claude-code
  2. JDK 21+ - Required to run MoatBot

    java -version
  3. Platform token (at least one):

    • Discord Bot Token, or
    • Telegram Bot Token, or
    • IDE with ACP support

Running MoatBot

Discord

export DISCORD_BOT_TOKEN="your-discord-bot-token"
./gradlew run

Setup:

  1. Go to Discord Developer Portal
  2. Create a new application → Bot section → Reset Token → Copy
  3. Enable "Message Content Intent" under Privileged Gateway Intents
  4. Invite bot using OAuth2 URL Generator

Telegram

export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
./gradlew run

Setup:

  1. Message @BotFather on Telegram
  2. Send /newbot and follow the prompts
  3. Copy the token

IDE (ACP)

./gradlew shadowJar
java -jar build/libs/moatbot-kotlin-0.1.0-SNAPSHOT-all.jar --acp

Configuration

Variable Description Default
DISCORD_BOT_TOKEN Discord bot token -
TELEGRAM_BOT_TOKEN Telegram bot token -
SESSION_DIR Conversation storage (:memory: for in-memory) ~/.moatbot/sessions
CLAUDE_CLI_PATH Path to Claude CLI claude
CLAUDE_WORKING_DIR Working directory for Claude .

Commands

Command Description
/clear Clear conversation history
/status Show session info
/help Show available commands

Architecture

For detailed design, see docs/design.md.

┌─────────────────────────────────────────────────────────┐
│                    Your Platform                         │
│   Discord  │  Telegram  │  IDE (ACP)                    │
└─────────────────────────┬───────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                      MoatBot                             │
│   • Manages conversations                                │
│   • Streams responses                                    │
│   • Handles multiple platforms                           │
└─────────────────────────┬───────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                     Claude CLI                           │
│   Executes prompts, maintains context                    │
└─────────────────────────────────────────────────────────┘

Building from Source

git clone https://github.com/anthropics/moatbot.git
cd moatbot

./gradlew build
./gradlew test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Troubleshooting

Claude CLI not found

which claude  # Verify installation

No messaging platform configured Set at least one of DISCORD_BOT_TOKEN or TELEGRAM_BOT_TOKEN.

Discord bot not responding

  1. Enable "Message Content Intent" in Discord Developer Portal
  2. Verify bot has read/send message permissions

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published