aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorMintyFreshers <[email protected]>2024-07-18 05:47:01 +0100
committerGitHub <[email protected]>2024-07-17 21:47:01 -0700
commitd7261260a3eb6bbe8f5af50dda215ef7b501a8ab (patch)
tree77e7f523a513233049b3177d0518c8f0419a8b16 /src/services
parent62b1abcba04c776f2a7f8c53478bf4be47011516 (diff)
downloadmuse-d7261260a3eb6bbe8f5af50dda215ef7b501a8ab.tar.xz
muse-d7261260a3eb6bbe8f5af50dda215ef7b501a8ab.zip
Added skip currently playing track option into the /play options. (#1046)
Co-authored-by: Max Isom <[email protected]>
Diffstat (limited to 'src/services')
-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}`);
}
}