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 --- AudioBackend/Shutdown.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'AudioBackend/Shutdown.js') diff --git a/AudioBackend/Shutdown.js b/AudioBackend/Shutdown.js index fb89505..dcc57f7 100644 --- a/AudioBackend/Shutdown.js +++ b/AudioBackend/Shutdown.js @@ -24,12 +24,15 @@ import { updatePlaylist } from './PlayAudio.js'; import { audioState } from './AudioControl.js'; import { readFileSync, writeFile } from 'node:fs'; import { getVoiceConnection, VoiceConnectionStatus } from '@discordjs/voice'; +import i18next from '../Utilities/i18n.js'; + const { statusChannel, txtFile } = JSON.parse(readFileSync('./config.json', 'utf-8')); let fileData; +const t = i18next.t; export async function destroyAudio(interaction) { if (txtFile) { - fileData = 'Now Playing: Nothing'; + fileData = t('txtNothing'); writeFile('now-playing.txt', fileData, (err) => { if (err) { console.log(err); } }); @@ -47,13 +50,13 @@ export async function destroyAudio(interaction) { export async function stopBot(bot, interaction) { const statusEmbed = new EmbedBuilder() .setAuthor({ name: bot.user.username, iconURL: bot.user.avatarURL() }) - .setDescription(`That's all folks! Powering down ${bot.user.username}...`) + .setDescription(t('statusShutdown', { bot: bot.user.username })) .setColor('#0066ff'); const channel = bot.channels.cache.get(statusChannel); - if (!channel) return console.error('The status channel does not exist! Skipping.'); + if (!channel) return console.error(t('statusChannelError')); await channel.send({ embeds: [statusEmbed] }); - console.log(`Powering off ${bot.user.username}...`); + console.log(t('powerOff', { bot: bot.user.username })); await destroyAudio(interaction); await bot.destroy(); return process.exit(0); -- cgit v1.2.3