From e2582087e23c509b22bc255c9e5e4b5e11696a26 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 21 Dec 2022 14:58:30 -0500 Subject: Hopefully fixed the inaccurate information --- Commands/status.js | 4 ++-- Utilities/Voting.js | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Commands/status.js b/Commands/status.js index ee6300c..aeb909d 100644 --- a/Commands/status.js +++ b/Commands/status.js @@ -41,7 +41,7 @@ export default { const members = voiceChannel.members.filter(m => !votes.has(m.id)); // Calculate the number of votes required to skip the audio track - const votesRequired = Math.ceil(members.size / 2); + const votesRequired = Math.ceil((members.size - votes.size) / 2); if (audioID >= files.length) { audioName = 'Playlist Finished'; @@ -65,7 +65,7 @@ export default { { name: 'State', value: `${playerState}` }, { name: 'Tracks', value: `${audioID}/${files.length}` }, { name: 'Duration', value: `${duration}` }, - { name: 'Votes Needed', value: `${votesRequired - votes.size}` } + { name: 'Votes Needed', value: `${votesRequired}` } ) .setColor('#0066ff'); diff --git a/Utilities/Voting.js b/Utilities/Voting.js index ce837d5..c737339 100644 --- a/Utilities/Voting.js +++ b/Utilities/Voting.js @@ -41,14 +41,12 @@ export async function voteSkip(interaction, bot) { if (interaction.commandName === 'next') { if (nextCheck !== true) { // Reset the votes if the current value of nextCheck is different from the command being executed - console.log('Vote has reset due to previous command being executed'); votes.clear(); } nextCheck = true; } else if (interaction.commandName === 'previous') { if (nextCheck !== false) { // Reset the votes if the current value of nextCheck is different from the command being executed - console.log('Vote has reset due to next command being executed'); votes.clear(); } nextCheck = false; @@ -64,13 +62,12 @@ export async function voteSkip(interaction, bot) { // Check if the message author has already voted if (votes.has(interaction.user.id)) { - return interaction.reply({ content: `You have already voted, wait ${votesRequired - votes.size} more vote(s) to skip the audio track`, ephemeral: true }); + return interaction.reply({ content: `You have already voted, wait ${votesRequired} more vote(s) to skip the audio track`, ephemeral: true }); } - // Add the message author to the set of members who have voted - votes.add(interaction.user.id); - if (playerState === 'Playing' || playerState === 'Paused') { + // Add the message author to the set of members who have voted + votes.add(interaction.user.id); if (votes.size >= votesRequired) { console.log('Enough votes has passed, skipping audio file...'); // Reset the number of votes @@ -79,8 +76,8 @@ export async function voteSkip(interaction, bot) { await commandCheck(interaction, bot); } else { // Send a message with the number of votes needed to skip the audio track - console.log(`${votesRequired - votes.size} more vote(s) needed to skip the audio track.`); - await interaction.reply({ content: `${votesRequired - votes.size} more vote(s) needed to skip the audio track.` }); + console.log(`${votesRequired - 1} more vote(s) needed to skip the audio track.`); + await interaction.reply({ content: `${votesRequired - 1} more vote(s) needed to skip the audio track.` }); } } else if (playerState === 'Stopped') { return await interaction.reply({ content: 'Cannot play next music. Player is currently stopped...', ephemeral: true }); -- cgit v1.2.3