feat: add !resume to continue playback from last interruption

Tracks playback position via frame counting in stream_audio().
On stop/skip, saves URL + elapsed time to bot.state (SQLite).
!resume reloads the track and seeks to the saved position via
ffmpeg -ss. State persists across bot restarts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-22 00:15:39 +01:00
parent 9d58a5d073
commit f189cbd290
5 changed files with 227 additions and 9 deletions

View File

@@ -1569,6 +1569,7 @@ and voice transmission.
!play <query> Search YouTube, play a random result
!stop Stop playback, clear queue
!skip Skip current track
!resume Resume last stopped/skipped track from saved position
!queue Show queue
!queue <url> Add to queue (alias for !play)
!np Now playing
@@ -1589,3 +1590,5 @@ and voice transmission.
other music commands silently no-op
- Playback runs as an asyncio background task; the bot remains responsive
to text commands during streaming
- `!resume` continues from where playback was interrupted (`!stop`/`!skip`);
position is persisted via `bot.state` and survives bot restarts