From 84fc853dd69c9e088173bb044a6a38925f69ceec Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Tue, 8 Mar 2022 13:02:42 -0600 Subject: [PATCH] refactor(handler) change init param to Wrapper, add eventConfig type --- src/handler/structures/wrapper.ts | 3 +-- src/types/handler.ts | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/handler/structures/wrapper.ts b/src/handler/structures/wrapper.ts index 43fbaad..1bdb189 100644 --- a/src/handler/structures/wrapper.ts +++ b/src/handler/structures/wrapper.ts @@ -1,5 +1,4 @@ import type { Client } from 'discord.js'; -import type * as Sern from '../sern'; /** * An object to be passed into Sern.Handler constructor. @@ -14,7 +13,7 @@ interface Wrapper { readonly client: Client; readonly prefix: string; readonly commands: string; - init?: (handler: Sern.Handler) => void; + init?: (handler: Wrapper) => void; readonly privateServers: { test: boolean; id: string }[]; } diff --git a/src/types/handler.ts b/src/types/handler.ts index b4b998c..223658a 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -3,6 +3,8 @@ import type { CommandInteractionOptionResolver, MessagePayload, MessageOptions, + ClientEvents, + Awaitable, } from 'discord.js'; import type Module from '../handler/structures/module'; @@ -21,4 +23,5 @@ export type ParseType = { export type Arg = ParseType<{ text: string[]; slash: SlashOptions }>; // TypeAlias for interaction.options +export type eventConfig = { [K in keyof ClientEvents] : (...args : ClientEvents[K] ) => Awaitable}[]; export type SlashOptions = Omit;