diff --git a/src/intervals/score.ts b/src/intervals/score.ts index bb2c144..9a1b02c 100644 --- a/src/intervals/score.ts +++ b/src/intervals/score.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-plusplus */ /* eslint-disable no-continue */ /* eslint-disable one-var-declaration-per-line */ /* eslint-disable no-await-in-loop */ @@ -22,8 +23,8 @@ export default async function calculateScore(client: Client): Promise client.guilds.get(client.config.guildID).channels.get('485680288123584525')).getMessages(3000); - const media = await ( client.guilds.get(client.config.guildID).channels.get('508006539768889354')).getMessages(100); const programmingSupport = await ( client.guilds.get(client.config.guildID).channels.get('506970598631538708')).getMessages(300); + const programmingSupport2 = await ( client.guilds.get(client.config.guildID).channels.get('554892820553531422')).getMessages(100); const cloudSupport = await ( client.guilds.get(client.config.guildID).channels.get('546457788184789013')).getMessages(200); for (const member of members.values()) { if (member.bot) continue; @@ -78,16 +79,16 @@ 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; - for (const mod of moderations) { - const testDate = (new Date(new Date(mod.date).setHours(2190))); - if (testDate > new Date()) moderation -= 15; - } - } else moderation = 2; + let activeMods = 0; + for (const mod of moderations) { + if (mod.type === 1 || mod.type === 4) continue; + const testDate = (new Date(new Date(mod.date).setHours(2190))); + if (testDate > new Date()) { moderation -= 15; activeMods++; } + } + if (activeMods <= 0) moderation = 2; let messageCountTotal = 0; - const allMessagesArray = [...general, ...media, ...programmingSupport, ...cloudSupport]; + const allMessagesArray = [...general, ...programmingSupport, ...programmingSupport2, ...cloudSupport]; for (const msg of allMessagesArray.filter((m) => m.member?.id === member.id)) { if (!msg.content) continue; @@ -111,20 +112,22 @@ export default async function calculateScore(client: Client): Promise new Date()) negatives -= 2; - } + let warns = 0; + for (const warn of response.warns) { + const date = (new Date(new Date(warn).setHours(730))); + if (date > new Date()) { negatives -= 2; warns++; } } - if (response.locks.length === 0) positives += 10; - else { - for (const lock of response.locks) { - const date = (new Date(new Date(lock).setHours(1460))); - if (date > new Date()) negatives -= 5; - } + if (warns <= 0) positives += 2; + if (response.warns.length === 0) positives += 3; + + let locks = 0; + for (const lock of response.locks) { + const date = (new Date(new Date(lock).setHours(1460))); + if (date > new Date()) { negatives -= 5; locks++; } } + if (locks <= 0) positives += 3; + if (response.locks.length === 0) positives += 7; + if (response.deletes.length > 0) { for (const del of response.deletes) { const date = (new Date(new Date(del).setHours(3650))); @@ -134,6 +137,7 @@ export default async function calculateScore(client: Client): Promise