diff --git a/locales/en/bot.json b/locales/en/bot.json index ddedbf7..f4dcece 100644 --- a/locales/en/bot.json +++ b/locales/en/bot.json @@ -325,6 +325,12 @@ "volumeMuted": "{{icon}} **Audio muted**\nPlayback audio has been muted, because the volume was set to **`0%`**." } }, + "components": { + "responses": { + "paused": "Paused track", + "resumed": "Resumed track" + } + }, "musicPlayerCommon": { "controls": { "stop": "Stop", @@ -397,6 +403,7 @@ "notValidGuildId": "{{icon}} **Oops!**\nNo permission to perform this action.\n\nThe command {{command}} cannot be executed in this server.", "queueDoesNotExist": "{{icon}} **Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with {{playCommand}}!", "queueIsEmpty": "{{icon}} **Oops!\nThere are no tracks added to the queue. First add some tracks with {{playCommand}}!", - "queueNoCurrentTrack": "{{icon}} **Oops!**\nThere is nothing currently playing. First add some tracks with {{playCommand}}!" + "queueNoCurrentTrack": "{{icon}} **Oops!**\nThere is nothing currently playing. First add some tracks with {{playCommand}}!", + "trackNotPlayingAnymore": "{{icon}} **Oops!**\nThis track has been skipped or is no longer playing." } } diff --git a/locales/no/bot.json b/locales/no/bot.json index 5240e10..1313243 100644 --- a/locales/no/bot.json +++ b/locales/no/bot.json @@ -325,6 +325,12 @@ "volumeMuted": "{{icon}} **Lyd dempet**\nAvspillingslyden er dempet, fordi volumet ble satt til **`0%`**." } }, + "components": { + "responses": { + "paused": "Pauset låt", + "resumed": "Gjenopptok låt" + } + }, "musicPlayerCommon": { "controls": { "stop": "Stopp", @@ -397,6 +403,7 @@ "notValidGuildId": "{{icon}} **Oi sann!**\nIngen tillatelse til å utføre denne handlingen.\n\nKommandoen {{command}} kan ikke utføres på denne serveren.", "queueDoesNotExist": "{{icon}} **Oi sann!**\nDet er ingen låter i køen og ingenting spilles av for øyeblikket. Legg først til noen låter med {{playCommand}}!", "queueIsEmpty": "{{icon}} **Oi sann!\nDet er ingen låter lagt til i køen. Legg først til noen låter med {{playCommand}}!", - "queueNoCurrentTrack": "{{icon}} **Oi sann!**\nDet spilles ingenting av for øyeblikket. Legg først til noen låter med {{playCommand}}!" + "queueNoCurrentTrack": "{{icon}} **Oi sann!**\nDet spilles ingenting av for øyeblikket. Legg først til noen låter med {{playCommand}}!", + "trackNotPlayingAnymore": "{{icon}} **Oi sann!**\nDenne låten har blitt hoppet over allerede eller spiller ikke lenger." } } diff --git a/locales/resources.d.ts b/locales/resources.d.ts index d16cfd7..897b4dc 100644 --- a/locales/resources.d.ts +++ b/locales/resources.d.ts @@ -326,6 +326,12 @@ interface Resources { volumeMuted: '{{icon}} **Audio muted**\nPlayback audio has been muted, because the volume was set to **`0%`**.'; }; }; + components: { + responses: { + paused: 'Paused track'; + resumed: 'Resumed track'; + }; + }; musicPlayerCommon: { controls: { stop: 'Stop'; @@ -399,6 +405,7 @@ interface Resources { queueDoesNotExist: '{{icon}} **Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with {{playCommand}}!'; queueIsEmpty: '{{icon}} **Oops!\nThere are no tracks added to the queue. First add some tracks with {{playCommand}}!'; queueNoCurrentTrack: '{{icon}} **Oops!**\nThere is nothing currently playing. First add some tracks with {{playCommand}}!'; + trackNotPlayingAnymore: '{{icon}} **Oops!**\nThis track has been skipped or is no longer playing.'; }; }; } diff --git a/src/interactions/components/action-pauseresume-button.ts b/src/interactions/components/action-pauseresume-button.ts index 61d7a4f..f0c82c2 100644 --- a/src/interactions/components/action-pauseresume-button.ts +++ b/src/interactions/components/action-pauseresume-button.ts @@ -6,7 +6,7 @@ import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { TFunction } from 'i18next'; import { useServerTranslator } from '../../common/localeUtil'; -import { formatRepeatModeDetailed } from '../../common/formattingUtils'; +import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; class ActionPauseResumeButton extends BaseComponentInteraction { constructor() { @@ -28,11 +28,11 @@ class ActionPauseResumeButton extends BaseComponentInteraction { ]); if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) { - return await this.handleNoQueue(interaction); + return await this.handleNoQueue(interaction, translator); } if (queue.currentTrack!.id !== referenceId) { - return await this.handleAlreadySkipped(interaction); + return await this.handleAlreadySkipped(interaction, translator); } const currentTrack: Track = queue.currentTrack!; @@ -48,12 +48,15 @@ class ActionPauseResumeButton extends BaseComponentInteraction { return await this.handleSuccess(interaction, currentTrack, queue, translator); } - private async handleNoQueue(interaction: MessageComponentInteraction) { + private async handleNoQueue(interaction: MessageComponentInteraction, translator: TFunction) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` + translator('validation.queueNoCurrentTrack', { + icon: this.embedOptions.icons.warning, + playCommand: formatSlashCommand('play', translator) + }) ) .setColor(this.embedOptions.colors.warning) ], @@ -61,12 +64,14 @@ class ActionPauseResumeButton extends BaseComponentInteraction { }); } - private async handleAlreadySkipped(interaction: MessageComponentInteraction) { + private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThis track has been skipped or is no longer playing.` + translator('validation.trackNotPlayingAnymore', { + icon: this.embedOptions.icons.warning + }) ) .setColor(this.embedOptions.colors.warning) ], @@ -84,7 +89,9 @@ class ActionPauseResumeButton extends BaseComponentInteraction { .setAuthor(this.getEmbedUserAuthor(interaction)) .setDescription( `**${this.embedOptions.icons.pauseResumed} ${ - queue.node.isPaused() ? 'Paused Track' : 'Resumed track' + queue.node.isPaused() + ? translator('components.responses.paused') + : translator('components.responses.resumed') }**\n ${this.getDisplayTrackDurationAndUrl(queue.currentTrack!, translator)}\n\n` + `${formatRepeatModeDetailed(queue.repeatMode, this.embedOptions, translator, 'success')}` ) diff --git a/src/interactions/components/action-previous-button.ts b/src/interactions/components/action-previous-button.ts index 7ee8cc8..ebad2c3 100644 --- a/src/interactions/components/action-previous-button.ts +++ b/src/interactions/components/action-previous-button.ts @@ -30,11 +30,11 @@ class ActionPreviousButton extends BaseComponentInteraction { ]); if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) { - return await this.handleNoQueue(interaction); + return await this.handleNoQueue(interaction, translator); } if (queue.currentTrack!.id !== referenceId) { - return await this.handleAlreadySkipped(interaction); + return await this.handleAlreadySkipped(interaction, translator); } return await this.handleBackToPreviousTrack(logger, interaction, history, translator); @@ -76,12 +76,15 @@ class ActionPreviousButton extends BaseComponentInteraction { }); } - private async handleNoQueue(interaction: MessageComponentInteraction) { + private async handleNoQueue(interaction: MessageComponentInteraction, translator: TFunction) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` + translator('validation.queueNoCurrentTrack', { + icon: this.embedOptions.icons.warning, + playCommand: formatSlashCommand('play', translator) + }) ) .setColor(this.embedOptions.colors.warning) ], @@ -89,12 +92,14 @@ class ActionPreviousButton extends BaseComponentInteraction { }); } - private async handleAlreadySkipped(interaction: MessageComponentInteraction) { + private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.` + translator('validation.trackNotPlayingAnymore', { + icon: this.embedOptions.icons.warning + }) ) .setColor(this.embedOptions.colors.warning) ], @@ -110,8 +115,10 @@ class ActionPreviousButton extends BaseComponentInteraction { const successEmbed = new EmbedBuilder() .setAuthor(this.getEmbedUserAuthor(interaction)) .setDescription( - `**${this.embedOptions.icons.back} Recovered track**\n` + - `${this.getDisplayTrackDurationAndUrl(recoveredTrack, translator)}` + translator('commands.back.trackRecovered', { + icon: this.embedOptions.icons.back, + track: this.getDisplayTrackDurationAndUrl(recoveredTrack, translator) + }) ) .setThumbnail(recoveredTrack.thumbnail) .setColor(this.embedOptions.colors.success); diff --git a/src/interactions/components/action-skip-button.ts b/src/interactions/components/action-skip-button.ts index 5f822aa..e087f6b 100644 --- a/src/interactions/components/action-skip-button.ts +++ b/src/interactions/components/action-skip-button.ts @@ -6,7 +6,7 @@ import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { TFunction } from 'i18next'; import { useServerTranslator } from '../../common/localeUtil'; -import { formatRepeatModeDetailed } from '../../common/formattingUtils'; +import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; class ActionSkipButton extends BaseComponentInteraction { constructor() { @@ -28,11 +28,11 @@ class ActionSkipButton extends BaseComponentInteraction { ]); if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) { - return await this.handleNoQueue(interaction); + return await this.handleNoQueue(interaction, translator); } if (queue.currentTrack!.id !== referenceId) { - return await this.handleAlreadySkipped(interaction); + return await this.handleAlreadySkipped(interaction, translator); } const skippedTrack: Track = queue.currentTrack!; @@ -43,12 +43,15 @@ class ActionSkipButton extends BaseComponentInteraction { return await this.handleSuccess(interaction, skippedTrack, queue, translator); } - private async handleNoQueue(interaction: MessageComponentInteraction) { + private async handleNoQueue(interaction: MessageComponentInteraction, translator: TFunction) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` + translator('validation.queueNoCurrentTrack', { + icon: this.embedOptions.icons.warning, + playCommand: formatSlashCommand('play', translator) + }) ) .setColor(this.embedOptions.colors.warning) ], @@ -56,12 +59,14 @@ class ActionSkipButton extends BaseComponentInteraction { }); } - private async handleAlreadySkipped(interaction: MessageComponentInteraction) { + private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.` + translator('validation.trackNotPlayingAnymore', { + icon: this.embedOptions.icons.warning + }) ) .setColor(this.embedOptions.colors.warning) ], @@ -78,7 +83,10 @@ class ActionSkipButton extends BaseComponentInteraction { const successEmbed = new EmbedBuilder() .setAuthor(this.getEmbedUserAuthor(interaction)) .setDescription( - `**${this.embedOptions.icons.skipped} Skipped track**\n` + + translator('commands.skip.skippedTrack', { + icon: this.embedOptions.icons.skipped + }) + + '\n' + `${this.getDisplayTrackDurationAndUrl(skippedTrack, translator)}\n\n` + `${formatRepeatModeDetailed(queue.repeatMode, this.embedOptions, translator, 'success')}` )