Open Source

Claude Code
in Discord

Discord bot that manages Claude Code sessions via tmux. Each session gets its own channel.

Discord - #claude-myproject
R
Ruby

Add rate limiting to the /users endpoint

C
Claude

I'll add rate limiting to the /users endpoint. Let me implement this using a sliding window approach...

const rateLimit = createRateLimiter({ windowMs: 60000, max: 100 });

📝 Modified src/routes/users.ts

What it does

Bridges Discord to Claude Code via persistent tmux sessions

Just Type

No commands needed. Messages go straight to Claude. Responses stream back in real-time with ANSI colors.

Persistent Sessions

Sessions run in tmux. Survive disconnects, bot restarts, everything. Pick up where you left off.

Terminal Access

Drop into the terminal anytime with tmux attach. Full access to the same session.

Interactive Prompts

When Claude shows numbered options, clickable buttons appear. Select without typing.

Secure by Default

User whitelist ensures only you can run commands. Your machine, your rules.

Simple Architecture

Discord messages flow through to Claude Code running in tmux

Discord #claude-myproject
Your message
Disclaude Discord Bot
tmux send-keys
Claude Code tmux session

Installation

Prerequisites

Node.js 18+ JavaScript runtime
tmux brew install tmux
Claude Code CLI Installed & authenticated
Discord Server With channel permissions
1

Create Discord Application

  1. Go to Discord Developer Portal
  2. Click "New Application" and name it
  3. Go to Bot tab → Click "Reset Token" → Copy and save it
  4. Enable Message Content Intent under Privileged Gateway Intents
  5. Go to OAuth2 → URL Generator
OAuth2 Settings

Scopes: bot, applications.commands

Bot Permissions: Send Messages, Manage Channels, Embed Links, Add Reactions, Read Message History

Open the generated URL to invite the bot to your server

2

Clone & Configure

Terminal
git clone https://github.com/disclaude/app
cd app

Create a .env file with your configuration:

.env
# Required: Discord Bot Token
DISCORD_TOKEN=your_bot_token_here

# Required: Discord Application Client ID
DISCORD_CLIENT_ID=your_client_id_here

# Required: Guild/Server ID
DISCORD_GUILD_ID=your_guild_id_here

# Highly Recommended: Allowed Discord user IDs
ALLOWED_USERS=123456789012345678

# Optional: Default working directory
DEFAULT_DIRECTORY=/path/to/your/projects
Security Warning

Always set ALLOWED_USERS - this bot can execute code on your machine. Only whitelisted users should have access.

  1. Open Discord Settings → Advanced → Enable Developer Mode
  2. Server ID: Right-click server icon → Copy Server ID
  3. User ID: Right-click your username → Copy User ID
  4. Client ID: Discord Developer Portal → Your App → OAuth2
3

Install & Run

Terminal
npm install
npm start

For development with hot reload:

Terminal
npm run dev
4

Create Your First Session

Discord
/claude new myproject ~/Dev/my-project

A new channel #claude-myproject will be created. Just type in it to talk to Claude!

Commands

Command Description
/claude new <name> [directory] Create a new session + channel
/claude list List all active sessions
/claude sync Reconnect orphaned tmux sessions
/claude end End the session (run in session channel)
/claude output [lines] Dump recent output
/claude attach Get the tmux attach command