Merge branch 'dev'
commit
d5f0346f75
|
@ -43,7 +43,8 @@
|
|||
"consistent-return": "off",
|
||||
"no-continue": "off",
|
||||
"no-plusplus": "off",
|
||||
"no-undef": "off"
|
||||
"no-undef": "off",
|
||||
"space-before-function-paren": "off"
|
||||
},
|
||||
"ignorePatterns": "**/*.js"
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
"@types/cron": "^1.7.3",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/helmet": "^0.0.48",
|
||||
"@types/jsonwebtoken": "^8.5.6",
|
||||
"@types/ioredis": "4.28.10",
|
||||
"@types/jsonwebtoken": "^8.5.6",
|
||||
"@types/node": "^16.11.12",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/puppeteer": "^5.4.4",
|
||||
|
@ -49,7 +49,7 @@
|
|||
"express": "^4.17.1",
|
||||
"helmet": "^4.6.0",
|
||||
"ioredis": "^4.28.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"mathjs": "^10.0.0",
|
||||
"moment": "^2.29.1",
|
||||
"mongoose": "^6.1.1",
|
||||
|
|
|
@ -26,13 +26,13 @@ export default class Command {
|
|||
|
||||
/**
|
||||
* - **0:** Everyone
|
||||
* - **1:** Associates+
|
||||
* - **1:** Core Team, Staff in Training, and ++
|
||||
* - **2:** Core Team+
|
||||
* - **3:** Moderators, Supervisor, & Board of Directors
|
||||
* - **4:** Technicians, Supervisor, & Board of Directors
|
||||
* - **5:** Moderators, Technicians, Supervisor, & Board of Directors
|
||||
* - **6:** Supervisor+
|
||||
* - **7:** Board of Directors
|
||||
* - **3:** Moderators and Department Heads
|
||||
* - **4:** Technicians and Department Heads
|
||||
* - **5:** Moderators, Technicians, and Management
|
||||
* - **6:** Management
|
||||
* - **7:** Department Heads
|
||||
*/
|
||||
public permissions: number;
|
||||
|
||||
|
@ -74,19 +74,19 @@ export default class Command {
|
|||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return member.roles.some((r) => ['701481967149121627', '453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['701481967149121627', '453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '1077646568091570236'].includes(r));
|
||||
case 2:
|
||||
return member.roles.some((r) => ['453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '1077646568091570236'].includes(r));
|
||||
case 3:
|
||||
return member.roles.some((r) => ['455972169449734144', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['455972169449734144', '1077646956890951690', '1077647072163020840'].includes(r));
|
||||
case 4:
|
||||
return member.roles.some((r) => ['701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['701454780828221450', '1077646956890951690', '1077647072163020840'].includes(r));
|
||||
case 5:
|
||||
return member.roles.some((r) => ['455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['455972169449734144', '701454780828221450', '1077646568091570236'].includes(r));
|
||||
case 6:
|
||||
return member.roles.some((r) => ['701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['1077646568091570236'].includes(r));
|
||||
case 7:
|
||||
return member.roles.includes('662163685439045632');
|
||||
return member.roles.some((r) => ['1077646956890951690', '1077647072163020840'].includes(r));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -98,19 +98,19 @@ export default class Command {
|
|||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return member.roles.some((r) => ['701481967149121627', '453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['701481967149121627', '453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '1077646568091570236'].includes(r));
|
||||
case 2:
|
||||
return member.roles.some((r) => ['453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '1077646568091570236'].includes(r));
|
||||
case 3:
|
||||
return member.roles.some((r) => ['455972169449734144', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['455972169449734144', '1077646956890951690', '1077647072163020840'].includes(r));
|
||||
case 4:
|
||||
return member.roles.some((r) => ['701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['701454780828221450', '1077646956890951690', '1077647072163020840'].includes(r));
|
||||
case 5:
|
||||
return member.roles.some((r) => ['455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['455972169449734144', '701454780828221450', '1077646568091570236'].includes(r));
|
||||
case 6:
|
||||
return member.roles.some((r) => ['701454855952138300', '662163685439045632'].includes(r));
|
||||
return member.roles.some((r) => ['1077646568091570236'].includes(r));
|
||||
case 7:
|
||||
return member.roles.includes('662163685439045632');
|
||||
return member.roles.some((r) => ['1077646956890951690', '1077647072163020840'].includes(r));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ export default class Queue {
|
|||
const programmingSupport = await (<TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('506970598631538708')).getMessages(300);
|
||||
const programmingSupport2 = await (<TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('554892820553531422')).getMessages(100);
|
||||
const cloudSupport = await (<TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('546457788184789013')).getMessages(200);
|
||||
|
||||
|
||||
const projectChannels: TextChannel[] = [];
|
||||
for (const c of this.client.guilds.get(this.client.config.guildID).channels.filter((ch) => ch.type === 0)) {
|
||||
const chan = <TextChannel> c;
|
||||
|
@ -78,8 +78,8 @@ export default class Queue {
|
|||
members.forEach(async member => {
|
||||
const resolvedMember = await this.client.getRESTGuildMember(this.client.config.guildID, member.id);
|
||||
calculateReport(this.client, resolvedMember, [...general, ...programmingSupport, ...programmingSupport2, ...cloudSupport, ...projectMessages])
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
historialCommunityReportJob.start();
|
||||
clearOldHistoricalReportsJob.start();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import PhoneNumber from 'awesome-phonenumber';
|
||||
import axios from 'axios';
|
||||
import { Message, TextChannel } from 'eris';
|
||||
import { Client, Command, RichEmbed } from '../class';
|
||||
import { Client, CmdContext, Command, RichEmbed } from '../class';
|
||||
|
||||
export default class Callback extends Command {
|
||||
constructor(client: Client) {
|
||||
|
@ -19,7 +19,7 @@ export default class Callback extends Command {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public async run(message: Message, args: string[]) {
|
||||
public async run(ctx: CmdContext) {
|
||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
if (message.channel.type === 0) await message.delete();
|
||||
const member = this.mainGuild.members.get(message.author.id);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
/* eslint-disable prefer-destructuring */
|
||||
import { Activity, Member, Message } from 'eris';
|
||||
import { Client, Command, RichEmbed } from '../class';
|
||||
import { Client, CmdContext, Command, RichEmbed } from '../class';
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
enum ActivityType {
|
||||
|
@ -26,7 +26,7 @@ export default class Game extends Command {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public async run(message: Message, args: string[]) {
|
||||
public async run(ctx: CmdContext) {
|
||||
let member: Member;
|
||||
if (!args[0]) member = message.member;
|
||||
else {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
import { Message } from 'eris';
|
||||
import { Client, Command } from '../class';
|
||||
import { Client, CmdContext, Command } from '../class';
|
||||
import { Misc as MiscPBXActions } from '../pbx';
|
||||
|
||||
export default class Intercom extends Command {
|
||||
|
@ -17,7 +17,7 @@ export default class Intercom extends Command {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public async run(message: Message, args: string[]) {
|
||||
public async run(ctx: CmdContext) {
|
||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
const loading = await this.loading(message.channel, 'Synthesizing text...');
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* eslint-disable default-case */
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { Message } from 'eris';
|
||||
import { Client, Command } from '../class';
|
||||
import { Client, CmdContext, Command } from '../class';
|
||||
|
||||
export default class Offer extends Command {
|
||||
constructor(client: Client) {
|
||||
|
@ -19,7 +19,7 @@ export default class Offer extends Command {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public async run(message: Message, args: string[]) {
|
||||
public async run(ctx: CmdContext) {
|
||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
const member = this.client.util.resolveMember(args[0], this.mainGuild);
|
||||
if (!member) return this.error(message.channel, 'Could not find member.');
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import { Message, GuildTextableChannel } from 'eris';
|
||||
import moment, { unitOfTime } from 'moment';
|
||||
import { Client, Command } from '../class';
|
||||
import { Client, CmdContext, Command } from '../class';
|
||||
|
||||
export default class Slowmode extends Command {
|
||||
regex: RegExp;
|
||||
|
@ -20,7 +20,7 @@ export default class Slowmode extends Command {
|
|||
this.regex = /[a-z]+|[^a-z]+/gi;
|
||||
}
|
||||
|
||||
public async run(message: Message<GuildTextableChannel>, args: string[]) {
|
||||
public async run(ctx: CmdContext) {
|
||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
|
||||
const [length, unit] = args[0].match(this.regex);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import { Message } from 'eris';
|
||||
import { apply as Apply } from '.';
|
||||
import { Client, Command } from '../class';
|
||||
import { Client, CmdContext, Command } from '../class';
|
||||
|
||||
export default class SSS_Create_Account extends Command {
|
||||
public applyCommand: Apply;
|
||||
|
@ -19,7 +19,7 @@ export default class SSS_Create_Account extends Command {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public async run(message: Message) {
|
||||
public async run(ctx: CmdContext) {
|
||||
try {
|
||||
const staff = await this.client.db.mongo.Staff.findOne({ userID: message.author.id }).lean().exec();
|
||||
if (!staff) return this.error(message.channel, 'Staff information not located.');
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import { randomBytes } from 'crypto';
|
||||
import { Message, TextChannel } from 'eris';
|
||||
import { Client, Command, LocalStorage } from '../class';
|
||||
import { Client, CmdContext, Command, LocalStorage } from '../class';
|
||||
|
||||
export default class StoreMessages extends Command {
|
||||
constructor(client: Client) {
|
||||
|
@ -18,7 +18,7 @@ export default class StoreMessages extends Command {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public async run(message: Message, args: string[]) {
|
||||
public async run(ctx: CmdContext) {
|
||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
const check = this.client.util.resolveGuildChannel(args[0], this.mainGuild, false);
|
||||
if (!check || check.type !== 0) return this.error(message.channel, 'The channel you specified either doesn\'t exist or isn\'t a textable guild channel.');
|
||||
|
|
|
@ -3,20 +3,20 @@ import { Client } from '../class';
|
|||
import { CloudServicesUtil } from '../util';
|
||||
|
||||
export function getTotalMessageCount(client: Client): number {
|
||||
const projectChannels: TextChannel[] = [];
|
||||
for (const c of client.guilds.get(client.config.guildID).channels.filter((ch) => ch.type === 0)) {
|
||||
const chan = <TextChannel> c;
|
||||
if (chan.parentID !== '701591772186411108') continue;
|
||||
projectChannels.push(chan);
|
||||
}
|
||||
return (projectChannels.length * 200) + 2200 + 300 + 100 + 200;
|
||||
const projectChannels: TextChannel[] = [];
|
||||
for (const c of client.guilds.get(client.config.guildID).channels.filter((ch) => ch.type === 0)) {
|
||||
const chan = <TextChannel> c;
|
||||
if (chan.parentID !== '701591772186411108') continue;
|
||||
projectChannels.push(chan);
|
||||
}
|
||||
return (projectChannels.length * 200) + 2200 + 300 + 100 + 200;
|
||||
}
|
||||
|
||||
export default async function(client: Client, member: Member, allMessagesArray: Message<TextChannel>[]) {
|
||||
if (member.bot) return;
|
||||
let score = await client.db.mongo.Score.findOne({ userID: member.user.id });
|
||||
if (!score) {
|
||||
const data: {
|
||||
export default async function calculateReport(client: Client, member: Member, allMessagesArray: Message<TextChannel>[]) {
|
||||
if (member.bot) return;
|
||||
let score = await client.db.mongo.Score.findOne({ userID: member.user.id });
|
||||
if (!score) {
|
||||
const data: {
|
||||
userID: string,
|
||||
total: number,
|
||||
activity: number,
|
||||
|
@ -43,127 +43,132 @@ export default async function(client: Client, member: Member, allMessagesArray:
|
|||
lastUpdated: new Date(),
|
||||
pin: [client.util.randomNumber(100, 999), client.util.randomNumber(10, 99), client.util.randomNumber(1000, 9999)],
|
||||
};
|
||||
score = await (new client.db.mongo.Score(data)).save();
|
||||
client.util.signale.debug(`SCORE INIT - ${member.username}`);
|
||||
}
|
||||
score = await (new client.db.mongo.Score(data)).save();
|
||||
client.util.signale.debug(`SCORE INIT - ${member.username}`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line prefer-const
|
||||
// eslint-disable-next-line one-var-declaration-per-line
|
||||
// eslint-disable-next-line one-var
|
||||
let total = 0, activity = 0, roles = 0, moderation = 0, cloudServices = 0, other = 0, staff = 0;
|
||||
cloudServices = 0;
|
||||
// eslint-disable-next-line prefer-const
|
||||
// eslint-disable-next-line one-var-declaration-per-line
|
||||
// eslint-disable-next-line one-var
|
||||
let total = 0,
|
||||
activity = 0,
|
||||
roles = 0,
|
||||
moderation = 0,
|
||||
cloudServices = 0,
|
||||
other = 0,
|
||||
staff = 0;
|
||||
|
||||
roles = Math.floor(member.roles.length * 0.50);
|
||||
if (roles > 54) roles = 54;
|
||||
roles = Math.floor(member.roles.length * 0.50);
|
||||
if (roles > 54) roles = 54;
|
||||
|
||||
const moderations = await client.db.mongo.Moderation.find({ userID: member.user.id });
|
||||
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;
|
||||
const moderations = await client.db.mongo.Moderation.find({ userID: member.user.id });
|
||||
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;
|
||||
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++;
|
||||
}
|
||||
let messageCountTotal = 0;
|
||||
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(getTotalMessageCount(client)) * 12)) activity = Math.floor((Math.log1p(getTotalMessageCount(client)) * 12));
|
||||
if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) staff += 5;
|
||||
const activityTotal = messageCountTotal;
|
||||
activity = Math.floor(Math.log1p(activityTotal) * 12);
|
||||
if (activity > (Math.log1p(getTotalMessageCount(client)) * 12)) activity = Math.floor((Math.log1p(getTotalMessageCount(client)) * 12));
|
||||
if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) staff += 5;
|
||||
|
||||
const response = await CloudServicesUtil.fetchAccountStatus(member.user.id, client.config.internalKey);
|
||||
if (response || response?.found === true) {
|
||||
let negatives = 0;
|
||||
let positives = 0;
|
||||
if (response.createdAt) {
|
||||
const csCreatedTestDate = (new Date(new Date(response.createdAt).setHours(730)));
|
||||
if (csCreatedTestDate > new Date()) {
|
||||
negatives -= 10;
|
||||
}
|
||||
}
|
||||
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 (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)));
|
||||
if (date > new Date()) negatives -= 20;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
const inquiries = await client.db.mongo.Inquiry.find({ userID: member.user.id, type: 0 }).lean().exec();
|
||||
const judgements = await client.db.mongo.Judgement.find({ userID: member.user.id }).lean().exec();
|
||||
|
||||
if (inquiries?.length > 0) {
|
||||
for (const inq of inquiries) {
|
||||
const testDate = (new Date(new Date(inq.date).setHours(1460)));
|
||||
if (testDate > new Date()) other -= 1.65;
|
||||
}
|
||||
other = Math.floor(other * 1.15);
|
||||
}
|
||||
|
||||
if (judgements?.length > 0) {
|
||||
for (const judgement of judgements) {
|
||||
switch (judgement.severity) {
|
||||
// eslint-disable-next-line default-case-last
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
other -= 5;
|
||||
break;
|
||||
case 1:
|
||||
other -= 10;
|
||||
break;
|
||||
case 2:
|
||||
other -= 20;
|
||||
break;
|
||||
}
|
||||
const response = await CloudServicesUtil.fetchAccountStatus(member.user.id, client.config.internalKey);
|
||||
if (response || response?.found === true) {
|
||||
let negatives = 0;
|
||||
let positives = 0;
|
||||
if (response.createdAt) {
|
||||
const csCreatedTestDate = (new Date(new Date(response.createdAt).setHours(730)));
|
||||
if (csCreatedTestDate > new Date()) {
|
||||
negatives -= 10;
|
||||
}
|
||||
}
|
||||
|
||||
const discordAccountCreatedAtTestDate = (new Date(new Date(new Date(member.user.createdAt)).setHours(730)));
|
||||
if (discordAccountCreatedAtTestDate > new Date()) {
|
||||
other -= 10;
|
||||
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 (warns <= 0) positives += 2;
|
||||
if (response.warns.length === 0) positives += 3;
|
||||
|
||||
const joinedAtTestDate = (new Date(new Date(new Date(member.joinedAt)).setHours(420)));
|
||||
if (joinedAtTestDate > new Date()) {
|
||||
other -= 30;
|
||||
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;
|
||||
|
||||
total = Math.floor(((total + activity + roles + moderation + cloudServices + staff + other) * 5.13) * 1.87);
|
||||
|
||||
// client.queue.updateScore(score, total, activity, roles, moderation, cloudServices, other, staff);
|
||||
|
||||
client.db.mongo.Score.updateOne({ userID: score.userID }, { $set: { total, activity, roles, moderation, cloudServices, other, staff, lastUpdate: new Date() } }).exec();
|
||||
if (!score.pin || score.pin?.length < 1) {
|
||||
client.db.mongo.Score.updateOne({ userID: score.userID }, { $set: { pin: [this.client.util.randomNumber(100, 999), this.client.util.randomNumber(10, 99), this.client.util.randomNumber(1000, 9999)] } }).exec();
|
||||
if (response.deletes.length > 0) {
|
||||
for (const del of response.deletes) {
|
||||
const date = (new Date(new Date(del).setHours(3650)));
|
||||
if (date > new Date()) negatives -= 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
const inquiries = await client.db.mongo.Inquiry.find({ userID: member.user.id, type: 0 }).lean().exec();
|
||||
const judgements = await client.db.mongo.Judgement.find({ userID: member.user.id }).lean().exec();
|
||||
|
||||
if (inquiries?.length > 0) {
|
||||
for (const inq of inquiries) {
|
||||
const testDate = (new Date(new Date(inq.date).setHours(1460)));
|
||||
if (testDate > new Date()) other -= 1.65;
|
||||
}
|
||||
other = Math.floor(other * 1.15);
|
||||
}
|
||||
|
||||
if (judgements?.length > 0) {
|
||||
for (const judgement of judgements) {
|
||||
switch (judgement.severity) {
|
||||
// eslint-disable-next-line default-case-last
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
other -= 5;
|
||||
break;
|
||||
case 1:
|
||||
other -= 10;
|
||||
break;
|
||||
case 2:
|
||||
other -= 20;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const discordAccountCreatedAtTestDate = (new Date(new Date(new Date(member.user.createdAt)).setHours(730)));
|
||||
if (discordAccountCreatedAtTestDate > new Date()) {
|
||||
other -= 10;
|
||||
}
|
||||
|
||||
const joinedAtTestDate = (new Date(new Date(new Date(member.joinedAt)).setHours(420)));
|
||||
if (joinedAtTestDate > new Date()) {
|
||||
other -= 30;
|
||||
}
|
||||
|
||||
total = Math.floor(((total + activity + roles + moderation + cloudServices + staff + other) * 5.13) * 1.87);
|
||||
|
||||
// client.queue.updateScore(score, total, activity, roles, moderation, cloudServices, other, staff);
|
||||
|
||||
client.db.mongo.Score.updateOne({ userID: score.userID }, { $set: { total, activity, roles, moderation, cloudServices, other, staff, lastUpdate: new Date() } }).exec();
|
||||
if (!score.pin || score.pin?.length < 1) {
|
||||
client.db.mongo.Score.updateOne({ userID: score.userID }, { $set: { pin: [this.client.util.randomNumber(100, 999), this.client.util.randomNumber(10, 99), this.client.util.randomNumber(1000, 9999)] } }).exec();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@ export default class Apply extends InteractionCommand {
|
|||
|
||||
public async run(interaction: CommandInteraction) {
|
||||
console.log(interaction.data);
|
||||
interaction.createMessage('HELP ME PLEASE');
|
||||
interaction.createMessage('.');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue