An open API service indexing awesome lists of open source software.

https://github.com/abhinav2712/release-bot

A Discord bot for managing weekly release threads
https://github.com/abhinav2712/release-bot

bot developer-tools discord discord-bot go golang release

Last synced: about 1 month ago
JSON representation

A Discord bot for managing weekly release threads

Awesome Lists containing this project

README

          

# ๐Ÿš€ Release Bot

A Discord bot for managing weekly release threads โ€” built in Go using [`discordgo`](https://github.com/bwmarrin/discordgo).

PMs initialize a release, developers add and update their branches, and the bot keeps a live summary message in the thread updated automatically.

---

## Features

- ๐Ÿ“‹ Create release threads with one command
- โž• Add branch entries grouped by **Frontend** or **Backend**
- โœ๏ธ Update your own entries via guided dropdowns
- โŒ Remove a branch from the release (shown struck-through in the thread, excluded from summary counts)
- ๐Ÿ“Š Instant ephemeral summary of release status
- ๐Ÿ”’ Thread-safe in-memory state

---

## Commands

| Command | Who | What it does |
|---|---|---|
| `/ping` | Anyone | Health check โ€” responds `Pong ๐Ÿš€` |
| `/release-init` | PM | Starts a new release (type โ†’ date โ†’ notes โ†’ thread) |
| `/release-add` | Developer | Adds a branch entry โ€” choose **Frontend** or **Backend** first, then status |
| `/release-update` | Developer | Updates a branch entry โ€” or removes it from the release |
| `/release-summary` | Anyone | Shows an ephemeral count snapshot by status (removed entries excluded) |

---

## Setup Guide

### Prerequisites

- [Go](https://go.dev/dl/) installed (`go 1.21+` recommended)
- A Discord account
- Permission to add bots to the target server

---

### 1. Clone the repository

```bash
git clone https://github.com/abhinav2712/release-bot.git
cd release-bot
```

---

### 2. Create a Discord application

1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
2. Click **New Application** and give it a name
3. Navigate to the **Bot** section
4. Click **Add Bot** โ†’ confirm
5. Under **Token**, click **Reset Token** and copy it

> This is your `DISCORD_TOKEN`. Keep it secret.

---

### 3. Invite the bot to your server

1. In the Developer Portal, open **OAuth2 โ†’ URL Generator**
2. Select scopes:
- โœ… `bot`
- โœ… `applications.commands`
3. Select bot permissions:
- โœ… View Channels
- โœ… Send Messages
- โœ… Read Message History
- โœ… Manage Threads
4. Copy the generated URL, open it in your browser, and add the bot to your server

---

### 4. Get your Guild ID (Server ID)

1. Open Discord
2. Go to **User Settings โ†’ Advanced**
3. Enable **Developer Mode**
4. Right-click your server name in the sidebar
5. Click **Copy Server ID**

> This is your `GUILD_ID`.

---

### 5. Set up environment variables

Copy the example file and fill in your values:

```bash
cp .env.example .env
```

```env
DISCORD_TOKEN=your_bot_token_here
GUILD_ID=your_server_id_here
```

| Variable | Description |
|---|---|
| `DISCORD_TOKEN` | Bot token from the Discord Developer Portal |
| `GUILD_ID` | ID of the server where slash commands are registered |

---

### 6. Install dependencies

```bash
go mod tidy
```

---

### 7. Run the bot

```bash
go run cmd/bot/main.go
```

If everything is configured correctly, you'll see:

```
Bot is ready!
Bot is running...
```

---

### 8. Test it out

In your Discord server, run:

```
/ping
```

If the bot replies with `Pong ๐Ÿš€`, you're good to go.

---

## Release Flow

```
PM runs /release-init
โ””โ”€ selects release type (major / minor)
โ””โ”€ selects release date
โ””โ”€ enters release notes in modal
โ””โ”€ bot creates a thread + posts a live summary message

Developers run /release-add
โ””โ”€ choose layer (Frontend / Backend)
โ””โ”€ select status
โ””โ”€ fill in branch, title, PR link, blocker in modal
โ””โ”€ summary thread updates with FE / BE grouping

Developers run /release-update
โ””โ”€ select their branch
โ””โ”€ select new status
โ”œโ”€ normal status โ†’ fill in updated PR / blocker in modal โ†’ summary updates
โ””โ”€ "Remove from Release" โ†’ no modal, branch instantly struck through in thread

Anyone runs /release-summary
โ””โ”€ receives an ephemeral count breakdown (removed branches excluded)
```

---

## Project Structure

```
release-bot/
โ”œโ”€โ”€ cmd/bot/main.go # Entry point โ€” env, session wiring, signal handling
โ””โ”€โ”€ internal/
โ”œโ”€โ”€ models/release.go # ReleaseItem and CurrentRelease types
โ”œโ”€โ”€ state/store.go # Thread-safe in-memory state store
โ”œโ”€โ”€ status/status.go # Status helpers, emoji map, date options
โ”œโ”€โ”€ discord/respond.go # Interaction response helpers
โ”œโ”€โ”€ summary/builder.go # Summary message builder
โ””โ”€โ”€ handlers/
โ”œโ”€โ”€ router.go # Top-level interaction dispatcher
โ”œโ”€โ”€ release_init.go # /release-init flow
โ”œโ”€โ”€ release_add.go # /release-add flow
โ”œโ”€โ”€ release_update.go # /release-update flow
โ””โ”€โ”€ release_summary.go # /release-summary
```

---

## Status Reference

| Status | Emoji | Meaning |
|---|---|---|
| `in-progress` | ๐Ÿ› ๏ธ | Work is ongoing |
| `given-for-review` | ๐Ÿ‘€ | Shared for review |
| `reviewed` | โœ… | Review is complete |
| `tested` | ๐Ÿงช | Testing is complete |
| `reviewed-and-tested` | ๐Ÿš€ | Ready to ship |
| `removed` | โŒ | Removed from the release โ€” struck-through in thread, excluded from counts |

> [!NOTE]
> The `removed` status is only available via `/release-update`. It cannot be set when first adding an entry with `/release-add`.

---

## Troubleshooting

**Slash commands are not showing up**
- Make sure the bot was invited with `applications.commands` scope
- Verify `GUILD_ID` matches the correct server
- Confirm the bot is running

**"Missing Access" error**
- The bot is not in the server, or was invited without the correct scopes
- Double-check the invite URL was generated with both `bot` and `applications.commands`

**`.env` values are not being read**
- The `.env` file must be in the project root, the same directory you run the command from

---

## Security

> [!CAUTION]
> Never commit your real `.env` file or bot token to version control.
> Only commit `.env.example` with empty values.
> If your token is ever exposed, reset it immediately from the [Discord Developer Portal](https://discord.com/developers/applications).

---

## License

MIT