interval fixes
parent
829405378d
commit
e94798d5c3
|
@ -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<NodeJS.Tim
|
|||
const { members } = client.guilds.get(client.config.guildID);
|
||||
|
||||
const general = await (<TextChannel> client.guilds.get(client.config.guildID).channels.get('485680288123584525')).getMessages(3000);
|
||||
const media = await (<TextChannel> client.guilds.get(client.config.guildID).channels.get('508006539768889354')).getMessages(100);
|
||||
const programmingSupport = await (<TextChannel> client.guilds.get(client.config.guildID).channels.get('506970598631538708')).getMessages(300);
|
||||
const programmingSupport2 = await (<TextChannel> client.guilds.get(client.config.guildID).channels.get('554892820553531422')).getMessages(100);
|
||||
const cloudSupport = await (<TextChannel> 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<NodeJS.Tim
|
|||
if (roles > 54) roles = 54;
|
||||
|
||||
const moderations = await client.db.Moderation.find({ userID: member.user.id });
|
||||
if (moderations?.length > 0) {
|
||||
moderation = -moderations.length * 8;
|
||||
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;
|
||||
if (testDate > new Date()) { moderation -= 15; activeMods++; }
|
||||
}
|
||||
} else moderation = 2;
|
||||
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<NodeJS.Tim
|
|||
negatives -= 10;
|
||||
}
|
||||
}
|
||||
if (response.warns.length === 0) positives += 5;
|
||||
else {
|
||||
let warns = 0;
|
||||
for (const warn of response.warns) {
|
||||
const date = (new Date(new Date(warn).setHours(730)));
|
||||
if (date > new Date()) negatives -= 2;
|
||||
if (date > new Date()) { negatives -= 2; warns++; }
|
||||
}
|
||||
}
|
||||
if (response.locks.length === 0) positives += 10;
|
||||
else {
|
||||
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;
|
||||
}
|
||||
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<NodeJS.Tim
|
|||
positives += Math.floor(response.totalReferrals * 1.17);
|
||||
if (response.tier === 2) positives += 2;
|
||||
else if (response.tier === 3) positives += 3;
|
||||
|
||||
if (negatives < 0) cloudServices = Math.floor((negatives * 1.2) + (positives * 0.06));
|
||||
else cloudServices = Math.floor(positives * 0.61);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue