Skip to content

Commit

Permalink
Refactor skip method in Dispatcher class
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet committed Dec 25, 2023
1 parent 1ef2199 commit 3cb1899
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/structures/Dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ export default class Dispatcher {
public async skip(skipto = 1): Promise<void> {
if (!this.player) return;
if (skipto > 1) {
this.queue.unshift(this.queue[skipto - 1]);
this.queue.splice(skipto, 1);
if (skipto > this.queue.length) {
this.queue.length = 0;
} else {
this.queue.splice(0, skipto - 1);
}
}
this.repeat = this.repeat == 1 ? 0 : this.repeat;
this.player.stopTrack();
Expand Down

0 comments on commit 3cb1899

Please sign in to comment.