feat(sern.ts) Add basic event manager

This commit is contained in:
Jacob Nguyen
2022-03-08 16:36:51 -06:00
parent 84fc853dd6
commit 0dd95be59a
6 changed files with 29 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ export type Visibility = 'private' | 'public';
// Anything that can be sent in a `<TextChannel>#send` or `<CommandInteraction>#reply`
export type possibleOutput<T = string> = T | (MessagePayload & MessageOptions);
export type execute = Module<unknown>['execute'];
// Thanks @cursorsdottsx
export type ParseType<T> = {
[K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never;
@@ -22,6 +23,7 @@ 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 DiscordEvent =
ParseType< { [K in keyof ClientEvents ] : (...args : ClientEvents[K]) => Awaitable<void> }>;
export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>;