Merge branch 'dev'

merge-requests/28/head
Matthew 2023-02-21 13:09:42 -05:00
commit d5f0346f75
13 changed files with 170 additions and 164 deletions

View File

@ -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"
}

View File

@ -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",

View File

@ -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;
}

View File

@ -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();

View File

@ -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);

View File

@ -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 {

View File

@ -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...');

View File

@ -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.');

View File

@ -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);

View File

@ -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.');

View File

@ -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.');

View File

@ -10,9 +10,9 @@ export function getTotalMessageCount(client: Client): number {
projectChannels.push(chan);
}
return (projectChannels.length * 200) + 2200 + 300 + 100 + 200;
}
}
export default async function(client: Client, member: Member, allMessagesArray: Message<TextChannel>[]) {
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) {
@ -50,8 +50,13 @@ export default async function(client: Client, member: Member, allMessagesArray:
// 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;
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;

View File

@ -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('.');
}
}