Discord Rich Presence plugin for OpenCode - Show your coding activity in Discord
npm install opencode-discord-rpcDiscord Rich Presence plugin for OpenCode - Show your AI-assisted coding activity in Discord!
!Discord Rich Presence Preview
- Shows your current AI model being used (GPT-4, Claude, etc.)
- Displays session duration (elapsed time)
- Shows activity status (Coding/Idle/Thinking)
- Clickable button to visit OpenCode.ai
- Auto-reconnects if Discord restarts
- Zero configuration needed
Add the plugin to your opencode.json:
``json`
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-discord-rpc"]
}
For global installation, add it to ~/.config/opencode/opencode.json.
That's it! Restart OpenCode and your Discord Rich Presence will appear.
Once installed, the plugin automatically:
1. Connects to Discord when OpenCode starts
2. Displays your current activity in Discord's Rich Presence
3. Updates in real-time as you code:
- Coding... - When tools are executing or you're actively working
- Thinking... - When the AI is generating a response
- Waiting for input... - When the session is waiting for your input
- Idle - When no session is active
``
┌─────────────────────────────────────────┐
│ [OpenCode Logo] │
│ │
│ Using gpt-4o │
│ Coding... │
│ 01:23:45 elapsed │
│ │
│ [ Visit OpenCode.ai ] │
└─────────────────────────────────────────┘
The plugin works out of the box with no configuration needed.
For advanced users, you can customize behavior with environment variables:
| Variable | Description | Default |
|----------|-------------|---------|
| OPENCODE_DISCORD_ENABLED | Set to "false" to disable | "true" |OPENCODE_DISCORD_CLIENT_ID
| | Use your own Discord Application | Built-in |OPENCODE_DISCORD_RETRY_INTERVAL
| | Reconnect interval (ms) | 15000 |OPENCODE_DISCORD_MAX_RETRIES
| | Max reconnection attempts | 5 |
- OpenCode v1.0+
- Discord Desktop App (must be running)
1. Make sure Discord is running - The desktop app must be open
2. Check Activity Status is enabled - In Discord Settings > Activity Privacy, ensure "Display current activity as a status message" is ON
3. Restart OpenCode - The plugin connects on startup
The plugin will automatically retry if Discord isn't available. Common messages:
- "Discord is not running or not accessible" - Discord desktop app is closed"Max retry attempts reached"
- - Discord wasn't found after multiple attempts; restart OpenCode when Discord is running
This plugin does not display:
- Your project name or path
- File names or contents
- Any code or conversation content
It only shows:
- The AI model being used
- Your activity status
- How long the session has been active
Contributions are welcome! Please feel free to submit a Pull Request.
`bashClone the repository
git clone https://github.com/phoenixak/opencode-discord-rpc.git
cd opencode-discord-rpc
MIT License - see LICENSE for details.
- Built for OpenCode
- Uses @xhayper/discord-rpc for Discord IPC communication