Add Discord event announcement functionality to backend
This commit introduces a new Discord event announcer to the backend, allowing for event announcements via Discord. It includes the addition of new environment variables for Discord configuration in `.env.example` and `compose.yaml`. The `main.go` file has been updated to initialize the announcer, and a new `discord` package has been created, containing the announcer logic and tests. Additionally, the service layer has been modified to support bracket draft management, enhancing the overall event workflow. Integration tests have been updated to ensure proper functionality of the new features.
This commit is contained in:
@@ -19,6 +19,9 @@ Set these as production variables in Coolify:
|
||||
- `DISCORD_CLIENT_SECRET`
|
||||
- `DISCORD_REDIRECT_URL=https://mix.example.com/api/auth/discord/callback`
|
||||
- `ADMIN_DISCORD_IDS` — comma-separated Discord user IDs
|
||||
- `DISCORD_BOT_TOKEN` — bot token from the Developer Portal; never expose it to the frontend
|
||||
- `DISCORD_ANNOUNCEMENT_CHANNEL_ID` — numeric ID of the text channel for new mix announcements
|
||||
- `DISCORD_ANNOUNCEMENT_LOCALE=ru` — announcement language, `ru` or `en`
|
||||
|
||||
Do not copy production values into `.env` in the repository.
|
||||
|
||||
@@ -31,6 +34,8 @@ In the Discord Developer Portal:
|
||||
3. Use only the `identify` OAuth scope.
|
||||
4. Store the client secret only in Coolify.
|
||||
|
||||
For event announcements, add the bot to the server with the `bot` scope. In the announcement channel grant only `View Channel`, `Send Messages`, `Embed Links`, and `Mention Everyone`. Copy the channel ID with Discord Developer Mode and store it in `DISCORD_ANNOUNCEMENT_CHANNEL_ID`. The bot token is separate from the OAuth client secret and must also remain only in Coolify. If either the token or channel ID is omitted, announcements stay disabled.
|
||||
|
||||
## Storage and backups
|
||||
|
||||
PostgreSQL uses the `postgres_data` named volume. Confirm that Coolify recognizes it as persistent storage before accepting users.
|
||||
@@ -44,7 +49,8 @@ Persistent storage is not a backup. Schedule an encrypted `pg_dump` to storage o
|
||||
3. Open `/health` through the public domain.
|
||||
4. Complete Discord login and verify the admin role.
|
||||
5. Create a test event and RSVP.
|
||||
6. Restart/redeploy and confirm the event remains.
|
||||
7. Verify SSE remains connected through the proxy.
|
||||
6. Confirm the bot posts one announcement with an `@everyone` mention and a working registration button.
|
||||
7. Restart/redeploy and confirm the event remains.
|
||||
8. Verify SSE remains connected through the proxy.
|
||||
|
||||
Rollback application images only when the database migration is backward-compatible. Otherwise restore the matching database backup.
|
||||
|
||||
Reference in New Issue
Block a user