feat(RPGREC-008): autojoin / autostop for monitored voice channels #14

Merged
florianbeisel merged 1 commit from feature/RPGREC-008-autojoin into main 2026-03-14 01:21:39 +01:00
florianbeisel commented 2026-03-14 01:20:38 +01:00 (Migrated from github.com)

Summary

  • AutojoinCog (bot/autojoin.py) listens for on_voice_state_update and automatically starts a RecordingSession when ≥ AUTOJOIN_MIN_USERS humans join a monitored channel, and stops with a 60 s debounce when 0 users remain
  • Config via .env: AUTOJOIN_CHANNELS (comma-separated channel IDs), AUTOJOIN_MIN_USERS (default: 2)
  • Sends 🔴 Automatische Aufnahme gestartet (N Teilnehmer) on auto-join; triggers pipeline on stop
  • Sessions shared with RecordCog so /record stop always works even for auto-started sessions
  • Listener registered via cog_load() instead of @commands.Cog.listener() (avoids Python 3.14 decorator issue in pytest)

Pragmatic decisions

Question Decision
Send message on autojoin? Yes: 🔴 Automatische Aufnahme gestartet (N Teilnehmer)
Stop when N users left? Stop when 0 users remain
Debounce 60 s before join and stop
Config interface .env variables

Test plan

  • 11 unit tests in tests/test_autojoin.py covering all join/stop paths, debounce cancellation, skip conditions, and pipeline enqueueing
  • make test passes (253/254 — one pre-existing failure in test_missing_discord_token_raises unrelated to this PR)
  • Manual: set AUTOJOIN_CHANNELS=<channel_id> and join/leave voice channel to verify join/stop behaviour

🤖 Generated with Claude Code

## Summary - **AutojoinCog** (`bot/autojoin.py`) listens for `on_voice_state_update` and automatically starts a `RecordingSession` when ≥ `AUTOJOIN_MIN_USERS` humans join a monitored channel, and stops with a 60 s debounce when 0 users remain - Config via `.env`: `AUTOJOIN_CHANNELS` (comma-separated channel IDs), `AUTOJOIN_MIN_USERS` (default: 2) - Sends `🔴 Automatische Aufnahme gestartet (N Teilnehmer)` on auto-join; triggers pipeline on stop - Sessions shared with `RecordCog` so `/record stop` always works even for auto-started sessions - Listener registered via `cog_load()` instead of `@commands.Cog.listener()` (avoids Python 3.14 decorator issue in pytest) ## Pragmatic decisions | Question | Decision | |---|---| | Send message on autojoin? | Yes: `🔴 Automatische Aufnahme gestartet (N Teilnehmer)` | | Stop when N users left? | Stop when 0 users remain | | Debounce | 60 s before join and stop | | Config interface | `.env` variables | ## Test plan - [x] 11 unit tests in `tests/test_autojoin.py` covering all join/stop paths, debounce cancellation, skip conditions, and pipeline enqueueing - [x] `make test` passes (253/254 — one pre-existing failure in `test_missing_discord_token_raises` unrelated to this PR) - [ ] Manual: set `AUTOJOIN_CHANNELS=<channel_id>` and join/leave voice channel to verify join/stop behaviour 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No description provided.