pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 1 | import readConfig from "./readConfig.js"; |
| 2 | |
| 3 | class Memory { |
| 4 | memory: {}; |
| 5 | constructor() { |
| 6 | this.memory = {}; |
| 7 | } |
| 8 | |
| 9 | async readGuildInfo(guild: string): Promise<object> { |
| 10 | if (!this.memory[guild]) { |
| 11 | let guildData = await readConfig(guild); |
| 12 | this.memory[guild] = { |
| 13 | filters: guildData.filters, |
| 14 | logging: guildData.logging, |
| 15 | tickets: guildData.tickets, |
| 16 | }; // TODO: REMOVE GUILD FROM MEMORY WHEN THESE UPDATE |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 17 | } // TODO: Add a "lastAccessed" prop, delete after 15 minutes |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 18 | return this.memory[guild]; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | export default Memory; |