aboutsummaryrefslogtreecommitdiff
path: root/Utilities/Voting.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-12-21 14:58:30 -0500
committerAndrew Lee <alee14498@protonmail.com>2022-12-21 15:19:38 -0500
commite2582087e23c509b22bc255c9e5e4b5e11696a26 (patch)
tree4c8100992d8c572dbb0ce28c8cefa4ee2f4855b3 /Utilities/Voting.js
parenta1eb0704666f613857c7cf87234c1fd485e97942 (diff)
downloadDLAP-e2582087e23c509b22bc255c9e5e4b5e11696a26.tar.gz
DLAP-e2582087e23c509b22bc255c9e5e4b5e11696a26.tar.bz2
DLAP-e2582087e23c509b22bc255c9e5e4b5e11696a26.zip
Hopefully fixed the inaccurate information
Diffstat (limited to 'Utilities/Voting.js')
-rw-r--r--Utilities/Voting.js13
1 files changed, 5 insertions, 8 deletions
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 });