fix: Fix showing repeat mode in skipped track

This commit is contained in:
Marius Begby committed 2023-12-19 12:32:04 +01:00
1 parent 83462ab626
commit 88511f87c1
2 files changed
+7 -5

No files matched your search

+6 -4
View File
@@ -7,7 +7,7 @@ import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/valid
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatSlashCommand } from '../../../common/formattingUtils'; import { formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils';
class SkipCommand extends BaseSlashCommandInteraction { class SkipCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
@@ -61,7 +61,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
const skippedTrack: Track = queue.currentTrack!; const skippedTrack: Track = queue.currentTrack!;
queue.node.skipTo(trackPosition - 1); queue.node.skipTo(trackPosition - 1);
logger.debug('Skipped to specified track position.'); logger.debug('Skipped to specified track position.');
return await this.respondWithSuccessEmbed(skippedTrack, interaction, translator); return await this.respondWithSuccessEmbed(skippedTrack, interaction, queue, translator);
} }
} }
@@ -102,7 +102,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
const skippedTrack: Track = queue.currentTrack!; const skippedTrack: Track = queue.currentTrack!;
queue.node.skip(); queue.node.skip();
logger.debug('Skipped current track.'); logger.debug('Skipped current track.');
return await this.respondWithSuccessEmbed(skippedTrack, interaction, translator); return await this.respondWithSuccessEmbed(skippedTrack, interaction, queue, translator);
} }
private async handleNoTracksInQueueAndNoCurrentTrack( private async handleNoTracksInQueueAndNoCurrentTrack(
@@ -128,6 +128,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
private async respondWithSuccessEmbed( private async respondWithSuccessEmbed(
skippedTrack: Track, skippedTrack: Track,
interaction: ChatInputCommandInteraction, interaction: ChatInputCommandInteraction,
queue: GuildQueue,
translator: TFunction translator: TFunction
) { ) {
return await interaction.editReply({ return await interaction.editReply({
@@ -139,7 +140,8 @@ class SkipCommand extends BaseSlashCommandInteraction {
icon: this.embedOptions.icons.skipped icon: this.embedOptions.icons.skipped
}) + }) +
'\n' + '\n' +
this.getDisplayTrackDurationAndUrl(skippedTrack, translator) `${this.getDisplayTrackDurationAndUrl(skippedTrack, translator)}\n` +
`${formatRepeatModeDetailed(queue.repeatMode, this.embedOptions, translator, 'success')}`
) )
.setThumbnail(this.getTrackThumbnailUrl(skippedTrack)) .setThumbnail(this.getTrackThumbnailUrl(skippedTrack))
.setColor(this.embedOptions.colors.success) .setColor(this.embedOptions.colors.success)
@@ -87,7 +87,7 @@ class ActionSkipButton extends BaseComponentInteraction {
icon: this.embedOptions.icons.skipped icon: this.embedOptions.icons.skipped
}) + }) +
'\n' + '\n' +
`${this.getDisplayTrackDurationAndUrl(skippedTrack, translator)}\n\n` + `${this.getDisplayTrackDurationAndUrl(skippedTrack, translator)}\n` +
`${formatRepeatModeDetailed(queue.repeatMode, this.embedOptions, translator, 'success')}` `${formatRepeatModeDetailed(queue.repeatMode, this.embedOptions, translator, 'success')}`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)