From dda0f93b67873cdf1d7c4c2326ac0d16f6a19de8 Mon Sep 17 00:00:00 2001 From: coopw1 <48886919+coopw1@users.noreply.github.com> Date: Sun, 21 Jan 2024 21:08:22 -0500 Subject: [PATCH] better progress tracking --- src/commands/general/util/getAllListens.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/commands/general/util/getAllListens.js b/src/commands/general/util/getAllListens.js index 4c83d85..947ca36 100644 --- a/src/commands/general/util/getAllListens.js +++ b/src/commands/general/util/getAllListens.js @@ -19,6 +19,9 @@ module.exports = async ( listenBrainzToken, brainzUsername ); + if (totalScrobbles < maxCount) { + maxCount = totalScrobbles; + } const BASE_URL = `https://api.listenbrainz.org/1/user/${brainzUsername}/listens`; const AUTH_HEADER = { @@ -78,9 +81,10 @@ module.exports = async ( lastResponseCount = response.data.payload.count; interaction.editReply({ - content: `Retrieved ${responses.count}/${totalScrobbles} listens. (${ - (responses.count / totalScrobbles) * 100 - }%)`, + content: `Retrieved ${responses.count}/${maxCount} listens. (${( + (responses.count / maxCount) * + 100 + ).toFixed(2)}%)`, }); }