Fixed a lot of commands, 0 typing errors on those changed
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 203e05b..0a32a1e 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -2,6 +2,7 @@
import client from "./client.js";
import * as fs from "fs";
import * as path from "path";
+// @ts-expect-error
import config from "../config/main.json" assert { type: "json" };
class EventScheduler {
@@ -19,11 +20,11 @@
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);
+ if (role) await user.roles.remove(role);
await job.remove();
});
this.agenda.define("deleteFile", async (job) => {
- fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), client._error);
+ fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), (e) => { client.emit("error", e as Error); });
await job.remove();
});
this.agenda.define("naturalUnmute", async (job) => {
@@ -34,7 +35,7 @@
try {
await client.database.history.create("unmute", user.guild.id, user.user, null, null, null, null);
} catch (e) {
- client._error(e);
+ client.emit("error", e as Error);
}
const data = {
meta: {
@@ -48,7 +49,7 @@
list: {
memberId: entry(user.user.id, `\`${user.user.id}\``),
name: entry(user.user.id, renderUser(user.user)),
- unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ unmuted: entry(new Date().getTime().toString(), renderDelta(new Date().getTime())),
unmutedBy: entry(null, "*Time out ended*")
},
hidden: {