Fix a bunch of linter errors
diff --git a/src/utils/memory.ts b/src/utils/memory.ts
index 070bd7f..a397d09 100644
--- a/src/utils/memory.ts
+++ b/src/utils/memory.ts
@@ -1,31 +1,38 @@
import client from "./client.js";
+import type { GuildConfig } from "./database.js";
+
+interface GuildData {
+ lastUpdated: number;
+ filters: GuildConfig["filters"];
+ logging: GuildConfig["logging"];
+ tickets: GuildConfig["tickets"];
+}
class Memory {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- memory: Record<string, any>;
+ memory: Map<string, GuildData>;
constructor() {
- this.memory = {};
+ this.memory = new Map<string, GuildData>();
setInterval(() => {
- for (const guild in this.memory) {
- if (this.memory[guild].updated + 15 * 60 * 1000 < Date.now()) {
- delete this.memory[guild];
+ for (const [guild, guildData] of this.memory.entries()) {
+ if (guildData.lastUpdated + 15 * 60 * 1000 < Date.now()) {
+ this.memory.delete(guild);
}
}
}, 1000 * 60 * 30);
}
- async readGuildInfo(guild: string): Promise<object> {
- if (!this.memory[guild]) {
+ async readGuildInfo(guild: string): Promise<GuildData> {
+ if (!this.memory.has(guild)) {
const guildData = await client.database.guilds.read(guild);
- this.memory[guild] = {
+ this.memory.set(guild, {
lastUpdated: Date.now(),
filters: guildData.filters,
logging: guildData.logging,
tickets: guildData.tickets
- };
+ });
}
- return this.memory[guild];
+ return this.memory.get(guild)!;
}
}