refactor(handler) change init param to Wrapper, add eventConfig type

This commit is contained in:
Jacob Nguyen
2022-03-08 13:02:42 -06:00
parent cfb7df8451
commit 84fc853dd6
2 changed files with 4 additions and 2 deletions

View File

@@ -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 }[];
}

View File

@@ -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<T> = {
export type Arg = ParseType<{ text: string[]; slash: SlashOptions }>;
// TypeAlias for interaction.options
export type eventConfig = { [K in keyof ClientEvents] : (...args : ClientEvents[K] ) => Awaitable<void>}[];
export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>;