Skip to content

Latest commit

Β 

History

105 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Devin AI β€” Discord Bot

GitHub Repo Banner

License TypeScript DiscordJS NodeJS BunJS Docker Hub GitHub Packages

Devin AI β€” Discord Bot is a self-hosted TypeScript integration that brings Devin AI into Discord. Start sessions with a mention or slash command, collaborate in dedicated threads with live status updates, and run tasks like PRs, tests, and bug fixes without leaving Discord.

Deploy Your Own

Deploy on Railway

Deploy your own copy and support the project. πŸ’–

Features

  • Slash Commands β€” /devin start, /devin reply, /devin stop, /devin sessions, /devin template
  • @Mention Support β€” Tag the bot in any channel to start a session
  • Threaded Conversations β€” Each session gets a dedicated thread with live updates
  • Adaptive Polling β€” Fast updates during active work, slower when idle
  • Template System β€” Pre-built templates for common tasks (PRs, code review, tests, bug fixes)
  • File Attachments β€” Upload files directly to Devin via Discord
  • Thread Keywords β€” mute, unmute, !aside, EXIT for in-thread control
  • Status Embeds β€” Color-coded status with emoji indicators
  • Restart Recovery β€” Session ownership and thread mapping persist across bot restarts
  • Customizable Bot Name β€” Set BOT_NAME in .env to rebrand embed headers and thread names
  • Self-Hosted β€” Full control over your data and deployment

Tech Stack

Layer Technology
Language TypeScript 5.8+
Runtime Node.js 26 (default), 22 & 24 LTS supported
Framework discord.js v14
Toolchain Bun
Linter Biome
Testing Bun Test
CI GitHub Actions

Prerequisites

  • Node.js 22+ (26 recommended)
  • Bun 1.0+
  • A Discord bot (create one)
    • OAuth2 > URL Generator: select scopes bot and applications.commands only
    • Integration Type: Guild Install
    • Bot permissions: View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Embed Links, Attach Files, Read Message History, Add Reactions, Use Slash Commands
    • Generated guild install link: copy the URL Discord generates for you β€” it will look like https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=311385246784&integration_type=0&scope=bot+applications.commands
    • Bot tab: Public Bot off, Requires OAuth2 Code Grant off, Presence Intent on, Server Members Intent on, Message Content Intent on
  • A Devin API key (starts with apk_)
  • PostgreSQL 14+ (for persistent session state)

Quick Start

1. Install dependencies

git clone https://github.com/wgtechlabs/devin-discord-bot.git
cd devin-discord-bot
bun install

2. Configure environment

cp .env.example .env

Edit .env with your credentials:

DISCORD_BOT_TOKEN=your_bot_token
DISCORD_CLIENT_ID=your_client_id
DATABASE_URL=postgres://postgres:postgres@localhost:5432/devin_discord_bot
DEVIN_API_KEY=apk_your_api_key
# Required when DEVIN_API_KEY starts with cog_ (service-user v3 keys)
# DEVIN_ORG_ID=org_your_org_id

# Optional β€” session compute tier for v3 keys (normal, fast, lite, ultra)
# Startup default only; can be changed at runtime with:
# /devin settings mode value:<normal|fast|lite|ultra>
# DEVIN_MODE=normal

# Optional β€” per-user concurrent session cap in Discord (disabled by default)
# Set a positive integer to enable (example: 2)
# Runtime override available via: /devin settings cap per_user:<n|0>
# DEVIN_MAX_SESSIONS_PER_USER=2
# Runtime-only global cap via slash command: /devin settings cap global:<n|0>

# Optional β€” customize the bot's display name in embeds and thread names
# BOT_NAME=Devin

3. Run the bot

# Development (with hot reload)
bun run dev

# Production
bun run build
bun run start

Deploy with Railway

Use the Deploy on Railway button above for one-click hosting. Deploying from this template supports the author and ongoing maintenance.

Usage

Slash Commands

Command Description
/devin start task: Start a new Devin session with a freeform task
/devin template Start a session from a pre-built template
/devin reply message: Send a message to Devin (use in a session thread)
/devin stop Terminate a session (use in a session thread)
/devin sessions List all active sessions

@Mention

Tag the bot (default: @Devin) in any text channel:

@Devin Write a Python script that fetches top stories from Hacker News

The bot creates a Devin session and opens a thread for the conversation.

Thread Keywords

Keyword Function
mute Stop forwarding messages to Devin (owner only)
unmute Resume forwarding messages (owner only)
!aside or (aside) Message is ignored by Devin
EXIT Terminate the session (owner only)

Templates

Template Description
Open a PR Write code and open a pull request
Code Review Review an existing pull request
Write Tests Add test coverage to a repository
Fix a Bug Investigate and fix a bug

Status Indicators

Status Color Meaning
Working Yellow Devin is actively working
Blocked Orange Devin needs input
Finished Green Task complete
Error Red Session expired, stopped, or failed

Architecture

src/
β”œβ”€β”€ index.ts                  # Bot entry point
β”œβ”€β”€ config.ts                 # Environment config and constants
β”œβ”€β”€ commands/
β”‚   β”œβ”€β”€ index.ts              # Unified /devin command and subcommand routing
β”‚   β”œβ”€β”€ devin.ts              # /devin start β€” start a session
β”‚   β”œβ”€β”€ devin-reply.ts        # /devin reply β€” send message to session
β”‚   β”œβ”€β”€ devin-stop.ts         # /devin stop β€” terminate session
β”‚   β”œβ”€β”€ devin-sessions.ts     # /devin sessions β€” list active sessions
β”‚   └── devin-template.ts     # /devin template β€” template-based sessions
β”œβ”€β”€ handlers/
β”‚   β”œβ”€β”€ interaction.ts        # Slash command and component router
β”‚   └── message.ts            # @mention and thread message handler
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ devin-api.ts          # Devin REST API client
β”‚   β”œβ”€β”€ session-manager.ts    # Session tracking and polling
β”‚   └── logger.ts             # Structured logger with level filtering
β”œβ”€β”€ templates/
β”‚   └── index.ts              # Pre-built prompt templates
└── types/
    └── index.ts              # Shared type definitions

Runtime state is in-memory; restart recovery snapshots are stored in PostgreSQL via DATABASE_URL.

Development

# Install dependencies
bun install

# Run linter
bun run lint

# Fix lint issues
bun run lint:fix

# Type check
bun run typecheck

# Run tests
bun test

# Run tests in watch mode
bun run test:watch

# Build for production
bun run build

Container Publishing

Production CI publishes container images to both Docker Hub and GitHub Container Registry (GHCR) through build-flow.yml.

Required repository secrets:

  • DOCKER_HUB_USERNAME
  • DOCKER_HUB_ACCESS_TOKEN (recommended: Docker Hub access token)

Required repository permissions:

  • Contents: Read and write
  • Packages: Read and write
  • Pull requests: Read and write
  • Security events: Read and write
  • Actions: Read

Notes:

  • GHCR publishing uses the workflow token and repository package permissions.
  • Docker Hub publishing uses the configured Docker Hub secrets.
  • Pull requests run validation, while pushes to dev and main can publish images.
  • Pushes to main also update the mutable latest tag in both registries.
  • Published release builds continue to publish versioned release tags.

Workflow

This project follows Clean Flow, Clean Commit, and Clean Labels conventions.

  • Branches: main (stable) + dev (integration) + feature branches
  • Merge Strategy: Feature branches squash-merge into dev, dev merges into main
  • Commit Format: <emoji> <type>: <description> (see Clean Commit)
  • Labels: 21 standardized labels across 5 categories (see .github/labels.yml)

πŸ› Issues

Please report any issues and bugs by creating a new issue here, also make sure you're reporting an issue that doesn't exist. Any help to improve the project would be appreciated. Thanks! πŸ™βœ¨

πŸ™ Sponsor

Like this project? Leave a star! ⭐⭐⭐⭐⭐

Want to support my work and get some perks? Become a sponsor! πŸ’–

Or, you just love what I do? Buy me a coffee! β˜•

Recognized my open-source contributions? Nominate me as GitHub Star! πŸ’«

πŸ“‹ Code of Conduct

Read the project's code of conduct.

πŸ“ƒ License

This project is licensed under GNU General Public License v3.0.

πŸ“ Author

This project is created by Waren Gonzaga, with the help of awesome contributors.

contributors


πŸ’»πŸ’–β˜• by Waren Gonzaga | YHWH πŸ™ - Without Him, none of this exists, even me.

About

Deploy Devin, your friendly AI software engineer, directly into Discord.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages