Fix some sorting and a message id caching issue

This commit is contained in:
Michael 2024-12-23 20:40:34 -06:00
parent 315b02ce0d
commit 6b9f020922
Signed by: TheShadowEevee
GPG key ID: 7A8AA92B3BAFAB75

View file

@ -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;