From ec7a6d2cd4b0d25251d5e9691a148a2b07984509 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 15 Feb 2024 17:33:10 -0500 Subject: Checking if player is not running for reshuffle; Made strings more consistent --- Commands/reshuffle.js | 4 ++-- Locales/en/translation.json | 2 +- Utilities/Voting.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Commands/reshuffle.js b/Commands/reshuffle.js index d4ecfc3..459575f 100644 --- a/Commands/reshuffle.js +++ b/Commands/reshuffle.js @@ -23,7 +23,7 @@ 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'} @@ -36,7 +36,7 @@ export default { async execute(interaction, bot) { 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: t('reshufflePlaylist'), ephemeral: true }); await audioState(2); diff --git a/Locales/en/translation.json b/Locales/en/translation.json index aa42b78..68cd260 100644 --- a/Locales/en/translation.json +++ b/Locales/en/translation.json @@ -65,6 +65,7 @@ "statusStopped": "Music is currently not playing", "alreadyLeave": "Already left the voice chat", "alreadyJoin": "Already joined the voice chat", + "playerStopped": "Music player is currently not running", "reshufflePlaylist": "Reshuffling the playlist...", "reshuffleDisabled": "Shuffle mode is disabled, enable it in the configuration file to access this command.", "playlistDone": "Playlist Finished", @@ -78,6 +79,5 @@ "alreadyVoted": "You have already voted, wait {{votesRequired}} more vote(s) to skip the audio track", "enoughVotes": "Enough votes has passed, skipping audio file...", "votesNeeded": "{{votesRequired}} more vote(s) needed to skip the audio track.", - "cannotPlay": "Cannot play next music. Player is currently stopped...", "forceSkip": "Force skipping this audio track..." } diff --git a/Utilities/Voting.js b/Utilities/Voting.js index 0d986b8..452dc55 100644 --- a/Utilities/Voting.js +++ b/Utilities/Voting.js @@ -82,7 +82,7 @@ export async function voteSkip(interaction, bot) { await interaction.reply({ content: t('votesNeeded', { votesRequired: votesRequired - 1 }) }); } } else if (playerStatus === 2) { - return await interaction.reply({ content: t('cannotPlay'), ephemeral: true }); + return await interaction.reply({ content: t('playerStopped'), ephemeral: true }); } } @@ -94,7 +94,7 @@ export async function voteSkip(interaction, bot) { // Do something to skip the audio track here (e.g. player.stop()) await commandCheck(interaction, bot); } else if (playerStatus === 2) { - return await interaction.reply({ content: t('cannotPlay'), ephemeral: true }); + return await interaction.reply({ content: t('playerStopped'), ephemeral: true }); } } } -- cgit v1.2.3