mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 17:22:42 +02:00
Added skip currently playing track option into the /play options. (#1046)
Co-authored-by: Max Isom <hi@maxisom.me>
This commit is contained in:
parent
62b1abcba0
commit
d7261260a3
4 changed files with 25 additions and 4 deletions
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue