Skip to content

Commit

Permalink
fix skip with autoplay
Browse files Browse the repository at this point in the history
when there were no related songs using autoplay, skip would fail.
made it completely stop the queue instead
  • Loading branch information
Prevter committed Aug 8, 2023
1 parent f34a705 commit 3ca47fb
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/commands/music/skip.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,20 @@ module.exports = class extends Command {
if (number > 1) {
await queue.jump(number);
} else {
if (queue.songs.length > 1 || queue.autoplay)
if (queue.songs.length > 1) {
await queue.skip();
}
else if (queue.autoplay) {
try {
await queue.skip();
}
catch (e) {
if (e.errorCode === 'NO_RELATED') {
await queue.stop();
}
else throw e;
}
}
else {
await queue.stop();
}
Expand Down Expand Up @@ -61,8 +73,20 @@ module.exports = class extends Command {
if (number > 1) {
await queue.jump(number);
} else {
if (queue.songs.length > 1 || queue.autoplay)
if (queue.songs.length > 1) {
await queue.skip();
}
else if (queue.autoplay) {
try {
await queue.skip();
}
catch (e) {
if (e.errorCode === 'NO_RELATED') {
await queue.stop();
}
else throw e;
}
}
else {
await queue.stop();
}
Expand Down

0 comments on commit 3ca47fb

Please sign in to comment.