From dispatch-discord
Start or stop the Discord bot server that connects local Claude Code to Discord. Use when the user wants to run the bot, start the server, connect to Discord, stop the bot, kill the server, or disconnect from Discord.
npx claudepluginhub runbear-io/skills --plugin dispatch-discordThis skill is limited to using the following tools:
Start, stop, restart, or check the status of the Discord bot server, which connects local Claude Code to Discord via the Agent SDK.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Analyzes BMad project state from catalog CSV, configs, artifacts, and query to recommend next skills or answer questions. Useful for help requests, 'what next', or starting BMad.
Start, stop, restart, or check the status of the Discord bot server, which connects local Claude Code to Discord via the Agent SDK.
The server entry point is scripts/index.js. The default port is 3031 (override with --port <number> or PORT env var).
Parse $ARGUMENTS for:
start, stop, restart, status (default: start)Examples:
/dispatch-discord:dispatch start /Users/me/my-project/dispatch-discord:dispatch stop/dispatch-discord:dispatch (defaults to start)Before executing the start command, ask the user which mode to run in:
CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY in .env.If the user does not specify, default to local.
lsof -ti:${PORT:-3031} 2>/dev/null
If already running, inform the user and ask if they want to restart.
.env in the project root ($PROJECT_ROOT) has the required vars:grep -c "^DISCORD_BOT_TOKEN" "$PROJECT_ROOT/.env"
If missing, tell the user to run /dispatch-discord:init first.
node_modules/ is missing):cd "$SKILL_DIR" && npm install
.env from the project root to the skill directory so the server can load it:cp "$PROJECT_ROOT/.env" "$SKILL_DIR/.env"
PROJECT_DIR="/private/tmp/claude-$(id -u)/$(echo "$PROJECT_ROOT" | tr '/' '-')" && SESSION_ID="$(find "$PROJECT_DIR"/*/tasks -name "*.output" -maxdepth 1 2>/dev/null | xargs ls -t 2>/dev/null | head -1 | sed "s|$PROJECT_DIR/||;s|/tasks/.*||")" && cd "$SKILL_DIR" && npm start -- --cwd "$PROJECT_ROOT" --session-id "$SESSION_ID" $ARGUMENTS
Run this in the background so the conversation can continue.
Wait a few seconds, then check output to confirm "Discord bot started" appears.
docker compose version
If not installed, tell the user to install Docker and try again, or use local mode instead.
.env has a credential the container can use:grep -c "^CLAUDE_CODE_OAUTH_TOKEN\|^ANTHROPIC_API_KEY" "$PROJECT_ROOT/.env"
If neither is set, tell the user to run claude setup-token on the host machine and add CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-... to .env.
.env into the skill directory so Docker can access it:cp "$PROJECT_ROOT/.env" "$SKILL_DIR/.env"
Ask the user which directory to mount as the workspace. Default to $PROJECT_ROOT.
Build and start with the workspace mounted:
cd "$SKILL_DIR" && WORKSPACE_PATH="<workspace-dir>" docker compose up -d --build
Replace <workspace-dir> with the absolute path the user chose (default: $PROJECT_ROOT). The project is mounted at the same path inside the container so Claude Code session keys match the host, enabling session continuity.
docker compose -f "$SKILL_DIR/docker-compose.yml" logs --tail 20
Confirm "Discord bot started" appears in the logs.
kill $(lsof -ti:${PORT:-3031}) 2>/dev/null
cd "$SKILL_DIR" && docker compose down
Stop then start (preserves mode and any working directory argument).
Local:
lsof -ti:${PORT:-3031} 2>/dev/null
If a PID is returned, the server is running. Otherwise it is stopped.
Docker:
docker compose -f "$SKILL_DIR/docker-compose.yml" ps
POST /api/query — run a prompt, return full JSON response.
Request body: prompt (required), cwd, sessionId, allowedTools, systemPrompt.
0.0.0.0, not 127.0.0.1. It accepts connections from any interface.CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY in .env. Generate an OAuth token with claude setup-token. The ~/.claude directory is also mounted (useful on Linux where credentials are file-based, but insufficient on macOS where auth is stored in Keychain).Write tool are automatically sent as Discord attachments after the response. Eligible extensions: .pdf, .md, .txt, .csv, .json, .xml, .html, .log, .yaml, .yml, .js, .ts, .py, .sh, .sql, and more. Files must be under 25MB (Discord limit). Empty or missing files are skipped.