aboutsummaryrefslogtreecommitdiff
path: root/Commands/list.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2024-02-17 00:07:31 -0500
committerGitHub <noreply@github.com>2024-02-17 00:07:31 -0500
commit214a83c0f696ac731c54b00bf7503f87e497afa6 (patch)
tree15d57b08e69d19fb4c2f3effb9937aec8d042bdc /Commands/list.js
parentb29ab06623fd24cfc2a611bdd658b4d2ef934335 (diff)
parentc848f1d90fef40ffa81915d7dd875a2ee6d6c8d5 (diff)
downloadDLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.tar.gz
DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.tar.bz2
DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.zip
Merge pull request #17 from Alee14/testing
Merging testing branch
Diffstat (limited to 'Commands/list.js')
-rw-r--r--Commands/list.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/Commands/list.js b/Commands/list.js
index 90d3cc6..4713a63 100644
--- a/Commands/list.js
+++ b/Commands/list.js
@@ -21,9 +21,10 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { readdir } from 'node:fs';
+import i18next from '../Utilities/i18n.js';
const musicFolder = './music';
-
+const t = i18next.t;
export default {
data: new SlashCommandBuilder()
.setName('list')
@@ -42,7 +43,7 @@ export default {
const pageSize = 20; // Number of tracks per page
const numPages = Math.ceil(trackList.length / pageSize); // Total number of pages
if (page < 1 || page > numPages) { // Check if the page number is valid
- return await interaction.reply({ content: `Invalid page number. Please specify a number between 1 and ${numPages}.`, ephemeral: true });
+ return await interaction.reply({ content: t('invalidPage', { numPages }), ephemeral: true });
}
// Split the track list into pages
const pages = [];
@@ -53,9 +54,9 @@ export default {
}
// Send the specified page with the page number and total number of pages
const listEmbed = new EmbedBuilder();
- listEmbed.setAuthor({ name: `${bot.user.username} List`, iconURL: bot.user.avatarURL() });
- listEmbed.addFields({ name: `Listing ${trackList.length} audio tracks...`, value: `\`\`\`\n${pages[page - 1].join('\n')}\n\`\`\`` });
- listEmbed.setFooter({ text: `Page ${page}/${numPages}` });
+ listEmbed.setAuthor({ name: t('listTitle', { bot: bot.user.username }), iconURL: bot.user.avatarURL() });
+ listEmbed.addFields({ name: t('listTracks', { trackList: trackList.length }), value: `\`\`\`\n${pages[page - 1].join('\n')}\n\`\`\`` });
+ listEmbed.setFooter({ text: t('listPage') + ` ${page}/${numPages}` });
listEmbed.setColor('#0066ff');
await interaction.reply({ embeds: [listEmbed] });
}