aboutsummaryrefslogtreecommitdiff
path: root/Commands/play.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2024-02-13 22:35:50 -0500
committerAndrew Lee <alee14498@protonmail.com>2024-02-13 23:39:19 -0500
commit72ea1090753ccca3c5573801ae0b0a4439e1b736 (patch)
treebb3ff6e00572d111ddc1af0a864df90208c63840 /Commands/play.js
parent3d4f5061d402b44218cdfd351f39317d5f8ecd11 (diff)
downloadDLAP-72ea1090753ccca3c5573801ae0b0a4439e1b736.tar.gz
DLAP-72ea1090753ccca3c5573801ae0b0a4439e1b736.tar.bz2
DLAP-72ea1090753ccca3c5573801ae0b0a4439e1b736.zip
Fully working i18n (hopefully); Docker on walkthrough
Diffstat (limited to 'Commands/play.js')
-rw-r--r--Commands/play.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/Commands/play.js b/Commands/play.js
index f6a7fd3..7cfe36b 100644
--- a/Commands/play.js
+++ b/Commands/play.js
@@ -26,7 +26,9 @@ import { audio } from '../AudioBackend/PlayAudio.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
import { readFileSync } from 'node:fs';
import { votes } from '../Utilities/Voting.js';
+import i18next from '../Utilities/i18n.js';
+const t = i18next.t;
const { djRole, ownerID } = JSON.parse(readFileSync('./config.json', 'utf-8'));
export let integer;
@@ -41,24 +43,24 @@ export default {
),
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 });
integer = interaction.options.getInteger('int');
if (integer) {
if (integer < files.length) {
await inputAudio(bot, integer);
await votes.clear();
- return await interaction.reply({ content: `Now playing: ${audio}`, ephemeral: true });
+ return await interaction.reply({ content: t('nowPlayingFile', audio), ephemeral: true });
} else {
- return await interaction.reply({ content: 'Number is too big, choose a number that\'s less than ' + files.length + '.', ephemeral: true });
+ return await interaction.reply({ content: t('numBig', { files: files.length }), ephemeral: true });
}
}
if (isAudioStatePaused) {
toggleAudioState();
- return await interaction.reply({ content: 'Resuming music', ephemeral: true });
+ return await interaction.reply({ content: t('resumingMusic'), ephemeral: true });
} else {
- return await interaction.reply({ content: 'Music is already playing', ephemeral: true });
+ return await interaction.reply({ content: t('resumedAlready'), ephemeral: true });
}
}
};