blob: a06705b05c270be08941edb9ce7c54766a19f336 [file] [log] [blame]
import client from "./client.js";
class Memory {
memory: {};
constructor() {
this.memory = {};
setInterval(() => {
for (let guild in this.memory) {
if (this.memory[guild].updated + 15 * 60 * 1000 < Date.now()) {
delete this.memory[guild];
}
}
}, 1000 * 60 * 30)
}
async readGuildInfo(guild: string): Promise<object> {
if (!this.memory[guild]) {
let guildData = await client.database.guilds.read(guild);
this.memory[guild] = {
lastUpdated: Date.now(),
filters: guildData.filters,
logging: guildData.logging,
tickets: guildData.tickets,
};
};
return this.memory[guild];
}
}
export default Memory;