aboutsummaryrefslogtreecommitdiff
path: root/Commands/reshuffle.js
diff options
context:
space:
mode:
Diffstat (limited to 'Commands/reshuffle.js')
-rw-r--r--Commands/reshuffle.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/Commands/reshuffle.js b/Commands/reshuffle.js
index 340c91b..459575f 100644
--- a/Commands/reshuffle.js
+++ b/Commands/reshuffle.js
@@ -23,23 +23,25 @@ import { SlashCommandBuilder } from 'discord.js';
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 { audioState, playerStatus } 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.member.permission.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 });
+ if (playerStatus === 2) return await interaction.reply({ content: t('playerStopped'), 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 });
}
};