score message basic classifications
parent
5e77745036
commit
f3fa7560f3
|
@ -78,10 +78,25 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
||||||
if (roles > 54) roles = 54;
|
if (roles > 54) roles = 54;
|
||||||
|
|
||||||
const moderations = await client.db.Moderation.find({ userID: member.user.id });
|
const moderations = await client.db.Moderation.find({ userID: member.user.id });
|
||||||
if (moderations?.length > 0) moderation = -moderations.length * 8;
|
if (moderations?.length > 0) {
|
||||||
else moderation = 2;
|
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);
|
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 (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;
|
if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) staff = 20;
|
||||||
|
|
Loading…
Reference in New Issue