mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-10 04:01:37 +02:00
Don't allow seeking past end of song
This commit is contained in:
parent
7844e80991
commit
11246812a6
6 changed files with 40 additions and 17 deletions
|
@ -64,6 +64,10 @@ export default class {
|
|||
throw new Error('No song currently playing');
|
||||
}
|
||||
|
||||
if (positionSeconds > currentSong.length) {
|
||||
throw new Error('Seek position is outside the range of the song.');
|
||||
}
|
||||
|
||||
if (await this.isCached(currentSong.url)) {
|
||||
this.dispatcher = this.voiceConnection.play(this.getCachedPath(currentSong.url), {seek: positionSeconds});
|
||||
} else {
|
||||
|
|
|
@ -77,7 +77,7 @@ export default class {
|
|||
|
||||
// Don't clear curently playing song
|
||||
if (this.queue.length > 0) {
|
||||
newQueue.push(this.queue[0]);
|
||||
newQueue.push(this.queue[this.position]);
|
||||
}
|
||||
|
||||
this.queue = newQueue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue