Still got errors and warnings, mostly the same and easy to fix
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 396b202..cde178f 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -1,39 +1,39 @@
import { Agenda } from "agenda/es.js";
-import client from './client.js';
-import * as fs from 'fs';
-import * as path from 'path';
-import config from '../config/main.json' assert {type: 'json'};
+import client from "./client.js";
+import * as fs from "fs";
+import * as path from "path";
+import config from "../config/main.json" assert {type: "json"};
class EventScheduler {
private agenda: Agenda;
constructor() {
- this.agenda = new Agenda({db: {address: config.mongoUrl + "Nucleus", collection: 'eventScheduler'}})
+ this.agenda = new Agenda({db: {address: config.mongoUrl + "Nucleus", collection: "eventScheduler"}});
this.agenda.define("unmuteRole", async (job: Agenda.job) => {
- let guild = await client.guilds.fetch(job.attrs.data.guild);
- let user = await guild.members.fetch(job.attrs.data.user);
- let role = await guild.roles.fetch(job.attrs.data.role);
+ const guild = await client.guilds.fetch(job.attrs.data.guild);
+ const user = await guild.members.fetch(job.attrs.data.user);
+ const role = await guild.roles.fetch(job.attrs.data.role);
await user.roles.remove(role);
await job.remove();
- })
+ });
this.agenda.define("deleteFile", async (job: Agenda.job) => {
- fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), (err) => {})
+ fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), client._error);
await job.remove();
- })
+ });
this.agenda.define("naturalUnmute", async (job: Agenda.job) => {
- const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger
- let guild = await client.guilds.fetch(job.attrs.data.guild);
- let user = await guild.members.fetch(job.attrs.data.user);
- if (user.communicationDisabledUntil === null) return
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
+ const guild = await client.guilds.fetch(job.attrs.data.guild);
+ const user = await guild.members.fetch(job.attrs.data.user);
+ if (user.communicationDisabledUntil === null) return;
try { await client.database.history.create(
"unmute", user.guild.id, user.user, null, null, null, null
- )} catch {}
- let data = {
+ );} catch (e) { client._error(e); }
+ const data = {
meta: {
- type: 'memberUnmute',
- displayName: 'Unmuted',
- calculateType: 'guildMemberPunish',
+ type: "memberUnmute",
+ displayName: "Unmuted",
+ calculateType: "guildMemberPunish",
color: NucleusColors.green,
emoji: "PUNISH.MUTE.GREEN",
timestamp: new Date().getTime()
@@ -47,23 +47,25 @@
hidden: {
guild: guild.id
}
- }
+ };
log(data);
- })
+ });
}
async start() {
- await new Promise(resolve => this.agenda.once('ready', resolve));
- this.agenda.start()
- return this
+ await new Promise(resolve => this.agenda.once("ready", resolve));
+ this.agenda.start();
+ return this;
}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
async schedule(name: string, time: string, data: any) {
- await this.agenda.schedule(time, name, data)
+ await this.agenda.schedule(time, name, data);
}
- cancel(name: string, data: Object) {
- this.agenda.cancel({name, data})
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ cancel(name: string, data: any) {
+ this.agenda.cancel({name, data});
}
}