Skip to content

Puri12/opencode-discord-presence

Repository files navigation

opencode-discord-presence

npm version License: MIT

한국어 | English

Display your current OpenCode session status in Discord Rich Presence. Show which AI agent you're using, the current model, session time, and more.

image

Features

  • Real-time agent display - Shows which AI agent (Claude, Prometheus, etc.) you're currently using
  • Model information - Displays the active model (Claude Sonnet, GPT-4, etc.)
  • Session time tracking - Shows how long you've been coding
  • Korean language support - Proper Korean particle handling (을/를, 은/는)
  • Idle detection - Automatically shows when you're taking a break

Installation

# Using bun
bun add opencode-discord-presence

# Using npm
npm install opencode-discord-presence

# Using pnpm
pnpm add opencode-discord-presence

Quick Start

Add the plugin to your opencode.json:

{
  "plugins": ["opencode-discord-presence"]
}

That's it! The plugin will automatically connect to Discord and display your session status.

Configuration

Create a .discord-presence.json file in your home directory or project root:

{
  "enabled": true,
  "applicationId": "YOUR_DISCORD_APP_ID",
  "language": "ko"
}

Or use environment variables:

OPENCODE_DISCORD_ENABLED=true
OPENCODE_DISCORD_CLIENT_ID=YOUR_APP_ID
OPENCODE_DISCORD_LANGUAGE=ko

Configuration Options

Option Type Default Description
enabled boolean true Enable or disable the plugin
applicationId string (built-in) Custom Discord Application ID for your own branding
language string "en" Display language ("en" or "ko")

Config File Priority

  1. Project directory: .discord-presence.json
  2. Home directory: ~/.discord-presence.json
  3. Environment variables

Custom Discord Application

For custom branding (your own images and app name):

  1. Go to Discord Developer Portal
  2. Click "New Application" and give it a name
  3. Go to "Rich Presence" → "Art Assets"
  4. Upload your images (at least one named opencode-logo)
  5. Copy the Application ID from "General Information"
  6. Add it to your config:
{
  "discordPresence": {
    "applicationId": "YOUR_APPLICATION_ID"
  }
}

How It Works

The plugin hooks into OpenCode's event system:

  • chat.message - Updates presence when you send/receive messages, tracking the current agent and model
  • event - Listens for session state changes (idle, active)

Presence States

State English Korean Description
Active "Working with Prometheus" "Prometheus를 갈구는중" You're actively coding with an agent
Idle "Prometheus is idle" "Prometheus는 휴식중" Session is idle

Korean particles (을/를, 은/는) are automatically selected based on whether the agent name ends with a consonant (받침).

Development

# Install dependencies
bun install

# Run tests
bun test

# Run tests in watch mode
bun test --watch

# Type check
bun run typecheck

# Lint
bun run lint

# Format
bun run format

# Build
bun run build

Architecture

src/
├── index.ts              # Main entry point & exports
├── plugin.ts             # Core plugin implementation
├── config.ts             # Configuration management
├── types/
│   └── index.ts          # TypeScript type definitions
├── services/
│   └── discord-rpc.ts    # Discord RPC service (singleton)
└── utils/
    └── particle.ts       # Korean particle handling (을/를, 은/는)

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

Quick Contribution Guide

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Run tests (bun test)
  4. Commit your changes (git commit -m 'feat: add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

License

MIT License - see LICENSE for details.

Related Projects

Changelog

See CHANGELOG.md for release history.

About

Discord Rich Presence plugin for OpenCode - Display your AI agent, model, and session status in Discord

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors