feat: optional idle-leave-after-playback timeout#1
Closed
seitzbg wants to merge 8 commits into
Closed
Conversation
Owner
Author
|
Superseded by the upstream PR against dev-topsoil/slopsoil: dev-topsoil#16 (clean, idle-leave-only, based on upstream main). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IDLE_LEAVE_TIMEOUT(seconds). When playback ends — a video finishing on its own or!stop— and nothing new starts within the timeout, the bot leaves voice and posts a short note. Unset / empty /0keeps today's behavior (the bot stays put).asynciotimer armed from the playback-cleanup (finally) blocks incogs/stream.py(covers both the camera and go-live paths). A fire-time guard re-checks the bot is genuinely idle (stream_tasks/live_connectionsempty,vcnot playing, still connected) before disconnecting, so it never cuts off active or resumed playback.!leaveand auto-leave-on-empty cancel it. Timers are also cancelled on bot shutdown.Implementation notes
cogs/stream.py:_idle_leave_timeout,_format_idle,schedule_idle_leave,cancel_idle_leave,_idle_leave_after,_idle_leave_now.SlopSoilgainsidle_leave_tasks: dict[int, asyncio.Task](cancelled inclose()).cogs/voice.pycancels the timer on!leaveand auto-leave-on-empty.IDLE_LEAVE_TIMEOUTadded to.env.exampleand the README config table + features list.docs/superpowers/.Test Plan
pytest— full suite green (176 tests), including newtests/test_idle_leave.py(config parsing, duration formatting, schedule/re-arm/cancel, idle-guard no-ops, and!leave/auto-leave cancellation wiring).IDLE_LEAVE_TIMEOUT=30, play a short clip, let it finish → bot leaves after ~30s and posts "left after 30 sec idle".!stopmid-clip → bot leaves after the timeout.!leavebefore the timeout → no spurious idle message.0→ bot never auto-leaves on idle (current behavior).