import type Command from "#cmd-classes/command.js"; import type InteractionCollector from "../pagination/awaitinteractions.ts"; import type { ExtCommand, MediaMeta } from "./types.ts"; export const commands = new Map(); export const messageCommands = new Map(); export const userCommands = new Map(); export const paths = new Map(); export const aliases = new Map(); export const categories = new Map>(); export const collectors = new Map(); export const locales = new Map(); class TimedMap extends Map { time: number; private timeouts: Map> = new Map(); constructor(time: number) { super(); this.time = time; } set(key: K, value: V) { super.set(key, value); const oldHandle = this.timeouts.get(key); if (oldHandle) clearTimeout(oldHandle); const handle = setTimeout(() => { this.delete(key); }, this.time); this.timeouts.set(key, handle); return this; } delete(key: K) { const out = super.delete(key); const handle = this.timeouts.get(key); if (handle) { clearTimeout(handle); this.timeouts.delete(key); } return out; } } export const runningCommands = new TimedMap(5000); export const selectedImages = new TimedMap(180000); export const pendingCommands = new TimedMap(120000);