feat: optional idle-leave-after-playback timeout#16
Closed
seitzbg wants to merge 5 commits into
Closed
Conversation
5 tasks
seitzbg
force-pushed
the
feat/idle-leave-upstream
branch
from
June 1, 2026 21:17
89ea48d to
36a2b26
Compare
seitzbg
force-pushed
the
feat/idle-leave-upstream
branch
from
June 3, 2026 22:42
36a2b26 to
2a5c17b
Compare
Owner
|
@seitzbg this PR has been sitting stale as a draft for a while and the repo has gone through quite a few changes to the project structure since which may make a merge quite annoying. I'm going to close the PR for now just for housekeeping reasons. If you want to get your clanker to re-do the PR I'm more than willing to add this feature to Slopsoil. Also for what it's worth, I did try and reach out via email about linking up on Discord to discuss further features for the project but didn't hear anything back. I was out of town for a while so maybe I just didn't notice the reply or it got caught in a filter. Didn't want you to think I was ignoring you. The author info in my commits should be up to date if you want to reach out that way. |
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 current behavior (the bot stays in the channel).asynciotimer armed from the playback-cleanup (finally) blocks incogs/stream.py(covers both the camera path and the go-live path). 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. The go-live guard relies onstream_tasks/live_connectionsbecause go-live audio doesn't go throughvc.play().!leaveand the auto-leave-on-empty handler cancel it. Pending timers are also cancelled on bot shutdown (SlopSoil.close()).Changes
cogs/stream.py:_idle_leave_timeout,_format_idle,schedule_idle_leave,cancel_idle_leave,_idle_leave_after,_idle_leave_now; arm in bothfinallyblocks.bot.py: newidle_leave_tasks: dict[int, asyncio.Task], cancelled inclose().cogs/voice.py: cancel the timer on!leaveand auto-leave-on-empty..env.example+README.md: documentIDLE_LEAVE_TIMEOUT.tests/test_idle_leave.py: new unit tests.Test Plan
pytest— full suite green, 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; start new playback before it → bot stays.!leavebefore the timeout → no spurious idle message; unset/0→ never auto-leaves (current behavior).Merge note
Standalone on
main— not stacked, no dependency on #14 or #15. It does touch the README config table /.envblock andcogs/stream.py, which #14 (stream profile / packet pacing) also touches, so whichever of #14 / #16 merges second will need a trivial rebase.