diff --git a/src/interfaces/Event.ts b/src/interfaces/Event.ts new file mode 100644 index 0000000..8a22171 --- /dev/null +++ b/src/interfaces/Event.ts @@ -0,0 +1,6 @@ +import { IEventOptions } from "./EventOptions"; + +export interface IEvent { + options: IEventOptions; + execute: (...args: any[]) => Promise; +} diff --git a/src/managers/event/index.ts b/src/managers/event/index.ts index 8a3a506..537f730 100644 --- a/src/managers/event/index.ts +++ b/src/managers/event/index.ts @@ -1,13 +1,14 @@ /* eslint-disable no-loops/no-loops */ import { Client } from "discord.js"; import listDir from "../../helpers/listDir"; +import { IEvent } from "../../interfaces/Event"; export const register = async (client: Client) => { const eventNames = await listDir("events"); if (!eventNames) return; for await (const eventName of eventNames) { - const event = await import(`../../events/${eventName}`); + const event: IEvent = await import(`../../events/${eventName}`); const eventExecutor = async (...args: any[]) => event.execute(...args); if (!event.options?.type) return;