From 6b9f020922166386c2e85466431f3ac4c109f810 Mon Sep 17 00:00:00 2001 From: TheShadowEevee Date: Mon, 23 Dec 2024 20:40:34 -0600 Subject: [PATCH] Fix some sorting and a message id caching issue --- commands/commit-count.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/commit-count.js b/commands/commit-count.js index d64f2a9..c954862 100644 --- a/commands/commit-count.js +++ b/commands/commit-count.js @@ -64,7 +64,7 @@ module.exports = { // Fetch Messages const sum_messages = []; let first_id = convertDateToSnowflake(startDate); - const messageMap = new Map(); + let messageMap = new Map(); let continueFetching = true; while (continueFetching) { @@ -76,7 +76,7 @@ module.exports = { sum_messages.push(...messages.values()); for (const [snowflake, message] of messages) { - if (message.author.id === threadStarterMessage.member.id) { + if (message.author.id === threadStarterMessage.author.id) { const messageDate = convertSnowflakeToDate(snowflake); let monthName = ''; @@ -114,6 +114,8 @@ module.exports = { } } + messageMap = new Map([...messageMap.entries()].sort()); + // Start Commit Checking let validString = ''; let invalidString = ''; @@ -165,7 +167,7 @@ module.exports = { } if (dateVerified) { - validString = `${date}: ${verifyReason}\n` + validString; + validString += `${date}: ${verifyReason}\n`; validDays.push(date); } } @@ -196,7 +198,6 @@ module.exports = { while (currentDate <= endDate) { allDays.push(new Date(currentDate)); currentDate.setDate(currentDate.getDate() + 1); - console.log(allDays); } for (const day of allDays) { @@ -218,7 +219,6 @@ module.exports = { invalidString += `${formattedDay}\n`; dayMap.set(formattedDay, false); } - console.log(dayMap); } let streakCount = 0;