mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
refactor(queue): add history field and pushHistory helper
Inert in this commit — no callers yet. Sets up the back-stack used by the upcoming history-aware prev rewrite. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
94c60ad465
commit
c4b7cfaa2f
1 file changed
+10
@@ -21,6 +21,16 @@ export class PlayQueue {
|
||||
private currentIndex = -1;
|
||||
private mode: PlayMode = PlayMode.Sequential;
|
||||
private playedIndices = new Set<number>();
|
||||
private history: number[] = [];
|
||||
private static readonly HISTORY_LIMIT = 50;
|
||||
|
||||
private pushHistory(idx: number): void {
|
||||
if (idx < 0 || idx >= this.songs.length) return;
|
||||
this.history.push(idx);
|
||||
if (this.history.length > PlayQueue.HISTORY_LIMIT) {
|
||||
this.history.shift();
|
||||
}
|
||||
}
|
||||
|
||||
add(song: QueuedSong): void {
|
||||
this.songs.push(song);
|
||||
|
||||
Reference in new issue
Block a user