From 72ea1090753ccca3c5573801ae0b0a4439e1b736 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 13 Feb 2024 22:35:50 -0500 Subject: Fully working i18n (hopefully); Docker on walkthrough --- Commands/reshuffle.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Commands/reshuffle.js') diff --git a/Commands/reshuffle.js b/Commands/reshuffle.js index c16314e..d4ecfc3 100644 --- a/Commands/reshuffle.js +++ b/Commands/reshuffle.js @@ -24,22 +24,24 @@ import { shufflePlaylist } from '../AudioBackend/QueueSystem.js'; import { PermissionFlagsBits } from 'discord-api-types/v10'; import { readFileSync } from 'node:fs'; import { audioState } from '../AudioBackend/AudioControl.js'; +import i18next from '../Utilities/i18n.js'; + // import config from './config.json' assert {type: 'json'} const { shuffle, djRole, ownerID } = JSON.parse(readFileSync('./config.json', 'utf-8')); - +const t = i18next.t; export default { data: new SlashCommandBuilder() .setName('reshuffle') .setDescription('Reshuffles the playlist'), async execute(interaction, bot) { - if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); - if (!interaction.member.roles.cache.has(djRole) && interaction.user.id !== ownerID && !interaction.memberPermissions.has(PermissionFlagsBits.ManageGuild)) return interaction.reply({ content: 'You need a specific role to execute this command', ephemeral: true }); + if (!interaction.member.voice.channel) return await interaction.reply({ content: t('voicePermission'), ephemeral: true }); + if (!interaction.member.roles.cache.has(djRole) && interaction.user.id !== ownerID && !interaction.memberPermissions.has(PermissionFlagsBits.ManageGuild)) return interaction.reply({ content: t('rolePermission'), ephemeral: true }); async function shuffleDetected(bot) { - await interaction.reply({ content: 'Reshuffling the playlist...', ephemeral: true }); + await interaction.reply({ content: t('reshufflePlaylist'), ephemeral: true }); await audioState(2); await shufflePlaylist(bot); } - return (shuffle) ? await shuffleDetected(bot) : await interaction.reply({ content: 'Shuffle mode is disabled, enable it in the configuration file to access this command.', ephemeral: true }); + return (shuffle) ? await shuffleDetected(bot) : await interaction.reply({ content: t('reShuffleDisabled'), ephemeral: true }); } }; -- cgit v1.2.3