mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 09:12:43 +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
|
@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- A `skip` option to the `/play` command
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed playback issue
|
- Fixed playback issue
|
||||||
- Audioplayer not stopping properly
|
- Audioplayer not stopping properly
|
||||||
|
|
|
@ -28,7 +28,10 @@ export default class implements Command {
|
||||||
.setDescription('shuffle the input if you\'re adding multiple tracks'))
|
.setDescription('shuffle the input if you\'re adding multiple tracks'))
|
||||||
.addBooleanOption(option => option
|
.addBooleanOption(option => option
|
||||||
.setName('split')
|
.setName('split')
|
||||||
.setDescription('if a track has chapters, split it')))
|
.setDescription('if a track has chapters, split it'))
|
||||||
|
.addBooleanOption(option => option
|
||||||
|
.setName('skip')
|
||||||
|
.setDescription('skip the currently playing track')))
|
||||||
.addSubcommand(subcommand => subcommand
|
.addSubcommand(subcommand => subcommand
|
||||||
.setName('list')
|
.setName('list')
|
||||||
.setDescription('list all favorites'))
|
.setDescription('list all favorites'))
|
||||||
|
@ -124,6 +127,7 @@ export default class implements Command {
|
||||||
shuffleAdditions: interaction.options.getBoolean('shuffle') ?? false,
|
shuffleAdditions: interaction.options.getBoolean('shuffle') ?? false,
|
||||||
addToFrontOfQueue: interaction.options.getBoolean('immediate') ?? false,
|
addToFrontOfQueue: interaction.options.getBoolean('immediate') ?? false,
|
||||||
shouldSplitChapters: interaction.options.getBoolean('split') ?? false,
|
shouldSplitChapters: interaction.options.getBoolean('split') ?? false,
|
||||||
|
skipCurrentTrack: interaction.options.getBoolean('skip') ?? false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@ export default class implements Command {
|
||||||
.setDescription('shuffle the input if you\'re adding multiple tracks'))
|
.setDescription('shuffle the input if you\'re adding multiple tracks'))
|
||||||
.addBooleanOption(option => option
|
.addBooleanOption(option => option
|
||||||
.setName('split')
|
.setName('split')
|
||||||
.setDescription('if a track has chapters, split it'));
|
.setDescription('if a track has chapters, split it'))
|
||||||
|
.addBooleanOption(option => option
|
||||||
|
.setName('skip')
|
||||||
|
.setDescription('skip the currently playing track'));
|
||||||
|
|
||||||
public requiresVC = true;
|
public requiresVC = true;
|
||||||
|
|
||||||
|
@ -52,6 +55,7 @@ export default class implements Command {
|
||||||
addToFrontOfQueue: interaction.options.getBoolean('immediate') ?? false,
|
addToFrontOfQueue: interaction.options.getBoolean('immediate') ?? false,
|
||||||
shuffleAdditions: interaction.options.getBoolean('shuffle') ?? false,
|
shuffleAdditions: interaction.options.getBoolean('shuffle') ?? false,
|
||||||
shouldSplitChapters: interaction.options.getBoolean('split') ?? false,
|
shouldSplitChapters: interaction.options.getBoolean('split') ?? false,
|
||||||
|
skipCurrentTrack: interaction.options.getBoolean('skip') ?? false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,14 @@ export default class AddQueryToQueue {
|
||||||
addToFrontOfQueue,
|
addToFrontOfQueue,
|
||||||
shuffleAdditions,
|
shuffleAdditions,
|
||||||
shouldSplitChapters,
|
shouldSplitChapters,
|
||||||
|
skipCurrentTrack,
|
||||||
interaction,
|
interaction,
|
||||||
}: {
|
}: {
|
||||||
query: string;
|
query: string;
|
||||||
addToFrontOfQueue: boolean;
|
addToFrontOfQueue: boolean;
|
||||||
shuffleAdditions: boolean;
|
shuffleAdditions: boolean;
|
||||||
shouldSplitChapters: boolean;
|
shouldSplitChapters: boolean;
|
||||||
|
skipCurrentTrack: boolean;
|
||||||
interaction: ChatInputCommandInteraction;
|
interaction: ChatInputCommandInteraction;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const guildId = interaction.guild!.id;
|
const guildId = interaction.guild!.id;
|
||||||
|
@ -169,6 +171,14 @@ export default class AddQueryToQueue {
|
||||||
await player.play();
|
await player.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (skipCurrentTrack) {
|
||||||
|
try {
|
||||||
|
await player.forward(1);
|
||||||
|
} catch (_: unknown) {
|
||||||
|
throw new Error('no song to skip to');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Build response message
|
// Build response message
|
||||||
if (statusMsg !== '') {
|
if (statusMsg !== '') {
|
||||||
if (extraMsg === '') {
|
if (extraMsg === '') {
|
||||||
|
@ -183,9 +193,9 @@ export default class AddQueryToQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSongs.length === 1) {
|
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 {
|
} 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