mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
feat(player): add %skipto command, empty voice auto-pause, and server mute guard
This commit is contained in:
1 parent
dfe77d86b9
commit
c0c95610ac
12 files changed
+287
-12
No files matched your search
@@ -177,6 +177,22 @@ export class Queue extends EventEmitter {
|
||||
/** @returns {Array<object>} Copy of recent playback history. */
|
||||
getHistory() { return this.history.slice(); }
|
||||
|
||||
/**
|
||||
* Remove all tracks before target index (0-based) and return the skipped tracks.
|
||||
* @param {number} targetIndex - 0-based index of track to jump to.
|
||||
* @returns {Array<object>} Array of skipped tracks.
|
||||
*/
|
||||
skipTo(targetIndex) {
|
||||
if (targetIndex <= 0) return [];
|
||||
const count = Math.min(targetIndex, this.data.length);
|
||||
const skipped = this.data.splice(0, count);
|
||||
this.emit("queue", {
|
||||
type: "skipTo",
|
||||
data: { targetIndex, skipped, remaining: this.data.length }
|
||||
});
|
||||
return skipped;
|
||||
}
|
||||
|
||||
/** Remove all tracks from the queue. */
|
||||
clear() { this.data.length = 0; }
|
||||
/** Clear the queue and reset all state (current, loops, history). */
|
||||
|
||||
Reference in new issue
Block a user