mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
add more missing translations in component interactions
This commit is contained in:
1 parent
b63d98ca7f
commit
9778020f2b
6 files changed
+69
-26
No files matched your search
@@ -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')}`
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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')}`
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user