diff --git a/src/intervals/score.ts b/src/intervals/score.ts index 358f6a7..db626df 100644 --- a/src/intervals/score.ts +++ b/src/intervals/score.ts @@ -78,10 +78,25 @@ export default async function calculateScore(client: Client): Promise 54) roles = 54; const moderations = await client.db.Moderation.find({ userID: member.user.id }); - if (moderations?.length > 0) moderation = -moderations.length * 8; - else moderation = 2; + if (moderations?.length > 0) { + moderation = -moderations.length * 8; + for (const mod of moderations) { + const testDate = (new Date(new Date(mod.date).setHours(2190))); + if (testDate > new Date()) moderation -= 15; + } + } else moderation = 2; - const activityTotal = (general.filter((m) => m.member?.id === member.id).length + media.filter((m) => m.member?.id === member.id).length + programmingSupport.filter((m) => m.member?.id === member.id).length + cloudSupport.filter((m) => m.member?.id === member.id).length); + let messageCountTotal = 0; + const allMessagesArray = [...general, ...media, ...programmingSupport, ...cloudSupport]; + + for (const msg of allMessagesArray.filter((m) => m.member?.id === member.id)) { + if (!msg.content) continue; + if (msg.content.length < 5) continue; + // eslint-disable-next-line no-plusplus + messageCountTotal++; + } + + const activityTotal = messageCountTotal; activity = Math.floor(Math.log1p(activityTotal) * 12); if (activity > (Math.log1p(5000 + 300 + 200) * 12 + 100)) activity = Math.floor((Math.log1p(5000 + 300 + 200 + 100) * 12)); if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) staff = 20;