From e6af84f702fff16306088318dded8959674b40af Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Mon, 30 May 2022 17:31:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20added=20event=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interfaces/Event.ts | 6 ++++++ src/managers/event/index.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/interfaces/Event.ts 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;