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/leave.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Commands/leave.js') diff --git a/Commands/leave.js b/Commands/leave.js index c90231c..e6559ca 100644 --- a/Commands/leave.js +++ b/Commands/leave.js @@ -23,18 +23,19 @@ import { SlashCommandBuilder } from 'discord.js'; import { destroyAudio } from '../AudioBackend/Shutdown.js'; import { PermissionFlagsBits } from 'discord-api-types/v10'; import { readFileSync } from 'node:fs'; +import i18next from '../Utilities/i18n.js'; const { djRole, ownerID } = JSON.parse(readFileSync('./config.json', 'utf-8')); - +const t = i18next.t; export default { data: new SlashCommandBuilder() .setName('leave') .setDescription('Leaves the voice chat'), 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 }); - console.log('Leaving voice channel...'); + console.log(t('leaveVoice')); await destroyAudio(interaction); - return await interaction.reply({ content: 'Leaving voice channel', ephemeral: true }); + return await interaction.reply({ content: t('leaveVoice'), ephemeral: true }); } }; -- cgit v1.2.3