rm automod.ts & report.ts
parent
18c7f1d071
commit
2fde5d0fcd
|
@ -1,35 +0,0 @@
|
|||
/* eslint-disable no-bitwise */
|
||||
import { Member, Message, User } from 'eris';
|
||||
import { randomBytes } from 'crypto';
|
||||
import moment, { unitOfTime } from 'moment';
|
||||
import { Client, Moderation, RichEmbed } from '.';
|
||||
import { Moderation as ModerationModel, ModerationInterface } from '../models';
|
||||
import { moderation as channels } from '../configs/channels.json';
|
||||
|
||||
export default class AutoMod extends Moderation {
|
||||
public client: Client;
|
||||
|
||||
public list: Set<string>
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor(client: Client) {
|
||||
super(client);
|
||||
this.list = new Set();
|
||||
}
|
||||
|
||||
public run(message: Message, member: Member) {
|
||||
/*
|
||||
try {
|
||||
if (member)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public warn(message: Message, member: Member) {
|
||||
/*
|
||||
try {
|
||||
await message.channel.createMessage(`__**`)
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
import { EventEmitter } from 'events';
|
||||
import { Client, RichEmbed } from '.';
|
||||
import { ScoreHistoricalRaw } from '../models/ScoreHistorical';
|
||||
|
||||
export default class Report {
|
||||
public client: Client;
|
||||
|
||||
constructor(client: Client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public async soft(userID: string) {
|
||||
const report = await this.client.db.Score.findOne({ userID });
|
||||
if (!report) return null;
|
||||
let totalScore: number;
|
||||
let activityScore: number;
|
||||
const moderationScore = Math.round(report.moderation);
|
||||
let roleScore: number;
|
||||
let cloudServicesScore: number;
|
||||
const otherScore = Math.round(report.other);
|
||||
let miscScore: number;
|
||||
|
||||
if (report.total < 200) totalScore = 0;
|
||||
else if (report.total > 800) totalScore = 800;
|
||||
else totalScore = Math.round(report.total);
|
||||
|
||||
if (report.activity < 10) activityScore = 0;
|
||||
else if (report.activity > Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12))) activityScore = Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12));
|
||||
else activityScore = Math.round(report.activity);
|
||||
|
||||
if (report.roles <= 0) roleScore = 0;
|
||||
else if (report.roles > 54) roleScore = 54;
|
||||
else roleScore = Math.round(report.roles);
|
||||
|
||||
if (report.staff <= 0) miscScore = 0;
|
||||
else miscScore = Math.round(report.staff);
|
||||
|
||||
if (report.cloudServices === 0) cloudServicesScore = 0;
|
||||
else if (report.cloudServices > 10) cloudServicesScore = 10;
|
||||
else cloudServicesScore = Math.round(report.cloudServices);
|
||||
|
||||
const historicalData = await this.client.db.ScoreHistorical.find({ userID: member.userID }).lean().exec();
|
||||
const array: ScoreHistoricalRaw[] = [];
|
||||
for (const data of historicalData) {
|
||||
let total: number;
|
||||
let activity: number;
|
||||
const moderation = Math.round(data.report.moderation);
|
||||
let role: number;
|
||||
let cloud: number;
|
||||
const other = Math.round(data.report.other);
|
||||
let misc: number;
|
||||
|
||||
if (data.report.total < 200) total = 0;
|
||||
else if (data.report.total > 800) total = 800;
|
||||
else total = Math.round(data.report.total);
|
||||
|
||||
if (data.report.activity < 10) activity = 0;
|
||||
else if (data.report.activity > Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12))) activity = Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12));
|
||||
else activity = Math.round(data.report.activity);
|
||||
|
||||
if (data.report.roles <= 0) role = 0;
|
||||
else if (data.report.roles > 54) role = 54;
|
||||
else role = Math.round(data.report.roles);
|
||||
|
||||
if (data.report.staff <= 0) role = 0;
|
||||
else misc = Math.round(data.report.staff);
|
||||
|
||||
if (data.report.cloudServices === 0) cloud = 0;
|
||||
else if (data.report.cloudServices > 10) cloud = 10;
|
||||
else cloud = Math.round(data.report.cloudServices);
|
||||
|
||||
data.report.total = total; data.report.activity = activity; data.report.moderation = moderation; data.report.roles = role; data.report.cloudServices = cloud; data.report.other = other; data.report.staff = misc;
|
||||
|
||||
array.push(data);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue