aboutsummaryrefslogtreecommitdiff
path: root/src/services/add-query-to-queue.ts
diff options
context:
space:
mode:
authorJoão Costa <[email protected]>2024-10-28 16:16:27 +0000
committerGitHub <[email protected]>2024-10-28 16:16:27 +0000
commitce8edf4145469dbaeced2e68c9a138d0fd76d38f (patch)
treeae8da28276249570310ef421d80d2d8793bdfb57 /src/services/add-query-to-queue.ts
parentae40463712875613c7d485264d61a7965df8a57d (diff)
parent534d8fafaa7f09f7ba940d044b08e6c48f800c7a (diff)
downloadmuse-ce8edf4145469dbaeced2e68c9a138d0fd76d38f.tar.xz
muse-ce8edf4145469dbaeced2e68c9a138d0fd76d38f.zip
Merge branch 'master' into feature/select-dotenv-path
Diffstat (limited to 'src/services/add-query-to-queue.ts')
-rw-r--r--src/services/add-query-to-queue.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/services/add-query-to-queue.ts b/src/services/add-query-to-queue.ts
index 2b84b63..401ad90 100644
--- a/src/services/add-query-to-queue.ts
+++ b/src/services/add-query-to-queue.ts
@@ -38,12 +38,14 @@ export default class AddQueryToQueue {
addToFrontOfQueue,
shuffleAdditions,
shouldSplitChapters,
+ skipCurrentTrack,
interaction,
}: {
query: string;
addToFrontOfQueue: boolean;
shuffleAdditions: boolean;
shouldSplitChapters: boolean;
+ skipCurrentTrack: boolean;
interaction: ChatInputCommandInteraction;
}): Promise<void> {
const guildId = interaction.guild!.id;
@@ -169,6 +171,14 @@ export default class AddQueryToQueue {
await player.play();
}
+ if (skipCurrentTrack) {
+ try {
+ await player.forward(1);
+ } catch (_: unknown) {
+ throw new Error('no song to skip to');
+ }
+ }
+
// Build response message
if (statusMsg !== '') {
if (extraMsg === '') {
@@ -183,9 +193,9 @@ export default class AddQueryToQueue {
}
if (newSongs.length === 1) {
- await interaction.editReply(`u betcha, **${firstSong.title}** added to the${addToFrontOfQueue ? ' front of the' : ''} queue${extraMsg}`);
+ await interaction.editReply(`u betcha, **${firstSong.title}** added to the${addToFrontOfQueue ? ' front of the' : ''} queue${skipCurrentTrack ? 'and current track skipped' : ''}${extraMsg}`);
} else {
- await interaction.editReply(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue${extraMsg}`);
+ await interaction.editReply(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue${skipCurrentTrack ? 'and current track skipped' : ''}${extraMsg}`);
}
}